IRQ - INTERRUPT MADE ABSOLUTELY EASY WITH C128 -------------------------------------------------------------------------------------------------- TOOL: C128 - Built-In ML-Monitor and BASIC 7.0 {Commodore C128} Language: Assembler / BASIC 7.0 Extra: None Author: Misel Zivanovic Note: (C) 12th DEC 2025 - www.lived.ch, mzretro.ch Information: I guess every C128 owner want to see IRQ their own IRQ in action! --------------------------------------------------------------------------------------------------- Now you'll see why it is important to know what goes where! We have 2 identical lines of code {same commands}, however slightly re-arranged and that is then showing effects. As you will see, both code examples are going to deliver the same result, but with one major difference. Example one isn't permanent change, it's just temporary! It means you can change text color {cursor}, background and border color. While the 2nd example will not allow you to do that. It will look like the system is ignoring your requests! And we learned something again, nice! --------------------------------------------------------------------------------------------------- EXAMPLE 1: --------------------------------------------------------------------------------------------------- d 1300 1320 . 01300 78 sei . 01301 a9 1b lda #$1b . 01303 8d 14 03 sta $0314 . 01306 a9 13 lda #$13 . 01308 8d 15 03 sta $0315 . 0130b a9 0b lda #$0b . 0130d 85 f1 sta $f1 . 0130f a9 08 lda #$08 . 01311 8d 20 d0 sta $d020 . 01314 a9 09 lda #$09 . 01316 8d 21 d0 sta $d021 . 01319 58 cli . 0131a 60 rts . 0131b 4c 65 fa jmp $fa65 --------------------------------------------------------------------------------------------------- ALL EXPLAINED: . 01300 78 sei Set Interrupt Disable Flag {System ignores interrupts until we set new one, meaning clear the flag} . 01301 a9 1b lda #$1b This is the LOW Byte {Target address} . 01303 8d 14 03 sta $0314 Write to IRQ Vector . 01306 a9 13 lda #$13 This is the HIGH Byte {Target address} . 01308 8d 15 03 sta $0315 Write to IRQ . 0130b a9 0b lda #$0b Dark-Grey for the . 0130d 85 f1 sta $f1 Cursor . 0130f a9 08 lda #$08 Color for the . 01311 8d 20 d0 sta $d020 border . 01314 a9 09 lda #$09 Color for the . 01316 8d 21 d0 sta $d021 background . 01319 58 cli Clear Interrupt Disable Flag . 0131a 60 rts Return To Subroutine or here back to BASIC when called from BASIC . 0131b 4c 65 fa jmp $fa65 The normal IRQ interrupt handling routine {Restore normal IRQ functions} --------------------------------------------------------------------------------------------------- MACHINE-LANGUAGE-MONITOR CODE LISTING: {If you paste this code in ML-Monitor of C128, then you can avoid manual corrections which} {are practically mandatory when you paste the assembled code from above} {This below is exactly the same code as above!} --------------------------------------------------------------------------------------------------- m 1300 1320 {EXAMPLE 1} >01300 78 a9 1b 8d 14 03 a9 13:XI....I. >01308 8d 15 03 a9 0b 85 f1 a9:...I..QI >01310 08 8d 20 d0 a9 09 8d 21:.. PI..! >01318 d0 58 60 4c 65 fa 00 fa:Px.lEZ.Z >01320 00 00 00 00 00 00 00 00:........ --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- EXAMPLE 2: --------------------------------------------------------------------------------------------------- This example will not allow you any kind of modification in regard of text color, background or border color! Your input will be ignored! Easy done! {And if you, in addition to this, disable the RESTORE Key, dann this change will be} {practically permanent until the reset button is pressed} d 1300 131e . 01300 78 sei . 01301 a9 0d lda #$0d . 01303 8d 14 03 sta $0314 . 01306 a9 13 lda #$13 . 01308 8d 15 03 sta $0315 . 0130b 58 cli . 0130c 60 rts . 0130d a9 0b lda #$0b . 0130f 85 f1 sta $f1 . 01311 a9 08 lda #$08 . 01313 8d 20 d0 sta $d020 . 01316 a9 09 lda #$09 . 01318 8d 21 d0 sta $d021 . 0131b 4c 65 fa jmp $fa65 . 0131e 00 brk --------------------------------------------------------------------------------------------------- MACHINE-LANGUAGE-MONITOR CODE LISTING: {If you paste this code into ML-Monitor of C128, then you can avoid manual corrections which} {are practically mandatory when you paste the assembled code from above} {This below is exactly the same code as above!} --------------------------------------------------------------------------------------------------- m 1300 131e {EXAMPLE 2} >01300 78 a9 0d 8d 14 03 a9 13:XI....I. >01308 8d 15 03 58 60 a9 0b 85:...x.I.. >01310 f1 a9 08 8d 20 d0 a9 09:QI.. PI. >01318 8d 21 d0 4c 65 fa 00 00:.!PlEZ.. ---------------------------------------------------------------------------------------------------