-
Notifications
You must be signed in to change notification settings - Fork 0
/
irq.inc
81 lines (68 loc) · 1.5 KB
/
irq.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;;; -*-asm-*-
MODULE irq,$f03000
load (IRQ_FLAGADDR.a),IRQ_FLAG.a
movei #cpu_irq,IRQScratch0.a
bset #9+0,IRQ_FLAG.a
load (IRQ_SP.a),IRQ_RTS.a
jump (IRQScratch0.a)
bclr #3,IRQ_FLAG.a
org $f03020
timer::
load (IRQ_FLAGADDR.a),IRQ_FLAG.a
movei #timer_irq,IRQScratch0.a
bset #9+2,IRQ_FLAG.a
load (IRQ_SP.a),IRQ_RTS.a
jump (IRQScratch0.a)
bclr #3,IRQ_FLAG.a
org $f03030
op::
load (IRQ_FLAGADDR.a),IRQ_FLAG.a
bset #9+3,IRQ_FLAG.a
load (IRQ_SP.a),IRQ_RTS.a
bclr #3,IRQ_FLAG.a
IF LOCK_VBL = 0
movefa VBLFlag,IRQScratch0.a
cmpq #0,IRQScratch0.a
jr ne,.no_swap
moveq #1,IRQScratch0.a
moveta IRQScratch0.a,VBLFlag
ELSE
movefa VBLFlag,IRQScratch0.a
subq #1,IRQScratch0.a
jr ne,.no_swap
moveta IRQScratch0.a,VBLFlag
ENDIF
move obl0.a,IRQScratch0.a
move obl1.a,obl0.a
move IRQScratch0.a,obl1.a
moveta screen0.a,IRQScratch0.a
move screen1.a,screen0.a
movefa IRQScratch0.a,screen1.a
.no_swap
move obl0.a,IRQScratch0.a
movei #$1040,IRQScratch1.a
moveq #12-1,IRQScratch3.a
.l loadp (IRQScratch0.a),IRQScratch2.a
addqt #8,IRQScratch0.a
subq #1,IRQScratch3.a
storep IRQScratch2.a,(IRQScratch1.a)
jr pl,.l
addq #8,IRQScratch1.a
movei #$f00026,IRQScratch1.a
jr irq_return
storew IRQScratch1.a,(IRQScratch1.a) ; resume OP
timer_irq::
nop
irq_return
addqt #2,IRQ_RTS.a
addqt #4,IRQ_SP.a
moveta IRQ_RTS.a,IRQ_RTS.a ; only for VJ needed
store IRQ_FLAG.a,(IRQ_FLAGADDR.a)
jump (IRQ_RTS.a)
nop
cpu_irq:
moveq #1,IRQScratch0.a
moveta IRQScratch0.a,VBLFlag
jr irq_return
nop
ENDMODULE irq