]> git.sur5r.net Git - cc65/blob - libsrc/atari/irq.s
atari: split color.s into bordercolor.s and bgcolor.s
[cc65] / libsrc / atari / irq.s
1 ;
2 ; IRQ handling (ATARI version)
3 ;
4
5         .export         initirq, doneirq
6         .import         callirq
7
8         .include        "atari.inc"
9 .ifdef __ATARIXL__
10         .import         __CHARGEN_START__
11         .include        "romswitch.inc"
12 .endif
13
14 ; ------------------------------------------------------------------------
15
16 .segment        "ONCE"
17
18 initirq:
19         lda     #$4C                    ; JMP opcode
20         sta     IRQInd
21         lda     VVBLKD
22         ldx     VVBLKD+1
23         sta     IRQInd+1
24         stx     IRQInd+2
25         lda     #7
26         ldy     #<IRQStub
27         ldx     #>IRQStub
28         jmp     SETVBV
29
30 ; ------------------------------------------------------------------------
31
32 .code
33
34 doneirq:
35         lda     #7
36         ldy     IRQInd+1
37         ldx     IRQInd+2
38         jmp     SETVBV
39
40 ; ------------------------------------------------------------------------
41
42 .segment        "LOWCODE"
43
44 IRQStub:
45         cld                             ; Just to be sure
46 .ifdef __ATARIXL__
47 .ifdef CHARGEN_RELOC
48         lda     CHBAS
49         pha
50 .endif
51 .endif
52         lda     PORTB
53         pha
54 .ifdef __ATARIXL__
55         and     #$FE                    ; disable ROM
56 .endif
57         ora     #$10                    ; map main memory into $4000..$7FFF area
58         sta     PORTB
59 .ifdef __ATARIXL__
60         set_chbase >__CHARGEN_START__
61 .endif
62         jsr     callirq                 ; Call the functions
63         pla
64         sta     PORTB                   ; restore old memory settings
65 .ifdef __ATARIXL__
66 .ifdef CHARGEN_RELOC
67         pla
68         sta     CHBAS
69         sta     CHBASE
70 .endif
71 .endif
72         jmp     IRQInd                  ; Jump to the saved IRQ vector
73
74 ; ------------------------------------------------------------------------
75
76 .segment        "LOWBSS"
77
78 IRQInd: .res    3
79
80 .end