annotate 3rdparty/utils/view/view_wait.a @ 2488:00e35931156e

Updated
author boisy
date Wed, 31 Mar 2010 02:58:46 +0000
parents b7fb6a9aead4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1706
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
1 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
2 * View_wait.a -- End-of-picture pause... handles color cycling, screen
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
3 * flipping, and timeout.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
4 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
5 * Global labels:
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
6 * keywait: Subroutine to handle end-of-picture pause.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
7 * SetSig: Sets trivial signal trap which stores signal in SigCode
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
8 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
9 check macro
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
10 pshs b,cc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
11 ldb #\1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
12 os9 F$PErr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
13 puls b,cc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
14 endm
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
15
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
16 ifp1
1777
b7fb6a9aead4 Removed /dd/defs so that rma could assemble
boisy
parents: 1706
diff changeset
17 use os9defs.a
1706
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
18 endc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
19
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
20 StdOut equ 1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
21 StdErr equ 2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
22
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
23 psect View_wait_a,0,0,0,0,0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
24
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
25 *******************************************************
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
26 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
27 * Keywait- wait for keypress or mouse click
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
28 * Also, handle palette cycling.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
29 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
30 *******************************************************
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
31 vsect dp
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
32 cycleleft rmb 2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
33 extraleft rmb 2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
34 endsect
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
35
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
36 keywait:
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
37 pshs a,b,x,y,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
38 clr <abort
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
39
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
40 ldd <cyclerate Initialize cycle and extra count-down timers.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
41 std <cycleleft
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
42 ldd <extrarate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
43 std <extraleft
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
44
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
45 kwloop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
46 lbsr conscheck Check for consistency, to make sure we don't waste time.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
47 clr <SigCode Set up our signals.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
48 lbsr setmouse
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
49 lbsr setkeysig
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
50
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
51 kwchkey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
52 lbsr getkey Is there a key waiting?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
53 bcs kwnokey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
54 clr <SigCode
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
55 lbsr kwdokey If so, handle it
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
56 bra kwchkey . and then check again.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
57 kwnokey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
58
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
59 tst <flipping If flipping is on, do that.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
60 beq kwnoflip
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
61 lbsr kwflip
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
62 bra kwsig
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
63 kwnoflip
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
64
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
65 tst <cycle If animation is on, do that.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
66 beq kwnocycle
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
67 lbsr kwanimate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
68 bra kwsig
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
69 kwnocycle
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
70
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
71 ldx <MaxTime If none of the above, just sleep for MaxTime
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
72 cmpx #0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
73 beq kwsig
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
74 tst <SigCode
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
75 bne nosleep1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
76 os9 F$Sleep
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
77 nosleep1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
78 stx <MaxTime
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
79
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
80
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
81 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
82 * Handle a signal.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
83 kwsig
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
84 ldd <MaxTime If we timed out, end now.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
85 beq kwend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
86 lda <SigCode
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
87
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
88 cmpa #KButton Was it a keypress that woke us up?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
89 bne kwnokey1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
90 clr <SigCode If so, clear sigcode,
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
91 lbsr getkey . get the key
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
92 bsr kwdokey . process it
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
93 bcc kwloop . and keep going.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
94 bra kwend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
95 kwnokey1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
96
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
97 cmpa #MButton Was it a mouse click?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
98 bne kwnomouse None of the above, we just exit.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
99 bsr kwdomouse
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
100 lbcc kwloop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
101 bra kwend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
102 kwnomouse
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
103
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
104 kwend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
105 puls a,b,x,y,u,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
106
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
107
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
108 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
109 * Process a mouse click.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
110 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
111 kwdomouse
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
112 clr <SigCode
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
113 orcc #Carry Set carry, since any mouse click should end.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
114 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
115
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
116 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
117 * process a key press.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
118 * Expects: key in A.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
119 kwdokey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
120 pshs a,b,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
121 cmpa #'Z Convert key to lower case
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
122 bhi kwlower
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
123 cmpa #'A
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
124 blo kwlower
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
125 suba #'A-'a
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
126 kwlower
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
127
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
128 cmpa #$20 Was it a space?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
129 bne kwkey1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
130 com <cycle Yes, turn cycling on/off
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
131 lbne kwdonekey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
132 lbsr setpals Restore original palettes, if we just turned cycling off.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
133 lbra kwdonekey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
134 kwkey1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
135
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
136 cmpa #', Was it a "<"?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
137 beq kwkey21
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
138 cmpa #'<
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
139 beq kwkey21
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
140 cmpa #'s Was it an "S" (slower)
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
141 bne kwkey2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
142 kwkey21
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
143 ldx <cyclerate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
144 leax 1,x Increase the cycle delay
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
145 beq kwkey22
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
146 stx <cyclerate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
147 kwkey22
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
148 tst <flipping
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
149 beq kwkey23 If not flipping, don't do this...
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
150 ldd <fliprate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
151 addd #1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
152 cmpd #6000
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
153 bhs kwkey23
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
154 std <fliprate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
155 kwkey23
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
156 lbra kwdonekey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
157 kwkey2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
158
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
159 cmpa #'.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
160 beq kwkey31
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
161 cmpa #'>
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
162 beq kwkey31
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
163 cmpa #'f "F" (faster)
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
164 bne kwkey3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
165 kwkey31
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
166 ldx <cyclerate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
167 leax -1,x Decrease the cycle delay
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
168 beq kwkey32
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
169 stx <cyclerate Don't make it zero!
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
170 kwkey32
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
171 tst <flipping
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
172 beq kwkey33 If not flipping, don't do this...
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
173 ldd <fliprate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
174 subd #1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
175 cmpd #2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
176 bls kwkey33
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
177 std <fliprate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
178 kwkey33
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
179 lbra kwdonekey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
180 kwkey3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
181
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
182 cmpa #$B2 F2 key
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
183 beq kwkey41
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
184 cmpa #$0a Down-arrow
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
185 bne kwkey4
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
186 kwkey41
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
187 lbsr flipscreen
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
188 lbra kwdonekey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
189 kwkey4
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
190
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
191 cmpa #$0c Up-arrow
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
192 bne kwkey5
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
193 lbsr flipback
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
194 lbra kwdonekey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
195 kwkey5
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
196
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
197 cmpa #$B1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
198 bne kwkey6
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
199 lda <flipping
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
200 beq kwkey61
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
201 lda #$ff
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
202 kwkey61
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
203 coma
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
204 sta <flipping
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
205 lbra kwdonekey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
206 kwkey6
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
207
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
208 lbsr docycle Any other key? Single step.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
209 lbsr dorotate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
210 lbra kwdonekey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
211 kwdonekey
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
212 andcc #^Carry Clear carry flag, since no key forces an exit.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
213 puls a,b,x,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
214
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
215 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
216 * Check cycle, extra, and flipping variables for consistency,
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
217 * since naive routines may end up with inconsistent or inefficient
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
218 * combinations of settings (for example, we might end up with
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
219 * flipping enabled, but only one screen allocated).
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
220 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
221 conscheck
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
222 pshs a,b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
223 * Check "cycle" values for consistency.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
224 lda <cyclestart Do a consistency check on the cycle values.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
225 cmpa <cycleend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
226 blo cons0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
227 ldd #$ffff if cyclestart >= cycleend, then
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
228 std <cyclerate set cyclerate to $ffff.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
229 bra cons1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
230 cons0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
231 ldd <cyclerate otherwise, make sure cyclerate is not 0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
232 bne cons1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
233 ldd #10 Just a random value.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
234 std <cyclerate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
235 cons1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
236
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
237 * Check "extra" palette values for consistency.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
238 lda <extranum Do a consistency check on extra palette values.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
239 bne cons2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
240 ldd #$ffff if extranum is zero,
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
241 std <extrarate set extrarate to $ffff.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
242 bra cons3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
243 cons2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
244 ldd <extrarate otherwise, make sure extrarate is not 0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
245 bne cons3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
246 ldd #10 Just a random value.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
247 std <extrarate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
248 cons3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
249
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
250 * Check flipping vars for consistency
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
251 lda <numscreens Do a consistency check on flipping var.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
252 cmpa #2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
253 bhs cons4
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
254 clr <flipping If <2 screens, then ensure flipping is off.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
255 cons4
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
256
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
257 * Check "cycle" variable for consistency.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
258 lda <cyclestart A consistency check: If all animation effects
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
259 cmpa <cycleend are disabled, then turn off "cycle"
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
260 blo cons5
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
261 lda <extranum
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
262 bne cons5
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
263 clr <cycle And turn off cycle flag.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
264 cons5
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
265
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
266 puls a,b,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
267
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
268 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
269 * Do screen flipping
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
270 * Return when MaxTime goes to zero, or when a signal is received.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
271 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
272 kwflip
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
273 pshs a,b,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
274 kwfliploop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
275 ldd <MaxTime Count down one extra tick each time through
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
276 lbeq kwflipend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
277 lbsr flipscreen Do one flip
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
278 ldd <fliprate interval between flips
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
279 cmpd <MaxTime
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
280 lbls kwflip0 If MaxTime is shorter than this, use MaxTime instead.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
281 ldd <MaxTime
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
282 kwflip0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
283 tfr d,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
284 pshs x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
285 tst <SigCode
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
286 bne nosleep2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
287 os9 F$Sleep
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
288 nosleep2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
289 pshs x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
290 ldd <MaxTime Count down MaxTime
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
291 addd ,s++
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
292 subd ,s++
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
293 std <MaxTime
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
294 tst <SigCode Did we end due to a signal?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
295 beq kwfliploop No, keep flipping.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
296 kwflipend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
297 puls a,b,x,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
298
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
299 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
300 * Do animation
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
301 * Return when MaxTime goes to zero, or a signal is received.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
302 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
303 kwanimate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
304 pshs a,b,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
305 kwanimloop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
306 ldd <MaxTime
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
307 lbeq kwanimend If MaxTime is zero, quit now.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
308
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
309 ldd <cycleleft Have we timed out for cycle?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
310 bne kwanim0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
311 lbsr docycle Roll the palettes.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
312 ldd <cyclerate Restore the countdown.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
313 std <cycleleft
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
314 kwanim0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
315
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
316 ldd <extraleft Have we timed out for extra?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
317 bne kwanim1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
318 lbsr dorotate Rotate extra palettes.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
319 ldd <extrarate Restore the countdown.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
320 std <extraleft
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
321 kwanim1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
322
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
323 ldd <cycleleft Sleep for the appropriate delay
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
324 cmpd <extraleft
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
325 blo kwanim20 The appropriate delay is the least of
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
326 ldd <extraleft cycleleft, extraleft, and MaxTime.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
327 kwanim20
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
328 cmpd <MaxTime
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
329 blo kwanim2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
330 ldd <MaxTime
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
331 kwanim2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
332
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
333 tfr d,x Save original delay in D.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
334 tst <SigCode
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
335 bne nosleep3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
336 os9 F$Sleep This returns the amount of time that we didn't sleep.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
337 nosleep3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
338 pshs x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
339 subd ,s subtract time left
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
340 std ,s This gives total time slept
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
341 ldd <MaxTime Count down maximum time left
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
342 subd ,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
343 std <MaxTime
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
344 ldd <cycleleft Count down cycle time left
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
345 subd ,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
346 std <cycleleft
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
347 ldd <extraleft count down extra time left
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
348 subd ,s++ Clean up the stack while we're at it.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
349 std <extraleft
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
350
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
351 tst <SigCode Were we woken up by a signal?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
352 beq kwanimloop No, keep going.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
353 kwanimend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
354 puls a,b,x,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
355
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
356 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
357 * Trivial signal handler... store signal value and exit
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
358 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
359 SigInter
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
360 stb SigCode,u Store the signal code.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
361 tfr u,y Set up y as it should be.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
362 tfr u,d
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
363 tfr a,dp Set up DP too.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
364 tst <abort Should we abort now?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
365 lbne _abort
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
366 rti
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
367
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
368 SetSig:
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
369 pshs x,y,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
370 leax SigInter,pcr Set the signal intercept
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
371 leau ,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
372 os9 F$Icpt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
373 lbcs _error
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
374 puls x,y,u,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
375
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
376 endsect