]> git.sur5r.net Git - cc65/blob - libsrc/atmos/irq.s
Save some bytes by sharing the code doing the actual vector setting. Note: Jumping...
[cc65] / libsrc / atmos / irq.s
1 ;
2 ; IRQ handling (Oric version)
3 ;
4
5         .export         initirq, doneirq
6         .import         callirq
7
8         .include        "atmos.inc"
9
10 ; ------------------------------------------------------------------------
11
12 .segment        "INIT"
13
14 initirq:
15         lda     IRQVec
16         ldx     IRQVec+1
17         sta     IRQInd+1
18         stx     IRQInd+2
19         lda     #<IRQStub
20         ldx     #>IRQStub
21         jmp     setvec
22
23 ; ------------------------------------------------------------------------
24
25 .code
26
27 doneirq:
28         lda     IRQInd+1
29         ldx     IRQInd+2
30 setvec: sei
31         sta     IRQVec
32         stx     IRQVec+1
33         cli
34         rts
35
36 ; ------------------------------------------------------------------------
37
38 .segment        "LOWCODE"
39
40 IRQStub:
41         cld                             ; Just to be sure
42         pha
43         txa
44         pha
45         tya
46         pha
47         jsr     callirq                 ; Call the functions
48         pla
49         tay
50         pla
51         tax
52         pla
53         jmp     IRQInd                  ; Jump to the saved IRQ vector
54
55 ; ------------------------------------------------------------------------
56
57 .data
58
59 IRQInd: jmp     $0000