]> git.sur5r.net Git - cc65/blob - libsrc/c64/irq.s
Replaced whole bunch for Makefiles with a single generic Makefile.
[cc65] / libsrc / c64 / irq.s
1 ;
2 ; IRQ handling (C64 version)
3 ;
4
5         .export         initirq, doneirq
6         .import         callirq
7
8         .include        "c64.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         jsr     callirq                 ; Call the functions
43         jmp     IRQInd                  ; Jump to the saved IRQ vector
44
45 ; ------------------------------------------------------------------------
46
47 .data
48
49 IRQInd: jmp     $0000