2 ; IRQ handling (C128 version)
5 .export initirq, doneirq
10 IRQInd = $2FD ; JMP $0000 - used as indirect IRQ vector
12 ; ------------------------------------------------------------------------
29 ; ------------------------------------------------------------------------
42 ; ------------------------------------------------------------------------
43 ; The C128 has ROM parallel to the RAM starting from $4000. The startup code
44 ; above will change this setting so that we have RAM from $0000-$BFFF. This
45 ; works quite well with the exception of interrupts: The interrupt handler
46 ; is in ROM, and the ROM switches back to the ROM configuration, which means
47 ; that parts of our program may not be accessible. To solve this, we place
48 ; the following code into a special segment called "LOWCODE" which will be
49 ; placed just above the startup code, so it goes into a RAM area that is
56 lda MMU_CR ; Get old register value
57 pha ; And save on stack
58 lda #MMU_CFG_CC65 ; Bank 0 with kernal ROM
60 jsr callirq ; Call the functions
61 pla ; Get old register value
63 jmp IRQInd ; Jump to the saved IRQ vector