Hello everyone, long time no see!
I'm writting some code that needs to be executed on a V9990-generated interrupt, so I figure it should be hooked on H.KEYI hook:
Address Name Description
FD9Ah H.KEYI Call: Called at the beginning of the KEYINT interrupt routine (Main-ROM at 0038h).
Usage: Used to test whether the interruption was caused by a device other than the VDP. (RS-232C, MSX-Midi, etc)
Note: The program must back to the interrupt routine if no device has caused the interrupt.
So I wrote the code below, poke'd CD 00 80 at #FD9A and it simply freeze: (yep, I redirected TXTTAB to #9001, but it happens on any memory location)
ROUTINE: org #8000 di push af in a,(#66) bit 1,a jr z,SPLIT bit 0,a jr z,REFRESH pop af ei ret SPLIT: ld a,2 out (#66),a ld a,13 out (#64),a ld a,4 out (#63),a pop af ei ret REFRESH: ld a,1 out (#66),a ld a,13 out (#64),a ld a,0 out (#63),a pop af ei ret
(for now I am just selecting another palette midscreen and resetting it on refresh)
So I opened the debugger and realized that SP was all the way down to #7CFF in just a few seconds of execution. another few seconds and it probably overflow. I also noted main RAM contents completely corrupted.
For testing purposes I reduced to just this: (with no noticeable changes)
ROUTINE: org #8000 di push af in a,(#66) bit 1,a pop af ei ret
Can anyone point what am I missing?