forked from historicalsource/smashtv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPOW2.ASM
325 lines (310 loc) · 6.2 KB
/
POW2.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
.FILE "POW2.ASM (ORBITING LASER)"
.TITLE "ROBO-RAMA GAME PROGRAM"
.WIDTH 132
.OPTION B,D,L,T
.MNOLIST
;
; INITIATED: APRIL 26,1989
; MODIFIED: !
; SOFTWARE: MARK TURMELL & ROBERT ASHWORTH
;
; COPYRIGHT (C) 1989 WILLIAMS ELECTRONICS GAMES, INC.
;
;
; GET THE SYSTEM STUFF
.INCLUDE "MPROC.EQU" ;MPROC EQUATES
.INCLUDE "DISP.EQU" ;DISPLAY PROC. EQUATES
.include "sys.inc" ;z unit system equates
.include "macros.hdr" ;macros definitions
.INCLUDE "IMGTBL.GLO"
.INCLUDE "ROBO.EQU"
;
;SOUND HEADERS USED
;
.REF WOO2
;
;SYMBOLS EXTERNALLY DEFINED
;
.REF PUTA7,FLASHME
.REF GETANIXY,AFONT0
.REF GPALOBJ,STFOBJ,INSOBJ,ADJSTWTL
.REF FRANIM,KILOBJ,KILALL
.REF SCRTST
.REF DELOBJ
.REF GETCOS
.REF GETSIN
.REF DO_BND
.REF EXISTP
.REF KILL
.REF ICNFLG
;
;SYMBOLS DEFINED IN THIS FILE
;
.DEF POW2ON,LSHIT
.DEF LASRX,LASRY,ALIGNXY
;
;UNINITIALIZED RAM DEFINITIONS
;
.BSS LASRX,32
.BSS LASRY,32
;
;EQUATES
;
ADLTA .EQU (411775/(160/2))
; LASER/BLADES DATA STRUCTURE
;
PTRX .EQU PDATA ;UHW ;LAST X
PTRY .EQU PDATA+16 ;UHW ;LAST Y
ANIMTIK .EQU PDATA+32 ;UHL ;FRAME SLEEP TIME
THETA .EQU PDATA+64 ;SHL ;CURRENT PROGRESSION
DELTA .EQU PDATA+96 ;SHL ;DELTA ANGLE
LEG .EQU PDATA+128 ;UHL LEG OF PLAYER WHO COLLECTED ME
;
;
;EQUATES FOR THIS FILE
;
;
.TEXT
;
POW2ON:
;FROM COLLISION ROUTINE!
MOVE A0,A9 ;LEG PTR OF WHO GOT ME
; MOVE *A0(OPLINK),A0,L
; MOVK 1,A1
; MOVB A1,*A0(LSRFLG) ;HELPER ON FLAG FOR THIS PLAYER;
MOVE A8,A0
CALLA DELOBJ
MOVI WOO2,A0
CALLA ONESND
MOVK 1,A11 ;1 ORBITING OBJECT
ALL1:
CREATE LSRPID,LASER
DSJS A11,ALL1
RETS
; DO LASER MOVEMENT LOGIC
;A11 = OFFSET FOR VECTOR POINT FOR STARTING POSITION OF LASER
LASER:
;A9=LEG IMG PNTR OF PLAYER WHO TOUCHED ME
MOVE *A9(OPLINK),A7,L
MOVK 1,A0
MOVB A0,*A7(BNDTYP)
MOVB A0,@ICNFLG
CALLA DO_BND
CLR A0
MOVB A0,*A13(ANIMTIK)
MOVI ADLTA,A0
MOVE A0,*A13(DELTA),L
CALLA SETPOINT
;
ENCIRCLE:
; MAKE LASER MOVE IN A CIRCLE AROUND PLAYER
CALLA ANILASER ;ANIMATE LASER
CALLR ALIGNXY ;KEEP OBJECT ALIGNED WITH PLAYER
MOVE *A13(THETA),A2,L ;PROGRESSIVE THETA
MOVE *A13(DELTA),A0,L ;NEXT DELTA ANGLE
ADD A2,A0
CALLA GETCOS
MOVE A0,A11
MOVK 2,A0
MPYS A0,A11
MOVE A14,*A13(THETA),L
MOVE A14,A0
CALLA GETSIN
MOVE A0,A3
MOVK 2,A0
MPYS A0,A3
MOVE A3,A10
MOVE *A8(OXVAL),A3,L
MOVE *A8(OYVAL),A4,L
ADD A11,A3
ADD A10,A4
MOVE A3,*A8(OXVAL),L
MOVE A4,*A8(OYVAL),L
SLOOP 1,ENCIRCLE
ANILASER:
;ANIMATE LASER
MOVB *A13(ANIMTIK),A0
DEC A0
MOVB A0,*A13(ANIMTIK)
JRNN NOTNEXT
;FALLS HERE IF NEGATIVE
MOVK 4,A1
JSRP FRANIM ;1 FRAME STEP
MOVB A0,*A13(ANIMTIK) ;SAVE SLEEP TIME BETWEEN FRAMES
JRNC NOTNEXT
MOVI FLASER,A9
NOTNEXT:
CALLA GETANIXY
MOVE A2,@LASRY,L
MOVE A3,@LASRX,L
RETS
;
LASERDIE:
MOVE A11,*A8(OXVEL),L
MOVE A10,*A8(OYVEL),L
;TURN HELPER WHITE, FLOAT AWAY
; CLR A0
; MOVE A0,*A8(OID)
FLYER:
; CALLR ANILASER ;DO ANIMATION
MOVI [023H,021H],A2
MOVI [0FCH,0171H],A3
CALLA SCRTSTG
JRNZ LSER
MOVI 006060000H,A9
CREATE 0,FLASHME
SLOOP 10,FLYER
LSER:
CLR A0
MOVE A0,@LASRX,L
MOVE A0,@LASRY,L
MOVE A8,A0
CALLA DELOBJ ;KILL IMAGE
CLR A1
NOT A1 ;MASK FOR PROCESS EXIST ROUTINE
MOVK 2,A3 ;ASSUME CHAINSAW'S BOUNDARY
;MAKE THIS SMARTER!
MOVE *A13(PROCID),A2,W ;SAVE CURRENT PROCESS ID
MOVI DUM_ID,A0
MOVE A0,*A13(PROCID),W ;REPLACE ID FOR THIS PROCESS
MOVI CHNSWPID,A0 ;CHAINSAW PROCESS
CALLA EXISTP
JRNZ SETAREA ;BR = DOES EXIST
MOVK 1,A3 ;ASSUME CHNSW'S BOUNDARY
;WHAT?
MOVI LSRPID,A0 ;LASER PROCESS ID
CALLA EXISTP
JRNZ SETAREA ;BR = DOES EXIST
CLR A3 ;ASSUME NORMAL BOUNDARY
SETAREA:
MOVE *A13(LEG),A0,L
MOVE *A0(OPLINK),A7,L
MOVB A3,*A7(BNDTYP)
CLR A2
MOVB A2,*A7(PRVBND)
CALLA DO_BND
DIE
ALIGNXY:
; KEEP LASER WITHIN X CENTERPOINT OF PLAYER
; PARMS:
;
; A8 = PTR TO PLINDX
;
MOVE *A13(PTRX),A4,W ;OLD X,Y VALUES
MOVE *A13(PTRY),A5,W
MOVE A8,A10
MOVE *A13(LEG),A8,L
CALLA GETANIXY ;Y/X POSITION RETURNED IN A2,A3
MOVE A10,A8
SWAP A2,A3
SRL 16,A2
SRL 16,A3
MOVE A4,A4
JRZ PK
DIFF:
CMP A4,A2
JREQ DOY
JRGT ADDX ;NEW X POS > OLD X POS
SUBX:
SUB A2,A4
MOVE *A8(OXPOS),A6
SUB A4,A6
MOVE A6,*A8(OXPOS)
JRUC DOY
ADDX:
SUB A2,A4
NEG A4
MOVE *A8(OXPOS),A6
ADD A4,A6
MOVE A6,*A8(OXPOS)
DOY:
CMP A5,A3
JREQ PK ;NO DIFFERENCES IN X,Y BYE!
JRGT ADDY ;NEW Y POS > OLD Y POS
SUBY:
SUB A3,A5
MOVE *A8(OYPOS),A6
SUB A5,A6
MOVE A6,*A8(OYPOS)
JRUC PK
ADDY:
SUB A3,A5
NEG A5
MOVE *A8(OYPOS),A6
ADD A5,A6
MOVE A6,*A8(OYPOS)
PK:
MOVE A2,*A13(PTRX),W
MOVE A3,*A13(PTRY),W
RETS
SETPOINT:
MOVI INITAB,A14
CALLA GPALOBJ ;ALLOCATE A COLOR PALETTE
CALLA STFOBJ ;STUFF OBJECT DATA
MOVE A13,*A0(OPLINK),L
CALLA ADJSTWTL ;PUT US IN THE WORLD
CALLA INSOBJ ;INSERT OBJECT INTO LIST
MOVE A0,A10
;A9=CORRECT LEG PTR
MOVE A9,*A13(LEG),L
;A7=A7 ALREADY?
MOVE *A9(OPLINK),A7,L ;LEGS HAVE SAME OPLINK AS TORSO!
;A7 NOW EQUALS TORSO PROC OF PLAYER WHO PICKED UP HELPER ICON
MOVE A0,*A7(LSRPTR),L
;THIS OKAY?
MOVE A9,A8
CALLA GETANIXY ;Y/X POSITION RETURNED IN A2,A3
MOVE A10,A8
ADDI [5,0],A2
MOVE A2,*A8(OYVAL),L
SUBI [7,0],A3
MOVE A3,*A8(OXVAL),L
CLR A0
MOVE A0,*A13(PTRX),W ;OLD X,Y VALUES
MOVE A0,*A13(PTRY),W
MOVE A0,*A13(THETA),L
MOVI FLASER,A9
RETS
LSHIT:
;CALLED FROM COLLISION ROUTINE
;ALSO CALLED FROM ROBO WHEN PLAYER DIES
;A8=HELPER IMG PNTR
MMTM SP,A0,A7,A13
;PUSHING ENOUGH STUFF HERE?
CLR A0
MOVE A0,*A8(OID)
MOVE *A8(OPLINK),A13,L ;GET PROCESS ID BACK
;HELPER TO FLY OFF
;RESET HERE
MOVE *A13(LEG),A0,L ;GET LEG I SURROUND
MOVE *A0(OPLINK),A0,L ;GET PLAYER PROC
CLR A7
MOVE A7,*A0(LSRPTR),L ;ZERO PLAYER PROC LASER PNTR
MOVE A13,A0
MOVI LASERDIE,A7
CALLA PUTA7 ;THIS HLPR WILL NOW WAKE UP AT A7 ADDR
MMFM SP,A0,A7,A13
RETS
INITAB:
.LONG 0,0,HLPR1
.WORD 171,DMAWNZ,CLSPLYR|TYPLSR ;171
.LONG 0,0
;
;ANIMATION TABLE FOR LASER
;
FLASER:
.LONG HLPR1
.WORD 3
.LONG HLPR2
.WORD 3
.LONG HLPR3
.WORD 3
.LONG HLPR4
.WORD 3
.LONG HLPR5
.WORD 3
.LONG HLPR6
.WORD 3
.LONG 0
.END