VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

When I try to use play.exe from the disks of the Soundblaster 2.0 with UniPCemu's new, accurate DMA emulation, it plays fine for about one second(playing the wav file from the samples directory). But after that, sound is chopped off. When I try to restart the app, emulation hangs due to the DMA never lowering the DRQ line? The setting of bit 2 of the DMAEnabled makes it wait for the next timer interval. Bit 1 halts the DMA transaction, when set. Bit 0 needs to be set(and the other bits cleared), with DREQ being 1 to be able to raise DRQ. Otherwise DRQ is lowered(low). That allows for proper timed DMA to function. DREQ works in much the same way, with bit 1 inhabiting DMA transfers until the timer times(at the tendering rate, rendering the buffered sample). DREQ bit 2 makes it lower the DREQ signal until the IRQ is acnowledged(when autoinit is triggered by the amount of samples written).

Now exit autoinit clears the autoinit flag and also sets DREQ to 0(inactive DMA, Not waiting for IRQ acnowledge&timer timeout(rendering frequency).

https://bitbucket.org/superfury/unipcemu/src/ … ter.c?at=master

Anyone can see what's going wrong? Why is executing play.exe for the second time raising DRQ permanently? The DMA isn't stopped at that point. Also, after 1 second of audio, playback becomes silent? Running play.exe a second time causes permanent BUS master being DMA, causing the CPU to 'hang'.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 1, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've improved the code a bit:
- Changed DMAEnable to be reversed(DMADisable) instead.
- Modified Soundblaster.DREQ as follows:
bit 0=DREQ/request running
bit 1=Wait until rendered(every DMA write) and decoded buffer is emptied(single/ADPCM sample(s) rendered).
bit 2=Wait for generic timing(For DMA microtransactions, set on DACK)
bit 3=Wait for interrupt acnowledge(when transfer complete, continuing transfer after acnowledge).

https://bitbucket.org/superfury/unipcemu/src/ … ter.c?at=master

DREQ is completely reset when a new command is received.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io