[hatari-devel] New problem with GullBach demo (Aura falcon demo)

Eero Tamminen eerot at users.berlios.de
Fri Jul 10 09:53:18 CEST 2009


Hi,

On Thursday 09 July 2009, npomarede at corp.free.fr wrote:
> On Thu, 9 Jul 2009, Laurent Sallafranque wrote:
> > Here is the trace (hope this helps)

Thanks!

> > (gdb) bt
> > #0  0x00007fb513877fb5 in raise () from /lib/libc.so.6
> > #1  0x00007fb513879bc3 in abort () from /lib/libc.so.6
> > #2  0x00007fb513870f09 in __assert_fail () from /lib/libc.so.6
> > #3  0x000000000041d028 in Int_AddRelativeInterruptWithOffset
> > (CycleTime=-340026, CycleType=1,
> >    Handler=INTERRUPT_DMASOUND, CycleOffset=0) at int.c:392

This bt misses couple of functions.  One is static and another inline so GCC
probably left out the function frames for them.  Strange that Gdb doesn't
show the names of the functions though, debug sections should have
enough information to decipher that.

Laurent, the functions are (you can find them by looking at what's at the
indicated line number and where the relevant functions are called):
	DmaSnd_StartNewFrame()
	DmaSnd_CheckForEndOfFrame()

> > #4  0x000000000040f4cf in DmaSnd_GenerateSamples (nMixBufIdx=4484,
> > nSamplesToGenerate=2) at dmaSnd.c:191
> > #5  0x000000000042d864 in Sound_Update () at sound.c:1033
> > #6  0x000000000043bdb1 in m68k_go (may_quit=<value optimized out>) at
> > newcpu.c:1738
> > #7  0x0000000000420991 in main (argc=4, argv=0x7fff1c7b2aa8) at
> > main.c:712
...
> From the trace, it seems the assert is showing a bug that is not related
> to video.c but was already present in dmasnd.c

Ok, this isn't properly validating the values it reads from ST RAM:
----------------
static void DmaSnd_StartNewFrame(void)
{
        int nCyclesForFrame;

        nFrameStartAddr = (IoMem[0xff8903] << 16) | (IoMem[0xff8905] << 8) | 
(IoMem[0xff8907] & ~1);
        nFrameEndAddr = (IoMem[0xff890f] << 16) | (IoMem[0xff8911] << 8) | 
(IoMem[0xff8913] & ~1);

        FrameCounter = 0;
        nFrameLen = nFrameEndAddr - nFrameStartAddr;

        /* To get smooth sound, set an "interrupt" for the end of the frame 
that
         * updates the sound mix buffer. */
        nCyclesForFrame = nFrameLen * (8013000.0 / 
DmaSnd_DetectSampleRate());
        if (!(nDmaSoundMode & DMASNDMODE_MONO))  /* Is it stereo? */
                nCyclesForFrame = nCyclesForFrame / 2;
        Int_AddRelativeInterrupt(nCyclesForFrame, INT_CPU_CYCLE, 
INTERRUPT_DMASOUND);
}
----------------


> CycleTime=-340026, which is <0 and wrong, it should always be >0.
>
> But this would mean that nFrameEndAddr < nFrameStartAddr ; this case
> should be handled I guess (I don't know what is intended by this demo on
> a real falcon).
>
> I leave this to some falcon experts :)

Laurent/Thomas, what happens / should happen on real Falcon if DMA sound
frame start and end mismatch?


	- Eero



More information about the hatari-devel mailing list