-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bomby.asm
416 lines (352 loc) · 6.44 KB
/
bomby.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
//obsługuje bomby
bomba_x org *+24
bomba_y org *+24
bomba_anim_licznik org *+24
bomba_anim_licznik1 org *+24
bomba_m_scr org *+24
bomba_s_scr org *+24
bomba_anim_faza org *+24
bomba_anim_typ org *+24
bomba_zapalona org *+24
bomba_ch0 org *+24
bomba_ch1 org *+24
bomba_ch2 org *+24
bomba_ch3 org *+24
bomba_score_licznik org *+24
BOMBA_ANIM_SPEED=8
MAX_BOMB=24-1
//tablica z nr znaków, po 4 na kazda faze animacji
tab_anim0
dta ch_bomb0,ch_bomb0+1,ch_bomb0+2,ch_bomb0+3,ch_bomb0+4,ch_bomb0+5,ch_bomb0+6,ch_bomb0+7,ch_bomb0+8,ch_bomb0+9,ch_bomb0+10,ch_bomb0+11,ch_bomb0+12,ch_bomb0+13,ch_bomb0+14,ch_bomb0+15 ;zwykła bomba 4fazy x 4znaki na niebieskim tle
dta ch_bomb1,ch_bomb1+1,ch_bomb1+2,ch_bomb1+3,ch_bomb1+4,ch_bomb1+5,ch_bomb1+6,ch_bomb1+7,ch_bomb1+8,ch_bomb1+9,ch_bomb1+10,ch_bomb1+11,ch_bomb1+12,ch_bomb1+13,ch_bomb1+14,ch_bomb1+15 ;zwykła bomba 4fazy x 4znaki na brazowym tle
dta ch_bomb0,ch_bomb0+1,ch_bomb0+2,ch_bomb0+3,ch_bomb2,ch_bomb2+1,ch_bomb2+2,ch_bomb2+3,ch_bomb0,ch_bomb0+1,ch_bomb0+2,ch_bomb0+3,ch_bomb0,ch_bomb0+1,ch_bomb0+2,ch_bomb0+3 ;biala bomba na niebieskim tle
dta ch_bomb1,ch_bomb1+1,ch_bomb1+2,ch_bomb1+3,ch_bomb3,ch_bomb3+1,ch_bomb3+2,ch_bomb3+3,ch_bomb1,ch_bomb1+1,ch_bomb1+2,ch_bomb1+3,ch_bomb1,ch_bomb1+1,ch_bomb1+2,ch_bomb1+3 ;biala bomba na brazowym tle
.local bomb
//gasi bonus po pewnym czasie
zgas_bonus
ldx #MAX_BOMB
@ lda bomba_score_licznik,x
beq @+
dec bomba_score_licznik,x
bne @+
jsr zmaz_bombe
dec ile_score
@ dex
bpl @-1
rts
zgas_bombe
ldx #MAX_BOMB
@ lda bomba_x,x
beq @+
lda bomba_zapalona,x
beq @+
lda bomba_m_scr,x
sta pom
lda bomba_s_scr,x
sta pom+1
mva #0 bomba_zapalona,x
sta bomba_anim_faza,x
lda bomba_anim_typ,x
eor #$20
sta bomba_anim_typ,x
mva #BOMBA_ANIM_SPEED bomba_anim_licznik,x
lda bomba_anim_typ,x
tax
ldy #0
lda tab_anim0,x
sta (pom),y
iny
lda tab_anim0+1,x
sta (pom),y
ldy #48
lda tab_anim0+2,x
sta (pom),y
iny
lda tab_anim0+3,x
sta (pom),y
rts
@ dex
bpl @-1
rts
animuj_bomby
ldx #MAX_BOMB
@ lda bomba_x,x
bne @+
ab0 dex
bpl @-
rts
@ ldy bomba_zapalona,x
bne @+
dec bomba_anim_licznik1,x
lda bomba_anim_licznik1,x
cmp #32
bcs ab0
@ dec bomba_anim_licznik,x ;czy animujemy ta bombke
bne ab0
lda #BOMBA_ANIM_SPEED
cpy #0
beq *+3
lsr
sta bomba_anim_licznik,x ;ustaw ponownie licznik
lda bomba_m_scr,x
sta pom
lda bomba_s_scr,x
sta pom+1
dec bomba_anim_faza,x
lda bomba_anim_faza,x
asl
asl
and #%1100
ora bomba_anim_typ,x ;typ animacji 0=zwykly,16-inne tlo, 32=migajaca bomba
stx pom0 ;zapamietaj indeks bomby
tax
ldy #0
lda tab_anim0,x
sta (pom),y
iny
lda tab_anim0+1,x
sta (pom),y
ldy #48
lda tab_anim0+2,x
sta (pom),y
iny
lda tab_anim0+3,x
sta (pom),y
ldx pom0
jmp ab0
//rysuje bombe w pozycji y,x a=0->niebieskie tlo,a>0->brazowe tlo
rysuj_bombe
pha
clc
tya
adc obr_m,x
sta pom
pha
lda obr_s,x
adc #0
sta pom+1
ldx pom0a
sta bomba_s_scr,x
pla
sta bomba_m_scr,x
_negatyw0 equ *+1
lda #0
ora #ch_bomb0
tax
pla
beq *+7
_negatyw1 equ *+1
lda #0
ora #ch_bomb1
tax
ldy #0
lda (pom),y
pha
txa
sta (pom),y
inx
iny
lda (pom),y
pha
txa
sta (pom),y
inx
ldy #48
lda (pom),y
pha
txa
sta (pom),y
inx
iny
lda (pom),y
pha
txa
sta (pom),y
ldx pom0a
pla
sta bomba_ch3,x
pla
sta bomba_ch2,x
pla
sta bomba_ch1,x
pla
sta bomba_ch0,x
mva #0 bomba_score_licznik,x
rts
dec_paraliz
sta _dp0+1
lda paraliz_flag
bne @+
lda sprite_typ+7
cmp #t_paraliz
beq @+
lda licznik_paraliz
ora licznik_paraliz+1
bne @+
sec
lda licznik1_paraliz
_dp0 sbc #1
sta licznik1_paraliz
bcc @+1
@ rts
@
mva #1 paraliz_flag ;zezwol na paraliz
mva #19 licznik1_paraliz ;zeruj licznik
rts
nie_zapalona
lda #1
jsr dec_paraliz
lda #2
ldy #fx_bomba
jsr sfx.add_fx
ldx pom0
ldy bonus
lda score_tab0,y
jsr score_add
zmaz_bombe
lda bomba_m_scr,x
sta pom
lda bomba_s_scr,x
sta pom+1
ldy #0
lda bomba_ch0,x
sta (pom),y
iny
lda bomba_ch1,x
sta (pom),y
ldy #48
lda bomba_ch2,x
sta (pom),y
iny
lda bomba_ch3,x
sta (pom),y
lda ile_bomb
beq @+
lda czy_zapalona
beq *+3
@ rts
inc czy_zapalona
jmp zapal_bombe
zbieraj_bomby
ldx #MAX_BOMB
@ lda bomba_x,x
bne @+
nx_bmb dex
bpl @-
rts
@ sec
sbc sprite_x
clc
adc #4
cmp #9
bcs nx_bmb
lda bomba_y,x
sec
sbc sprite_y
clc
adc #9
cmp #19
bcs nx_bmb
dec ile_bomb
mva #0 bomba_x,x ;nie ma juz bomby
stx pom0
lda bomba_zapalona,x
beq nie_zapalona
lda #2
jsr dec_paraliz
inc ile_zapalonych
ldy bonus
lda score_tab,y
jsr score_add
cpy #4
bne *+7
lda #$50 ;1000=2x500
jsr score_add
lda bomba_m_scr,x
sta pom
lda bomba_s_scr,x
sta pom+1
lda bomba_anim_typ,x
lsr
and #8
clc
adc #ch_bonus+3
adc bonus
ldy #0
sta (pom),y
pha
lda bonus
cmp #4
beq @+
pla
sbc bonus
pha
sbc #1
pha
sbc #1
jmp @+1
@ pla
sbc bonus
sbc #2
pha
sbc #1
pha
adc #0
@ ldy #49
sta (pom),y
dey
pla
sta (pom),y
ldy #1
pla
sta (pom),y
mva #30 bomba_score_licznik,x
inc ile_score
lda #2
ldy #fx_bomba1
jsr sfx.add_fx
lda ile_bomb
beq @+1
;wlaczamy nastepna bombe
zapal_bombe
ldx pom0
@ dex
bpl *+4
ldx #23
lda bomba_x,x
beq @-
@ mva #1 bomba_zapalona,x
sta bomba_anim_licznik,x
mva #2 bomba_anim_faza,x
lda bomba_anim_typ,x
ora #32
sta bomba_anim_typ,x
@ rts
score_tab
.he 20,40,60,80,50 ;punkty dla zapalonej bomby
score_tab0
.he 10,20,30,40,50 ;punkty dla zwykłej bomby
.endl
score_add
clc
sed
adc score
sta score
lda score+1
adc #0
sta score+1
lda score+2
adc #0
cld
sta score +2
rts
score_addx100
clc
sed
adc score+1
sta score+1
lda score+2
adc #0
cld
sta score+2
rts