From 03221c5fb4d934c2cda0a0ed243193e6ad85d785 Mon Sep 17 00:00:00 2001 From: "Matthias@Dell" Date: Thu, 21 Dec 2023 17:28:02 +0100 Subject: [PATCH] wip: irq --- system/irq_handler.h65 | 12 ++++++++++++ system/irq_handler.s65 | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 system/irq_handler.h65 create mode 100644 system/irq_handler.s65 diff --git a/system/irq_handler.h65 b/system/irq_handler.h65 new file mode 100644 index 0000000..07fcaf6 --- /dev/null +++ b/system/irq_handler.h65 @@ -0,0 +1,12 @@ +;******************************************************************************** +; @module irq_handler +; @type system +;******************************************************************************** +.ifndef INCLUDE_IRQ_HANDLER +INCLUDE_IRQ_HANDLER = 1 + +.scope irq + +.endscope +.endif + diff --git a/system/irq_handler.s65 b/system/irq_handler.s65 new file mode 100644 index 0000000..19d3831 --- /dev/null +++ b/system/irq_handler.s65 @@ -0,0 +1,43 @@ +.include "irq_handler.h65" +.bss + + +.code + +.proc register_via_handler +.endproc + +.proc remove_via_handler +.endproc + +.proc main_handler + Print "Unknown IRQ" + rti +.endproc + +.zeropage +tmp: .res 1 + +.macro VIAHandler via_addr, via_handlers_table + lda via_addr + IO::IFR + sta tmp + bbr7 tmp,@rts ; irq + bbs0 tmp,@ca2 + bbs1 tmp,@ca1 + bbs2 tmp,@sr + bbs3 tmp,@cb2 + bbs4 tmp,@cb1 + bbs5 tmp,@t2 + bbs6 tmp,@t1 + ; TODO error, one should have been true + stp +@rts: + rts +@ca2: jmp (via_handlers_table) +@ca1: jmp (via_handlers_table+2) +@sr: jmp (via_handlers_table+4) +@cb2: jmp (via_handlers_table+6) +@cb1: jmp (via_handlers_table+8) +@t2: jmp (via_handlers_table+10) +@t1: jmp (via_handlers_table+12) +.endmacro