2013-02-12 22:39:38 +00:00
|
|
|
;
|
|
|
|
; IRQ handling (Oric 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 "atmos.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
|
|
|
|
pha
|
|
|
|
txa
|
|
|
|
pha
|
|
|
|
tya
|
|
|
|
pha
|
|
|
|
jsr callirq ; Call the functions
|
|
|
|
pla
|
|
|
|
tay
|
|
|
|
pla
|
|
|
|
tax
|
|
|
|
pla
|
|
|
|
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
|