-
Notifications
You must be signed in to change notification settings - Fork 0
/
block_attack.pas
2076 lines (1398 loc) · 42.5 KB
/
block_attack.pas
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
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ---------------------------------------------------------------
// mp.exe block_attack.pas -ipath:[mad_pascal_path]\lib\ -code:980
// ---------------------------------------------------------------
// Block Attack
// ---------------------------------------------------------------
// 2019..2022 Tebe/Madteam
//
// 2021-08-25 grafika Odyn1ec
//
// 2021-09-25 nowy ekran tytulowy, ekran wyboru
// 2021-09-03 IRQ zmiana kolorow panelu, rezygnacja z '$define romoff'
// 2021-09-05 rezygnacja z WSYNC (JGP2.PAS -> JPGDLi), cykle opozniajace 'inc DliCnt'
// 2021-12-11 dodane SEI / CLI w procedurze NMI
// 2022-07-17 DEBUG, dla szybszego testowania GAME OVER
// 2022-08-06 creditsy, game over, time over
// 2022-08-08 usuniecie rozkazow SEI/CLI z przerwania NMI, Atari800Win wykladal sie na 'cli \ rti'
// 2022-08-09 dodany modu³ SYSREQ, wymagany 'ANTIC PAL', 'CPU 6502'
// 2022-08-22 poprawione wywolanie IRQ, 'INC IRQEN' zastapione przez 'lda #$00\ sta irqen\ lda #4\ sta irqen'
// 2022-08-23 muzyka na drugim POKEY-u, SAP-R LZSS
// 2022-09-02 obsluga klawiatury A-LEFT, D-RIGHT, W-UP, S-DOWN, Q-FIRE, ESC-QUIT
// 2022-09-17 dodanie obslugi FIRE2 (JOYSCAN) jako alternatywa dla klawisza SHIFT
// 2022-11-06 muzyka LiSU, poprawiony SAPLZSS (restart modulu)
// 2023-06-28 muzyka LiSU na ekran tytu³owy, muzyka VinsCool podczas gry
// 2023-07-06 dodane animacje na panelu (reakcja na zdobycie punktow, combo i przesuniecie klockow)
uses crt, sysutils, jgp2, atari, joystick, graph, zx5, sysreq, saplzss;
{$r block_attack.rc}
{$define basicoff}
//{$DEFINE DEBUG}
type
TGameMode = (gmEndless, gmTimeTrial);
TJoyKey = procedure (a: byte);
const
PM_COLOR = $0600;
PMB_PAGE = $D800;
DISPLAY_LIST_ADDRESS = PMB_PAGE;
CHARSET_RAM_ADDRESS = PMB_PAGE + $0800; // $dc00, $e000, $e400, $e800, $ec00
VIDEO_RAM_ADDRESS_A = $C000; // ..$C9FF (64*width) !!! WIDTH = 40
VIDEO_RAM_ADDRESS_B = $B000; // ..$B9FF (64*width) !!! WIDTH = 40
SAPR_PLAYER = $a400; // ..$02FF player, $0300..$0BFF buffers [$C00]
bkg_color = $02;
bkg_panel = 122 xor $80;
width = 40;
max_speed = 100;
match1 : array [0..18] of byte = (0, // SFX - match1
$ff-$b0, $a8,
$fe-$b0, $a8,
$fd-$b0, $a8,
$fc-$b0, $a6,
$fb-$b0, $a4,
$f9-$b0, $a3,
$f8-$b0, $a2,
$00, $a0,
$00, $00 );
match2 : array [0..18] of byte = (0, // SFX - match2
$f7-$c0, $a8,
$f6-$c0, $a8,
$f5-$c0, $a8,
$f4-$c0, $a6,
$f3-$c0, $a4,
$f2-$c0, $a3,
$f1-$c0, $a2,
$00, $a0,
$00, $00 );
match3 : array [0..18] of byte = (0, // SFX - match3
$ef-$d0, $a8,
$ee-$d0, $a8,
$ed-$d0, $a8,
$ec-$d0, $a6,
$eb-$d0, $a4,
$e9-$d0, $a3,
$e8-$d0, $a2,
$e0, $a0,
$00, $00 );
sfmove : array [0..18] of byte = (0, // SFX - move
$00, $a3,
$00, $a0,
$00, $a3,
$00, $a0,
$00, $a3,
$00, $a0,
$00, $a0,
$00, $a0,
$00, $00);
sfswap : array [0..18] of byte = (0, // SFX - swap
$00, $04,
$00, $02,
$00, $01,
$00, $00,
$00, $02,
$00, $04,
$00, $00,
$00, $00,
$00, $00);
vpanel : array [0..14] of byte = (0, bkg_panel, bkg_panel, bkg_panel, bkg_panel, bkg_panel, bkg_panel, bkg_panel, bkg_panel, 0,0,0,0,0,0);
pmDigit : array [0..159] of byte = (
$38,$38,$4C,$4C,$54,$54,$64,$64, // 0
$44,$44,$44,$44,$38,$38,$00,$00,
$10,$10,$30,$30,$10,$10,$10,$10, // 1
$10,$10,$10,$10,$7C,$7C,$00,$00,
$38,$38,$04,$04,$38,$38,$40,$40, // 2
$40,$40,$40,$40,$7C,$7C,$00,$00,
$7C,$7C,$08,$08,$18,$18,$04,$04, // 3
$04,$04,$44,$44,$38,$38,$00,$00,
$40,$40,$50,$50,$7C,$7C,$10,$10, // 4
$10,$10,$10,$10,$10,$10,$00,$00,
$7C,$7C,$40,$40,$78,$78,$04,$04, // 5
$04,$04,$44,$44,$38,$38,$00,$00,
$38,$38,$40,$40,$78,$78,$44,$44, // 6
$44,$44,$44,$44,$38,$38,$00,$00,
$7C,$7C,$04,$04,$08,$08,$10,$10, // 7
$10,$10,$10,$10,$10,$10,$00,$00,
$38,$38,$44,$44,$38,$38,$44,$44, // 8
$44,$44,$44,$44,$38,$38,$00,$00,
$3C,$3C,$44,$44,$44,$44,$3C,$3C, // 9
$04,$04,$04,$04,$04,$04,$00,$00
);
digitH : array [0..191] of byte = (
$00,$00,$00,$00,$00,$00,$00,$00, //space
$60,$A0,$A0,$A0,$A0,$C0,$00,$00, //0
$C0,$40,$40,$40,$40,$40,$00,$00, //1
$C0,$20,$60,$80,$80,$E0,$00,$00, //2
$E0,$20,$60,$20,$20,$C0,$00,$00, //3
$80,$A0,$A0,$E0,$20,$20,$00,$00, //4
$E0,$80,$E0,$20,$20,$C0,$00,$00, //5
$C0,$80,$E0,$A0,$A0,$C0,$00,$00, //6
$E0,$20,$20,$20,$20,$20,$00,$00, //7
$E0,$A0,$E0,$A0,$A0,$E0,$00,$00, //8
$E0,$A0,$A0,$E0,$20,$20,$00,$00, //9
$00,$40,$40,$00,$40,$40,$00,$00, //:
// );
//digitL : array [0..95] of byte = (
$0,$0,$0,$0,$0,$0,$0,$0, //space
$6,$A,$A,$A,$A,$C,$0,$0, //0
$C,$4,$4,$4,$4,$4,$0,$0, //1
$C,$2,$6,$8,$8,$E,$0,$0, //2
$E,$2,$6,$2,$2,$C,$0,$0, //3
$8,$A,$A,$E,$2,$2,$0,$0, //4
$E,$8,$E,$2,$2,$C,$0,$0, //5
$C,$8,$E,$A,$A,$C,$0,$0, //6
$E,$2,$2,$2,$2,$2,$0,$0, //7
$E,$A,$E,$A,$A,$E,$0,$0, //8
$E,$A,$A,$E,$2,$2,$0,$0, //9
$0,$4,$4,$0,$4,$4,$0,$00 //:
);
gameover_yn: array [0..191] of byte = (
$00, $01, $00, $01, $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $00, $01, $00, $01, $00, $01,
$00, $01, $00, $01, $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $00, $01, $00, $01, $00, $01,
$0e, $0f, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $1b, $1c, $1d, $1e, $1f, $00, $01, $00, $01, $00, $01,
$0e, $0f, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $1b, $1c, $1d, $1e, $1f, $00, $01, $00, $01, $00, $01,
$20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $2c, $2d, $2e, $2f, $30, $31, $32, $33, $00, $01, $00, $01,
$20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $2c, $2d, $2e, $2f, $30, $31, $32, $33, $00, $01, $00, $01,
$00, $01, $00, $01, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c, $3d, $3e, $3f, $40, $41, $42, $43, $44, $45, $00, $01,
$00, $01, $00, $01, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c, $3d, $3e, $3f, $40, $41, $42, $43, $44, $45, $00, $01
);
gameover: array [0..671] of byte = (
$00, $00, $01, $02, $03, $00, $04, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $00, $00, $00, $00, $00, $00, $00,
$0f, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $1b, $1c, $1d, $1e, $1f, $00, $00, $00, $00, $00, $00, $00,
$20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $2c, $2d, $2e, $2f, $30, $00, $00, $00, $00, $00, $00, $00,
$00, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c, $3d, $3e, $3f, $40, $41, $42, $43, $00, $00, $00, $00,
$00, $00, $00, $00, $0f, $10, $44, $45, $46, $47, $48, $49, $4a, $4b, $4c, $4d, $4e, $4f, $50, $51, $00, $00, $00, $00,
$00, $00, $00, $00, $52, $53, $54, $55, $56, $57, $58, $59, $5a, $5b, $5c, $5d, $5e, $5f, $60, $61, $62, $00, $00, $00,
$00, $00, $00, $00, $00, $63, $64, $65, $66, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $00, $00, $00, $00, $00, $00, $00,
$00, $0c, $0d, $0e, $0f, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $1b, $00, $00, $00, $00, $00, $00, $00,
$1c, $1d, $1e, $1f, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $2c, $00, $00, $00, $00, $00, $00, $00,
$2d, $2e, $2f, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c, $3d, $0a, $3e, $3f, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $0c, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4a, $4b, $4c, $4d, $00, $00, $00, $00,
$00, $00, $00, $00, $4e, $4f, $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5a, $5b, $5c, $5d, $5e, $00, $00, $00,
$00, $00, $00, $00, $00, $5f, $60, $61, $62, $63, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $01, $02, $00, $03, $04, $05, $06, $07, $08, $09, $0a, $00, $00, $00, $00, $00, $00, $00,
$00, $0b, $0c, $0d, $0e, $0f, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $00, $00, $00, $00, $00, $00, $00,
$1b, $1c, $1d, $1e, $1f, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $00, $00, $00, $00, $00, $00, $00,
$2c, $2d, $2e, $2f, $30, $31, $32, $07, $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $09, $3c, $3d, $00, $00, $00, $00,
$00, $00, $3e, $3f, $00, $0b, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4a, $4b, $4c, $4d, $00, $00, $00, $00,
$00, $00, $00, $00, $4e, $4f, $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5a, $5b, $5c, $5d, $5e, $00, $00, $00,
$00, $00, $00, $00, $00, $5f, $60, $61, $62, $63, $64, $00, $65, $66, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $02, $03, $04, $00, $00, $00, $00, $00, $00, $00,
$00, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f, $10, $11, $12, $13, $14, $00, $00, $00, $00, $00, $00, $00,
$15, $16, $17, $18, $19, $1a, $1b, $1c, $1d, $1e, $1f, $20, $21, $22, $23, $24, $25, $00, $00, $00, $00, $00, $00, $00,
$26, $27, $28, $29, $2a, $2b, $2c, $00, $2d, $2e, $2f, $30, $31, $32, $33, $34, $35, $03, $04, $00, $00, $00, $00, $00,
$00, $36, $37, $38, $39, $05, $3a, $3b, $3c, $3d, $3e, $3f, $40, $41, $42, $43, $44, $45, $46, $47, $00, $00, $00, $00,
$00, $00, $00, $00, $15, $16, $48, $49, $4a, $4b, $4c, $4d, $4e, $4f, $50, $51, $52, $53, $54, $55, $56, $00, $00, $00,
$00, $00, $00, $00, $57, $58, $59, $5a, $5b, $5c, $5d, $5e, $5f, $60, $61, $62, $63, $36, $64, $65, $00, $00, $00, $00
);
timeover_yn: array [0..191] of byte = (
$00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01,
$00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01,
$82, $83, $84, $85, $86, $07, $88, $09, $8a, $8b, $8c, $8d, $8e, $8f, $90, $91, $92, $93, $94, $15, $00, $01, $00, $01,
$82, $83, $84, $85, $86, $87, $88, $89, $8a, $8b, $8c, $8d, $8e, $8f, $90, $91, $92, $93, $94, $95, $00, $01, $00, $01,
$96, $97, $98, $99, $9a, $9b, $9c, $9d, $9e, $9f, $a0, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $00, $01, $00, $01,
$16, $97, $98, $99, $9a, $9b, $9c, $9d, $9e, $9f, $a0, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $00, $01, $00, $01,
$2a, $ab, $ac, $ad, $ae, $af, $b0, $b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8, $b9, $ba, $bb, $bc, $bd, $00, $01, $00, $01,
$2a, $2b, $2c, $2d, $2e, $2f, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c, $3d, $00, $01, $00, $01
);
timeover: array [0..671] of byte = (
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$81, $82, $83, $84, $85, $86, $87, $88, $89, $8a, $8b, $8c, $8d, $8e, $8f, $90, $91, $92, $93, $94, $00, $00, $00, $00,
$95, $96, $97, $98, $99, $9a, $9b, $9c, $9d, $9e, $9f, $a0, $a1, $a2, $a3, $a4, $a5, $9f, $a6, $a7, $00, $00, $00, $00,
$00, $a8, $a9, $aa, $ab, $ac, $ad, $a1, $ae, $af, $9f, $b0, $b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8, $00, $00, $00, $00,
$00, $b9, $ba, $bb, $bc, $bd, $be, $bf, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $ca, $cb, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$81, $82, $83, $84, $85, $86, $87, $88, $89, $8a, $8b, $8c, $8d, $8e, $8f, $90, $91, $8f, $84, $92, $00, $00, $00, $00,
$93, $94, $95, $96, $97, $98, $99, $9a, $9b, $9c, $9d, $9e, $9f, $a0, $a1, $a2, $a3, $a4, $a5, $a6, $00, $00, $00, $00,
$00, $a7, $a8, $a9, $aa, $ab, $ac, $ad, $ae, $af, $a4, $b0, $b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8, $00, $00, $00, $00,
$00, $b9, $ba, $bb, $bc, $bd, $be, $bf, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $ca, $cb, $00, $00, $00, $00,
$00, $cc, $cd, $ce, $cd, $cf, $80, $d0, $ce, $80, $d0, $ce, $d1, $cc, $d1, $d2, $d3, $ce, $cc, $d1, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$81, $82, $83, $84, $85, $80, $86, $80, $81, $85, $87, $88, $89, $85, $8a, $8b, $84, $8a, $84, $80, $00, $00, $00, $00,
$8c, $8d, $8e, $8f, $90, $91, $92, $93, $94, $95, $96, $97, $98, $99, $9a, $9b, $9c, $9d, $9e, $9f, $00, $00, $00, $00,
$a0, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $aa, $ab, $ac, $ad, $ae, $af, $b0, $b1, $b2, $b3, $00, $00, $00, $00,
$00, $b4, $b5, $b6, $b7, $b8, $b9, $ba, $bb, $bc, $bd, $be, $bf, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $00, $00, $00, $00,
$00, $c7, $c8, $c9, $ca, $cb, $cc, $cd, $c9, $ce, $cf, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $d1, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$80, $81, $82, $80, $80, $80, $82, $80, $80, $80, $80, $82, $83, $80, $80, $80, $80, $80, $80, $80, $00, $00, $00, $00,
$84, $85, $86, $87, $88, $89, $8a, $8b, $8c, $8d, $8e, $8f, $90, $91, $92, $93, $94, $95, $96, $97, $00, $00, $00, $00,
$98, $99, $9a, $9b, $9c, $9d, $9e, $9f, $a0, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $aa, $ab, $00, $00, $00, $00,
$00, $ac, $ad, $ae, $af, $b0, $b1, $a4, $b2, $b3, $a2, $b4, $b5, $b6, $b7, $b8, $b9, $ba, $bb, $bc, $00, $00, $00, $00,
$80, $bd, $be, $bf, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $ca, $cb, $cc, $cd, $ce, $cf, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
);
// game over
tryagain: array [0..191] of byte = (
$00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01,
$00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01,
$46, $c7, $c8, $c9, $ca, $cb, $cc, $cd, $ce, $cf, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $d8, $d9, $00, $01, $00, $01,
$46, $c7, $c8, $c9, $ca, $cb, $4c, $cd, $ce, $cf, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $d8, $d9, $00, $01, $00, $01,
$00, $01, $00, $01, $5a, $5b, $5c, $5d, $5e, $5f, $00, $01, $60, $61, $62, $63, $64, $65, $00, $01, $00, $01, $00, $01,
$00, $01, $00, $01, $5a, $5b, $5c, $5d, $5e, $5f, $00, $01, $60, $61, $62, $63, $64, $65, $00, $01, $00, $01, $00, $01,
$00, $01, $00, $01, $66, $67, $68, $69, $6a, $6b, $00, $01, $6c, $6d, $6e, $6f, $70, $71, $00, $01, $00, $01, $00, $01,
$00, $01, $00, $01, $66, $67, $68, $69, $6a, $6b, $00, $01, $6c, $6d, $6e, $6f, $70, $71, $00, $01, $00, $01, $00, $01
);
// time over
tryagain2: array [0..191] of byte = (
$00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01,
$00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01, $00, $01,
$3e, $bf, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $ca, $cb, $cc, $cd, $ce, $cf, $d0, $d1, $00, $01, $00, $01,
$3e, $bf, $c0, $c1, $c2, $c3, $44, $c5, $c6, $c7, $c8, $c9, $ca, $cb, $cc, $cd, $ce, $cf, $d0, $d1, $00, $01, $00, $01,
$00, $01, $00, $01, $52, $53, $54, $55, $56, $57, $00, $01, $58, $59, $5a, $5b, $5c, $5d, $00, $01, $00, $01, $00, $01,
$00, $01, $00, $01, $52, $53, $54, $55, $56, $57, $00, $01, $58, $59, $5a, $5b, $5c, $5d, $00, $01, $00, $01, $00, $01,
$00, $01, $00, $01, $5e, $5f, $60, $61, $62, $63, $00, $01, $64, $65, $66, $67, $68, $69, $00, $01, $00, $01, $00, $01,
$00, $01, $00, $01, $5e, $5f, $60, $61, $62, $63, $00, $01, $64, $65, $66, $67, $68, $69, $00, $01, $00, $01, $00, $01
);
monster0 : array [0..143] of byte =
(
$0E,$D7,$8F,$4F,$0B,$2F,$26,$00,$10,$0A,$00,$15,$14,$0D,$2C,$2C,$1C,$54,$20,$44,$00,$00,$40,$FE,
$0E,$D7,$8F,$4B,$0B,$2B,$26,$00,$10,$0A,$00,$15,$14,$0C,$2C,$2D,$1C,$54,$20,$44,$00,$00,$40,$FE,
$0E,$D7,$89,$49,$09,$2B,$26,$00,$11,$0B,$01,$11,$14,$0C,$2C,$2C,$1D,$54,$20,$44,$00,$00,$40,$FE,
$4E,$57,$6F,$4F,$6B,$4F,$66,$E0,$51,$5A,$F0,$53,$03,$51,$55,$F4,$76,$65,$40,$04,$00,$00,$00,$81,
$4E,$57,$6F,$4B,$6B,$4B,$66,$E0,$51,$5A,$F0,$53,$03,$01,$05,$54,$56,$F5,$70,$64,$40,$00,$00,$81,
$4E,$57,$69,$49,$49,$6B,$E6,$50,$59,$F2,$50,$13,$03,$41,$05,$04,$56,$55,$F0,$74,$60,$40,$00,$81
);
monster1 : array [0..143] of byte =
(
$E0,$32,$18,$0A,$08,$42,$2A,$23,$05,$08,$80,$17,$2B,$17,$0F,$20,$07,$0B,$13,$07,$00,$00,$00,$E8,
$E0,$32,$18,$0A,$08,$82,$8A,$43,$45,$08,$80,$17,$28,$11,$27,$01,$27,$01,$20,$01,$0B,$00,$00,$E8,
$E0,$32,$18,$0A,$08,$82,$8A,$83,$45,$08,$80,$17,$28,$11,$4F,$01,$5F,$0F,$41,$00,$1B,$00,$00,$E8,
$3E,$7E,$86,$03,$03,$13,$8B,$8B,$82,$C4,$7A,$76,$A7,$E3,$F5,$73,$60,$E0,$C0,$80,$00,$00,$00,$00,
$3E,$7E,$86,$03,$03,$23,$A3,$93,$92,$C4,$7A,$76,$A7,$63,$B5,$23,$B0,$20,$20,$C0,$80,$00,$00,$00,
$3E,$7E,$86,$03,$03,$23,$A3,$A3,$92,$C4,$7A,$76,$A7,$63,$D5,$13,$D0,$90,$10,$E0,$80,$00,$00,$00
);
monster2 : array [0..143] of byte =
(
$0F,$47,$23,$51,$59,$04,$22,$14,$01,$2A,$19,$2A,$1A,$08,$02,$05,$02,$01,$00,$00,$00,$00,$00,$4C,
$0F,$47,$2B,$51,$59,$04,$22,$14,$01,$2A,$18,$2A,$1A,$08,$02,$05,$02,$01,$00,$00,$00,$00,$00,$4C,
$0F,$47,$2B,$51,$59,$04,$22,$14,$01,$2A,$18,$2A,$1A,$08,$02,$05,$02,$01,$00,$00,$00,$00,$00,$4C,
$46,$54,$48,$51,$E3,$A4,$A8,$E5,$70,$FA,$19,$0B,$49,$EA,$0C,$1C,$78,$70,$E0,$00,$00,$00,$00,$00,
$46,$54,$4A,$51,$E3,$A4,$A8,$E5,$10,$0A,$09,$0B,$69,$EA,$6C,$24,$31,$5E,$EC,$43,$00,$00,$00,$00,
$46,$54,$4A,$51,$E3,$A4,$A8,$E5,$10,$0A,$09,$0B,$69,$EA,$6C,$34,$10,$58,$EF,$44,$02,$00,$00,$00
);
var
playfield: array [0..127] of byte absolute $0680;
missile: array [0..255] of byte absolute PMB_PAGE+$300;
gmSpeed: array [0..1] of byte = (max_speed - 20, max_speed shr 2);
hiscore: cardinal = 500;
gameMode: TGameMode = gmEndless;
rnd: byte absolute $d20a;
vsc, cntRow, scroll, cntFound, xSel, ySel, found,
joyDelay, joy, yOld, yShift, tick, match, frame_cnt,
minute, left_edge, right_edge, SpeedInc, second, second_,
level, speed, speed_cnt, combo_cnt, monster0_frm, monster1_frm, monster2_frm: byte;
ScrollFreeze: word;
score, score_, hiscore_: cardinal;
vram: ^word;
old_vbl, old_dli, old_irq: pointer;
jump: array [0..5] of Boolean;
FoundThree, ScrollUp, Combo, ShiftKey, monster_score,
stop, fireDelay, fireBtn, msx_play, match_play, move_play, swap_play, msx_faster: Boolean;
msx: TLZSSPlay;
SwapTiles: record
stage,
index,
tile0,
tile1: byte;
p: PByte;
end;
{$i printTime.inc}
{$i printSpeed.inc}
{$i printScore.inc}
{$i printHiScore.inc}
{$i monsters.inc}
procedure panelUpdate;
var p: PByte register;
j: byte;
const
ch0 = (bkg_panel and $7f) + 2;
ch1 = (bkg_panel and $7f) + 3;
begin
p:=pointer(vram^ + 29);
for j:=3 downto 0 do begin
p[0] := ch1 xor $80;
p[width] := bkg_panel+1;
p[width*2] := bkg_panel+1;
p[width*3] := bkg_panel+1; inc(p, width*4);
p[0] := ch0 xor $80;
p[width] := bkg_panel;
p[width*2] := bkg_panel;
p[width*3] := bkg_panel; inc(p, width*4);
end;
poke(CHARSET_RAM_ADDRESS + ch0*8 + vsc, $00);
poke(CHARSET_RAM_ADDRESS + $400 + ch0*8 + vsc, $00);
poke(CHARSET_RAM_ADDRESS + ch1*8 + vsc, $ff);
poke(CHARSET_RAM_ADDRESS + $400 + ch1*8 + vsc, $ff);
if vsc = 0 then begin
poke(CHARSET_RAM_ADDRESS + ch0*8+1, $ff);
poke(CHARSET_RAM_ADDRESS + ch0*8+2, $ff);
poke(CHARSET_RAM_ADDRESS + ch0*8+3, $ff);
poke(CHARSET_RAM_ADDRESS + ch0*8+4, $ff);
poke(CHARSET_RAM_ADDRESS + ch0*8+5, $ff);
poke(CHARSET_RAM_ADDRESS + ch0*8+6, $ff);
poke(CHARSET_RAM_ADDRESS + ch0*8+7, $ff);
poke(CHARSET_RAM_ADDRESS + $400 + ch0*8+1, $ff);
poke(CHARSET_RAM_ADDRESS + $400 + ch0*8+2, $ff);
poke(CHARSET_RAM_ADDRESS + $400 + ch0*8+3, $ff);
poke(CHARSET_RAM_ADDRESS + $400 + ch0*8+4, $ff);
poke(CHARSET_RAM_ADDRESS + $400 + ch0*8+5, $ff);
poke(CHARSET_RAM_ADDRESS + $400 + ch0*8+6, $ff);
poke(CHARSET_RAM_ADDRESS + $400 + ch0*8+7, $ff);
poke(CHARSET_RAM_ADDRESS + ch1*8+1, $00);
poke(CHARSET_RAM_ADDRESS + ch1*8+2, $00);
poke(CHARSET_RAM_ADDRESS + ch1*8+3, $00);
poke(CHARSET_RAM_ADDRESS + ch1*8+4, $00);
poke(CHARSET_RAM_ADDRESS + ch1*8+5, $00);
poke(CHARSET_RAM_ADDRESS + ch1*8+6, $00);
poke(CHARSET_RAM_ADDRESS + ch1*8+7, $00);
poke(CHARSET_RAM_ADDRESS + $400 + ch1*8+1, $00);
poke(CHARSET_RAM_ADDRESS + $400 + ch1*8+2, $00);
poke(CHARSET_RAM_ADDRESS + $400 + ch1*8+3, $00);
poke(CHARSET_RAM_ADDRESS + $400 + ch1*8+4, $00);
poke(CHARSET_RAM_ADDRESS + $400 + ch1*8+5, $00);
poke(CHARSET_RAM_ADDRESS + $400 + ch1*8+6, $00);
poke(CHARSET_RAM_ADDRESS + $400 + ch1*8+7, $00);
end;
end;
procedure timeUpdate;
begin
if (stop = false) and (scroll = 0) then
if gameMode = gmTimeTrial then begin
dec(second);
if second = $ff then begin
second := 59;
dec(minute)
end;
end else begin
inc(second);
if second > 59 then begin
second:=0;
inc(minute);
end;
end;
end;
procedure IRQ; interrupt; assembler;
asm
sta rA
lda pmc: pm_color
sta color3
inc pmc
lda #0 ; reuse IRQ
sta irqen
lda #4
sta irqen
lda rA: #0
end;
procedure PlaySAP; assembler; keep;
asm
lda MSX
ldy MSX+1
jsr SAPLZSS.TLZSSPLAY.Decode
lda MSX
ldy MSX+1
jmp SAPLZSS.TLZSSPLAY.Play
end;
procedure NMI; interrupt; assembler;
asm
bit nmist
bpl vbl
jmp (vdslst)
vbl sta stimer ; restart IRQ
sta rA
stx rX
sty rY
sta nmist
; ---
lda #0
sta IRQ.pmc
; ---
; -----------------------
; play msx
; ----------------------
@ lda msx_play
beq @+
lda MSX
ldy MSX+1
jsr SAPLZSS.TLZSSPLAY.Decode
lda MSX
ldy MSX+1
jsr SAPLZSS.TLZSSPLAY.Play
; -----------------------
; sfx match
; ----------------------
@ ldy match_play
beq @+
lda sfx_match_audf: $1000,y
sta audf1
iny
lda sfx_match_audc: $1000,y
sta audc1
iny
sty match_play
cpy #18+1
bne @+
lda #0
sta match_play
; -----------------------
; sfx move
; ----------------------
@ ldy move_play
beq @+
lda adr.sfmove,y
sta audf2
iny
lda adr.sfmove,y
sta audc2
iny
sty move_play
cpy #18+1
bne @+
lda #0
sta move_play
; -----------------------
; sfx swap
; ----------------------
@ ldy swap_play
beq @+
lda adr.sfswap,y
sta audf3
iny
lda adr.sfswap,y
sta audc3
iny
sty swap_play
cpy #18+1
bne @+
lda #0
sta swap_play
; ----------------------
@ inc rtclok+2
mva sdmctl dmactl
mwa SDLSTL dlptr
:5 mva 708+# $d016+#
lda >CHARSET_RAM_ADDRESS
.def :JGPFirstCharset = *-1
sta JGPCharset
; lda #$48
; sta color1
; lda #$8c
; sta color2
lda #128-29
sta dliCnt ; unit JPG2 ; procedure JGPDLI
lda rtclok+2
and #8
sta atract
:3 lsr @
pha
add left_edge
sta hposm0
pla
eor #$ff
adc right_edge
sta hposm3
lda ScrollFreeze
ora ScrollFreeze+1
bne @+
:2 inc speed_cnt
@
dec tic
bpl toExit
mva #49 tic
jsr timeUpdate
toExit
lda rA: #0
ldx rX: #0
ldy rY: #0
rti
tic dta 49
end;
function TilesFallDown: Boolean;
var k: byte;
begin
Result:=false;
for k:=15*6-1 downto 0 do
if playfield[k] <> 0 then
if playfield[k+6] = 0 then begin
playfield[k+6] := playfield[k];
playfield[k] := 0;
Result:=true;
if move_play = false then move_play := true;
end;
end;
function onInvers(a: byte): byte; inline;
begin
if (a=0) or (a=5) {or (a=17)} then // blok z wykrzyknikiem w inwersie
Result := $80 + 2 // przesuniecie +2 ze wzgledu na pierwszy 2 bajtowy Tiles reprezentujacy puste pole
else
Result := 2;
end;
function TileCode(a: byte): byte;
var inv: byte;
begin
if a <> 0 then begin
dec(a);
inv := onInvers(a);
a:=a shl 2 + inv;
end;
Result:=a;
end;
procedure DrawVerticalJumpTiles(x, c: byte);
var i, a, inv, k: byte;
p: PByte absolute $e0;
begin
p:=pointer(vram^ + x shl 2 + 4);
if cntRow <> 0 then dec(p, width);
k:=x;
for i:=14 downto 0 do begin
a := playfield[k];
if a >= 1 then
if a < 7 then begin
dec(a);
inv := onInvers(a);
if c and 15 >= 8 then inc(a, 6);
a:=a shl 2+inv;
p[0]:=a;
p[width]:=a;
inc(a);
p[1]:=a;
p[width+1]:=a;
inc(a);
p[2]:=a;
p[width+2]:=a;
inc(a);
p[3]:=a;
p[width+3]:=a;
end;
inc(p, width*2);
inc(k, 6);
end;
end;
procedure DrawHorizontalTiles(p: PByte; k: byte); register;
var i, a, inv: byte;
begin
for i:=5 downto 0 do begin
a := playfield[k];
// if a = 128+6 then a:=0;
if a = 0 then begin // Tile 0, puste pole
p[0]:=0;
p[1]:=0;
p[2]:=0;
p[3]:=0;
p[width]:=0;
p[width+1]:=0;
p[width+2]:=0;
p[width+3]:=0;
end else begin
dec(a);
if a>=128 then a:=a and $7f + 12;
inv := onInvers(a);
a:=a shl 2 + inv;
if a = 70 then begin // tile ATARI trafiony
p[0]:=a;
p[width]:=a or $80;
inc(a);
p[1]:=a;
p[width+1]:=a or $80;
inc(a);
p[2]:=a;
p[width+2]:=a or $80;
inc(a);
p[3]:=a;
p[width+3]:=a or $80;
end else begin // pozosta³e tilesy
p[0]:=a;
p[width]:=a;
inc(a);
p[1]:=a;
p[width+1]:=a;
inc(a);
p[2]:=a;
p[width+2]:=a;
inc(a);
p[3]:=a;
p[width+3]:=a;
end;
end;
inc(p, 4); // +4
inc(k);
end;
end;
procedure sfx_match;
begin
case match of
0:
asm
lda <adr.match1
sta NMI.sfx_match_audf
sta NMI.sfx_match_audc
lda >adr.match1
sta NMI.sfx_match_audf+1
sta NMI.sfx_match_audc+1
end;
1:
asm
lda <adr.match2
sta NMI.sfx_match_audf
sta NMI.sfx_match_audc
lda >adr.match2
sta NMI.sfx_match_audf+1
sta NMI.sfx_match_audc+1
end;
else
asm
lda <adr.match3
sta NMI.sfx_match_audf
sta NMI.sfx_match_audc
lda >adr.match3
sta NMI.sfx_match_audf+1
sta NMI.sfx_match_audc+1
end;
end;
inc(match);
match_play:=true;
end;
procedure UpdateTiles;
var p: PByte absolute $e0;
j, k: byte;
begin
tick:=0;
p:=pointer(vram^ + 4);
if cntRow <> 0 then dec(p, width);
k:=0;
for j:=15 downto 0 do begin
DrawHorizontalTiles(p, k);
inc(k, 6);
inc(p, width*2);
end;
end;
function FindThreeInRow: Boolean;
var i: byte;
ok: Boolean;
p: PByte absolute $e0;
q: PByte absolute $e2;
procedure Horizontal(n: byte);
var a: byte;
begin
a:=p[0] and $7f;
if a < 7 then
if a >= 1 then
if a = p[1] and $7f then
if p[1] and $7f = p[2] and $7f then begin
p[0]:=a or 128;
p[1]:=p[0];
p[2]:=p[0];
ok := true;
end;
end;
procedure Vertical;
var a: byte;
begin
a:=p[0] and $7f;
if a < 7 then
if a >= 1 then
if a = p[6] and $7f then
if p[6] and $7f = p[12] and $7f then begin
p[0]:=a or 128;
p[6]:=p[0];
p[12]:=p[0];
ok := true;
end;
end;
begin
ok := false;
q:=playfield;
for i:=14 downto 0 do begin