I'm trying to make a version of Press Your Luck for the Genesis, and I'm having a problem getting the PCM driver to work. The driver replaces the standard Z80 PCM driver used by games with hybrid sound drivers, to allow both samples contained entirely within one Z80 bank, as well as multi-bank samples. I can get it to work in Kega, but not in any other emulator, nor on real hardware.
Here's the ROM.
Here's my code to load the Z80 RAM:
And here's my code to trigger the sample:
I'm thinking my problem is in my Z80 handshaking (as the trigger code handles the Z80 handshaking in a different order), but I've tried damn near everything I can think of and am still at a loss. If I reorganize my trigger code to match that used when initializing the Z80 RAM (including the assertion of /RESET) it completely breaks. I also figure that I'm wasting more time than I need waiting on the Z80 reset, but I can't imagine that would cause any problems. Any ideas? I also have the original 68k FM driver in the ROM, but I'm not really using it (I do call it once, thinking that it may initialize the 2612, but it doesn't seem to make much difference).
Edit: Something I forgot to throw in - even though it's my understanding that word-wide writes to Z80 RAM result in MSB only, I have a later version of the code that copies byte-wise, and it doesn't work at all, with identical handshaking. Gens Kmod shows the Z80 stopping at $0034 (but I'm unsure if it's a matter of the Z80 actually halting execution, or if it's just somehow caught in an infinite loop).
Here's the ROM.
Here's my code to load the Z80 RAM:
Code:
SoundDriverLoad:
nop
move.w #$100,($A11100).l; request bus
move.w #$100,($A11200).l; ensure Z80 is running
lea (PCM_Z80).l,a0; load sound driver
lea ($A00000).l,a1
move.w #$13b,d0
Z80Copy:
move.w (a0)+,(a1)+
dbf d0,Z80Copy
move.w #0,($A11200).l; assert Z80 /RESET
nop
nop
nop
nop
move.w #0,($A11100).l; relinquish bus
move.w #$100,($A11200).l; drop Z80 /RESET
rts
And here's my code to trigger the sample:
Code:
move.w #$100,($A11100).l; request bus
move.w #$100,($A11200).l; ensure Z80 is running
move.b #$8F,($A01FFF).l
move.w #0,($A11100).l; relinquish bus
I'm thinking my problem is in my Z80 handshaking (as the trigger code handles the Z80 handshaking in a different order), but I've tried damn near everything I can think of and am still at a loss. If I reorganize my trigger code to match that used when initializing the Z80 RAM (including the assertion of /RESET) it completely breaks. I also figure that I'm wasting more time than I need waiting on the Z80 reset, but I can't imagine that would cause any problems. Any ideas? I also have the original 68k FM driver in the ROM, but I'm not really using it (I do call it once, thinking that it may initialize the 2612, but it doesn't seem to make much difference).
Edit: Something I forgot to throw in - even though it's my understanding that word-wide writes to Z80 RAM result in MSB only, I have a later version of the code that copies byte-wise, and it doesn't work at all, with identical handshaking. Gens Kmod shows the Z80 stopping at $0034 (but I'm unsure if it's a matter of the Z80 actually halting execution, or if it's just somehow caught in an infinite loop).