]> git.sur5r.net Git - cc65/blob - libsrc/atari/irq.s
Use deferred VBI instead of immediate VBI. A deferred VBI won't be
[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        "INIT"
17
18 initirq:
19         lda     VVBLKD
20         ldx     VVBLKD+1
21         sta     IRQInd+1
22         stx     IRQInd+2
23         lda     #7
24         ldy     #<IRQStub
25         ldx     #>IRQStub
26         jsr     SETVBV
27         rts
28
29 ; ------------------------------------------------------------------------
30
31 .code
32
33 doneirq:
34         lda     #7
35         ldy     IRQInd+1
36         ldx     IRQInd+2
37         jsr     SETVBV
38         rts
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         lda     PORTB
52         pha
53         and     #$FE
54         sta     PORTB                   ; disable ROM
55         set_chbase >__CHARGEN_START__
56 .endif
57         jsr     callirq                 ; Call the functions
58 .ifdef __ATARIXL__
59         pla
60         sta     PORTB                   ; restore old ROM setting
61 .ifdef CHARGEN_RELOC
62         pla
63         sta     CHBAS
64         sta     CHBASE
65 .endif
66 .endif
67         jmp     IRQInd                  ; Jump to the saved IRQ vector
68
69 ; ------------------------------------------------------------------------
70
71 .data
72
73 IRQInd: jmp     $0000