comparison 3rdparty/packages/pacos9/check90.as @ 2945:582b5b7232c0

pacos9: Rename assembler files to .as and port makefile to lwtools And build pacos9 by default again. Nowadays .a files are library archive files. According to rules.mak, as. files are to be built as object files for later linking with lwlink, similar to old RMA/RLINK.
author Tormod Volden <debian.tormod@gmail.com>
date Sat, 08 Feb 2014 01:03:26 +0100
parents 3rdparty/packages/pacos9/check90.a@f351932fa6cd
children 06508da42c98
comparison
equal deleted inserted replaced
2944:ab3f9eb5fc5c 2945:582b5b7232c0
1
2 NAM Check
3 TTL Routines to check & react to status
4
5 * Program segment to be compiled using Level II RMA
6 * This is not a mainline program segment
7 * Written by Larry Olson
8
9 IFP1
10 * use /dd/defs/os9defs.a
11 ENDc
12
13 STACK EQU 100
14
15 PSECT Check,0,0,2,STACK,CHECKS
16
17 VSECT
18
19 * Lcoal Variables
20
21
22 RMB STACK
23
24
25 ENDSECT
26
27
28 PALST1: fcb $1b,$31,3,18
29 fcb $1b,$31,4,36
30 fcb $1b,$31,5,63
31 fcb $1b,$31,6,25
32
33 PALST2: fcb $1b,$31,3,53
34 fcb $1b,$31,4,53
35 fcb $1b,$31,5,53
36 fcb $1b,$31,6,53
37
38
39 CHECKS: lda HITFLG Check hit flag
40 lbeq CHKGH If 0 the continue
41 lbpl KILPAC Pacman is hit, so kill him
42
43 * Kill ghost routine
44 * Make noise
45 ldd #1550 Set starting frequency
46 std SNDPR2 Save it in variable
47 KLOOP ldx #$3201 Set amplitude & duration
48 ldd SNDPR2
49 addd #250
50 cmpd #4050 Are we done yet?
51 beq KILGHT
52 std SNDPR2 Save new value
53 tfr D,Y Put value in Y reg.
54 lbsr SND Go make noise
55 bra KLOOP
56
57 KILGHT leax G1OFST,U Point to ghost tables
58 lda GHTHIT Get # of ghost destroyed
59 leax A,X Move to that ghosts table
60 stx XSAVE Save ghost table pointer
61 ldb #-3
62 stb 10,X Set status -3(killed)
63 * Erase ghost
64 ldd 2,X Get ghost scrn X location
65 std PGXLOC Give it to PUTGHT
66 ldd 4,X Get ghost scrn Y location
67 std PGYLOC Give it to PUTGHT
68 lda #1
69 sta PGBFN Set buff# to blank ghost
70 lbsr PUTGHT Go erase ghost
71 * Reset ghost table
72 lda GHTHIT Get ghost counter
73 leay GHTABL,U Point to backup tables
74 leay A,Y Use current ghost data
75 ldx XSAVE Restore X reg.
76 ldb #20 Transfer 20 bytes
77 RSLOOP lda ,Y+ Get a byte
78 sta ,X+ Transfer it
79 decb Decrement counter
80 bne RSLOOP Loop till 20 are done
81 * Reset palette for ghost
82 ldx XSAVE Point X reg. to ghost table
83 ldd 18,X Get palette number & color
84 std PALBT1+2 Put them in string
85 leax PALBT1,U Point to bytes to output
86 ldy #4 Output 4 bytes
87 lbsr OUTSTR Go output them
88 * Draw ghost in cage
89 ldx XSAVE Point X reg. to ghost table
90 ldd 2,X Get ghost scrn X location
91 std PGXLOC Put it in PUTGHT string
92 ldd 4,X Get ghost scrn Y location
93 std PGYLOC Put it in PUTGHT string
94 lda 11,X Get ghost buffer number
95 sta PGBFN Put it in PUTGHT string
96 lbsr PUTGHT Go put buffer to screen
97 * Reset hit flag
98 clr HITFLG Reset hit flag
99 * Add points to score
100 lda #50 50 points for ghost
101 sta POINTS+2
102 lbsr ADDUP Go add to score
103 lbra MAIN1 Return to main
104
105 KILPAC: ldx #$3209 Set amplitude & duration
106 ldy #2000 Set frequency
107 lbsr SND Go make sound
108 ldd PXNEW Get pacman scrn X location
109 std PXLOC Give it to PUTBLK
110 ldd PYNEW Get pacman scrn Y location
111 std PYLOC Give it to PUTBLK
112 lda #59 Starting buffer -1
113 sta PBFN Give it to PUTBLK
114 ldd #4050 Set frequency
115 std SNDPR1
116 HLOOP inc PBFN Increment buffer number
117 lbsr PUTBLK Put object on screen
118 ldx #$3205 Set amplitude & duration
119 ldd SNDPR1 Get frequency
120 subd #150 Subtract 150 from it
121 std SNDPR1 Put it back
122 tfr D,Y Also put it in Y reg.
123 lbsr SND Go make sound
124 lda PBFN Check buffer number
125 cmpa #67 Are we done ?
126 bne HLOOP If not, then keep looking
127 lda #37 37 = Blank pacman
128 sta PBFN Give it to PUTBLK
129 lbsr PUTBLK Put it on screen
130
131 * Go to delete pacman routines in MAIN
132
133 lbra DELPAC Go delete pacman
134
135
136 * Check if current ghost can be moved, if so then move it
137 * Two ghost moves will be made for each pacman move
138 * so the ghosts will be half as slow as pacman.
139 * If we made 4 ghost moves for each pacman move then the
140 * ghosts would move at the same speed as pacman.
141
142 CHKGH lda POWFLG Check power pill flag
143 lbeq MOVGH
144 deca Decrement flag (counter)
145 sta POWFLG Put it back
146 lbeq PALRST If 0 then reset palettes
147 TIMCHK cmpa #25 Are we close to zero?
148 lbhi MOVGH If not, go move ghost
149 leax PALST1,pcr Point to palette reset string
150 ldy #16 Output 16 bytes
151 lbsr OUTSTR Go output code bytes
152
153 clrb
154 stb STRLGH Set string length to 0
155 leax STRING,U Point to where string goes
156 leay G1OFST,U Move to top of ghost tables
157 lda 10,Y Get status for #1 ghost
158 cmpa #2 Is ghost chasing ?
159 bne PLCHG2 If so then branch
160 ldd #$1b31
161 std ,X++ PUT 2 bytes in string
162 ldd #$043d
163 std ,X++ Put 2 bytes in string
164 inc STRLGH Increment counter
165 PLCHG2 lda 30,Y Get status for ghost #2
166 cmpa #2 Is ghost chasing ?
167 bne PLCHG3 If so then branch
168 ldd #$1b31
169 std ,X++ Put 2 bytes in string
170 ldd #$063d
171 std ,X++ Put 2 bytes in string
172 inc STRLGH Increment counter
173 PLCHG3 lda 50,Y Get status for ghost #3
174 cmpa #2 Is ghost chasing ?
175 bne PLCHG4 If so then branch
176 ldd #$1b31
177 std ,X++ Put 2 bytes in string
178 ldd #$053d
179 std ,X++ Put 2 bytes in string
180 inc STRLGH Increment counter
181 PLCHG4 lda 70,Y Get status for ghost #4
182 cmpa #2 Is it chasing ?
183 bne PLTEST If so then branch
184 ldd #$1b31
185 std ,X++ Put 2 bytes in string
186 ldd #$033d
187 std ,X Put 2 bytes in string
188 inc STRLGH Increment counter
189 PLTEST ldb STRLGH Get counter value
190 beq PLDONE If 0 then we're done
191 lda #4 Set multiplier
192 mul Mul. 4 x STRLGH
193 tfr D,Y Put result in Y reg.
194 leax STRING,U Point to start of string
195 lbsr OUTSTR Go output string
196 PLDONE bra MOVGH
197
198
199 PALRST leax PALST1,pcr Point to palette reset bytes
200 ldy #16 Output 16 bytes
201 lbsr OUTSTR Go output bytes
202 * Now reset ghosts status from running to chasing
203 leax G1OFST,U
204 ldb #1
205 lda 10,X
206 cmpa #2 Is ghost running?
207 bne STRST2
208 stb 10,X Set to chasing
209 STRST2 lda 30,X
210 cmpa #2 Is ghost running?
211 bne STRST3
212 stb 30,X Set to chasing
213 STRST3 lda 50,X
214 cmpa #2 Is ghost running?
215 bne STRST4
216 stb 50,X Set to chasing
217 STRST4 lda 70,X
218 cmpa #2 Is ghost running?
219 bne MOVGH
220 stb 70,X Set to chasing
221
222 * Make 3 ghost moves for each pacman move
223 * This means that the 4 ghosts will be a
224 * little slower on the screen than pacman
225
226 MOVGH lbsr GHCHCK Go check for ghost move
227 lbsr GHCHCK Do it again
228
229 * Bonus Routines
230 BONUS lda BONFLG Check bonus flag
231 beq PUTBON Go put bonus on screen
232 dec BONTIM Decrement bonus timer
233 bne MOVGH2
234 * Erase bonus from screen
235 ERSBON ldd #310
236 std PXLOC
237 ldd #95
238 std PYLOC
239 lda #69
240 sta PBFN
241 lbsr PUTBLK Go erase bonus
242 leax ARRAY,U
243 ldd #1966
244 leax D,X
245 clr ,X Erase bonus from array
246 clr BONFLG Reset bonus flag
247 lda #150
248 sta BONTIM Reset bonus timer
249 bra LEAVE
250
251 * Put bonus on screen
252 *
253 PUTBON lda BONCNT Check counter
254 cmpa #10 Has player got 10 yet ?
255 beq MOVGH2 If so, then no more
256 dec BONTIM Decrement timer
257 bne MOVGH2
258 lbsr RANDNM Go pick random number
259 cmpa #200
260 bhi LEAVE
261 lda BONBUF Get bonus buffer #
262 inca
263 cmpa #73
264 bne PUTBN2
265 lda #70
266 PUTBN2 sta BONBUF
267 sta PBFN
268 ldd #310
269 std PXLOC
270 ldd #95
271 std PYLOC
272 lbsr PUTBLK Put bonus on screen
273 leax ARRAY,U
274 ldd #1966
275 leax D,X
276 lda #6
277 sta ,X Put bonus in array
278 lda #50
279 sta BONTIM Set bonus timer
280 inc BONFLG Set bonus flag
281 bra LEAVE
282
283 * If power pill flag is set then slow ghosts down
284
285 MOVGH2 lbsr GHCHCK One more time
286 * tst POWFLG
287 * bne LEAVE
288 * lbsr GHCHCK One more time
289
290 * Go return to main loop
291
292 LEAVE lbra MAIN1 Return to MAIN loop
293
294
295 ENDSECT
296
297