]> git.sur5r.net Git - cc65/blob - libsrc/pet/irq.s
5effd709780d70456e8a09aeea5d10156307c671
[cc65] / libsrc / pet / irq.s
1 ;
2 ; IRQ handling (PET version)
3 ;
4
5         .export         initirq, doneirq
6         .import         callirq
7
8         .include        "pet.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         sei
22         sta     IRQVec
23         stx     IRQVec+1
24         cli
25         rts
26
27 ; ------------------------------------------------------------------------
28
29 .code
30
31 doneirq:
32         lda     IRQInd+1
33         ldx     IRQInd+2
34         sei
35         sta     IRQVec
36         stx     IRQVec+1
37         cli
38         rts
39
40 ; ------------------------------------------------------------------------
41
42 .segment        "LOWCODE"
43
44 IRQStub:
45         cld                             ; Just to be sure
46         jsr     callirq                 ; Call the functions
47         jmp     IRQInd                  ; Jump to the saved IRQ vector
48
49 ; ------------------------------------------------------------------------
50
51 .data
52
53 IRQInd: jmp     $0000