]> git.sur5r.net Git - cc65/blob - libsrc/atari5200/irq.s
Fixed LinuxDoc Tools issues in some verbatim blocks in the Atari document.
[cc65] / libsrc / atari5200 / irq.s
1 ;
2 ; IRQ handling (ATARI 5200 version)
3 ;
4
5         .export         initirq, doneirq
6         .import         callirq
7
8         .include        "atari5200.inc"
9
10 ; ------------------------------------------------------------------------
11
12 .segment        "ONCE"
13
14 initirq:
15         lda     VVBLKD
16         ldx     VVBLKD+1
17         sta     IRQInd+1
18         stx     IRQInd+2
19         ldy     #<IRQStub
20         ldx     #>IRQStub
21         jmp     SETVBV
22
23 ; ------------------------------------------------------------------------
24
25 .code
26
27 doneirq:
28         ldy     IRQInd+1
29         ldx     IRQInd+2
30         ;jmp     SETVBV
31         ; fall thru
32
33 ; ------------------------------------------------------------------------
34 ; Set deferred vertical blank interrupt
35 ; logic copied from Atari computer ROM
36
37 SETVBV: txa
38         ldx     #5
39         sta     WSYNC                   ; waste 20 CPU cycles
40 @1:     dex                             ; to allow VBLANK to happen
41         bne     @1                      ; if this is line "7C"
42         sta     VVBLKD+1
43         sty     VVBLKD
44         rts
45
46 ; ------------------------------------------------------------------------
47
48 .segment        "LOWCODE"
49
50 IRQStub:
51         cld                             ; Just to be sure
52         jsr     callirq                 ; Call the functions
53         jmp     IRQInd                  ; Jump to the saved IRQ vector
54
55 ; ------------------------------------------------------------------------
56
57 .data
58
59 IRQInd: jmp     $0000