annotate 3rdparty/packages/pacos9/movpac90.a @ 1864:f351932fa6cd

Added pacos9
author boisy
date Tue, 26 Jul 2005 01:17:24 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1864
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
2 NAM MOVPAC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
3 TTL Move pacman routines
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
4
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
5 * Program segment to be compiled using Level II RMA
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
6 * This is not a mainline program segment
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
7 * Written by Larry Olson
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
8
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
9 IFP1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
10 * use /dd/defs/os9defs.a
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
11 ENDc
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
12
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
13
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
14 STACK EQU 100
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
15
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
16
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
17 PSECT MOVPAC,0,0,2,STACK,MVPAC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
18
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
19 VSECT
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
20
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
21 * Local variables
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
22
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
23 RMB STACK
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
24
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
25 ENDSECT
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
26
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
27
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
28 MVPAC: nop
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
29
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
30 * Read joystick
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
31
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
32 JOY lda PATH Set path to window
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
33 ldb #$13 Setup for SS.Joy
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
34 ldx PORT,U Get selected port
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
35 os9 I$GetStt
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
36 lbcs ERR1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
37 stx JOYSTX
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
38 sty JOYSTY
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
39 sta BUTTON
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
40 * Cycle is used to animate pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
41
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
42 CYC dec CYCLE Decrement cycle counter
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
43 bpl MVRT If >0 continue
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
44 lda #2 Reset counter to 2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
45 sta CYCLE
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
46
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
47 clra
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
48 sta MOVFLG,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
49
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
50 * Check direction of joystick & move pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
51
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
52 MVRT leay ARRAY,U Point to start of array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
53 ldd POFSET Get pacman offset in array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
54 leax D,Y
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
55 * X reg now points to pacman position in array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
56 ldd JOYSTX Get joystick X value
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
57 cmpd #37 Is it greater than 37 ?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
58 blo MVLFT Go to move left
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
59
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
60 inc MOVFLG,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
61
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
62 lda 1,X Get adjacent byte from array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
63 lbmi MVDWN If wall then go check for down
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
64 ldd PCXLOC GET pseudo screen X location
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
65 cmpd PXNEW Is it equal to actual location?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
66 beq SKIPR
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
67 addd #8
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
68 std PCXLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
69 SKIPR ldd PXNEW Get actual screen X location
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
70 addd #8 Add 8 to it
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
71 std PXNEW Put it back
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
72 ldd PYNEW Get screen Y location
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
73 std PCYLOC Set pyold = pynew
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
74 ldd POFSET Get pacman array offset
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
75 addd #1 Increment it
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
76 cmpd #1793 Is it off screen to the right ?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
77 bne STBUF1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
78 * Erase pacman on right side of screen
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
79 * Before moving pacman to left side
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
80 lda #37 Set for blank pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
81 sta PBFN Put it in putblk code
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
82 ldd #572
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
83 std PXLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
84 ldd #85
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
85 std PYLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
86 lbsr PUTBLK Go erase pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
87
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
88 ldd #44
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
89 std PXNEW Reset pac screen X to 36
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
90 subd #8 Set pseudo X location
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
91 std PCXLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
92 lda #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
93 ldd #1726 Move pacman to left side
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
94 STBUF1 std POFSET Store pacman array offset
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
95 leax D,Y Point to pacman position in array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
96 lda #25 Set pacman direction buffer
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
97 sta BUFF for right facing pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
98 ldb #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
99 lda B,X Get the byte at this spot
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
100 bmi MVPAC1 Branch if wall
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
101 bita #6 Check for a dot or pill
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
102 beq MVPAC1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
103 lbsr ERPILL Go erase pill or dot
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
104 bra MVPAC1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
105 MVLFT ldd JOYSTX Get joystick X value
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
106 cmpd #27
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
107 bhi MVDWN
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
108 inc MOVFLG,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
109 lda -1,X Get byte 1 move to the left
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
110 bmi MVDWN Branch if wall
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
111 ldd PXNEW Get new pac position
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
112 subd #8 Subtract 8 from it
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
113 std PXNEW Put it back
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
114 std PCXLOC Set pxold = pxnew
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
115 ldd PYNEW
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
116 std PCYLOC Set pyold = pynew
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
117 ldd POFSET Get pacman array offset
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
118 subd #1 Decrement it
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
119 cmpd #1725 Is it off left side of screen ?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
120 bne STBUF2 If not then store hcount
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
121 * Erase pacman on left side of screen
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
122 * Before moving pacman to right side
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
123 lda #37 Set for blank pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
124 sta PBFN Put it in PUTBLK code
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
125 ldd #44
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
126 std PXLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
127 ldd #85
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
128 std PYLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
129 lbsr PUTBLK Go erase pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
130
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
131 ldd #572
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
132 std PXNEW Update screen location too.
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
133 std PCXLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
134 ldd #1792 Move pacman to right side
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
135 STBUF2 std POFSET Store pacman array offset
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
136 leax D,Y X holds pacman position in array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
137 lda #28 Set pacman direction buffer
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
138 sta BUFF for left facing pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
139 ldb #-1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
140 lda B,X Get byte from array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
141 bmi MVPAC1 Branch if wall
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
142 bita #6 Check for dot or pill
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
143 beq MVPAC1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
144 lbsr ERPILL Go erase pill or dot
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
145 MVPAC1 lda BUFF
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
146 adda CYCLE
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
147 sta PCBFN
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
148 leax PUTPACM,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
149 ldy #8
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
150 lda PATH
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
151 os9 I$Write
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
152 lbcs ERR1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
153
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
154 MVDWN leay ARRAY,U Point to start of array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
155 ldd POFSET Get pacman array offset
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
156 leax D,Y X holds pacman array position
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
157 ldd JOYSTY Get joystick Y value
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
158 cmpd #27 Is it greater than 27 ?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
159 bhi MVUP If not, then check for up move
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
160 inc MOVFLG,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
161 lda 69,X Look at byte one line down
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
162 lbmi LEAVE Branch if wall
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
163 ldd PCYLOC Get pseudo screen Y location
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
164 cmpd PYNEW Are they the same ?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
165 beq SKIPD
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
166 addd #3 Add 3 to it
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
167 std PCYLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
168 SKIPD ldd PYNEW Get actual screen Y location
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
169 addd #3 Add 3 to it
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
170 std PYNEW Put it back
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
171 ldd PXNEW
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
172 std PCXLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
173 SKIPD2 ldd POFSET Get location in array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
174 addd #69 Move down 1 line
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
175 cmpd #3692 Off screen at bottom?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
176 bne STBUF3
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
177
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
178 lda #37 Blank pacman buffer
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
179 sta PBFN
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
180 ldd #316
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
181 std PXLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
182 ldd #166
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
183 std PYLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
184 lbsr PUTBLK Go erase pacman at bottom
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
185
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
186 ldd #300
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
187 std PXNEW
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
188 std PCXLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
189 ldd #07 New Y scrn location
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
190 std PCYLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
191 addd #3
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
192 std PYNEW
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
193 ldd #33 Move to top of array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
194 STBUF3 std POFSET
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
195 leax D,Y
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
196 lda #34 Set pacman direction buffer
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
197 sta BUFF for down facing pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
198 ldb #69 Look one line down
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
199 lda B,X Get byte at this spot
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
200 bmi MVPAC2 Branch if wall
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
201 bita #6 Check for dot(2) or pill(4)
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
202 beq MVPAC2 Go move pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
203 lbsr ERPILL Go erase pill or dot
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
204 bra MVPAC2 Go move pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
205
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
206 MVUP ldd JOYSTY Get joystick Y value
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
207 cmpd #37 Is it less than 37 ?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
208 lblo LEAVE
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
209 inc MOVFLG,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
210 lda -69,X Get byte from array, 1 line up
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
211 bmi LEAVE Branch if wall
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
212 ldd PYNEW Get pac screen Y location
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
213 subd #3 Subtract 3 from it
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
214 std PYNEW Put it back
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
215 std PCYLOC Set pyold = pynew
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
216 ldd PXNEW
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
217 std PCXLOC Set pxold = pxnew
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
218 lda #31 Set direction buffer
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
219 sta BUFF to up facing pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
220 ldd POFSET Get pacman array offset
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
221 subd #69 Move up one line
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
222 cmpd #33 At top of screen?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
223 bne STBUF4
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
224
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
225 lda #37 Blank pacman buffer #
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
226 sta PBFN
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
227 ldd #300
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
228 std PXLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
229 ldd #13
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
230 std PYLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
231 lbsr PUTBLK Erase pacman at top
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
232
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
233 ldd #316
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
234 std PXNEW
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
235 std PCXLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
236 ldd #169
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
237 std PYNEW
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
238 std PCYLOC
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
239 ldd #3692
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
240 STBUF4 std POFSET Put it back
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
241 leax D,Y X holds pacman array position
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
242 ldb #-69
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
243 lda B,X Get byte at this spot
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
244 bmi MVPAC2 Branch if wall
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
245 bita #6 Check for dot(2) or pill(4)
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
246 beq MVPAC2 Go move pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
247 lbsr ERPILL Go erase pill or dot
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
248 MVPAC2 lda BUFF Get current pac buffer
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
249 adda CYCLE Add cycle count
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
250 sta PCBFN Set putblk buffer
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
251 leax PUTPACM,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
252 ldy #8
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
253 lda PATH
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
254 os9 I$Write
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
255 lbcs ERR1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
256
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
257 LEAVE lda MOVFLG,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
258 bne EXTCHK
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
259 ldx #2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
260 lbsr WAIT
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
261
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
262 EXTCHK ldb PACMAN Get # of pacmen left
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
263 cmpb #6 Only a total of 6 allowed
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
264 beq MVDONE If already 6, then exit
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
265 lda SCRBCD,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
266 anda #15 %00001111 strip high
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
267 cmpa EXTPAC,U Compare it with goal
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
268 blo MVDONE If not =, then exit
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
269 incb If =, then give bonus-
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
270 stb PACMAN pacman to player
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
271 inc EXTPAC,U Increment goal
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
272 ldd #181
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
273 std PYLOC,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
274 lda #28
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
275 sta PBFN,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
276 lda #30
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
277 ldb PACMAN
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
278 subb #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
279 mul
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
280 std PXLOC,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
281 ldd #600
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
282 subd PXLOC,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
283 std PXLOC,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
284 lbsr PUTBLK
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
285
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
286 MVDONE rts Return to MAIN
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
287
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
288 PALCHG: clrb
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
289 stb STRLGH Save counter
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
290 leay STRING,U String to output
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
291 leax G1OFST,U Point to ghost tables
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
292 lda 10,X Get #1 ghost status
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
293 cmpa #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
294 bne TEST2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
295 ldd #$1b31 Palette set code
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
296 std ,Y++ Put it in string
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
297 ldd #$043d
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
298 std ,Y++ Put it in string
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
299 inc STRLGH
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
300 lda #2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
301 sta 10,X Make ghost run from pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
302 TEST2 lda 30,X Get #2 ghost status
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
303 cmpa #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
304 bne TEST3
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
305 ldd #$1b31 Palette set code
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
306 std ,Y++ Put it in string
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
307 ldd #$063d
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
308 std ,Y++ Put it in string
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
309 inc STRLGH
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
310 lda #2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
311 sta 30,X Make ghost run from pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
312 TEST3 lda 50,X Get #3 ghost status
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
313 cmpa #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
314 bne TEST4
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
315 ldd #$1b31 Palette set code
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
316 std ,Y++
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
317 ldd #$053d
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
318 std ,Y++ Put it in string
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
319 inc STRLGH
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
320 lda #2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
321 sta 50,X Make ghost run from pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
322 TEST4 lda 70,X Get #4 ghost status
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
323 cmpa #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
324 bne TESTCK
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
325 ldd #$1b31 Palette set code
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
326 std ,Y++
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
327 ldd #$033d
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
328 std ,Y
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
329 inc STRLGH
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
330 lda #2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
331 sta 70,X Make ghost run from pacman
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
332 TESTCK ldb STRLGH
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
333 beq OTDONE
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
334 lda #4
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
335 mul
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
336 tfr D,Y
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
337 leax STRING,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
338 lbsr OUTSTR
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
339 OTDONE rts
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
340
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
341 * erase pill subroutine
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
342 * Erases DOT or PILL from array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
343 * and updates score
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
344 * On entry, X reg points to spot in array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
345 * B reg holds 1 byte offset 1,-1,96 or -96
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
346 * A reg holds byte at that point in array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
347
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
348 ERPILL cmpa #6 Was it a bonus ?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
349 beq ERBON
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
350 bita #4 Was it a power dot ?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
351 beq ERDOT
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
352 anda #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
353 sta B,X Erase power pill from array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
354 lda #32 Add 20 to score
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
355 sta POINTS+2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
356
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
357 ldd DOTTOT
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
358 addd #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
359 std DOTTOT
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
360
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
361 lda #100 Set timeout counter
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
362 sta POWFLG
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
363 lbsr PALCHG Go change color of ghosts
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
364 bra ADDUP
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
365
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
366 ERBON clra
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
367 sta B,X
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
368 lbsr SETBON Go to Bonus Routines(in SCRNS)
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
369 lda #154 Add 100 to score
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
370 sta POINTS+2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
371 bra ADDUP
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
372
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
373 ERDOT anda #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
374 sta B,X Erase dot from array
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
375 lda #1 Add 1 point to score
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
376 sta POINTS+2 Put it back
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
377
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
378 ldd DOTTOT
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
379 addd #1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
380 std DOTTOT
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
381
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
382 * Add points to score
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
383
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
384 ADDUP: leax SCRBCD+3,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
385 leay POINTS+3,U
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
386 ldb #3 Set loop counter to 3
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
387 andcc #%11111110 Clear carry
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
388 ADLOOP lda ,-X Decrement X and get a byte
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
389 adca ,-Y Add new points
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
390 daa Decimal adjust bytes
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
391 sta ,X Put result back in score byte
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
392 decb Decrement loop counter
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
393 bne ADLOOP Loop till done
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
394
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
395 SHIFT leay SCRASC,U Point to asc string
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
396 leax SCRBCD,U Point to score bytes
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
397 ldb #3 Set loop counter to 3
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
398 stb SHCNT Set loop counter to 3
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
399 clrb Clear leading zero flag
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
400 SFLOOP lda ,X Get a byte of score, bump pointer
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
401 lsra
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
402 lsra Shift high nibble to low
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
403 lsra
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
404 lsra
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
405 beq TSTFG1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
406 incb Set leading zero flag
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
407 TSTFG1 tstb Is leading zero flag set ?
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
408 bne ASCSET1
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
409 lda #-16 48-16 = ascii space
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
410 ASCSET1 adda #48 Add ascii offset for number
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
411 sta ,Y+ Put result in score string
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
412 lda ,X+ Get bcd score byte again
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
413 anda #15 Mask off high nibble
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
414 beq TSTFG2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
415 incb
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
416 TSTFG2 tstb
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
417 bne ASCSET2
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
418 lda #-16
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
419 ASCSET2 adda #48
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
420 sta ,Y+
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
421 dec SHCNT
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
422 bne SFLOOP Loop 3 times
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
423
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
424 JUST1 leax SCRPOS,U Point to score string
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
425 ldy #9 Output 9 characters
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
426 lbsr OUTSTR Go output string
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
427
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
428 rts
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
429
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
430 * Noise maker when pacman eats a dot
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
431
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
432
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
433 *WOCWOC lda PATH
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
434 * ldb #$98
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
435 * ldx #$3202
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
436 * ldy #3000
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
437 * os9 I$SetStt
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
438
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
439 * ldy #2000
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
440 * os9 I$GetStt
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
441
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
442 * Return to MAIN
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
443
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
444 *SCDONE rts
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
445
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
446
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
447 ENDSECT
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
448
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
449
f351932fa6cd Added pacos9
boisy
parents:
diff changeset
450