Post by Tiido on Sept 27, 2012 3:56:50 GMT -5
tiido.rocketcat.info/BitShit/ANIM.BIN
I had quite a bit of fun getting things to a point where animation is still fast and sound does not suffer from VDP FIFO overflow induced system halts. On MD you can write VRAM anytime, there will be no lost data unlike SMS and I think SNES, but there's a catch :
When the FIFO is full and another write is coming in, !DTACK won't be released and the 68K side will be halted. This normally is not a problem, but when Z80 does a ROM access, it will be halted too.
This means goodbye timings so there will be considerable jitter in any PCM playback that may happen. DMA is fastest way to send data to VRAM but it takes the bus for the duration of DMA which will not work out at all for the Z80, unless there's some elaborate buffering scheme worked out that buffers data while there are no VDP access and plays it during DMA or intense FIFO overflowing
In this demo I start off sending data in tile quantities using 68K loop (68K cannot overwhelm VDP in VBL) and Z80 won't be closed off from the bus. I switch to slow update loop when there's active display, since there will be very few access slots per line and you can easily overflow the FIFO.
I coded a new WAV playback program for this one, my old code is just horrible haha.
You supply the address of the file, and the driver looks up the lenght and will do automatic looping. One thing I could add is automatic sample rate adjustment, but it is not very high on my priorities list.
In any case I am very happy with it, it took me a while to do but it works like a charm ^^
Sound sample is 26.5KHz, so this means it sounds best on real hardware !
Emulators seem to have problems with high PCM rates, everything is noticably scratchier (writes getting missed or such).
I had quite a bit of fun getting things to a point where animation is still fast and sound does not suffer from VDP FIFO overflow induced system halts. On MD you can write VRAM anytime, there will be no lost data unlike SMS and I think SNES, but there's a catch :
When the FIFO is full and another write is coming in, !DTACK won't be released and the 68K side will be halted. This normally is not a problem, but when Z80 does a ROM access, it will be halted too.
This means goodbye timings so there will be considerable jitter in any PCM playback that may happen. DMA is fastest way to send data to VRAM but it takes the bus for the duration of DMA which will not work out at all for the Z80, unless there's some elaborate buffering scheme worked out that buffers data while there are no VDP access and plays it during DMA or intense FIFO overflowing
In this demo I start off sending data in tile quantities using 68K loop (68K cannot overwhelm VDP in VBL) and Z80 won't be closed off from the bus. I switch to slow update loop when there's active display, since there will be very few access slots per line and you can easily overflow the FIFO.
I coded a new WAV playback program for this one, my old code is just horrible haha.
You supply the address of the file, and the driver looks up the lenght and will do automatic looping. One thing I could add is automatic sample rate adjustment, but it is not very high on my priorities list.
In any case I am very happy with it, it took me a while to do but it works like a charm ^^
Sound sample is 26.5KHz, so this means it sounds best on real hardware !
Emulators seem to have problems with high PCM rates, everything is noticably scratchier (writes getting missed or such).