-
Notifications
You must be signed in to change notification settings - Fork 6
/
WLMAN.ASM
452 lines (426 loc) · 7.57 KB
/
WLMAN.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
.FILE 'WLMAN.ASM'
.TITLE 'ROBO-RAMA GAME PROGRAM'
.WIDTH 132
.OPTION B,D,L,T
.MNOLIST
;
; INITIATED: JAN 6, 1989
; MODIFIED: !
; SOFTWARE: MARK TURMELL
;
; COPYRIGHT (C) 1989 WILLIAMS ELECTRONICS GAMES, INC.
;
;
; GET THE SYSTEM STUFF
.INCLUDE "MPROC.EQU" ;MPROC EQUATES
.INCLUDE "DISP.EQU" ;DISPLAY PROC. EQUATES
.INCLUDE "\VIDEO\SYS\SYS.INC" ;Z UNIT SYSTEM EQUATES
.INCLUDE "\VIDEO\SYS\MACROS.HDR" ;MACROS DEFINITIONS
.INCLUDE "IMGTBL.GLO"
.INCLUDE "ROBO.EQU"
;
;SOUNDS
.REF EXP3HI
;
;SYMBOLS EXTERNALLY DEFINED
;
.REF GET_STANDT2,WAY
.REF FRANIM,GAMSTATE,EHALT,BOOM2,GETFPAL,GET_WVADDR,BEGINOBJ2
.REF WAVEYX,PCNT,RANGRAND,PLYROBJS,HALT
.REF XYSKOBJ,GETHDR,CVRT,ABALL,RANDPER,DOBLO,P1DATA,P2DATA
.REF TSO_EXP2,FLASHME,GETUGH
;
;SYMBOLS DEFINED IN THIS FILE
;
.DEF KILL_WLMN,ONSCRN_WLMN,RECOIL,DIOFF
;
;UNINITIALIZED RAM DEFINITIONS
;
;
;EQUATES/STRUCURES FOR THIS FILE TO FOLLOW
;
HITWLM .EQU 35 ;61
;
;WLMAN DATA STRUCTURE
;
SPDLY .EQU PDATA ;UHB
WAY01 .EQU PDATA+8 ;UHB
TDIR .EQU PDATA+16 ;UHW
TSK_DIR .EQU PDATA+32 ;UHW
MODE .EQU PDATA+48 ;UHB
FIRED .EQU PDATA+56 ;UHB
SLOW .EQU PDATA+64 ;UHB
ABSRB .EQU PDATA+72 ;UHB
LEVEL .EQU PDATA+80 ;DIFFICULTY LEVEL FOR SPEEDS ETC.
;
;
.TEXT
;
WX .LONG [117,0],[285,0]
WY .LONG [-25,0],[-25,0]
;
ONSCRN_WLMN:
;A2=# OF ORBS TO CREATE ON SCREEN AT START OF WAVE
MOVE A2,A10
OH1 PUSH A10 ;CREATE A BUNCH OF THEM
CREATE WLMNPID,OWLMN
PULL A10
DSJNE A10,OH1
RETS
;
OWLMN:
;A10=1 OR 2
;A0 & A1 ARE SET UP
;ADD IN OFFSETS FOR THIS PARTICULAR ARENA
DEC A10
SLL 5,A10
MOVI WX,A0
ADD A10,A0
MOVE *A0,A0,L
MOVI WY,A1
ADD A10,A1
MOVE *A1,A1,L
;
MOVE @GAMSTATE,A2
CMPI INAMODE,A2
JREQ DMD
MOVE @WAVEYX,A2,L
; A2=PACKED OFFSETS
MOVX A2,A3
SLL 16,A3
ADD A3,A0 ;ADJUSTED A0 XVAL!
ANDI 0FFFF0000H,A2
ADD A2,A1 ;ADJUSTED A1 YVAL!
;
DMD
;A0,A1 ARE SETUP.
CALLR IH1 ;INIT WLMN (BEGINOBJ)
CALLA BEGINOBJ2 ;STUFF OBJ
;CHANGE TO PURPLE PALETTE
MOVI PURPTK,A0
CALLA GETFPAL ;GET A COLOR MAP ASSIGNMENT
ANDI 0FFFFH,A0
MOVE A0,*A8(OPAL),L ;STORE THE NEW PALETTE
CALLR SETUP_WLMN ;INC WLMN_CNT
CLR A0
MOVB A0,*A13(MODE)
MOVB A0,*A13(SPDLY)
MOVB A0,*A13(FIRED)
MOVB A0,*A13(ABSRB)
MOVK 9,A0
MOVE A0,*A13(TDIR)
;
; LOOP TOP FOR WLMNS
;
LUP_TOP:
;TOP OF WLMN LOGIC
MOVE @HALT,A0
JRNZ WZ
MOVE @EHALT,A0
JRZ MV ;BR=HALT ALL WLMNS!!
;PLAYER IS WALKING INTO ARENA SO DO NOT ALLOW MOVEMENT!
WZ SLEEP 2
JRUC LUP_TOP
MV:
;SEE IF ANY PLAYER IS WITHIN X DISTANCE.
;IF SO, SEEK TO MOST APPROPRIATE ANGLE AND X% OF TIME FIRE FLAMES AT PLAYER.
;STOP/SLEEP
TLP_TOP:
MOVB *A13(MODE),A1
JREQ SIT
CMPI 1,A1
JREQ SPN
CMPI 2,A1
JREQ SHT
; JRUC $
SIT MOVI 120,B0
MOVI 250,B1
CALLA RANGRAND
CMPI 150,A0
JRNC SPP
;NO SITTING
MOVI 2,A0
SPP
CALLA PRCSLP
MOVK 1,B0
MOVK 3,B1
CALLA RANGRAND
DEC A0
MOVB A0,*A13(MODE)
CMPI 1,A0
JREQ R1
CMPI 2,A0
JRNE TAG
;SHOOT
MOVK 2,A0
MOVB A0,*A13(FIRED)
JRUC TAG
R1
;WILL SPIN TO PLAYER
MOVB @PCNT,A3
INC A3
MOVB A3,@PCNT
ANDI 01,A3
SLL 5,A3
MOVI PLYROBJS,A2
ADD A3,A2
MOVE *A2,A0,L ;GET FIRST ENTRY
JRNZ PX
XORI 32,A3
ADDI PLYROBJS,A3
MOVE *A3,A0,L
PX CALLA XYSKOBJ
MOVE A5,A1
MOVE A6,A2
CALLA GETHDR
SLL 3,A0
ADDI CVRT,A0
MOVB *A0,A0
;DIR TO FACE IN A0
;A0=DIR TO SEEK TO FACE PLAYER
MOVE *A13(TDIR),A1
CMP A0,A1
JREQ AIM2
;NOT =
; CMPI 5,A0
; JRLT $
; CMPI 14,A0
; JRLT TYU
; MOVK 13,A0
;TYU
MOVE A0,*A13(TSK_DIR),W
MOVE A0,A1
MOVE *A13(TDIR),A0,W
CALLA WAY
JRC DIT ;INC
;DEC=CLRC
CLR A1
MOVB A1,*A13(WAY01)
JRUC DIT0
DIT MOVK 1,A1
MOVB A1,*A13(WAY01)
DIT0
JRUC TAG
;DIE OFF
DIOFF:
;CALLED FROM ENDWAVE
CREATE 0,TSO_EXP2
SLEEP 2
MOVE A8,A0
CALLA DELOBJ
DIE
AIM2
;ALREADY HERE!
MOVK 2,A0
MOVB A0,*A13(MODE)
MOVK 4,B0
MOVK 10,B1
CALLA RANGRAND
MOVB A0,*A13(FIRED)
JRUC TAG
SPN MOVB *A13(SPDLY),A1
CMPI 7,A1
JRLT AF
MOVI 2,A1
AF
DEC A1
MOVB A1,*A13(SPDLY)
JRNN TAG
MOVK 2,A0
MOVB A0,*A13(SPDLY)
MOVB *A13(WAY01),A1
JRNZ INCIT
;TANK IS DEC TO LEFT!
DECIT MOVE *A13(TDIR),A0,W
DEC A0
; CMPI 4,A0
; JREQ OUT2
; CALLA INHERE
MOVE A0,*A13(TDIR),W
JRUC OUT
INCIT
;TANK IS ROTATING TO RIGHT
MOVE *A13(TDIR),A0,W
INC A0
; CMPI 14,A0
; JREQ OUT2
; CALLA IC
MOVE A0,*A13(TDIR),W
OUT
MOVE *A13(TDIR),A0
PUSH A0
CALLA GET_STANDT2 ;DOES ANI OF CORRECT VIEW
PULL A0
MOVE *A13(TSK_DIR),A1
CMP A0,A1
JRNE TAG
;REACHED CORRECT SEEK ANGLE.
;SHOOT AT PLAYER NOW
MOVI 300,A0
CALLA RANDPER
JRC OUT3 ;DON'T FIRE
OUT2
MOVK 2,A0
MOVB A0,*A13(MODE)
MOVK 1,B0
MOVK 3,B1
CALLA RANGRAND
MOVB A0,*A13(FIRED)
JRUC TAG
SHT
; MOVB *A13(SLOW),A0
; CALLA PRCSLP
SLEEP 6
MOVE *A13(TDIR),A9
CREATE 0,ABALL
CREATE 0,RECOIL
MOVB *A13(FIRED),A0
ANDI 0FH,A0
DEC A0
MOVB A0,*A13(FIRED)
JRNZ TAG
OUT3
CLR A0
MOVB A0,*A13(MODE)
; MOVB @PCNT,A0
; ANDI 01,A0
; SLL 4,A0
; ADDI SLOCNT,A0
; MOVE *A0,A0
; MOVE A0,*A13(SLOW)
; JRUC TAG
TAG
SLEEP 1
JRUC LUP_TOP
;SLOCNT .WORD 03,0AH
RECOIL MOVE A9,A0
SLL 4,A0
MOVI XCHG,A1
ADD A0,A1
MOVE *A1,A10,W ;X MOD
MOVI YCHG,A2
ADD A0,A2
MOVE *A2,A9,W
MOVE *A8(OYPOS),A0
ADD A9,A0
MOVE A0,*A8(OYPOS)
MOVE *A8(OXPOS),A0
ADD A10,A0
MOVE A0,*A8(OXPOS)
SLEEP 2
MOVE *A8(OYPOS),A0
SUB A9,A0
MOVE A0,*A8(OYPOS)
MOVE *A8(OXPOS),A0
SUB A10,A0
MOVE A0,*A8(OXPOS)
DIE
XCHG: .WORD 0,0,-1,-2,-2,-2,-2,-2,-1,0,1,2,2,2,2,2,1
YCHG: .WORD 0,2,2,2,1,0,-1,-2,-2,-2,-2,-2,-1,0,1,2,2
;WAY:
;SPIN LEFT OR RIGHT
;A1=SEEK DIR
;A0=DIR IMAGE IS FACING NOW
;812
;7 3
;654
; 01
; 16 02
; 15 03
; 14 04
; 13 05
; 12 06
; 11 07
; 10 08
; 09
; SUB A0,A1
; MOVE A1,A2
; ABS A1
; CMPI 9,A1 ;5
; JRLT N0
; NEG A2
;N0: BTST 31,A2
; JRZ IC
;INHERE: DEC A0
; JRP TDEC
; MOVK 16,A0 ;8
;TDEC CLRC ;MEANS DEC
; RETS
;IC: INC A0 ;ROTATE TOWARD PLAYER
; CMPI 17,A0 ;9
; JRNE T1
; MOVK 1,A0
;T1: SETC ;MEANS INC
; RETS
;
IH1: ;ENTER HERE IF ON SCRN TANK
;STUFF NEEDED SHIT
;A0=OXVAL
;A1=OYVAL
MOVI MTK6,A2 ;(OIMG) DOES NOT MATTER
MOVI 230,A3 ;(OZPOS)
MOVI DMAWNZ,A4 ;(OFLAGS) NON-ZERO VALUE
MOVI CLSNEUT|TYPWLMN,A5 ;(OID)
CLR A6 ;(OXVEL)
CLR A7 ;(OYVEL)
RETS
;
SETUP_WLMN:
MOVI WLMN,A2
CALLA GET_WVADDR
; MOVE *A0(32),A1,W ;GET DIFFICULTY LEVEL FOR THIS WLMN
; MOVE A1,*A13(LEVEL),W
MOVE *A0(16),A1,W ;DEC WAVE RAM CNT FOR THIS WLMN
DEC A1
MOVE A1,*A0(16),W
RETS
KILL_WLMN:
;CALLED FROM COLL2.ASM WHEN A WLMN COLLIDES WITH SOMETHING.
;VICTIM PNTR IN A8
;A8=WLMN IMAGE PTR
MMTM SP,A1,A7,A10
MOVE *A8(OPLINK),A10,L
MOVE *A0(OID),A7,W ;KILLERS OID
;WILL BE BOGUS IF SOMETHING OTHER THAN A BULLET STRUCK TANK!
ANDI F_SUBT,A7
DEC A7
SLL 3,A7
ADDI PUNISHT,A7
MOVB *A7,A7
MOVB *A10(ABSRB),A1
ANDI 0FFH,A1
ADD A7,A1
MOVB A1,*A10(ABSRB)
CMPI HITWLM,A1
;IF LESS THAN, START COLOR CYCLE PROCESS HERE
JRLT KPY
;ABSORBED ENOUGH HITS TO DESTROY IT
MOVE *A0(OPLINK),A10,L
CREATE 0,WLMN_EXP ;BULLETS DIR WILL BE IN A10
MOVE *A8(OPLINK),A0,L
CALLA KILL ;KILLS PROCESS IN A0
MOVE A8,A0
CALLA DELOBJ
MMFM SP,A1,A7,A10
RETS
KPY PUSH A9
CALLA GETUGH
MOVI 018180000H,A9
CREATE 0,FLASHME
PULL A9
MMFM SP,A1,A7,A10
RETS
PUNISHT:
.BYTE 3,3,5,20,20
.EVEN
WLMN_EXP:
;WLMN MUST KNOW WHO SHOT IT!
MOVI EXP3HI,A0
CALLA ONESND
MOVB *A10(MYPLYR),A0
; JAUC TSO_EXP
;A0=1 OR 2
MOVI WALPT,A1 ;AMOUNT OF SCORE
JAUC DOBLO
.END