6502-OS/system/irq_handler.s65

44 lines
752 B
Plaintext
Raw Normal View History

2023-12-21 17:28:02 +01:00
.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