-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kolizje.asm
938 lines (753 loc) · 11.5 KB
/
kolizje.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
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
//kolizje
scr_ad_m
:26 dta b(<[obraz-8+48*#])
scr_ad_s
:26 dta b(>[obraz-8+48*#])
.local cl
sprite0x=pom0d
sprite0y=pom0e
sprawdzXY
tya
lsr
bcs @+
lsr
bcs sprawdz_lewo_gacek
bcc sprawdz_prawo_gacek
@ lsr
bcs sprawdz_nad_gackiem
jmp sprawdz_pod_gackiem
sprawdz_osX
lda pom0h
bmi sprawdz_lewo_gacek
sprawdz_prawo_gacek
lda sprite0x
cmp #POSX_MAX+1
bcc *+5
lda #0
rts
adc #6
jmp spr_l1
sprawdz_lewo_gacek
lda sprite0x
cmp #POSX_MIN
bcs *+5
lda #0
rts
adc #2-1
spr_l1
:2 lsr
tay
lda sprite0y
:3 lsr
stx pom0h
tax
dex
dex
clc
tya
adc scr_ad_m,x
sta pom4
lda scr_ad_s,x
adc #0
sta pom4+1
ldx pom0h
ldy #0
lda (pom4),y
lsr
cmp #$60
bne *+3
rts
ldy #48
lda (pom4),y
lsr
cmp #$60
bne *+3
rts
lda sprite0y
and #7 ;gdy przesuniecie =0 to sprawdz 2 bajty
bne *+5
lda #1
rts
ldy #96
lda (pom4),y
lsr
cmp #$60
rts
sprawdz_nad_gackiem
lda sprite0y
cmp #POSY_MIN
bcs *+5
lda #0
rts
;sec
sbc #16
bit bit2
bne *+5
lda #1
rts
:3 lsr
stx pom0h
tax
lda scr_ad_m,x
sta pom4
lda scr_ad_s,x
sta pom4+1
ldx pom0h
clc
lda sprite0x
adc #2
:2 lsr
tay
lda (pom4),y
lsr
cmp #$60
bne *+3
rts
iny
lda (pom4),y
lsr
cmp #$60
rts
sprawdz_osY
lda pom0h
bmi sprawdz_nad_gackiem
sprawdz_pod_gackiem
lda sprite0y
cmp #POSY_MAX+1
bcc *+5
lda #0
rts
sbc #0
bit bit12 ;zamiast bit012
beq *+4
clc
rts
:3 lsr
stx pom0h
tax
lda scr_ad_m,x
sta pom4
lda scr_ad_s,x
sta pom4+1
ldx pom0h
clc
lda sprite0x
adc #2
:2 lsr
tay
lda (pom4),y
lsr
cmp #$60
bne *+3
rts
iny
lda (pom4),y
lsr
cmp #$60
sec
rts
player_vs_enemy
lda after_paraliz
beq @+
dec after_paraliz
@ equ *
ldy #7
lda sprite_x
clc
adc #4
sta _pp0+1
lda sprite_y
adc #12+1 ;bo c=0
sta _pp1+1
sec
_pp0
@ lda #0 ;sprite_x
sbc sprite_x,y
;clc
;adc #4
cmp #9
bcs @+
_pp1
lda #0 ;sprite_y
sbc sprite_y,y
;clc
;adc #12
cmp #25
bcc @+1
@ dey
bne @-1
rts
@ lda sprite_anim_speed,y
beq @-1 ;to bonus, a nie przeciwnik
cpy #7
jeq @+1
lda licznik_paraliz
ora licznik_paraliz+1
jeq @+
dec licznik_extra
bne le0
mva #LICZNIK_EXTRA_START licznik_extra
lda random_extra
lsr
ora #3
sta random_extra
le0 equ *
;mva #0 sprite_x,y
mva #80 sprite_licznik,y ;czas wyswietlania bonus
mva #0 sprite_anim_speed,y
sta ai.ruch,y
mva #$02 sprite_c0,y
mva #$0c sprite_c1,y
lda sprite_typ,y
cmp #t_ptak
bne pe0
dec ile_ptakow
_ptak50 mva #50 licznik_ptak
jmp pe1
pe0
dec ile_enemy
mva ai.czekanie1 ai.czekanie
pe1
ldx ile_paraliz
lda paraliz_score_tab,x
sta pom0
inc ile_paraliz
ldx bonus
pe10
lda pom0
jsr score_add
lda pom0
jsr score_add
dex
bpl pe10
lda ile_paraliz
clc
adc #87
sta sprite_shape,y
sta sprite_anim,y
ldx bonus
beq pe10a
txa
adc #96
pe10a sta sprite_mask,y ;ustawienie animacji bonusu za paraliz
ldy #fx_literka
lda #2
jsr sfx.add_fx
lda ile_enemy
ora ile_ptakow
bne pe2
lda #0
sta licznik_paraliz
sta licznik_paraliz+1
ldx level_melody
lda tab_melody,x
jsr rmt_init0
pe2
rts
@ equ * //enemy
lda sprite_typ,y
cmp #t_none ;wybuch nie zabija
beq pe2
lda after_paraliz ;po zakończniu paraliżu przez chwile jestesmy niesmiertelni
bne pe2
mva #1 death
mva #shp_jspada sprite_shape
sta sprite_shape0
mva #2 sprite_anim
mva #7 sprite_anim_speed
mva #1 sprite_mask
jsr rmt_silence
mva #$28 audctl
mva #$3d audf3
mva #$ab audf4
mva #$a1+2 audc3
sta audc4
rts
//literka
@ ;mva #0 sprite_x,y ;usuń literkę
;sta ai.ruch,y
;mva next_bonus licznik_bonus
mva #80 sprite_licznik,y ;czas wyswietlania bonus
mva #0 sprite_anim_speed,y
sta ai.ruch,y
mva #$02 sprite_c0,y
mva #$0c sprite_c1,y
sty pom0
ldy #fx_literka
lda #3
jsr sfx.add_fx
ldy pom0
lda sprite_typ,y
cmp #t_bonus
bne @+
//bonus
;lda bonus
;cmp #4
;beq *+4
lda #94
sta sprite_shape,y
sta sprite_anim,y
sta sprite_mask,y
inc bonus
jsr panel.print_bonus
lda #$01
jmp score_addx100 ;dodatkowe 1000 pkt za zebranie literki B.
@ cmp #t_extra
bne @+
//extra life
mva #255 random_extra
mva #LICZNIK_EXTRA_START licznik_extra
mva #0 czy_extra
lda #96
sta sprite_shape,y
sta sprite_anim,y
sta sprite_mask,y
lda #3
ldy #fx_extra
jsr sfx.add_fx
inc lives
jsr panel.print_lives
lda #$03
jmp score_addx100
@
//paraliż
mva #0 kanal3
sta audc3
mva #t_none sprite_typ+7
lda kolor_p
cmp #7
tax
adc #87
sta sprite_shape,y
sta sprite_anim,y
sta sprite_mask,y
lda paraliz_score0,x
beq *+5
jsr score_add
lda paraliz_score1,x
beq *+5
jsr score_addx100
ldy #6
@ lda sprite_x,y
beq @+
lda sprite_shape,y
sta buf_shape,y
lda sprite_shape0,y
sta buf_shape0,y
lda sprite_anim_speed,y
sta buf_anim_speed,y
lda sprite_anim,y
sta buf_anim,y
lda sprite_mask,y
sta buf_mask,y
lda sprite_c0,y
sta buf_c0,y
lda sprite_c1,y
sta buf_c1,y
mva #shp_buzka sprite_shape,y
sta sprite_shape0,y
mva #3 sprite_anim_speed,y
mva #4 sprite_anim,y
mva #3 sprite_mask,y
mva #$24 sprite_c0,y
mva #$e8 sprite_c1,y
@ dey
bne @-1
mva #0 kolor_P
sta ile_paraliz ;ile zebrano buziek
_licznik_paraliz
mwa #255 licznik_paraliz
;;muzyczka w czasie paralizu
lda #$7a
jmp rmt_init0
paraliz_score_tab .he 05,10,15,25,40,60
paraliz_score0 .he 10,20,30,50,80,20,00
paraliz_score1 .he 00,00,00,00,00,01,02
buf_shape org *+7
buf_shape0 org *+7
buf_anim_speed org *+7
buf_anim org *+7
buf_mask org *+7
buf_c0 org *+7
buf_c1 org *+7
usun_paraliz
ldy #6
@ lda sprite_x,y
beq @+
lda sprite_anim_speed,y ;pomin bonus
beq @+
lda buf_shape,y
sta sprite_shape,y
lda buf_shape0,y
sta sprite_shape0,y
lda buf_anim_speed,y
sta sprite_anim_speed,y
lda buf_anim,y
sta sprite_anim,y
lda buf_mask,y
sta sprite_mask,y
lda buf_c0,y
sta sprite_c0,y
lda buf_c1,y
sta sprite_c1,y
@ dey
bne @-1
_after_paraliz
mva #40 after_paraliz
ldx level_melody
lda tab_melody,x
jsr rmt_init0
rts
animuj_death
lda death
cmp #1
bne ad_1
mva #2 pom0
@ lda sprite_x
sta sprite0x
ldy sprite_y
iny
sty sprite0y
jsr sprawdz_pod_gackiem
beq @+
inc sprite_y
dec pom0
bne @-
rts
@ inc death
mva #50 licznik_death
mva #shp_jupada sprite_shape
sta sprite_shape0
mva #15 sprite_anim_speed ;po upadku wolniejszy ruch
mva #$39 audf3
mva #$50 audf4
rts
ad_1
dec licznik_death
beq @+1
lda licznik_death
cmp #40
bne @+
jsr rmt_silence
@ rts
@ dec lives
bmi ad_gameover
ad_2
jsr rmt_silence
mva #0 audctl
jsr init_level1
mva #124 sprite_x
mva #$58 sprite_y
mva #0 ruch_poziom
sta czy_extra
sta ile_score
;:4 sta hposm0+#
mva #1 spadanie ;koniec ekranu , zaczyna się spadanie
mva #joy.LEN_SPADANIE predkosc_spadanie
mva #shp_jdol_srodek sprite_shape
mva #30 ai.czekanie
ldx #$e0
jsr multi.init_sprite2+2
jmp napisy.start
ad_gameover //game over
pla
pla
lda #$73
jsr rmt_init0
jsr wait_vbl
ldx #$e0
jsr multi.init_sprite2+2 ;czysci duszki
mva #$ff sizems
jsr bomb.zgas_bombe
sec
lda sprite_x
sbc #12
sta sprite_x
go1 jsr wait_vbl
jsr rmt_play0
mva sprite_x hposp0s
sta hposm0s
clc
adc #8
sta hposp1s
sta hposm1s
adc #8
sta hposp2s
sta hposm2s
adc #8
sta hposp3s
sta hposm3s
jsr change_colors
ldx sprite_y
ldy #0
mva #0 sprites+$300-1,x
@ lda text0,y
sta sprites+$400,x ;rysuj napis
lda text0+16,y
sta sprites+$500,x
lda text0+32,y
sta sprites+$600,x
lda text0+48,y
sta sprites+$700,x
lda #$ff
sta sprites+$300,x
inx
iny
cpy #16
bcc @-
mva #0 sprites+$300,x
lda sprite_x
cmp #112
beq @+
bcc _plus
dec sprite_x
dec sprite_x
_plus inc sprite_x
jmp go2
@ lda sprite_y
cmp #116
beq go3
bcc _plusy
dec sprite_y
dec sprite_y
_plusy inc sprite_y
go2 jmp go1
go3 mva #0 zegar
@ jsr wait_vbl
jsr rmt_play0
jsr change_colors
lda zegar
cmp #250
bcc @-
game_over1
jsr wait_vbl
mva #0 dmactl
sta sizems
ldy #41
@ lda panel_adr+48,y ;skopiuj hiscore
sta title0-17,y
dey
cpy #35
bne @-
jsr sprawdz_wynik
lda pom0a
bpl *+5
jmp tit0
jsr wait_vbl
mwa #dli2 dliv
mwa #vblk1 vbiv
jsr multi.hide_sprite
jsr multi.init_sprite2
mva #0 wpis+10
sta wpis+11
sta wpis+12
mva #108-12 hposp0
mva #3 sizep0
ldy pom0a
lda tab_dl+1,y
and #$f0
ora #$02
sta pom0e
ldy pom0a
ldx tab_w1,y
lda #$e0
ldy #8
@ sta sprites+$400,x
inx
dey
bne @-
jsr wait_vbl
lda #$8f
jsr rmt_init0
mwa #dlist_highscore dlptr
mva #>znaki1 chbase
mva #39 dmactl
mva #0 colbak
lda pom0a
:5 asl
adc #11-3
adc #<highscore
sta pom
lda #>highscore
adc #0
sta pom+1
lda pom0a
:3 asl
adc #<wyniki
sta pom1
lda #>wyniki
adc #0
sta pom1+1
mva #1 pom0b
ldy #0
sty pom0d
lda trig0
sta pom0c
mva #1 muza0
j0
lda pom0b
sta (pom1),y
ora #$20
sta wpis+10,y
ora #$a0
sta (pom),y
jsr wait_vbl
lda pom0d
beq @+1
ldx #5
@ jsr wait_vbl
dex
bne @-
@ mva #0 pom0d
lda porta
and #8
bne @+
inc pom0d
inc pom0b
lda pom0b
cmp #27
bne j1
lda #1
sta pom0b
jmp j1
@ lda porta
and #4
bne j1
inc pom0d
dec pom0b
bne j1
lda #26
sta pom0b
j1 equ *
lda trig0
cmp pom0c
sta pom0c
beq j0
cmp #0
bne j0
inc pom0d
iny
cpy #3
bcc j0
ldx #100
@ jsr wait_vbl
dex
bne @-
jsr wait_vbl
mva #0 dmactl
sta muza0
jmp tit0
tab_w1 .he 60,6b,76,81,8c
tab_w dta 32,24,16,8
sprawdz_wynik
ldx #0
ldy #0
@ sec
lda wyniki+5,x
sbc score
lda wyniki+4,x
sbc score+1
lda wyniki+3,x
sbc score+2
bcc @+
iny
tya
:3 asl
tax
cpy #5
bcc @-
lda #255
sta pom0a
rts
@ cpy #4
beq @+1
ldx #31
lda tab_w,y
sta pom0
@ lda wyniki,x
sta wyniki+8,x
dex
dec pom0
bne @-
@ tya
:3 asl
tax
lda score
sta wyniki+5,x
lda score+1
sta wyniki+4,x
lda score+2
sta wyniki+3,x
lda #$8f
sta wyniki,x
sta wyniki+1,x
sta wyniki+2,x
lda round
sta wyniki+7,x
sty pom0a
jmp przepisz_highscore
print_wynik
lda wyniki,x
and #$0f
ora #$90
sta (pom),y
dey
lda wyniki,x
:4 lsr
ora #$90
sta (pom),y
dey
dex
rts
print_litera
lda wyniki,x
bpl @+
lda #$8e
bne *+4
@ ora #$a0
sta (pom),y
dey
rts
przepisz_highscore
mwa #(highscore+8) pom
mva #5 pom0
ldx #7
@ ldy #19
jsr print_wynik
dex
ldy #12
jsr print_wynik
jsr print_wynik
jsr print_wynik
ldy #2
jsr print_litera
dex
jsr print_litera
dex
jsr print_litera
txa
clc
adc #8+7
tax
lda #32
jsr add_pom
dec pom0
bne @-
rts
text0 .he 00,7c,c6,c0,ce,c6,7c,00,00,7c,c6,c6,c6,c6,7c,00 ;G/O
.he 00,7c,c6,fe,c6,c6,c6,00,00,c6,c6,c6,c6,7c,38,00 ;A/V
.he 00,c6,fe,d6,d6,c6,c6,00,00,fe,c0,fc,c0,c0,fe,00 ;M/E
.he 00,fe,c0,fc,c0,c0,fe,00,00,fc,c6,fc,c6,c6,c6,00 ;E/R
change_colors
clc
lda zegar
and #$fc
sta colpm0s ;kolor
adc #$20
sta colpm1s
adc #$20
sta colpm2s
adc #$20
sta colpm3s
rts
.endl