-
Notifications
You must be signed in to change notification settings - Fork 4
/
FR.ASM
1302 lines (1107 loc) · 12.9 KB
/
FR.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
* fred 1.0 *
opt h+
icl 'd1/COMMON.ASM'
org fred
jmp strtfred
jmp r
jmp dsfred
jmp toxy
jmp sa
jmp get2cav
*- jump table
test jmp begn+3
xytoad jmp begn+6
gete jmp begn+9
pute jmp begn+12
zni2d jmp begn+27
swyb jmp begn+30
okfaz jmp begn+33
fire jmp ciski+6
levbeg jmp ciski+15
putit jmp ciski+18
setmig jmp ciski+21
getit jmp ciski+24
tstit jmp ciski+27
bonus jmp ciski+30
inscor jmp ciski+33
*********************
strtfred equ *
bit demo
bpl *+5
jmp erght
lda fmfl
bne *+5
jsr insyl
*- test move enable
* fmfl 11000001
* || └ jump
* |└────── on line
* └─────── fall
tmen equ *
lda deadfl
beq *+5
jmp dfred
lda fmfl
beq tj
bmi ffl
asl @
bmi tj
jsr jump
jmp dfred
ffl equ *
jsr fall
jmp dfred
*- test joystick
tj equ *
lda stck
and stck+1
and stck+2
and stck+3
*- call move procedures
ldx #8
cmp joyval,x
beq *+6
dex
bpl *-6
r rts
tay
lda fmfl ;na linie wiew 3
asl @
bmi norg
tya
*- turn fred (set wiew)
sta tmp
lsr @
bcs *+6
*- up pressed
ldy #0
sty tmp
lsr @
lsr @
bcs nolf
*- joy left
ldy #2
sty wiew
nolf lsr @
bcs norg
*- joy right
ldy #1
sty wiew
norg txa ;bez ruchu
bne *+4 ;sylwetka stojaca
sta sylnum
asl @
tax
lda moveproc,x
sta jmp+1
lda moveproc+1,x
sta jmp+2
jmp jsr jmp
dfred equ *
lda ptrg
and ptrg+1
bne nofire
ldy >$d300 ;•
sty hlp2+1 ;•
ldy <$d300 ;•
sty hlp2 ;•
lda (hlp2),y ;•
sta bomb ;•
beq jook ;•
iny ;•
iny ;•
lda #$38 ;•
sta (hlp2),y ;•
tya ;•
tax ;•
dey ;•
dey ;•
lda (hlp2),y ;•
sta bomb ;•
txa ;•
tay ;•
lda #$3c ;•
sta (hlp2),y ;•
jook equ * ;•
jsr fire
nofire equ *
lda ptrg
and ptrg+1
sta firdel
lda wiew
asl @
asl @ *16
asl @
asl @ clc
asl @
sta tmp
lda sylnum
asl @
adc tmp
sta defnum
*- test ground under fred
lda fmfl
bne notst ;if jump or fall no test
lda #$80
sta jfco ;big fall
lda #0
sta jdir ;only down
jmp fall
notst rts
* CC if space free
ftd equ *
lda fpy
and #$0f
beq cftd
lda #24 ;lapaj line
jsr ftdu
clc
rts
cftd equ *
lda fpy
bpl cft1
cmp #142
bcc nob
cmp #$e0
bcs nob
lda bulfl
bpl nob
inc bulfl
nob equ *
clc
rts
cft1 equ *
lda #$ff
sta bulfl
lda #0
jsr ftdu
php
cpy #$2d
bne *+5
jsr zni2d
plp
r01 rts
*- test char up fred
ftu lda #23
jmp ftdu
*- test char left fred
ftl lda #1
jmp ftrl
ftr lda #6
jmp ftrl
*--------------------
ftdu equ *
sta fthlp
ldx #2 ;right legg
ldy fthlp ;down fred
jsr toxy
jsr test
sty fxytst
bmi ch2l
jsr titem
bcs r01
ch2l ldx #5 ;left legg
ldy fthlp
jsr toxy
jsr test
bpl *+4
clc
rts
cpy #$1e ;lina
beq line
cpy #$0c
beq line
cpy #$0d
beq line
* jmp titem
titem equ *
cmp #5
beq capsule
cmp #7
beq *+5
cpy #$20
rts
jsr gete
ldx bonitc
cpx #4
bcs *+4
inc bonitc
lda itm_
asl @
tax
lda itproc,x
sta jit+1
lda itproc+1,x
sta jit+2
jit equ *
jsr *
lda #$80
sta itm_
clc
rts
capsule equ *
jsr gete
lda #1
jsr sound
ldx bonitc
cpx #4
bcs *+4
inc bonitc
lda #1
jsr inscor
ldx kamco
cpx #rockv
bcs full
inx
stx kamco
rts
full equ *
lda #rocka
jsr putit
bcc *+3
rts
lda #1
sta kamco
rts
*- fred na linie
line equ *
cpy fxytst
bne cr
lda fxreal
and #%00000111
cmp #%00000110
bne cr
lda #$40
sta fmfl
lda #3
sta wiew
lda #$39
jsr sound
cr clc
rts
ftrl equ *
sta fthlp
ldy #1
ldx fthlp
jsr toxy
jsr test
jsr titi
bcs rxx
ch3l ldy #16
ldx fthlp
jsr toxy
jsr test
jsr titi
bcs rxx
ch4l ldy #28
ldx fthlp
jsr toxy
jsr test
jmp titi
titi bmi cr
jmp titem
itproc equ *
dta a(copka),a(spray),a(rock)
dta a(tnt),a(kaktus),a(unvi)
dta a(buty),a(0),a(extralife)
extralife equ *
inc zycia
lda #$0d
jmp sound
copka equ *
lda #$5
jsr sound
lda #2
jsr inscor
lda #cpka
jsr putit
bcs rxx
lda copkco
bne rxx
lda #cpkval
sta copkco
rxx equ *
rts
tnt equ *
lda #2
cmp vcou
bne *-3
lda #$0e
sta $d01a
lda #$80
sta tntfl
lda #0
jsr sound
lda #10
jmp inscor
rock equ *
lda #$2
jsr sound
lda #2
jsr inscor
lda kamco
beq *+9
lda #rocka
jsr putit
bcc rxx
lda #rockv
sta kamco
rts
spray equ *
lda #$8
jsr sound
lda #3
jsr inscor
lda spraco
beq tobotl
lda #spra
jsr putit
bcc rxx
tobotl equ *
lda #40
sta spraco
lda leci
bmi *+3
rts
lda #1
sta bron
rts
kaktus equ *
lda #$50
jsr inscor
lda #$4
jmp sound
unvi equ *
ldx #$80
lda $380,x
cmp $500,x
bne nolod
inx
bne *-9
lda #0
beq *+5
nolod equ *
lda rnd
sta bomhk
lda #$6
jsr sound
lda #2
jsr inscor
lda #unv
jsr putit
bcc *+3
rts
lda #unvval
ldy unvico
bne *+4
sta unvico
rts
buty equ *
lda #7
jsr sound
lda #2
jsr inscor
lda #but
jsr putit
bcc *+3
rts
lda #butv
ldy butco
bne *+4
sta butco
rts
*- fred position to XY
toxy equ *
stx x
sty y
sec
lda fpx
adc x
sbc hsc
sta fxreal
lsr @
lsr @
lsr @
clc
adc scrnum
sta x
sec
lda fpy
sbc y
bpl *+4
lda #0
lsr @
lsr @
lsr @
lsr @
and #$7
sta y
r1 rts
left equ *
lda fmfl
asl @
bmi r1
tfl jsr ftl
bcs r1
ldx fpx
cpx #48
bcc *+5
dec fpx
rts
jmp eleft
rght equ *
lda fmfl
asl @
bmi r1
tfr jsr ftr
bcs r1
ldx fpx
cpx #104
bcs *+5
inc fpx
r4 rts
jmp erght
*-- down fred
dn equ *
lda fmfl
asl @
bmi dn0
lda #0
sta sylnum
rts
dn0 equ *
lda bomb
bmi joko
lda #ver
beq joko
lda #$80
sta upspd
sta upspd+1
joko equ *
lda #$80
sta fmfl
lda #0
jsr ftdu
cpy #$20
beq grunt
jsr ftd
bcs noli
lda fmfl
asl @
bmi cdn
noli equ *
lda #$80
sta jfco
sta fmfl
lda #0
sta jdir
sta sylnum
lda #1
sta wiew
jmp fall
cdn equ *
inc fpy
inc fpy
ldx sylnum
cpx #8
bcs *+4
ldx #7
inx
cpx #16
bcc *+4
ldx #8
stx sylnum
rts
grunt equ *
ldx #0
stx fmfl
stx sylnum
inx
stx wiew
dec fpy
rts
fall equ *
lda bulfl
bmi *+3
rts
jsr ftd
bcc cofl
efl lda fmfl
asl @
bmi *+6
lda #$0 ;no fall
sta fmfl ;joy test ok
r5 rts
cofl equ *
lda butco
beq cof1
lda fpy
bpl cof1
cmp #152 ;>>128
bcs cof1
lda #128
sta fpy
ldx butco
dex
stx butco
beq tstnxbut
cpx #15
bne efl
*- mig butem
lda #but
jsr setmig
jmp efl
tstnxbut equ *
lda #but
jsr getit
bcs cof1
lda #but
jsr tstit
bcs cof1
lda #butv
sta butco
bne efl ;jmp
cof1 equ *
lda fmfl
asl @
bmi efl
lda #$80 ;fall
sta fmfl ;no joy test
ldx jfco ;80 to fall bez skoku
cpx #$80
bne fcon
ldx #9
inx ;search first fall size
lda upspd,x
bpl *-4
inx
stx jfco
fcon equ *
*- set sylwetke
jsr sesjf
lda upspd,x
sta jfh
fll inc fpy
jsr ftd
bcs efl
dec jfh
bpl fll
inc jfco
lda jdir
beq r5
bmi *+5
jmp rght
jmp left
*- jump right
jr lda #1
sta jdir
lda fmfl
asl @
bpl jp
lda #1
bne swc
*- jump left
jl lda #$ff
sta jdir
lda fmfl
asl @
bpl jp
lda #2
swc pha
jsr ftu
cpy #$20
bne swc1
lda #%01000000
sta fmfl
pla
rts
swc1 equ *
pla
sta wiew
bne jp
*- jump up
ju equ *
lda fmfl
asl @
bpl coju
*- fred up on line
jsr ftu
bcc *+3
rts
dec fpy
jsr ftu
bcs *+4
dec fpy
insyl equ *
ldx sylnum
cpx #7
inx
bcc *+4
ldx #0
stx sylnum
rts
coju equ *
lda #0
sta jdir
jp lda #1
sta fmfl
ldx #0
stx jfco
rts
jump equ *
lda jdir
beq cj
bmi *+8
jsr rght
jmp cj
jsr left
cj equ *
ldx jfco
*- set sylwetke
jsr sesjf
ldy upspd,x
bmi eup
sty jfh
jupl dec fpy
jsr ftu
bcs eup
dec jfh
bpl jupl
inc jfco
rts
eup equ *
ldx #$80
stx jfco
lda fmfl
asl @
bmi *+4
stx fmfl
rts
*- set sylwetke in jump & fall
sesjf equ *
txa
cmp #8
bcc *+4
lda #6 ;sec
adc #8
sta sylnum
r8 rts
dspf equ * ;disp half freda
ldy #0
cppl lda (tmp),y
sta plrdef,x
lda (hlp),y
sta plrdef+$100,x
inx
iny
cpy #16
bne cppl
rts
sa equ *
ldx #0
stx tmp+1
asl @
rol tmp+1
asl @
rol tmp+1
asl @
rol tmp+1
asl @
rol tmp+1 ;clc
adc <plfnt
sta tmp
sta hlp
lda tmp+1
adc >plfnt
sta tmp+1
clc
lda tmp+1
adc >$400
sta hlp+1
rts
*- clear old shape
dsfred equ *
lda bulfl
bmi tded
bne *+7
lda #3
jsr sound
jsr clfred
ldx #130
ldy #15
lda #0
clrb sta plrdef,x
sta plrdef+$100,x
inx
dey
bpl clrb
ldx bulfl
lda bfaz,x
inx
stx bulfl
cpx #8
bcs tsgdzie
jsr sa
ldx #130
jmp dspf
tsgdzie equ *
jsr bonus
bcs qdb
inc zycia
jmp qdb
tded equ *
lda deadfl
beq life
jsr bonus
bcs dego
lda timebo
bne dego
inc zycia
jmp qdb
dego equ *
lda deadco
bne *+7
lda #$b
jsr sound
lda #0
sta deadco
ldx fpyo
ldy #31
clr equ *
lda plrdef,x
and rnd
sta plrdef,x
beq *+4
sta deadco
lda plrdef+$100,x
and rnd
sta plrdef+$100,x
beq *+4
sta deadco
inx
dey
bpl clr
lda deadco
beq *+3
rts
jsr bonus
bcs qdb
inc zycia
qdb equ *
dec zycia
jsr clfred
jmp levbeg
life equ *
jsr clfred
*- display fred
ldx defnum
lda fst+1,x
jsr sa
ldx fpy
jsr dspf
ldx defnum
lda fst,x
jsr sa
clc
lda fpy
adc #16
tax
jsr dspf
lda fpy
sta fpyo
lda fpx
sta fpxo
rts
clfred equ *
ldx fpyo
ldy #31
lda #0
clrp sta plrdef,x
sta plrdef+$100,x
inx
dey
bpl clrp
rts
*- set spray
spr equ *
lda #0
sta sylnum
lda bron
beq *+3
rts
lda spraco
beq *-3
lda #1
jmp ssss
*- set kamien
kam equ *
lda #0
sta sylnum
lda bron
bne *+3
rts
lda kamco
beq *-3
lda #0
ssss equ *
ldx leci
bmi *+3