-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstatus.asm
391 lines (328 loc) · 4.27 KB
/
status.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
!zone Status
.dscore !word 0
.lives !byte 0
.multiplier !byte 0
.stars !byte 0
.starfactor !byte 10
.trainer !byte 0
.starfactors !byte 2, 5, 10, 20, 50, 100
.ScoresScreen = Screen + 2
.ScoreColor = Color + 2
.LivesScreen = Screen + 24
.LivesColor = Color + 24
.LevelScreen = Screen + 16
.LevelColor = Color + 16
.size = 8
.Digits = 96
.highscore !fill .size, .Digits
.hashigh !byte 0
; Status line at top of screen
;
; 1 2 3 4
; 0123456789012345678901234567890123456789
; X.00000000.xMM..LVL.00..LlLlLlLlLlLlLl.X
.Init
lda #.Digits + 1
sta .highscore + .size - 4
rts
.Reset
ldy #0
-
lda #.Digits
sta .ScoresScreen, y
lda #5
sta .ScoreColor, y
iny
cpy #.size
bne -
jsr .ResetMultiplier
lda #7
sta .ScoreColor + 9, y
sta .ScoreColor + 10, y
sta .ScoreColor + 11, y
lda #0
sta .dscore
sta .dscore + 1
sta .LevelScreen + 0
sta .LevelScreen + 1
sta .LevelScreen + 2
sta .LevelScreen + 3
sta .LevelScreen + 4
sta .LevelScreen + 5
sta .hashigh
lda #3
sta .lives
jsr .DrawLives
rts
; Level color in Y, level number in A
.bonustext
!text "BONUS LIVE",0
.SetLevel
cpy #0
bne +
iny
+
sty .LevelColor + 0
sty .LevelColor + 1
sty .LevelColor + 2
sty .LevelColor + 3
sty .LevelColor + 4
sty .LevelColor + 5
ldy #124
sty .LevelScreen + 0
sty .LevelScreen + 2
ldy #154
sty .LevelScreen + 1
ldy #0
sty .LevelScreen + 3
ldy #.Digits
cmp #20
bcc +
iny
iny
sbc #20
+
cmp #10
bcc +
iny
sbc #10
+
sty .LevelScreen + 4
clc
adc #.Digits
sta .LevelScreen + 5
rts
.ResetMultiplier
lda #159
sta .ScoresScreen + 9
lda #.Digits
sta .ScoresScreen + 10
lda #.Digits + 1
sta .ScoresScreen + 11
lda #1
sta .multiplier
lda #0
sta .stars
rts
.IncMultiplier
lda .multiplier
cmp #99
bcs ++
inc .multiplier
lda .ScoresScreen + 11
cmp #.Digits + 9
beq +
inc .ScoresScreen + 11
rts
+ lda #.Digits + 0
sta .ScoresScreen + 11
inc .ScoresScreen + 10
++ rts
.AddStar
inc .stars
lda .stars
cmp .starfactor
bne +
lda #0
sta .stars
jsr .IncMultiplier
+ rts
; in A from 0 to 24
.DrawBossEnergy
pha
lsr
lsr
tax
tay
pla
and #3
ora #184
sta .LevelScreen, x
lda #188
dex
bmi +
- sta .LevelScreen, x
dex
bpl -
+ lda #184
cpy #5
bcs +
- iny
sta .LevelScreen, y
cpy #5
bcc -
+ rts
.DrawLives
ldy #0
ldx #0
lda .lives
beq +
-
lda #189
sta .LivesScreen, x
lda #190
sta .LivesScreen + 1, x
lda #14
sta .LivesColor, x
sta .LivesColor + 1,x
inx
inx
iny
cpy .lives
bcc -
+
cpy #7
bcs +
-
lda #0
sta .LivesScreen, x
sta .LivesScreen + 1, x
lda #15
sta .LivesColor, x
sta .LivesColor + 1,x
inx
inx
iny
cpy #7
bcc -
+
rts
.AddLive
lda .lives
cmp #7
bcs +
inc .lives
lda #<.bonustext
ldy #>.bonustext
jsr Starfield.QueueText
jmp .DrawLives
+
rts
.RemLive
bit .trainer
bpl +
rts
+
dec .lives
jmp .DrawLives
; score in y/a
.IncScore
sta tmpml
sty tmpmh
lda .multiplier
lsr
bcc .incloop2
.incloop1
tay
clc
lda .dscore
adc tmpml
sta .dscore
lda .dscore + 1
adc tmpmh
sta .dscore + 1
tya
beq .incdone
.incloop2
asl tmpml
rol tmpmh
lsr
bcs .incloop1
bne .incloop2
.incdone
lda .hashigh
and #$7f
sta .hashigh
rts
.TextHighscore !text "NEW HIGHSCORE", 0
.CheckHighscore
lda .hashigh
bpl +
rts
+
bne +
ldy #.size
sec
-
lda .highscore - 1, y
sbc .ScoresScreen - 1, y
dey
bne -
bcc +
lda #$80
sta .hashigh
rts
+
ldy #.size
-
lda .ScoresScreen - 1, y
sta .highscore - 1, y
dey
bne -
lda .hashigh
bne +
lda #<.TextHighscore
ldy #>.TextHighscore
jsr Starfield.QueueText
+
lda #$81
sta .hashigh
rts
.Update
lda Phase
and #$07
tay
lda .ScoreColor, y
and #$0f
cmp #1
bne +
lda #13
!byte $2C
+ lda #5
sta .ScoreColor, y
lda .dscore + 1
beq ++
sec
lda .dscore
sbc #100
sta .dscore
bcs +
dec .dscore + 1
+ ldy #.size - 2
jmp .incn
++ lda .dscore
bne +
jmp .CheckHighscore
+
cmp #200
bcc ++
sbc #100
sta .dscore
ldy #.size - 2
jmp .incn
++ cmp #20
bcc ++
sbc #10
sta .dscore
ldy #.size - 1
jmp .incn
++ dec .dscore
ldy #.size
.incn
- lda #1
sta .ScoreColor - 1, y
lda .ScoresScreen - 1, y
cmp #.Digits + 9
bcs +
adc #1
sta .ScoresScreen - 1, y
cpy #.size - 3
bcc .extra
rts
+ lda #.Digits
sta .ScoresScreen - 1, y
dey
bne -
rts
.extra
jmp .AddLive