-
Notifications
You must be signed in to change notification settings - Fork 4
/
HK_MAIN.ASM
1945 lines (1635 loc) · 16.7 KB
/
HK_MAIN.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
;◢▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀◣
;| "Hans Kloss" |
;| ---------------- |
;| |
;| 19 th March 1992 |
;| 19:34 |
;◥▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄◤
opt h+
org $1000
adr1 equ $b0
adr2 equ $b2
adr3 equ $b4
adca equ $b6
admin equ $b8
dlptr equ $0230
chbase equ $d409
dliv equ $0200
jstick0 equ $0278
strig0 equ $0284
random equ $d20a
init equ *
lda #$3c
sta $d303
lda <start
sta 12
lda >start
sta 13
lda #1
sta 9
jmp $e474
start equ *
lda #$ff
sta $d301
lda <reset
sta adr1
lda >reset
sta adr1+1
starlop equ *
ldy #0
lda (adr1),y
eor #17
sta (adr1),y
inc adr1
bne *+4
inc adr1+1
lda adr1+1
cmp >prgend
bcc starlop
lda adr1
cmp <prgend
bcc starlop
lda #1
sta 580
jmp reset
dta d'Written by:D.Zolna'
reset equ *
tsx
stx stos
ldx <muz
ldy >muz
lda #$70
jsr amp_
ldx #$00
lda #$00
jsr amp_
lda #255
sta music
begin equ *
ldx stos
txs
ldy #0
tya
bgn0 equ *
sta ekran,y
sta mapekr,y
sta mapekr+256,y
sta mapekr+480,y
dey
bne bgn0
lda <titdl
sta dlptr
lda >titdl
sta dlptr+1
ldy #8
lda #0
sta 704,y
dey
bpl *-4
lda #64
sta 54286
lda <titdlint
sta dliv
lda >titdlint
sta dliv+1
lda #192
sta 54286
lda <vbint
sta 548
lda >vbint
sta 549
lda >pmb
sta 54279
lda #33
sta 623
lda #61
sta 559
lda #3
sta $d20f
ldy #11
lda #0
sta 53248,y
dey
bpl *-4
ldy #0
sk1 equ *
sta pmb+$300,y
sta pmb+$400,y
sta pmb+$500,y
sta pmb+$600,y
sta pmb+$700,y
iny
bne sk1
lda #3
sta 53277
ldy <kaslen
lda #0
sta char,y
dey
bpl *-4
lda #9
sta food
sta food+1
sta drink
sta drink+1
lda #120
sta xplr
lda #50
sta yplr
lda #255
sta zezw
sta zebrane
sta otwarte
lda <zebrane
sta nrprz
lda >zebrane
sta nrprz+1
lda <otwarte
sta nrdrz
lda >otwarte
sta nrdrz+1
lda #15
sta xcav
sta ycav
jsr showcav
lda #0
ldy #3
sta 53248,y
dey
bpl *-4
lda #$a4
sta 708
lda #$f8
sta 709
lda #$0a
sta 710
lda #$a2
sta 711
lda strig0
beq *-3
titloop equ *
lda <title
sta adtit
lda >title
sta adtit+1
lda >tit
sta zestaw
ldx #4
wtl0 equ *
txa
pha
ldy #0
wtl2 equ *
tya
pha
sty kolor
lda #4
jsr waitfstr
pla
tay
iny
iny
cpy #15
bcc wtl2
pla
pha
cmp #4
bcc wtl3
lda #255
jsr waitfstr
lda #150
jsr waitfstr
wtl3 equ *
lda #100
jsr waitfstr
ldy #14
wtl1 equ *
tya
pha
sty kolor
lda #4
jsr waitfstr
pla
tay
dey
dey
bpl wtl1
lda >got
sta zestaw
lda adtit
clc
adc #64
sta adtit
lda adtit+1
adc #0
sta adtit+1
pla
tax
dex
bpl wtl0
jmp titloop
waitfstr equ *
clc
adc 20
pha
pse1 equ *
pla
cmp 20
bne *+3
rts
pha
lda 20
cmp 20
beq *-2
lda strig0
beq pse2
lda $d01f
cmp #6
beq pse2
lda 764
cmp #255
beq pse1
ldx pozx
cmp haslo,x
beq *+4
ldx #255
inx
stx pozx
lda #255
sta 764
cpx #11
bcc pse1
lda $6ff
eor #255
sta $6ff
beq death
ldy #3
lda guns,y
sta tytul,y
lda guns+4,y
sta tytul+32,y
lda guns+8,y
sta tytul+28,y
lda guns+12,y
sta tytul+60,y
dey
bpl *-25
jmp life
death equ *
ldy #3
lda #0
sta tytul,y
sta tytul+28,y
sta tytul+32,y
sta tytul+60,y
dey
bpl *-13
life equ *
lda #0
sta pozx
sta 20
jmp pse1
pse2 equ *
ldx stos
txs
lda #0
sta zezw
lda #4
jsr zgaskol
lda <newdl
sta dlptr
lda >newdl
sta dlptr+1
lda #64
sta 54286
lda <dlint
sta dliv
lda >dlint
sta dliv+1
lda #192
sta 54286
lda #0
sta ycav
lda #8
sta xcav
lda #$a8
sta 706
lda #$b4
sta 707
lda #$1a
sta 704
lda #$56
sta 705
jsr showcav
lda #$92
sta 708
lda #$a4
sta 709
lda #$7a
sta 710
lda #$1e
sta 711
lda #0
sta 712
ldy #7
lda 704,y
sta zpcol,y
dey
bpl *-7
* glowna petla gry
loop equ *
lda #255
sta 764
sta $d01e
lda jstick0
and #15
sta joy
cmp #13
beq lpo1
cmp #14
bne lpo2
lpo1 equ *
lda #1
jsr pause
jmp norg
lpo2 equ *
lda #2
jsr pause
lda 764
cmp #33
bne *+5
jsr przerwa
lda jstick0
and #15
sta joy
lda yplr
cmp lyplr
bne move
lda yplr
sec
sbc #32
and #7
bne move
lda joy
and #4
bne right
lda #9
sta plfaz
dec xplr
right equ *
lda joy
and #8
bne move
lda #0
sta plfaz
inc xplr
move equ *
jsr fazy
lda yplr
sta lyplr
lda joy
eor #255
and #12
bne *+7
lda #0
sta faza
norg equ *
jsr obekr
jsr sprawdz
testlift equ *
lda joy
cmp #14
beq tsl1
cmp #13
beq tsl1
jmp contloop
tsl1 equ *
lda adr1
pha
lda adr1+1
pha
lda #0
sta pom
ldy #1
jsr readstat
cmp #$0c
bcc ttl1
cmp #$0f
bcs ttl1
lda #2
sta pom
ttl1 equ *
ldy #3
jsr readstat
cmp #$0c
bcc ttl2
cmp #$0f
bcs ttl2
lda pom
ora #1
sta pom
ttl2 equ *
lda pom
bne *+5
jmp jazda
ldx #0
cmp #1
beq ttl4
ldx #9
lda xplr
and #7
beq jazda
ttl4 equ *
stx plfaz
ttl3 equ *
lda #2
jsr pause
jsr fazy
dec xplr
lda pom
cmp #1
bne *+8
inc xplr
inc xplr
jsr showplr
lda xplr
and #7
beq jazda
jmp ttl3
* jazda winda
jazda equ *
pla
sta adr1+1
pla
sta adr1
lda joy
cmp #13
beq wdol
ldy #1
jsr readstat
cmp #$0c
bne *+5
jmp uplift
cmp #$0e
bne *+5
jmp uplift
ldy #3
jsr readstat
cmp #$0c
bne *+5
jmp uplift
cmp #$0e
bne *+5
jmp uplift
jmp contloop
wdol equ *
lda joy
and #1
beq contloop
ldy #1
jsr readstat
cmp #$0d
bne *+5
jmp dwlift
cmp #$0e
bne *+5
jmp dwlift
ldy #3
jsr readstat
cmp #$0d
bne *+5
jmp dwlift
cmp #$0e
bne *+5
jmp dwlift
contloop equ *
jsr skok
jsr showplr
lda 764
cmp #28
bne *+5
jmp brkgame
jmp loop
obekr equ *
lda xplr
sec
sbc #64
lsr @
lsr @
sta adr1
lda yplr
sec
sbc #32
lsr @
lsr @
lsr @
lsr @
tay
beq zeroy
zer1 equ *
lda adr1
clc
adc #32
sta adr1
lda adr1+1
adc #0
sta adr1+1
dey
bne zer1
zeroy equ *
lda adr1
clc
adc <ekran-1
sta adr1
lda #0
adc >ekran-1
sta adr1+1
rts
sprawdz equ *
lda joy
and #4
bne *+5
jmp testleft
lda joy
and #8
bne *+5
jmp testrght
jmp testdown
* zderzenia z prawej strony
testrght equ *
ldy #35
jsr readstat
ldy #3
cmp #$02
bne *+5
jsr opendoor
ldy #35
jsr readstat
cmp #$01
bne nrd2
lda xplr
and #%11111000
sta xplr
lda #0
sta faza
nrd2 equ *
jmp testdown
* zderzenia z lewej strony
testleft equ *
ldy #33
jsr readstat
ldy #0
cmp #$02
bne *+5
jsr opendoor
ldy #33
jsr readstat
cmp #$01
bne testdown
lda xplr
and #%11111000
clc
adc #8
sta xplr
lda #0
sta faza
* testowanie posrodku
testdown equ *
lda strig0
bne nosw
ldy #1
jsr readstat
sta pom
ldy #2
jsr readstat
cmp pom
bne tdn1
ldy #1
jsr testuj
jmp ttd1
tdn1 equ *
cmp #$03
bcc ttd1
cmp #$0a
bcs ttd1
ldy #2
jsr testuj
ttd1 equ *
ldy #2
lda (adr1),y
cmp #79
bne noswitch
lda #255
sta timer
jsr zgas
noswitch equ *
ldy #1
lda (adr1),y
cmp #78
bne nosw
lda #255
sta timer
jsr zgas
nosw equ *
jsr foto
lda lot
beq *+3
rts
ldy #66
jsr readstat
cmp #$01
bne *+3
rts
cmp #$10
bne *+3
rts
jmp spadaj
skok equ *
lda joy
and #1
beq *+3
rts
ldy #66
jsr readstat
cmp #$01
beq skk0
cmp #$10
beq skk0
rts
skk0 equ *
lda #1
sta lot
sta goradol
lda yplr
sta zpy
ldy #64
lda plfaz
beq *+4
ldy #72
sty plfaz
lda #0
sta faza
ldy #5
skk1 equ *
tya
pha
lda joy
cmp #14
beq nomsk
and #4
bne skwp
lda xplr
sec
sbc xsktb,y
sta xplr
jmp nomsk
skwp equ *
lda xplr
clc
adc xsktb,y
sta xplr
nomsk equ *
lda zpy
sec
sbc ysktb,y
sta yplr
jsr obekr
jsr sprawdz
jsr showplr
lda #5
jsr pause
pla
tay
and #1
beq *+5
inc faza
dey
bpl skk1
lda joy
cmp #14
bne spadaj
jsr obekr
jsr sprawdz
ldy #66
jsr readstat
cmp #$01
beq *+6
cmp #$10
bne *+5
jmp spend
ldy #5
skk2 equ *
tya
pha
lda yplr
clc
adc #2
sta yplr
jsr showplr
lda #4
jsr pause
pla
tay
and #1
beq *+5
inc faza
dey
bpl skk2
lda yplr
clc
adc #4
sta yplr
jmp spe2
spadaj equ *
lda #1
sta lot
ldy #72
lda joy
and #4
beq *+4
ldy #64
sty plfaz
lda #4
sta faza
sploop equ *
lda lot
and #1
bne *+5
inc faza
lda faza
cmp #6
bcc *+4
lda #5
sta faza
jsr obekr
ldy #66
jsr readstat
cmp #$01
beq spend
cmp #$10
beq spend
ldy lot
lda joy
and #4
bne spwp
lda xplr
sec
sbc spdxtb-1,y
sta xplr
jmp nsppl
spwp equ *
lda xplr
clc
adc spdxtb-1,y
sta xplr
nsppl equ *
lda yplr
clc
adc spdytb-1,y
sta yplr
iny
cpy #14
bcc *+4
ldy #13
sty lot
jsr obekr
jsr sprawdz
jsr showplr
lda #4
jsr pause
jmp sploop
spend equ *
lda yplr
and #%11110000
sta yplr
lda music
bne *+7
lda #100
sta $d206
lda #5
sta faza
ldy #1
spe1 equ *
tya
pha
clc
adc #1
asl @
ldy music
bne *+5
sta $d207
inc faza
spe3 equ *
jsr showplr
lda #4
jsr pause
pla
tay
dey
bpl spe1
spe2 equ *
ldy #0
lda plfaz
cmp #64
beq *+4
ldy #9
sty plfaz
lda #0
sta faza
sta lot
sta goradol
ldy music
bne *+8
sta $d206
sta $d207
sta goradol
jmp showplr
testuj equ *
pha
cmp #$03
bne nokey