2013-02-12 22:39:38 +00:00
|
|
|
;
|
|
|
|
; IRQ handling (C64 version)
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export initirq, doneirq
|
|
|
|
.import callirq
|
2013-02-12 22:39:38 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "c64.inc"
|
2013-02-12 22:39:38 +00:00
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.segment "INIT"
|
2013-02-12 22:39:38 +00:00
|
|
|
|
|
|
|
initirq:
|
2013-05-09 11:56:54 +00:00
|
|
|
lda IRQVec
|
|
|
|
ldx IRQVec+1
|
|
|
|
sta IRQInd+1
|
|
|
|
stx IRQInd+2
|
|
|
|
lda #<IRQStub
|
|
|
|
ldx #>IRQStub
|
|
|
|
jmp setvec
|
2013-02-12 22:39:38 +00:00
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
|
|
|
|
.code
|
|
|
|
|
|
|
|
doneirq:
|
2013-05-09 11:56:54 +00:00
|
|
|
lda IRQInd+1
|
|
|
|
ldx IRQInd+2
|
|
|
|
setvec: sei
|
|
|
|
sta IRQVec
|
|
|
|
stx IRQVec+1
|
|
|
|
cli
|
|
|
|
rts
|
2013-02-12 22:39:38 +00:00
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.segment "LOWCODE"
|
2013-02-12 22:39:38 +00:00
|
|
|
|
|
|
|
IRQStub:
|
2013-05-09 11:56:54 +00:00
|
|
|
cld ; Just to be sure
|
|
|
|
jsr callirq ; Call the functions
|
|
|
|
jmp IRQInd ; Jump to the saved IRQ vector
|
2013-02-12 22:39:38 +00:00
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
|
|
|
|
.data
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
IRQInd: jmp $0000
|