wip: irq
This commit is contained in:
parent
0e774c5c86
commit
03221c5fb4
12
system/irq_handler.h65
Normal file
12
system/irq_handler.h65
Normal file
@ -0,0 +1,12 @@
|
||||
;********************************************************************************
|
||||
; @module irq_handler
|
||||
; @type system
|
||||
;********************************************************************************
|
||||
.ifndef INCLUDE_IRQ_HANDLER
|
||||
INCLUDE_IRQ_HANDLER = 1
|
||||
|
||||
.scope irq
|
||||
|
||||
.endscope
|
||||
.endif
|
||||
|
43
system/irq_handler.s65
Normal file
43
system/irq_handler.s65
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user