Posted By
Mad on 2020-12-02 13:00:23
| Re: Cartridge and raster interrupts
Ok here is what I have now "found", lol (strange that I had to look for that):
if you do a sta $ff3f you have to write a valid interrupt pointer at $fffe/$ffff before. Else it crashes. The initial value of $fffe/$ffff in ram in plus4emu is $f700. $f700 is really called (tested it) and crashes if you do sta $ff3f without setting a fresh interrupt vector.
The Rom $fffe/$ffff points to FCB3
FCB3 48 PHA FCB4 8A TXA FCB5 48 PHA FCB6 98 TYA FCB7 48 PHA FCB8 8D D0 FD STA $FDD0 FCBB 4C 00 CE JMP $CE00
CE00 BA TSX CE01 BD 04 01 LDA $0104, X CE04 29 10 AND #$10 CE06 D0 03 BNE $CE0B CE08 6C 14 03 JMP ($0314) CE0B 6C 16 03 JMP ($0316)
All should work if you put an little routine like this in ram:
myRamIrq PHA TXA PHA TYA PHA ; STA $FDD0 ; dunno not checked JMP ($0314)
And put somewhere in code a (stas write to ram all the time)
lda #myRamIrq & 255 sta $fffe lda #myRamIrq / 256 sta $ffff
so you can do a sta $ff3e and a sta $ff3f whilst $0314 vector is called in both cases (RAM/ROM)..
What I don't know if your own rom too exchanges $fffe/$ffff.. I understood from siz that $fffe/$ffff is not connected to roms but to kernel, that's why this strange $fcb3 stuff. But on C64 it is connected to roms as far as I know.. Then this FCB3 stuff would be obsolete.. (You just would need 2 interrupt routines then, one for rom and one for ram + one $fffe/$ffff in rom and one $fffe/$ffff in ram)
Hope that helps.. If Stinaris just wanted to do all entirely in rom this post here is of course senseless..
|