1;
2; IRQ handling (Oric version)
3;
4
5        .export         initirq, doneirq
6        .import         callirq
7
8        .include        "telestrat.inc"
9
10; ------------------------------------------------------------------------
11
12.segment        "ONCE"
13
14initirq:
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
27doneirq:
28        lda     IRQInd+1
29        ldx     IRQInd+2
30setvec: sei
31        sta     IRQVec
32        stx     IRQVec+1
33        cli
34        rts
35
36; ------------------------------------------------------------------------
37
38.segment        "LOWCODE"
39
40IRQStub:
41        cld                             ; Just to be sure
42        pha
43        txa
44        pha
45        tya
46        pha
47        jsr     callirq                 ; Call the functions
48        pla
49        tay
50        pla
51        tax
52        pla
53        jmp     IRQInd                  ; Jump to the saved IRQ vector
54
55; ------------------------------------------------------------------------
56
57.data
58
59IRQInd: jmp     $0000
60