RE: BASIC and System ROM replacements

From: J.G.Harston <jgh_at_mdfs.net>
Date: Mon, 27 May 2013 12:40:14 +0100
Message-ID: <c09d8b73dbd0540cf501d77a55c6572e@mdfs.net>
Baltissen, GJPAA (Ruud) wrote:
> I thought I mentioned a solution that can be used in an earlier 
> email.
...

Like this:

\ Interrupt veneers
\ =================
.c64irq
PHA:TXA:PHA:TYA:PHA:SEC        :\ Save registers, CS=IRQ
TSX:LDA &104,X                 :\ Get stacked P
AND #&10:BEQ c64irqGo          :\ BRK or IRQ
LDA #&30:STA &01               :\ Page in all RAM
JMP (BRKV)                     :\ Pass on to BRK handler
.c64nmi
PHA:TXA:PHA:TYA:PHA:CLC        :\ Save registers, CC=NMI
.c64irqGo
LDA &01:PHA:LDA #&36:STA &01   :\ Page in Kernal and I/O
LDA #c64irqRet DIV 256:PHA     :\ Return address back to here
LDA #c64irqRet AND 255:PHA
LDA #4:PHA                     :\ Stack 'noIRQ'+'not BRK'
BCC c64nmiGo
JMP (&FFFE)                    :\ Vector to Kernal IRQ handler
.c64nmiGo
JMP (&FFFA)                    :\ Vector to Kernal NMI handler
.c64irqRet
PLA:STA &01                    :\ Restore memory mapping
PLA:TAY:PLA:TAX:PLA:RTI        :\ Restore registers and return
.c64reset
LDA #&36:STA &01:JMP (&FFFC)   :\ Pass on to Kernal

-- 
J.G.Harston - jgh@mdfs.net - mdfs.net


       Message was sent through the cbm-hackers mailing list
Received on 2013-05-27 12:00:10

Archive generated by hypermail 2.2.0.