[hatari-devel] [Crossbar emulation] : new infos, + some help needed (complement of infos)

Laurent Sallafranque laurent.sallafranque at free.fr
Wed Sep 23 17:02:02 CEST 2009


In complement to my precedent mail :

In Crossbar_StartDspXmitHandler(void), I've implemented the 2 possible 
frequencies (you can replace the berlios code by this one ) :

(You can easily comment / uncomment the first part or the second part of 
this function.
(I listen to willi's adventure sound for my tests with DSP).

In the first case, sound is beautiful, but plays too fast
In the second case, sound is crappy but plays at correct frequency.

Any idea ?

Regards

Laurent



/**
 * start a DSP xmit "interrupt" at frequency parametered in the crossbar
 */
static void Crossbar_StartDspXmitHandler(void)
{
    Uint16 nCbSrc = IoMem_ReadWord(0xff8930);
    int freq = 1;
    int nFreq = 1;
    int nClkDiv;

    /* Sound is beautiful, but plays too fast */
/*
    if ((nCbSrc & 0x60) == 0x00)
    {
        freq = 25175000 / Crossbar_DetectSampleRate();
    }
    else if ((nCbSrc & 0x60) == 0x40)
    {
        freq = 32000000 / Crossbar_DetectSampleRate();
    }

    Int_AddRelativeInterrupt(CPU_FREQ/freq/256, INT_CPU_CYCLE, 
INTERRUPT_DSPXMIT);
*/


    /* Sound is crappy, but plays at correct speed */

    nClkDiv = 256 * ((IoMem_ReadByte(0xff8935) & 0x0f) + 1);

    if ((nCbSrc & 0x60) == 0x00)
    {
        /* Internal 25.175 MHz clock */
        nFreq = 25175000 / nClkDiv;
        Int_AddRelativeInterrupt((8013000+nFreq/2)/nFreq/2, 
INT_CPU_CYCLE, INTERRUPT_DSPXMIT);
    }
    else if ((nCbSrc & 0x60) == 0x40)
    {
        /* Internal 32 MHz clock */
        nFreq = 32000000 / nClkDiv;
        Int_AddRelativeInterrupt((CPU_FREQ+nFreq/2)/nFreq/2, 
INT_CPU_CYCLE, INTERRUPT_DSPXMIT);
    }
}




More information about the hatari-devel mailing list