-
Notifications
You must be signed in to change notification settings - Fork 4
/
CI.ASM
1629 lines (1379 loc) · 15 KB
/
CI.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
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
* pociski i inne *
icl 'd1/COMMON.ASM'
opt h+
org ciski
jmp spar
jmp dpoci
jmp fire
jmp detcol
jmp info
jmp levbeg
jmp putit
jmp setmig
jmp getit
jmp tstit
jmp bonus
jmp inscor
jmp quit
*- jump table
test jmp begn+3
xytoad jmp begn+6
pute jmp begn+12
zerccc jmp begn+15
stempo jmp begn+18
zni2d jmp begn+27
swyb jmp begn+30
okfaz jmp begn+33
toxy jmp fred+9
sa jmp fred+12
get2cav jmp fred+15
dlist dta b($f0),d'pp'
dta b(l),a(cvsc+000),b(l),a(cvsc+000)
dta b(l),a(cvsc+036),b(l),a(cvsc+036)
dta b(l),a(cvsc+072),b(l),a(cvsc+072)
dta b(l),a(cvsc+108),b(l),a(cvsc+108)
dta b(l),a(cvsc+144),b(l),a(cvsc+144)
dta b(l),a(cvsc+180),b(l),a(cvsc+180)
dta b(l),a(cvsc+216),b(l),a(cvsc+216)
dta b(l),a(cvsc+252),b(l),a(cvsc+252)
codl equ *
dta B($90),b($4d),a(posp),d'P'
dta b($c4),a(qbu+0),b($c4),a(qbu+0),B($50)
dta b($c4),a(qbu+32),b($c4),a(qbu+32)
dta b($c4),a(qbu+64),b($c4),a(qbu+64)
dta b($41),a(dlist)
levdl dta B($F0),d'pppppppppp'
dta b(l),a(levscr),b(l),a(levscr)
dta B($F0),d'p`ppp!',a(codl)
quit equ *
ldx ostos
txs
ldx levnum
bit demo
bpl *+4
ldx olev
lda beta,x
sta levnum
ldy #1
rts
*- Main
spar EQU *
tsx
stx ostos
stx 17
ldx #3
lda codn,x
sta colors,x
dex
bpl *-6
php
lda poke
bne spaspa
lda #0
bne spaspa
inc *-3
sta levnum
sta hisc
sta hisc+1
sta hisc+2
spaspa equ *
plp
lda #0
sta demo
sta colmig
bcc nodemo
lda #$80
sta demo
lda levnum
sta olev
lda #8
sta levnum
nodemo equ *
lda ptrg
and ptrg+1
sta firdel
lda <extra
sta exlif+1
lda >extra
sta exlif+2
lda #0
sta 559
sta exlif
sta exlif
sta score
sta score+1
sta score+2
jsr halt
ldx #3
lda colf,x
sta 704,x
dex
bpl *-7
lda #$c0
sta $d40e
LDX #11
LDA #0
STA $D000,X
DEX
BPL *-4
lda #%01010101
sta $d00c
ldx #3
ldy #$41
tya
sta $d004,x
iny
dex
bpl *-6
lda #$21
sta 623
lda #3
sta $d01d ;** gracze
lda >plrdef
sta $d407 ;pmbas
ldx #0
clp equ *
lda #$00
sta plrdef-$100,x
sta plrdef,x
sta plrdef+$100,x
sta plrdef+$200,x
sta plrdef+$300,x
inx
bne clp
stx 730
stx 729
lda <maint
sta scra
lda >maint
sta scra+1
jsr halt
LDA <DLIST
STA DLSTV
LDA >DLIST
STA DLSTV+1
lda #5
sta zycia
jsr setlevel
jsr dajstwory
jsr gc
jmp begn
setlevel equ *
ldx levnum
bit demo
bpl *+4
ldx #8
ldy leva,x
dey
dey
sty cave
rts
levdli pha
lda vcou
cmp #8
bcs dli1
lda #0
sta dlmo
lda 20
lsr @
lsr @
and #8
bne *+4
lda #$0c
sta $d019
lda colors+3
sta $d012
sta $d013
sta $d014
sta $d015
lda #$21
sta $d01b
lda colors
sta $d016
lda colors+1
sta $d017
lda colors+2
sta $d018
dli1 lda dlmo
lsr @
lda >dnfnt
bcc *+4
adc >$400-1
sta $d409
inc dlmo
pla
rti
halt lda 20
cmp 20
beq *-2
rts
newlevel equ *
inc levnum
lda levnum
tax
cmp #10 ;koniec gry
bcc noend
lda #0
sta levnum
ldx ostos
txs
ldy #0
rts
noend equ *
pha
lda #0
sta qbu+130+11+2
sta qbu+130+11+3
pla
clc
adc #1
ldx #130+11
cmp #10
bcc *+9
lda #1
jsr dspd
lda #0
jsr dspd
lda <levdl
sta 560
lda >levdl
sta 561
jsr halt
lda $200
pha
lda $201
pha
lda <levdli
sta $200
lda >levdli
sta $201
ldy #21
roll equ *
jsr halt
ldx #0
lda levscr+1,x
sta levscr,x
inx
cpx #50
bcc *-9
dey
bpl roll
lda #$0c
jsr sound
ldx #50
jsr halt
dex
bpl *-4
ldy #21
rorr equ *
jsr halt
ldx #50
lda levscr,x
sta levscr+1,x
dex
bpl *-7
dey
bpl rorr
ldx #20
jsr halt
dex
bpl *-4
jsr dajstwory
jsr setlevel
jsr setlpar
ldx #0
txa
sta cvsc,x
sta cvsc+32,x
inx
bne *-7
jsr halt
LDA <DLIST
STA DLSTV
LDA >DLIST
STA DLSTV+1
pla
sta $201
pla
sta $200
jmp zerccc
dajstwory equ *
lda levnum
asl @
asl @
ora #3
tay
ldx #3
lda cols,y
sta 708,x
dey
dex
bpl *-8
lda levnum ;^^^
tax
lda rndtab,x
sta ittab
sta ittab+1
sta ittab+2
sta ittab+3
ldy levnum
ldx tempot,y
lda ptempo,y
jsr stempo
ldx stwort,y
lda gdzie,x
beq nocop
pha
ldy #3
lda gdzie,y
beq znal
dey
bpl *-6
znal equ *
sta gdzie,x
pla
sta gdzie,y
tax
dex ;0,1,2
clc
lda <dnfnt
adc incf,x
sta hlp1
lda #0
adc >dnfnt
sta hlp1+1
clc
lda <nxfnt
adc #48
sta hlp2
lda #0
adc >nxfnt
sta hlp2+1
cophg equ *
ldx #7
cop0 equ *
ldy #47
cop1 equ *
lda (hlp2),y
pha
lda (hlp1),y
sta (hlp2),y
pla
sta (hlp1),y
dey
bpl cop1
inc hlp1+1
inc hlp2+1
dex
bpl cop0
nocop equ *
rts
levbeg equ *
jsr bonus
bcs *+5
jmp newlevel
lda zycia
bpl nodead
jmp quit
nodead equ *
jsr setlevel
gc equ *
jsr setlpar
lda #0
sta czapa
sta spraco
sta copkco
sta unvico
sta butco
sta bron
lda #9
sta kamco
ldx #pockln-1
lda #$80
sta migt,x
sta pocket,x
dex
bpl *-7
jmp zerccc
setlpar equ *
jsr get2cav
jsr get2cav
lda #0
sta sylnum
sta fmfl
sta yin
sta scrnum
sta zegar
sta itco_
sta deadfl
sta deadco
sta $d01e
sta tntfl
lda #$39
jsr sound
lda #9
sta x
tg0 equ *
lda #3
sta y
tg equ *
jsr test
cpy #$20
beq puf
inc y
cpy #8
bne tg
inc x
cpx #15
bne tg0
brk
puf equ *
lda x
asl @
asl @
asl @
adc #8
sta fpx
sta fpxo
lda y
asl @
asl @
asl @
asl @
sta fpy
sta fpyo
lda #$80
sta leci
sta itm_
sta bulfl
lda #8
sta hscr
sta hsc
lda #220
sta $d002
sta $d003
sta kx
lda #1
sta wiew
rts
dpoci equ *
lda ptrg
and ptrg+1
beq *+7
lda #$39
jsr sound
lda bron
beq *+7
lda #220
sta kx
rts
lda leci
bpl *+3
rts rts
tarea equ *
lda kx
cmp #12
bcc znik
cmp #140
bcs znik
lda ky
cmp #$a0
bcs znik
lda fpx
pha
lda fpy
pha
lda kx
sta fpx
lda ky
sta fpy
ldx #3
ldy #24
jsr toxy
jsr test
tax
pla
sta fpy
pla
sta fpx
jsr kol23
beq crt
cpy #$1e ;lina
beq crt
cpy #$80
beq blolr
cpy #$1d
beq crt
jsr znik
cpy #$10
bne *+5
jsr litem
cpy #$0e
bcs crt
sbu equ *
jsr znik
sbi equ *
lda #5
jsr inscor
jsr swyb
clc
rts
znik equ *
lda #220
sta kx
lda #$80
sta leci
tya
pha
txa
pha
lda #$0a
jsr sound
pla
tax
pla
tay
rts
crt equ *
clc
lda kx
adc kdir
sta kx
ldx leci
lda kdy,x
inx
cmp #$80
bne *+5
dex
lda #6
stx leci
tax
adc ky
sta ky
lda #63
jmp dkm
blolr equ *
dec x
jsr test
tya
and #%10111111
beq brt
cmp #5
bcc sbu
brt equ *
inc x
inc x
jsr test
tya
and #%10111111
beq crt
cmp #5
bcc sbu
jmp crt
dkm equ *
pha
ldx kyo
ldy #15
lda #$00
clrk equ *
sta plrdef+$200,x
sta plrdef+$300,x
inx
dey
bpl clrk
pla
jsr sa
ldx ky
ldy #0
cppk equ *
lda (tmp),y
sta plrdef+$200,x
lda (hlp),y
sta plrdef+$300,x
inx
iny
cpy #16
bne cppk
lda kx
sta kxo
lda ky
sta kyo
rts
fire equ *
ldx wiew
cpx #3
beq rrr
ldx deadfl
bne rrr
ldx leci
bmi *+3
rrr rts
lda bron
bne spray
ldx kamco
beq rrr
lda firdel
beq rrr
dec kamco
bne setdir
lda #rocka
jsr getit
bcs setdir
lda #rockv
sta kamco
setdir equ *
ldx wiew
beq rrr ;rts
cpx #3
bcs rrr ;rts
inx
cpx #2
beq *+4
ldx #$fe
stx kdir
jsr setpos
lda #0
sta leci
lda #63
jmp dkm
spray equ *
lda spraco
bne decspr
gspr equ *
lda #spra
jsr getit
bcs *+7
lda #40
sta spraco
rts
lda #0
sta bron
lda #$29
jmp sound
decspr equ *
dec spraco
lda spraco
bne *+5
jmp gspr
lda #$19
jsr sound
jsr setpos
ldx kyo
ldy #15
lda #0
sta plrdef+$200,x
sta plrdef+$300,x
inx
dey
bpl *-8
clc
lda wiew
adc #60
jsr sa
ldx ky
ldy #0
cpp equ *
lda (tmp),y
and rnd
and rnd
and rnd
sta plrdef+$200,x
lda (hlp),y
and rnd
and rnd
sta plrdef+$300,x
inx
iny
cpy #16
bne cpp
lda kx
sta kxo
lda ky
sta kyo
jsr kol23
bne *+3
rts
ldx wiew
dex
beq rtt
inc x
jsr wybua
dec x
jmp dali
rtt equ *
dec x
jsr wybua
inc x
dali equ *
jsr wybua
dec y
wybua equ *
jsr test
cpy #$10
beq litem
cpy #$e
bcs rx
jmp sbi
litem equ *
cpx #6
beq *+3
rx rts
ldx #0
stx itco_
pha
tya
pha
lda #$f
jsr sound
lda #0
tay
ldx #pockln-1
cmp pocket,x
bne *+3
iny
dex
bpl *-7
tya
bne itrnd
ldy levnum
lda #$03
cpy #3
bcs *+4
lda #$07
and rnd
beq itok
itrnd equ *
lda rnd
and #$0f
tax
lda ittab,x
cmp #6
bne itok ;-buty
lda levnum
cmp #0
beq itrnd
lda #6
itok equ *
ldy #0
ldx #pockln-1
cmp pocket,x
bne *+3
iny
dex
bpl *-7
cpy #2
bcs itrnd
sta itm_
tax
inx
txa
ldx <dnfnt
stx hlp1
stx hlp2
ldx >dnfnt
stx hlp1+1
inx
inx
inx
inx
stx hlp2+1
cmp #5
bcc cnor
sbc #5
inc hlp1+1
inc hlp1+1
inc hlp2+1
inc hlp2+1
cnor equ *
asl @
asl @
asl @
asl @
tay
ldx #0
from equ *
lda (hlp1),y
sta font+112,x
sta font1+112,x
lda (hlp2),y
sta font+$400+112,x
sta font1+$400+112,x
iny
inx
cpx #16
bcc from
lda #$47
ldx itm_
cpx #4
bne *+4
ora #$80
cpx #9
bne *+4
lda #5
jsr pute
pla
tay
pla
rts
setpos equ *
lda wiew
cmp #1
beq srt
cmp #2
beq slt
sec
rts
slt equ *
ldx #1
ldy #1
jsr toxy
dec x
lda #$fc
ldx bron
beq *+4
lda #$f9
sta stak+1
jmp stak-1
srt equ *
ldx #6
ldy #1
jsr toxy
inc x
lda #5
ldx bron