Commodore 128 Alive!

Commodore 128 => 128 programmers => Topic started by: MIRKOSOFT on December 07, 2009, 03:42 PM

Title: Reroute NMI (RESTORE key) / location of CIA 1&2
Post by: MIRKOSOFT on December 07, 2009, 03:42 PM
Hi!

I want to ask how to reroute NMI (pressing RESTORE key) - replacing call of original NMI routine - rewritting vectors?

Also, I'm not sure - where in RAM is location of CIA1 and CIA2 ? (on C64 it is $DC00/$DD00)

Thanks for every help.

Miro
Title: Re: Reroute NMI (RESTORE key) / location of CIA 1&2
Post by: SmallCleverDinosaur on December 07, 2009, 06:03 PM
This is becoming a standard answer; check "Mapping the C128" :)

On page 95, the vector at addresses 792-793 is described. It is the indirect NMI-vector through which all NMI interrupts are being routed.

The CIA's are in the I/O section which is not actually in RAM, but "above" RAM. They are located at the same addresses as in the C64. Again, see "Mapping the C128" for details (page 465-493) :)
Title: Re: Reroute NMI (RESTORE key) / location of CIA 1&2
Post by: MIRKOSOFT on December 08, 2009, 04:15 AM
Hi!

Yes, now RESTORE key works.
My own subroutine ends with RTI, but problem is here: after pressing RESTORE key my routine works and when ends, computer beeps and then goes to MONITOR, so there must be st. wrong, can you help me?

Thank you very much.

Miro
Title: Re: Reroute NMI (RESTORE key) / location of CIA 1&2
Post by: Hydrophilic on December 08, 2009, 02:52 PM
Before the JMP($318), the KERNAL also pushes MMU.CR, A, X, and Y on stack.  You must remove them from stack before RTI or computer will crash (Monitor).

The easy way to end your program is JMP $FF33, and this should work in any BANK (except 4, 5, 6, or 7).  Here is the disassembly:

. 0ff33  pla
. 0ff34  sta $ff00
. 0ff37  pla
. 0ff38  tay
. 0ff39  pla
. 0ff3a  tax
. 0ff3b  pla
. 0ff3c  rti
EhPortal 1.34 © 2025, WebDev