annotate gen_test_hv.s68 @ 1466:f2ee46d08b01

Push correct PC onto stack on divide by zero for pc-relative case
author Michael Pavone <pavone@retrodev.com>
date Wed, 13 Sep 2017 21:13:11 -0700
parents c86f27f5c5a6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
649
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 dc.l $0, start
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 ;$10
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 ;$20
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 ;$30
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 ;$40
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
23 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
24 ;$50
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
26 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
27 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
29 ;$60
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
31 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
32 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34 ;$70
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
35 dc.l int_4
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37 dc.l int_6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
38 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
39 ;$80
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
40 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
41 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
42 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
43 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
44 ;$90
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
45 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
46 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
47 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
48 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
49 ;$A0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
50 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
51 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
52 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
53 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
54 ;$B0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
55 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
56 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
57 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
58 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
59 ;$C0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
60 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
61 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
62 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
63 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
64 ;$D0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
65 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
66 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
67 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
68 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
69 ;$E0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
70 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
71 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
72 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
73 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
74 ;$F0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
75 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
76 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
77 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
78 dc.l empty_handler
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
79 dc.b "SEGA"
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
80 empty_handler:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
81 int_6:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
82 rte
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
83 int_4:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
84 move.w (a2), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
85 ori.w #$8000, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
86 move.w d0, (a4)+
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
87 rte
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
88
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
89 start:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
90 lea $C00000, a0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
91 lea $C00004, a1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
92 move.w #$8104, (a1) ;Mode 5, everything turned off
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
93 move.w #$8004, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
94 move.w #$8220, (a1) ;Scroll a table $8000
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
95 move.w #$8404, (a1) ;Scroll b table $8000
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
96 move.w #$8560, (a1) ;SAT table $C000
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
97 move.w #$8700, (a1) ;backdrop color 0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
98 move.w #$8B00, (a1) ;full screen scroll
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
99 move.w #$8C81, (a1) ;40 cell mode, no interlace
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
100 move.w #$8C81, (mode).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
101 move.w #$8D00, (a1) ;hscroll table at 0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
102 move.w #$8F02, (a1) ;autoinc 2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
103 move.w #$9011, (a1) ;64x64 scroll size
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
104 move.l #$C0000000, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
105 move.w #$000, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
106 move.w #$EEE, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
107
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
108 ;clear scroll table
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
109 move.l #$40000000, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
110 move.l #0, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
111
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
112 ;load tiles
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
113 move.l #$44000000, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
114 lea font(pc), a2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
115 move.w #((fontend-font)/4 - 1), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
116 tloop:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
117 move.l (a2)+, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
118 dbra d0, tloop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
119
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
120
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
121
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
122 ;clear name table
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
123 move.l #$40000002, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
124 moveq #32, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
125 move.w #(64*64-1), d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
126 ploop:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
127 move.w d0, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
128 dbra d1, ploop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
129
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
130
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
131 lea $FF0000, a4
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
132 move.b #$40, (a4, 6)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
133 move.w #$8144, (a1) ;enable display
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
134 move #$2300, sr
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
135
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
136 lea (4, a1), a2 ;hv counter line address
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
137 lea (2, a1), a3 ;second contro/status address
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
138
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
139 move.b #254, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
140 init_wait:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
141 cmp.b (a2), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
142 beq init_wait
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
143
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
144 top:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
145 move.b #254, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
146 lea $FF0000, a4
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
147 move.w #$8F00, (a1) ;autoinc of 0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
148 move.l #$40040000, (a1) ;unused VRAM address
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
149 wait_active:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
150 cmp.b (a2), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
151 bne.s wait_active
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
152
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
153 move.l #$8A718014, (a1) ;enable Hints
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
154
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
155 ;sync to VDP by attempting to fill FIFO
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
156 ;being in vblank makes this a bit difficult
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
157
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
158 rept 8
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
159 move.l d0, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
160 endr
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
161
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
162 ;sample data for vblank flag off
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
163 rept 82 ;two lines worth of move.l
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
164 move.l (a3), (a4)+
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
165 endr
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
166
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
167 move.l a4, a5 ;save end of first buffer
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
168
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
169 move.b (a2), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
170 wait_new_line:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
171 cmp.b (a2), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
172 beq.s wait_new_line
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
173
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
174 ;sync to VDP by filling FIFO
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
175 move.l d0, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
176 move.l d0, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
177 move.w d0, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
178
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
179 ;sample data for line change HV value
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
180 rept 45 ;one line worth of move.l
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
181 move.l (a2), (a4)+
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
182 endr
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
183
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
184 move.l a4, usp ;save end of second buffer
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
185
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
186 moveq #$70, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
187 wait_hint_line:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
188 cmp.b (a2), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
189 bne.s wait_hint_line
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
190
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
191 ;sample data for line change HV value
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
192 rept 45 ;one line worth of move.l
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
193 move.l (a2), (a4)+
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
194 endr
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
195
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
196 move.l a4, a6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
197
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
198 move.b #223, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
199 wait_inactive:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
200 cmp.b (a2), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
201 bne.s wait_inactive
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
202
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
203 ;sync to VDP by filling FIFO
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
204 move.l d0, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
205 move.l d0, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
206 move.w d0, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
207
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
208 ;sample data for vblank on
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
209 rept 82 ;two lines worth of move.l
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
210 move.l (a3), (a4)+
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
211 endr
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
212
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
213 move.l #$8AFF8004, (a1) ;disable Hints
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
214
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
215 rsset $FFFF8000
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
216 vblank_start_min rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
217 vblank_start_max rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
218 vblank_end_min rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
219 vblank_end_max rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
220 hblank_start_min rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
221 hblank_start_max rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
222 hblank_end_min rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
223 hblank_end_max rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
224 line_change_min rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
225 line_change_max rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
226 hint_min rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
227 hint_max rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
228 mode rs.w 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
229 printed_hv_dump rs.b 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
230 button_state rs.b 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
231
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
232 lea $FF0001, a4
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
233 .loop:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
234 btst.b #3, (a4)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
235 beq.s found_vblank_off
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
236 move.w 1(a4), d6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
237 addq #4, a4
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
238 bra.s .loop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
239 found_vblank_off:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
240
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
241 move.w (vblank_end_max).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
242 beq .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
243 cmp.w d0, d6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
244 blo .no_new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
245 .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
246 move.w d6, (vblank_end_max).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
247 .no_new_max:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
248
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
249
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
250 move.w 1(a4), d6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
251
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
252 move.w (vblank_end_min).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
253 beq .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
254 cmp.w d0, d6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
255 bhi .no_new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
256 .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
257 move.w d6, (vblank_end_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
258 .no_new_min:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
259
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
260 lea $FF0001, a4
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
261 ;first find a point where HBLANK is not set
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
262 bra.s .start
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
263 .loop:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
264 addq #4, a4
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
265 .start
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
266 btst.b #2, (a4)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
267 bne.s .loop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
268
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
269 ;then find a point after that where it switches to on
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
270 .loop2:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
271 btst.b #2, (a4)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
272 bne.s found_hblank_on
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
273 move.w 1(a4), d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
274 addq #4, a4
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
275 bra.s .loop2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
276 found_hblank_on:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
277
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
278 move.w (hblank_start_max).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
279 beq .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
280 cmp.w d0, d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
281 blo .no_new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
282 .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
283 move.w d5, (hblank_start_max).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
284 .no_new_max:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
285
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
286
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
287 move.w 1(a4), d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
288
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
289 move.w (hblank_start_min).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
290 beq .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
291 cmp.w d0, d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
292 bhi .no_new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
293 .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
294 move.w d5, (hblank_start_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
295 .no_new_min:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
296
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
297 ;finally find a point after that where it switches back off
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
298 .loop2:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
299 btst.b #2, (a4)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
300 beq.s found_hblank_off
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
301 move.w 1(a4), d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
302 addq #4, a4
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
303 bra.s .loop2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
304 found_hblank_off:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
305
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
306 move.w (hblank_end_max).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
307 beq .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
308 cmp.w d0, d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
309 blo .no_new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
310 .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
311 move.w d5, (hblank_end_max).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
312 .no_new_max:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
313
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
314
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
315 move.w 1(a4), d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
316
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
317 move.w (hblank_end_min).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
318 beq .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
319 cmp.w d0, d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
320 bhi .no_new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
321 .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
322 move.w d5, (hblank_end_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
323 .no_new_min:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
324
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
325 move.l a5, a4 ;save line change buffer for later
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
326 move.b (a5), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
327 .loop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
328 move.w (a5), d7
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
329 addq #2, a5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
330 cmp.b (a5), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
331 beq .loop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
332 found_line_change:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
333
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
334 move.w (line_change_max).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
335 beq .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
336 cmp.w d0, d7
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
337 blo .no_new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
338 .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
339 move.w d7, (line_change_max).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
340 .no_new_max:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
341
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
342 move.w (a5), d7
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
343
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
344 move.w (line_change_min).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
345 beq .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
346 cmp.w d0, d7
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
347 bhi .no_new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
348 .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
349 move.w d7, (line_change_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
350 .no_new_min:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
351
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
352 addq #1, a6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
353 .loop:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
354 btst.b #3, (a6)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
355 bne.s found_vblank_on
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
356 move.w 1(a6), d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
357 addq #4, a6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
358 bra.s .loop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
359 found_vblank_on:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
360
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
361 move.w (vblank_start_max).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
362 beq .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
363 cmp.w d0, d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
364 blo .no_new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
365 .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
366 move.w d5, (vblank_start_max).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
367 .no_new_max:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
368
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
369 move.w 1(a6), d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
370
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
371 move.w (vblank_start_min).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
372 beq .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
373 cmp.b d0, d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
374 bhi .no_new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
375 .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
376 move.w d5, (vblank_start_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
377 .no_new_min:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
378
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
379 move usp, a5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
380 .loop:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
381 btst.b #7, (a5)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
382 bne.s found_hint
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
383 move.w (a5), d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
384 addq #2, a5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
385 bra.s .loop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
386 found_hint:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
387
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
388 move.w (hint_max).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
389 beq .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
390 cmp.w d0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
391 blo .no_new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
392 .new_max
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
393 move.w d1, (hint_max).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
394 .no_new_max:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
395
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
396 move.w (a5), d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
397 and.w #$7FFF, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
398
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
399 move.w (hint_min).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
400 beq .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
401 cmp.b d0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
402 bhi .no_new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
403 .new_min
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
404 move.w d1, (hint_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
405 .no_new_min:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
406
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
407 draw_info:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
408 ;draw data
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
409 move.w #$8F02, (a1) ;autoinc of 2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
410 move.l #$40840002, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
411
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
412 moveq #0, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
413 lea VBlankStart(pc), a6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
414 bsr print_string
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
415
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
416
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
417 move.w (vblank_start_max), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
418 moveq #0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
419 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
420
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
421 move.w #32, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
422 move.w d5, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
423 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
424
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
425 move.w #32, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
426 move.w (vblank_start_min), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
427 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
428
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
429 moveq #0, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
430 move.l #$41040002, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
431 lea VBlankEnd(pc), a6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
432 bsr print_string
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
433
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
434 ;max value before vblank end
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
435 moveq #0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
436 move.w (vblank_end_max), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
437 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
438
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
439 move.w #32, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
440 move.w d6, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
441 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
442
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
443 ;min value after vblank end
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
444 move.w (vblank_end_min), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
445 move.w #32, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
446 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
447
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
448 moveq #0, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
449 move.l #$41840002, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
450 lea LineChange(pc), a6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
451 bsr print_string
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
452
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
453 move.w (line_change_max), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
454 moveq #0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
455 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
456
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
457 move.w #32, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
458 move.w d7, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
459 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
460
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
461 move.w (line_change_min), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
462 move.w #32, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
463 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
464
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
465 moveq #0, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
466 move.l #$42040002, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
467 lea HBlankStart(pc), a6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
468 bsr print_string
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
469
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
470 move.w (hblank_start_max), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
471 moveq #0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
472 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
473
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
474 move.w (hblank_start_min), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
475 move.w #32, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
476 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
477
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
478 moveq #0, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
479 move.l #$42840002, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
480 lea HBlankEnd(pc), a6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
481 bsr print_string
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
482
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
483 move.w (hblank_end_max), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
484 moveq #0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
485 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
486
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
487 move.w (hblank_end_min), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
488 move.w #32, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
489 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
490
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
491 moveq #0, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
492 move.l #$43040002, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
493 lea HInterrupt(pc), a6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
494 bsr print_string
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
495
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
496 move.w (hint_max), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
497 moveq #0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
498 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
499
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
500 move.w (hint_min), d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
501 move.w #32, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
502 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
503
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
504 ;read pad
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
505 move.b #$40, $A10003
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
506 move.b $A10003, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
507 move.b #$00, $A10003
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
508 and.b #$3f, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
509 move.b $A10003, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
510 and.b #$30, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
511 lsl.b #2, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
512 or.b d1, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
513 not.b d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
514 move.b (button_state).w, d2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
515 eor.b d0, d2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
516 and.b d0, d2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
517 move.b d2, d3 ;d3 contains newly pressed buttons, SACBRLDU
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
518 move.b d0, (button_state).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
519
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
520 btst.l #7, d3
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
521 beq not_pressed
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
522
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
523 moveq #0, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
524 move.l d0, (vblank_start_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
525 move.l d0, (vblank_end_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
526 move.l d0, (hblank_start_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
527 move.l d0, (hblank_end_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
528 move.l d0, (line_change_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
529 move.l d0, (hint_min).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
530 move.b d0, (printed_hv_dump).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
531 move.w (mode).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
532 eor.w #$81, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
533 move.w d0, (mode).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
534 move.w d0, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
535 bra top
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
536
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
537 not_pressed
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
538
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
539 move.b (printed_hv_dump).w, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
540 bne top
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
541 move.b #1, (printed_hv_dump).w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
542
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
543 moveq #0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
544 moveq #89, d4
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
545 moveq #6, d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
546 move.l #$45820002, d6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
547 move.l d6, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
548
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
549 print_loop:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
550 dbra d5, .no_line_change
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
551 ;#$45820002
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
552 add.l #$00800000, d6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
553 move.l d6, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
554 moveq #5, d5
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
555 .no_line_change
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
556 move.w #32, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
557 move.w (a4)+, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
558 bsr print_hexw
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
559 dbra d4, print_loop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
560
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
561 add.l #$01020000, d6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
562 move.l d6, (a1)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
563 moveq #0, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
564 lea Instructions(pc), a6
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
565 bsr print_string
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
566
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
567 bra top
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
568
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
569 VBlankStart:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
570 dc.b "VBlank Start: ", 0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
571 VBlankEnd:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
572 dc.b "VBlank End: ", 0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
573 LineChange:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
574 dc.b "Line Change: ", 0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
575 HBlankStart:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
576 dc.b "HBlank Start: ", 0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
577 HBlankEnd:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
578 dc.b "HBlank End: ", 0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
579 HInterrupt:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
580 dc.b "HInterrupt: ", 0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
581 Instructions:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
582 dc.b "Press Start to switch modes", 0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
583
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
584 align 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
585 ;Prints a number in hex format
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
586 ;d0.w - number to print
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
587 ;d1.w - base tile attribute
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
588 ;a0 - VDP data port
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
589 ;
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
590 ;Clobbers: d2.l, d3.l
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
591 ;
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
592 print_hexw:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
593 moveq #3, d3
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
594 .digitloop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
595 rol.w #4, d0
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
596 moveq #$F, d2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
597 and.b d0, d2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
598 cmp.b #$A, d2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
599 bge .hex
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
600 add.w #$30, d2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
601 bra .makeattrib
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
602 .hex
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
603 add.w #($41-$A), d2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
604 .makeattrib
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
605 add.w d1, d2
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
606 move.w d2, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
607 dbra d3, .digitloop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
608 rts
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
609
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
610 ;Prints a null terminated string
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
611 ;a6 - pointer to string
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
612 ;a0 - VDP data port
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
613 ;d0 - base tile attribute
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
614 ;
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
615 ;Clobbers: d1.w
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
616 print_string:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
617 .loop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
618 moveq #0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
619 move.b (a6)+, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
620 beq .end
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
621 add.w d0, d1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
622 move.w d1, (a0)
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
623 bra .loop
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
624 .end
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
625 rts
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
626
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
627 align 1
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
628 font:
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
629 incbin font.tiles
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
630 fontend
c86f27f5c5a6 Added HV counter test ROM source
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
631