-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBank $86.asm
16712 lines (14491 loc) · 702 KB
/
Bank $86.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
;;; $8000: Enable enemy projectiles ;;;
{
$86:8000 08 PHP
$86:8001 C2 20 REP #$20
$86:8003 A9 00 80 LDA #$8000
$86:8006 0C 8D 19 TSB $198D [$7E:198D]
$86:8009 28 PLP
$86:800A 6B RTL
}
;;; $800B: Disable enemy projectiles ;;;
{
$86:800B 08 PHP
$86:800C C2 20 REP #$20
$86:800E A9 00 80 LDA #$8000
$86:8011 1C 8D 19 TRB $198D [$7E:198D]
$86:8014 28 PLP
$86:8015 6B RTL
}
;;; $8016: Clear enemy projectiles ;;;
{
$86:8016 08 PHP
$86:8017 C2 30 REP #$30
$86:8019 DA PHX
$86:801A A2 22 00 LDX #$0022 ; Y = 22h (enemy projectile index)
; LOOP
$86:801D 9E 97 19 STZ $1997,x[$7E:19B9] ; Enemy projectile ID = 0
$86:8020 CA DEX ;\
$86:8021 CA DEX ;} Y -= 2
$86:8022 10 F9 BPL $F9 [$801D] ; If [Y] >= 0: go to LOOP
$86:8024 FA PLX
$86:8025 28 PLP
$86:8026 6B RTL
}
;;; $8027: Spawn enemy projectile [Y] with parameter [A] using enemy [X] graphics ;;;
{
;; Parameters:
;; A: Enemy projectile initialisation parameter
;; X: Enemy index, determines enemy projectile graphics indices
;; Y: Enemy projectile ID
;; Returns:
;; Carry: Set if enemy projectile could not be spawned
;; A: Enemy projectile index if spawned
$86:8027 08 PHP
$86:8028 8B PHB
$86:8029 DA PHX
$86:802A 5A PHY
$86:802B 8D 93 19 STA $1993 [$7E:1993] ; Enemy projectile initialisation parameter = [A]
$86:802E 4B PHK ;\
$86:802F AB PLB ;} DB = $86
$86:8030 BD 96 0F LDA $0F96,x[$86:A396] ;\
$86:8033 1D 98 0F ORA $0F98,x[$86:A398] ;} A = [enemy palette index] | [enemy VRAM tiles index]
$86:8036 48 PHA ;/
$86:8037 BB TYX ; X = [Y]
$86:8038 A0 22 00 LDY #$0022 ; Y = 22h (enemy projectile index)
; LOOP
$86:803B B9 97 19 LDA $1997,y[$7E:19B9] ;\
$86:803E F0 0B BEQ $0B [$804B] ;} If [enemy projectile ID] = 0: go to BRANCH_FOUND
$86:8040 88 DEY ;\
$86:8041 88 DEY ;} Y -= 2
$86:8042 10 F7 BPL $F7 [$803B] ; If [Y] >= 0: go to LOOP
$86:8044 68 PLA
$86:8045 7A PLY
$86:8046 FA PLX
$86:8047 AB PLB
$86:8048 28 PLP
$86:8049 38 SEC ;\
$86:804A 6B RTL ;} Return carry set
; BRANCH_FOUND
$86:804B 68 PLA ;\
$86:804C 99 BB 19 STA $19BB,y[$7E:19DD] ;} Enemy projectile graphics indices = [enemy palette index] | [enemy VRAM tiles index]
$86:804F 8A TXA ;\
$86:8050 99 97 19 STA $1997,y[$7E:19B9] ;} Enemy projectile ID = [X]
$86:8053 BD 02 00 LDA $0002,x[$86:A389] ;\
$86:8056 99 03 1A STA $1A03,y[$7E:1A25] ;} Enemy projectile pre-instruction = [[X] + 2]
$86:8059 BD 04 00 LDA $0004,x[$86:A38B] ;\
$86:805C 99 47 1B STA $1B47,y[$7E:1B69] ;} Enemy projectile instruction list pointer = [[X] + 4]
$86:805F BD 06 00 LDA $0006,x[$86:A38D] ;\
$86:8062 99 B3 1B STA $1BB3,y[$7E:1BD5] ;} Enemy projectile X / Y radius = [[X] + 6]
$86:8065 BD 08 00 LDA $0008,x[$86:A38F] ;\
$86:8068 99 D7 1B STA $1BD7,y[$7E:1BF9] ;} Enemy projectile properties = [[X] + 8]
$86:806B A9 01 00 LDA #$0001 ;\
$86:806E 99 8F 1B STA $1B8F,y[$7E:1BB1] ;} Enemy projectile instruction timer = 1
$86:8071 A9 00 80 LDA #$8000 ;\
$86:8074 99 6B 1B STA $1B6B,y[$7E:1B8D] ;} Enemy projectile spritemap pointer = $8000
$86:8077 A9 00 00 LDA #$0000 ;\
$86:807A 99 FF 1A STA $1AFF,y[$7E:1B21] ;} Enemy projectile $1AFF = 0
$86:807D 99 23 1B STA $1B23,y[$7E:1B45] ; Enemy projectile $1B23 = 0
$86:8080 99 DF 19 STA $19DF,y[$7E:1A01] ; Enemy projectile timer = 0
$86:8083 99 27 1A STA $1A27,y[$7E:1A49] ; Enemy projectile $1A27 = 0
$86:8086 99 6F 1A STA $1A6F,y[$7E:1A91] ; Enemy projectile $1A6F = 0
$86:8089 99 FB 1B STA $1BFB,y[$7E:1C1D] ; Enemy projectile collided projectile type = 0
$86:808C 5A PHY
$86:808D FC 00 00 JSR ($0000,x)[$86:A2EE]; Execute [[X]] (initialisation AI)
$86:8090 68 PLA
$86:8091 7A PLY
$86:8092 FA PLX
$86:8093 AB PLB
$86:8094 28 PLP
$86:8095 18 CLC ;\
$86:8096 6B RTL ;} Return carry clear
}
;;; $8097: Spawn enemy projectile [Y] with parameter [A] using room graphics ;;;
{
;; Parameters:
;; A: Enemy projectile initialisation parameter
;; Y: Enemy projectile ID
;; Returns:
;; Carry: Set if enemy projectile could not be spawned
;; A: Enemy projectile index if spawned
; (0 used for palette and graphics index)
; Used by some enemies, also gate PLMs
$86:8097 08 PHP
$86:8098 8B PHB
$86:8099 DA PHX
$86:809A 5A PHY
$86:809B 8D 93 19 STA $1993 [$7E:1993] ; Enemy projectile initialisation parameter = [A]
$86:809E 4B PHK ;\
$86:809F AB PLB ;} DB = $86
$86:80A0 BB TYX ; X = [Y]
$86:80A1 A0 22 00 LDY #$0022 ; Y = 22h (enemy projectile index)
; LOOP
$86:80A4 B9 97 19 LDA $1997,y[$7E:19B9] ;\
$86:80A7 F0 0A BEQ $0A [$80B3] ;} If [enemy projectile ID] = 0: go to BRANCH_FOUND
$86:80A9 88 DEY ;\
$86:80AA 88 DEY ;} Y -= 2
$86:80AB 10 F7 BPL $F7 [$80A4] ; If [Y] >= 0: go to LOOP
$86:80AD 7A PLY
$86:80AE FA PLX
$86:80AF AB PLB
$86:80B0 28 PLP
$86:80B1 38 SEC ;\
$86:80B2 6B RTL ;} Return carry set
; BRANCH_FOUND
$86:80B3 A9 00 00 LDA #$0000 ;\
$86:80B6 99 BB 19 STA $19BB,y[$7E:19DD] ;} Enemy projectile VRAM graphics index = 0, palette 0
$86:80B9 8A TXA ;\
$86:80BA 99 97 19 STA $1997,y[$7E:19B9] ;} Enemy projectile ID = [X]
$86:80BD BD 02 00 LDA $0002,x[$86:9736] ;\
$86:80C0 99 03 1A STA $1A03,y[$7E:1A25] ;} Enemy projectile pre-instruction = [[X] + 2]
$86:80C3 BD 04 00 LDA $0004,x[$86:9738] ;\
$86:80C6 99 47 1B STA $1B47,y[$7E:1B69] ;} Enemy projectile instruction list pointer = [[X] + 4]
$86:80C9 BD 06 00 LDA $0006,x[$86:973A] ;\
$86:80CC 99 B3 1B STA $1BB3,y[$7E:1BD5] ;} Enemy projectile X / Y radius = [[X] + 6]
$86:80CF BD 08 00 LDA $0008,x[$86:973C] ;\
$86:80D2 99 D7 1B STA $1BD7,y[$7E:1BF9] ;} Enemy projectile properties = [[X] + 8]
$86:80D5 A9 01 00 LDA #$0001 ;\
$86:80D8 99 8F 1B STA $1B8F,y[$7E:1BB1] ;} Enemy projectile instruction timer = 1
$86:80DB A9 00 80 LDA #$8000 ;\
$86:80DE 99 6B 1B STA $1B6B,y[$7E:1B8D] ;} Enemy projectile spritemap pointer = $8000
$86:80E1 A9 00 00 LDA #$0000 ;\
$86:80E4 99 FF 1A STA $1AFF,y[$7E:1B21] ;} Enemy projectile $1AFF = 0
$86:80E7 99 23 1B STA $1B23,y[$7E:1B45] ; Enemy projectile $1B23 = 0
$86:80EA 99 DF 19 STA $19DF,y[$7E:1A01] ; Enemy projectile timer = 0
$86:80ED 99 DF 19 STA $19DF,y[$7E:1A01] ; >_<;
$86:80F0 99 27 1A STA $1A27,y[$7E:1A49] ; Enemy projectile $1A27 = 0
$86:80F3 99 6F 1A STA $1A6F,y[$7E:1A91] ; Enemy projectile $1A6F = 0
$86:80F6 99 FB 1B STA $1BFB,y[$7E:1C1D] ; Enemy projectile collided projectile type = 0
$86:80F9 5A PHY
$86:80FA FC 00 00 JSR ($0000,x)[$86:96DC]; Execute [[X]] (initialisation AI)
$86:80FD 68 PLA
$86:80FE 7A PLY
$86:80FF FA PLX
$86:8100 AB PLB
$86:8101 28 PLP
$86:8102 18 CLC ;\
$86:8103 6B RTL ;} Return carry clear
}
;;; $8104: Enemy projectile handler ;;;
{
$86:8104 08 PHP
$86:8105 8B PHB
$86:8106 4B PHK ;\
$86:8107 AB PLB ;} DB = $86
$86:8108 2C 8D 19 BIT $198D [$7E:198D] ;\
$86:810B 10 15 BPL $15 [$8122] ;} If enemy projectiles not enabled: return
$86:810D A2 22 00 LDX #$0022 ; X = 22h (enemy projectile index)
; LOOP
$86:8110 8E 91 19 STX $1991 [$7E:1991] ; Enemy projectile index = [X]
$86:8113 BD 97 19 LDA $1997,x[$7E:19B9] ;\
$86:8116 F0 06 BEQ $06 [$811E] ;} If [enemy projectile ID] != 0:
$86:8118 20 25 81 JSR $8125 [$86:8125] ; Process enemy projectile
$86:811B AE 91 19 LDX $1991 [$7E:1991] ; X = [enemy projectile index]
$86:811E CA DEX ;\
$86:811F CA DEX ;} X -= 2
$86:8120 10 EE BPL $EE [$8110] ; If [X] >= 0: go to LOOP
$86:8122 AB PLB
$86:8123 28 PLP
$86:8124 6B RTL
}
;;; $8125: Process enemy projectile ;;;
{
;; Parameter:
;; X: Enemy projectile index
; Some instructions (e.g. sleep) pop the return address pushed to the stack by $813C to return out of *this* routine
; (marked "terminate processing enemy projectile")
$86:8125 FC 03 1A JSR ($1A03,x)[$86:A328]; Execute [enemy projectile pre-instruction]
$86:8128 AE 91 19 LDX $1991 [$7E:1991] ; X = [enemy projectile index]
$86:812B DE 8F 1B DEC $1B8F,x[$7E:1BB1] ; Decrement enemy projectile instruction timer
$86:812E D0 23 BNE $23 [$8153] ; If [enemy projectile instruction timer] != 0: return
$86:8130 BC 47 1B LDY $1B47,x[$7E:1B69] ; Y = [enemy projectile instruction list pointer]
; LOOP
$86:8133 B9 00 00 LDA $0000,y[$86:A28D] ;\
$86:8136 10 0A BPL $0A [$8142] ;} If [[Y]] & 8000h != 0:
$86:8138 85 12 STA $12 [$7E:0012] ; $12 = [[Y]] (ASM instruction pointer)
$86:813A C8 INY ;\
$86:813B C8 INY ;} Y += 2
$86:813C F4 32 81 PEA $8132 ; Return to LOOP
$86:813F 6C 12 00 JMP ($0012)[$86:81AB] ; Execute [$12]
$86:8142 9D 8F 1B STA $1B8F,x[$7E:1BB1] ; Enemy projectile instruction timer = [[Y]] (spritemap timer)
$86:8145 B9 02 00 LDA $0002,y[$86:A28F] ;\
$86:8148 9D 6B 1B STA $1B6B,x[$7E:1B8D] ;} Enemy projectile spritemap pointer = [[Y] + 2]
$86:814B 98 TYA ;\
$86:814C 18 CLC ;|
$86:814D 69 04 00 ADC #$0004 ;} Enemy projectile instruction list pointer = [Y] + 4
$86:8150 9D 47 1B STA $1B47,x[$7E:1B69] ;/
$86:8153 60 RTS
}
;;; $8154..838F: Generic instructions ;;;
{
;;; $8154: Instruction - delete ;;;
{
$86:8154 9E 97 19 STZ $1997,x[$7E:19B7] ; Enemy projectile ID = 0
$86:8157 68 PLA ; Terminate processing enemy projectile
$86:8158 60 RTS
}
;;; $8159: Instruction - sleep ;;;
{
$86:8159 88 DEY ;\
$86:815A 88 DEY ;|
$86:815B 98 TYA ;} Enemy projectile instruction list pointer = [Y] - 2
$86:815C 9D 47 1B STA $1B47,x[$7E:1B69] ;/
$86:815F 68 PLA ; Terminate processing enemy projectile
$86:8160 60 RTS
}
;;; $8161: Instruction - pre-instruction = [[Y]] ;;;
{
$86:8161 B9 00 00 LDA $0000,y[$86:A4CC]
$86:8164 9D 03 1A STA $1A03,x[$7E:1A25]
$86:8167 C8 INY
$86:8168 C8 INY
$86:8169 60 RTS
}
;;; $816A: Instruction - clear pre-instruction ;;;
{
$86:816A A9 70 81 LDA #$8170
$86:816D 9D 03 1A STA $1A03,x[$7E:1A11]
$86:8170 60 RTS
}
;;; $8171: Instruction - call external function [[Y]] ;;;
{
$86:8171 B9 00 00 LDA $0000,y[$86:C79C]
$86:8174 85 12 STA $12 [$7E:0012]
$86:8176 B9 01 00 LDA $0001,y[$86:C79D]
$86:8179 85 13 STA $13 [$7E:0013]
$86:817B 5A PHY
$86:817C 22 88 81 86 JSL $868188[$86:8188]
$86:8180 7A PLY
$86:8181 AE 91 19 LDX $1991 [$7E:1991]
$86:8184 C8 INY
$86:8185 C8 INY
$86:8186 C8 INY
$86:8187 60 RTS
$86:8188 DC 12 00 JML [$0012][$86:C7FB]
}
;;; $818B: Unused. Instruction - call external function [[Y]] with 2 byte parameter [[Y] + 3] ;;;
{
$86:818B B9 00 00 LDA $0000,y
$86:818E 85 12 STA $12 [$7E:0012]
$86:8190 B9 01 00 LDA $0001,y
$86:8193 85 13 STA $13 [$7E:0013]
$86:8195 B9 03 00 LDA $0003,y
$86:8198 5A PHY
$86:8199 22 A8 81 86 JSL $8681A8[$86:81A8]
$86:819D 7A PLY
$86:819E AE 91 19 LDX $1991 [$7E:1991]
$86:81A1 98 TYA
$86:81A2 18 CLC
$86:81A3 69 05 00 ADC #$0005
$86:81A6 A8 TAY
$86:81A7 60 RTS
$86:81A8 DC 12 00 JML [$0012]
}
;;; $81AB: Instruction - go to [[Y]] ;;;
{
$86:81AB B9 00 00 LDA $0000,y[$86:A29F]
$86:81AE A8 TAY
$86:81AF 60 RTS
}
;;; $81B0: Instruction - go to [Y] + ±[[Y]] ;;;
{
$86:81B0 84 12 STY $12 [$7E:0012]
$86:81B2 88 DEY
$86:81B3 B9 00 00 LDA $0000,y
$86:81B6 EB XBA
$86:81B7 30 05 BMI $05 [$81BE]
$86:81B9 29 FF 00 AND #$00FF
$86:81BC 80 03 BRA $03 [$81C1]
$86:81BE 09 00 FF ORA #$FF00
$86:81C1 18 CLC
$86:81C2 65 12 ADC $12 [$7E:0012]
$86:81C4 A8 TAY
$86:81C5 60 RTS
}
;;; $81C6: Instruction - decrement timer and go to [[Y]] if non-zero ;;;
{
$86:81C6 DE DF 19 DEC $19DF,x[$7E:1A01]
$86:81C9 D0 E0 BNE $E0 [$81AB]
$86:81CB C8 INY
$86:81CC C8 INY
$86:81CD 60 RTS
}
;;; $81CE: Unused. Instruction - decrement timer and go to [Y] + ±[[Y]] if non-zero ;;;
{
$86:81CE DE DF 19 DEC $19DF,x
$86:81D1 D0 DD BNE $DD [$81B0]
$86:81D3 C8 INY
$86:81D4 60 RTS
}
;;; $81D5: Instruction - timer = [[Y]] ;;;
{
$86:81D5 B9 00 00 LDA $0000,y[$86:ECAD]
$86:81D8 9D DF 19 STA $19DF,x[$7E:1A01]
$86:81DB C8 INY
$86:81DC C8 INY
$86:81DD 60 RTS
}
;;; $81DE: RTS. Instruction - NOP ;;;
{
$86:81DE 60 RTS
}
;;; $81DF: Instruction - move randomly within X radius [[Y]] - [[Y] - 1] and Y radius [[Y] - 2] - [[Y] - 3] ;;;
{
; Assumes [[Y]] + 1 and [[Y] + 2] + 1 are powers of 2
$86:81DF 22 11 81 80 JSL $808111[$80:8111] ; Generate random number
$86:81E3 85 12 STA $12 [$7E:0012] ; $12 = [random number]
; LOOP_X
$86:81E5 22 11 81 80 JSL $808111[$80:8111] ; Generate random number
$86:81E9 E2 20 SEP #$20 ;\
$86:81EB 39 00 00 AND $0000,y[$86:A3D9] ;|
$86:81EE 38 SEC ;} A = ([random number] & [[Y]]) - [[Y] + 1]
$86:81EF F9 01 00 SBC $0001,y[$86:A3DA] ;/
$86:81F2 C2 20 REP #$20
$86:81F4 30 EF BMI $EF [$81E5] ; If [A] < 0: go to LOOP_X
$86:81F6 29 FF 00 AND #$00FF
$86:81F9 24 12 BIT $12 [$7E:0012] ;\
$86:81FB 10 04 BPL $04 [$8201] ;} If [$12] & 8000h:
$86:81FD 49 FF FF EOR #$FFFF ;\
$86:8200 1A INC A ;} A = -[A]
$86:8201 18 CLC ;\
$86:8202 7D 4B 1A ADC $1A4B,x[$7E:1A59] ;} Enemy projectile X position += [A]
$86:8205 9D 4B 1A STA $1A4B,x[$7E:1A59] ;/
; LOOP_Y
$86:8208 22 11 81 80 JSL $808111[$80:8111] ; Generate random number
$86:820C E2 20 SEP #$20 ;\
$86:820E 39 02 00 AND $0002,y[$86:A3DB] ;|
$86:8211 38 SEC ;} A = (random number & [[Y] + 2]) - [[Y] + 3]
$86:8212 F9 03 00 SBC $0003,y[$86:A3DC] ;/
$86:8215 C2 20 REP #$20
$86:8217 30 EF BMI $EF [$8208] ; If [A] < 0: go to LOOP_Y
$86:8219 29 FF 00 AND #$00FF
$86:821C 24 12 BIT $12 [$7E:0012] ;\
$86:821E 50 04 BVC $04 [$8224] ;} If [$12] & 4000h:
$86:8220 49 FF FF EOR #$FFFF ;\
$86:8223 1A INC A ;} A = -[A]
$86:8224 18 CLC ;\
$86:8225 7D 93 1A ADC $1A93,x[$7E:1AA1] ;} Enemy projectile Y position += [A]
$86:8228 9D 93 1A STA $1A93,x[$7E:1AA1] ;/
$86:822B C8 INY ;\
$86:822C C8 INY ;|
$86:822D C8 INY ;} Y += 4
$86:822E C8 INY ;/
$86:822F 60 RTS
}
;;; $8230: Instruction - enemy projectile properties |= [[Y]] ;;;
{
$86:8230 BD D7 1B LDA $1BD7,x[$7E:1BE7]
$86:8233 19 00 00 ORA $0000,y[$86:A478]
$86:8236 9D D7 1B STA $1BD7,x[$7E:1BE7]
$86:8239 C8 INY
$86:823A C8 INY
$86:823B 60 RTS
}
;;; $823C: Instruction - enemy projectile properties &= [[Y]] ;;;
{
$86:823C BD D7 1B LDA $1BD7,x[$7E:1BE7]
$86:823F 39 00 00 AND $0000,y[$86:A480]
$86:8242 9D D7 1B STA $1BD7,x[$7E:1BE7]
$86:8245 C8 INY
$86:8246 C8 INY
$86:8247 60 RTS
}
;;; $8248: Unused. Instruction - enable collision with Samus projectiles ;;;
{
$86:8248 BD D7 1B LDA $1BD7,x
$86:824B 09 00 80 ORA #$8000
$86:824E 9D D7 1B STA $1BD7,x
$86:8251 60 RTS
}
;;; $8252: Instruction - disable collision with Samus projectiles ;;;
{
$86:8252 BD D7 1B LDA $1BD7,x[$7E:1BE5]
$86:8255 29 FF 7F AND #$7FFF
$86:8258 9D D7 1B STA $1BD7,x[$7E:1BE5]
$86:825B 60 RTS
}
;;; $825C: Instruction - disable collision with Samus ;;;
{
$86:825C BD D7 1B LDA $1BD7,x[$7E:1BE5]
$86:825F 09 00 20 ORA #$2000
$86:8262 9D D7 1B STA $1BD7,x[$7E:1BE5]
$86:8265 60 RTS
}
;;; $8266: Unused. Instruction - enable collision with Samus ;;;
{
$86:8266 BD D7 1B LDA $1BD7,x
$86:8269 29 FF DF AND #$DFFF
$86:826C 9D D7 1B STA $1BD7,x
$86:826F 60 RTS
}
;;; $8270: Unused. Instruction - set to not die on contact ;;;
{
$86:8270 BD D7 1B LDA $1BD7,x
$86:8273 09 00 40 ORA #$4000
$86:8276 9D D7 1B STA $1BD7,x
$86:8279 60 RTS
}
;;; $827A: Unused. Instruction - set to die on contact ;;;
{
$86:827A BD D7 1B LDA $1BD7,x
$86:827D 29 FF BF AND #$BFFF
$86:8280 9D D7 1B STA $1BD7,x
$86:8283 60 RTS
}
;;; $8284: Instruction - set high priority ;;;
{
$86:8284 BD D7 1B LDA $1BD7,x[$7E:1BE5]
$86:8287 09 00 10 ORA #$1000
$86:828A 9D D7 1B STA $1BD7,x[$7E:1BE5]
$86:828D 60 RTS
}
;;; $828E: Unused. Instruction - set low priority ;;;
{
$86:828E BD D7 1B LDA $1BD7,x
$86:8291 29 FF EF AND #$EFFF
$86:8294 9D D7 1B STA $1BD7,x
$86:8297 60 RTS
}
;;; $8298: Instruction - X radius = [[Y]], Y radius = [[Y] + 1] ;;;
{
$86:8298 B9 00 00 LDA $0000,y[$86:C434]
$86:829B 9D B3 1B STA $1BB3,x[$7E:1BD1]
$86:829E C8 INY
$86:829F C8 INY
$86:82A0 60 RTS
}
;;; $82A1: Unused. Instruction - X radius = 0, Y radius = 0 ;;;
{
$86:82A1 9E B3 1B STZ $1BB3,x
$86:82A4 60 RTS
}
;;; $82A5: Instruction - calculate direction towards Samus ;;;
{
; Used only by eye door projectile
$86:82A5 5A PHY
$86:82A6 AD F6 0A LDA $0AF6 [$7E:0AF6] ;\
$86:82A9 38 SEC ;|
$86:82AA FD 4B 1A SBC $1A4B,x[$7E:1A6D] ;|
$86:82AD 85 12 STA $12 [$7E:0012] ;|
$86:82AF AD FA 0A LDA $0AFA [$7E:0AFA] ;} A = (angle from enemy projectile to Samus)
$86:82B2 38 SEC ;|
$86:82B3 FD 93 1A SBC $1A93,x[$7E:1AB5] ;|
$86:82B6 85 14 STA $14 [$7E:0014] ;|
$86:82B8 22 AE C0 A0 JSL $A0C0AE[$A0:C0AE] ;/
$86:82BC 0A ASL A ;\
$86:82BD AC 91 19 LDY $1991 [$7E:1991] ;} Enemy projectile angle to Samus = [A] * 2 (angle * 2)
$86:82C0 99 FF 1A STA $1AFF,y[$7E:1B21] ;/
$86:82C3 AA TAX ;\
$86:82C4 BF 43 B4 A0 LDA $A0B443,x[$A0:B5B3];} Enemy projectile X velocity = sin([A] * pi / 80h)
$86:82C8 99 B7 1A STA $1AB7,y[$7E:1AD9] ;/
$86:82CB BF C3 B3 A0 LDA $A0B3C3,x[$A0:B533];\
$86:82CF 99 DB 1A STA $1ADB,y[$7E:1AFD] ;} Enemy projectile Y velocity = -cos([A] * pi / 80h)
$86:82D2 BB TYX
$86:82D3 7A PLY
$86:82D4 60 RTS
}
;;; $82D5: Unused. Instruction - write [[Y] + 4] colours from [[Y]] to colour index [[Y] + 2] ;;;
{
$86:82D5 5A PHY
$86:82D6 DA PHX
$86:82D7 BE 02 00 LDX $0002,y
$86:82DA B9 04 00 LDA $0004,y
$86:82DD 29 FF 00 AND #$00FF
$86:82E0 85 12 STA $12 [$7E:0012]
$86:82E2 B9 00 00 LDA $0000,y
$86:82E5 A8 TAY
$86:82E6 B9 00 00 LDA $0000,y
$86:82E9 9F 00 C0 7E STA $7EC000,x
$86:82ED C8 INY
$86:82EE C8 INY
$86:82EF E8 INX
$86:82F0 E8 INX
$86:82F1 C6 12 DEC $12 [$7E:0012]
$86:82F3 10 F1 BPL $F1 [$82E6]
$86:82F5 FA PLX
$86:82F6 68 PLA
$86:82F7 18 CLC
$86:82F8 69 05 00 ADC #$0005
$86:82FB A8 TAY
$86:82FC 60 RTS
}
;;; $82FD: Unused. Instruction - queue music track [[Y]] ;;;
{
$86:82FD B9 00 00 LDA $0000,y
$86:8300 29 FF 00 AND #$00FF
$86:8303 22 C1 8F 80 JSL $808FC1[$80:8FC1]
$86:8307 C8 INY
$86:8308 60 RTS
}
;;; $8309: Unused. Instruction - queue sound [[Y]], sound library 1, max queued sounds allowed = 6 ;;;
{
$86:8309 B9 00 00 LDA $0000,y
$86:830C 22 49 90 80 JSL $809049[$80:9049]
$86:8310 C8 INY
$86:8311 60 RTS
}
;;; $8312: Instruction - queue sound [[Y]], sound library 2, max queued sounds allowed = 6 ;;;
{
$86:8312 B9 00 00 LDA $0000,y[$86:A4C9]
$86:8315 22 CB 90 80 JSL $8090CB[$80:90CB]
$86:8319 C8 INY
$86:831A 60 RTS
}
;;; $831B: Instruction - queue sound [[Y]], sound library 3, max queued sounds allowed = 6 ;;;
{
$86:831B B9 00 00 LDA $0000,y[$86:AB4D]
$86:831E 22 4D 91 80 JSL $80914D[$80:914D]
$86:8322 C8 INY
$86:8323 60 RTS
}
;;; $8324: Instruction - queue sound [[Y]], sound library 1, max queued sounds allowed = 15 ;;;
{
$86:8324 B9 00 00 LDA $0000,y
$86:8327 22 21 90 80 JSL $809021[$80:9021]
$86:832B C8 INY
$86:832C 60 RTS
}
;;; $832D: Unused. Instruction - queue sound [[Y]], sound library 2, max queued sounds allowed = 15 ;;;
{
$86:832D B9 00 00 LDA $0000,y
$86:8330 22 A3 90 80 JSL $8090A3[$80:90A3]
$86:8334 C8 INY
$86:8335 60 RTS
}
;;; $8336: Unused. Instruction - queue sound [[Y]], sound library 3, max queued sounds allowed = 15 ;;;
{
$86:8336 B9 00 00 LDA $0000,y
$86:8339 22 25 91 80 JSL $809125[$80:9125]
$86:833D C8 INY
$86:833E 60 RTS
}
;;; $833F: Unused. Instruction - queue sound [[Y]], sound library 1, max queued sounds allowed = 3 ;;;
{
$86:833F B9 00 00 LDA $0000,y
$86:8342 22 35 90 80 JSL $809035[$80:9035]
$86:8346 C8 INY
$86:8347 60 RTS
}
;;; $8348: Unused. Instruction - queue sound [[Y]], sound library 2, max queued sounds allowed = 3 ;;;
{
$86:8348 B9 00 00 LDA $0000,y
$86:834B 22 B7 90 80 JSL $8090B7[$80:90B7]
$86:834F C8 INY
$86:8350 60 RTS
}
;;; $8351: Unused. Instruction - queue sound [[Y]], sound library 3, max queued sounds allowed = 3 ;;;
{
$86:8351 B9 00 00 LDA $0000,y
$86:8354 22 39 91 80 JSL $809139[$80:9139]
$86:8358 C8 INY
$86:8359 60 RTS
}
;;; $835A: Unused. Instruction - queue sound [[Y]], sound library 1, max queued sounds allowed = 9 ;;;
{
$86:835A B9 00 00 LDA $0000,y
$86:835D 22 2B 90 80 JSL $80902B[$80:902B]
$86:8361 C8 INY
$86:8362 60 RTS
}
;;; $8363: Unused. Instruction - queue sound [[Y]], sound library 2, max queued sounds allowed = 9 ;;;
{
$86:8363 B9 00 00 LDA $0000,y
$86:8366 22 AD 90 80 JSL $8090AD[$80:90AD]
$86:836A C8 INY
$86:836B 60 RTS
}
;;; $836C: Unused. Instruction - queue sound [[Y]], sound library 3, max queued sounds allowed = 9 ;;;
{
$86:836C B9 00 00 LDA $0000,y
$86:836F 22 2F 91 80 JSL $80912F[$80:912F]
$86:8373 C8 INY
$86:8374 60 RTS
}
;;; $8375: Unused. Instruction - queue sound [[Y]], sound library 1, max queued sounds allowed = 1 ;;;
{
$86:8375 B9 00 00 LDA $0000,y
$86:8378 22 3F 90 80 JSL $80903F[$80:903F]
$86:837C C8 INY
$86:837D 60 RTS
}
;;; $837E: Instruction - queue sound [[Y]], sound library 2, max queued sounds allowed = 1 ;;;
{
$86:837E B9 00 00 LDA $0000,y[$86:A4AC]
$86:8381 22 C1 90 80 JSL $8090C1[$80:90C1]
$86:8385 C8 INY
$86:8386 60 RTS
}
;;; $8387: Instruction - queue sound [[Y]], sound library 3, max queued sounds allowed = 1 ;;;
{
$86:8387 B9 00 00 LDA $0000,y
$86:838A 22 43 91 80 JSL $809143[$80:9143]
$86:838E C8 INY
$86:838F 60 RTS
}
}
;;; $8390: Draw high priority enemy projectiles ;;;
{
$86:8390 8B PHB
$86:8391 F4 00 8D PEA $8D00 ;\
$86:8394 AB PLB ;} DB = $8D
$86:8395 AB PLB ;/
$86:8396 20 27 84 JSR $8427 [$86:8427] ; Get values for screen shaking
$86:8399 A2 22 00 LDX #$0022 ; X = 22h (enemy projectile index)
; LOOP
$86:839C BD 97 19 LDA $1997,x[$7E:19B9] ;\
$86:839F F0 0B BEQ $0B [$83AC] ;} If [enemy projectile ID] != 0:
$86:83A1 BD D7 1B LDA $1BD7,x[$7E:1BF9] ;\
$86:83A4 29 00 10 AND #$1000 ;} If enemy projectile is high priority:
$86:83A7 F0 03 BEQ $03 [$83AC] ;/
$86:83A9 20 D6 83 JSR $83D6 [$86:83D6] ; Draw enemy projectile
$86:83AC CA DEX ;\
$86:83AD CA DEX ;} X -= 2
$86:83AE 10 EC BPL $EC [$839C] ; If [X] >= 0: go to LOOP
$86:83B0 AB PLB
$86:83B1 6B RTL
}
;;; $83B2: Draw low priority enemy projectiles ;;;
{
$86:83B2 8B PHB
$86:83B3 C2 30 REP #$30
$86:83B5 F4 00 8D PEA $8D00 ;\
$86:83B8 AB PLB ;} DB = $8D
$86:83B9 AB PLB ;/
$86:83BA 20 27 84 JSR $8427 [$86:8427] ; Get values for screen shaking
$86:83BD A2 22 00 LDX #$0022 ; X = 22h (enemy projectile index)
; LOOP
$86:83C0 BD 97 19 LDA $1997,x[$7E:19B9] ;\
$86:83C3 F0 0B BEQ $0B [$83D0] ;} If [enemy projectile ID] != 0:
$86:83C5 BD D7 1B LDA $1BD7,x[$7E:1BF9] ;\
$86:83C8 29 00 10 AND #$1000 ;} If enemy projectile is not high priority:
$86:83CB D0 03 BNE $03 [$83D0] ;/
$86:83CD 20 D6 83 JSR $83D6 [$86:83D6] ; Draw enemy projectile
$86:83D0 CA DEX ;\
$86:83D1 CA DEX ;} X -= 2
$86:83D2 10 EC BPL $EC [$83C0] ; If [X] >= 0: go to LOOP
$86:83D4 AB PLB
$86:83D5 6B RTL
}
;;; $83D6: Draw enemy projectile ;;;
{
;; Parameters:
;; X: Enemy projectile index
;; $22: Y displacement
;; $24: X displacement
$86:83D6 BC 6B 1B LDY $1B6B,x[$7E:1B8D] ; Y = [enemy projectile spritemap pointer]
$86:83D9 BD BB 19 LDA $19BB,x[$7E:19DD] ;\
$86:83DC 29 FF 00 AND #$00FF ;} $1A = [enemy projectile VRAM tiles index]
$86:83DF 85 1A STA $1A [$7E:001A] ;/
$86:83E1 BD BB 19 LDA $19BB,x[$7E:19DD] ;\
$86:83E4 29 00 FF AND #$FF00 ;} $1C = [enemy projectile palette index]
$86:83E7 85 1C STA $1C [$7E:001C] ;/
$86:83E9 BD 4B 1A LDA $1A4B,x[$7E:1A6D] ;\
$86:83EC 38 SEC ;|
$86:83ED ED 11 09 SBC $0911 [$7E:0911] ;|
$86:83F0 18 CLC ;} $14 = [enemy projectile X position] - [layer 1 X position] + [$24] (spritemap X origin)
$86:83F1 65 24 ADC $24 [$7E:0024] ;|
$86:83F3 85 14 STA $14 [$7E:0014] ;/
$86:83F5 18 CLC ;\
$86:83F6 69 80 00 ADC #$0080 ;|
$86:83F9 89 00 FE BIT #$FE00 ;} If not -80h <= [$14] < 180h: return
$86:83FC D0 28 BNE $28 [$8426] ;/
$86:83FE BD 93 1A LDA $1A93,x[$7E:1AB5] ;\
$86:8401 38 SEC ;|
$86:8402 ED 15 09 SBC $0915 [$7E:0915] ;|
$86:8405 18 CLC ;} $12 = [enemy projectile Y position] - [layer 1 Y position] + [$22] (spritemap Y origin)
$86:8406 65 22 ADC $22 [$7E:0022] ;|
$86:8408 85 12 STA $12 [$7E:0012] ;/
$86:840A 89 00 FF BIT #$FF00 ;\
$86:840D D0 08 BNE $08 [$8417] ;} If 0 <= (spritemap Y origin) < 100h:
$86:840F DA PHX ;\
$86:8410 22 0A 8C 81 JSL $818C0A[$81:8C0A] ;} Add spritemap to OAM with base tile number - Y origin on-screen
$86:8414 FA PLX ;/
$86:8415 80 0F BRA $0F [$8426]
$86:8417 18 CLC ;\ Else (not 0 <= (spritemap Y origin) < 100h):
$86:8418 69 80 00 ADC #$0080 ;|
$86:841B 89 00 FE BIT #$FE00 ;} If -80h <= (spritemap Y origin) < 180h:
$86:841E D0 06 BNE $06 [$8426] ;/
$86:8420 DA PHX ;\
$86:8421 22 7F 8C 81 JSL $818C7F[$81:8C7F] ;} Add spritemap to OAM with base tile number - Y origin off-screen
$86:8425 FA PLX ;/
$86:8426 60 RTS
}
;;; $8427: Get values for screen shaking ;;;
{
;; Returns:
;; $22: Y displacement
;; $24: X displacement
$86:8427 AD 40 18 LDA $1840 [$7E:1840] ;\
$86:842A F0 3A BEQ $3A [$8466] ;} If [earthquake timer] = 0: return zeros
$86:842C AD 78 0A LDA $0A78 [$7E:0A78] ;\
$86:842F D0 35 BNE $35 [$8466] ;} If time is frozen: return zeros
$86:8431 AD 3E 18 LDA $183E [$7E:183E] ;\
$86:8434 C9 24 00 CMP #$0024 ;} If [earthquake type] >= 24h: return
$86:8437 10 2D BPL $2D [$8466] ;/
$86:8439 0A ASL A ;\
$86:843A 0A ASL A ;} X = [earthquake type] * 4
$86:843B AA TAX ;/
$86:843C AD 40 18 LDA $1840 [$7E:1840] ;\
$86:843F 89 02 00 BIT #$0002 ;} If [earthquake timer] / 2 % 2 != 0:
$86:8442 F0 15 BEQ $15 [$8459] ;/
$86:8444 BF 6B 84 86 LDA $86846B,x[$86:84F7];\
$86:8448 49 FF FF EOR #$FFFF ;|
$86:844B 1A INC A ;} $24 = -[$86:846B + [earthquake type] * 4]
$86:844C 85 24 STA $24 [$7E:0024] ;/
$86:844E BF 6D 84 86 LDA $86846D,x[$86:84F9];\
$86:8452 49 FF FF EOR #$FFFF ;|
$86:8455 1A INC A ;} $22 = -[$86:846B + [earthquake type] * 4 + 2]
$86:8456 85 22 STA $22 [$7E:0022] ;/
$86:8458 60 RTS ; Return
$86:8459 BF 6B 84 86 LDA $86846B,x[$86:84F7];\
$86:845D 85 24 STA $24 [$7E:0024] ;} $24 = [$86:846B + [earthquake type] * 4]
$86:845F BF 6D 84 86 LDA $86846D,x[$86:84F9];\
$86:8463 85 22 STA $22 [$7E:0022] ;} $22 = [$86:846B + [earthquake type] * 4 + 2]
$86:8465 60 RTS ; Return
$86:8466 64 22 STZ $22 [$7E:0022]
$86:8468 64 24 STZ $24 [$7E:0024]
$86:846A 60 RTS
; [X displacement], [Y displacement]
; ______________________________ Horizontal shaking
; | ___________________ Vertical shaking
; | | ________ Diagonal shaking
; | | |
$86:846B dw 0000,0000, 0000,0000, 0000,0000, ;\
0000,0000, 0000,0000, 0000,0000, ;} BG1 only
0000,0000, 0000,0000, 0000,0000, ;/
0000,0000, 0000,0000, 0000,0000, ;\
0000,0000, 0000,0000, 0000,0000, ;} BG1 and BG2
0000,0000, 0000,0000, 0000,0000, ;/
0001,0000, 0000,0001, 0001,0001, ;\
0002,0000, 0000,0002, 0002,0002, ;} BG1, BG2 and enemies
0003,0000, 0000,0003, 0003,0003, ;/
0001,0000, 0000,0001, 0001,0001, ;\
0002,0000, 0000,0002, 0002,0002, ;} BG2 only and enemies
0003,0000, 0000,0003, 0003,0003 ;/
}
;;; $84FB: RTS ;;;
{
$86:84FB 60 RTS
}
;;; $84FC: Instruction list - delete ;;;
{
$86:84FC dw 8154
}
;;; $84FE: Unused. Instruction list - blank spritemap ;;;
{
$86:84FE dx 1000,8000,
81AB,84FE ; Go to $84FE
}
;;; $8506..8A38: Enemy projectile block collision detection ;;;
{
;;; $8506: Enemy projectile block collision - horizontal extension ;;;
{
; Adjusting the return address and modifying the jump index is a pretty neat trick,
; like a sort of indirect tail recursion
$86:8506 AE C4 0D LDX $0DC4 [$7E:0DC4] ;\
$86:8509 BF 02 64 7F LDA $7F6402,x[$7F:6A69];|
$86:850D 29 FF 00 AND #$00FF ;} If [current block BTS] = 0: return carry clear
$86:8510 F0 28 BEQ $28 [$853A] ;/
$86:8512 89 80 00 BIT #$0080 ;\
$86:8515 D0 05 BNE $05 [$851C] ;|
$86:8517 29 FF 00 AND #$00FF ;|
$86:851A 80 03 BRA $03 [$851F] ;|
;|
$86:851C 09 00 FF ORA #$FF00 ;} Current block index += ±[current block BTS]
;|
$86:851F 18 CLC ;|
$86:8520 6D C4 0D ADC $0DC4 [$7E:0DC4] ;|
$86:8523 8D C4 0D STA $0DC4 [$7E:0DC4] ;/
$86:8526 0A ASL A ;\
$86:8527 AA TAX ;|
$86:8528 BF 02 00 7F LDA $7F0002,x[$7F:0CCE];|
$86:852C 29 00 F0 AND #$F000 ;|
$86:852F EB XBA ;} X = [current block type] * 2 (index for JSR on return)
$86:8530 4A LSR A ;|
$86:8531 4A LSR A ;|
$86:8532 4A LSR A ;|
$86:8533 AA TAX ;/
$86:8534 68 PLA ;\
$86:8535 38 SEC ;|
$86:8536 E9 03 00 SBC #$0003 ;} (Return address) -= 3
$86:8539 48 PHA ;/
$86:853A 18 CLC
$86:853B 60 RTS
}
;;; $853C: Enemy projectile block collision - vertical extension ;;;
{
$86:853C AE C4 0D LDX $0DC4 [$7E:0DC4] ;\
$86:853F BF 02 64 7F LDA $7F6402,x[$7F:6493];|
$86:8543 29 FF 00 AND #$00FF ;} If [current block BTS] = 0: return carry clear
$86:8546 F0 40 BEQ $40 [$8588] ;/
$86:8548 89 80 00 BIT #$0080 ;\
$86:854B D0 12 BNE $12 [$855F] ;} If [current block BTS] & 80h != 0: go BRANCH_NEGATIVE
$86:854D 8D D4 0D STA $0DD4 [$7E:0DD4] ;\
$86:8550 AD C4 0D LDA $0DC4 [$7E:0DC4] ;|
;|
$86:8553 18 CLC ;} Current block += [current block BTS] * [room width]
$86:8554 6D A5 07 ADC $07A5 [$7E:07A5] ;|
$86:8557 CE D4 0D DEC $0DD4 [$7E:0DD4] ;|
$86:855A D0 F7 BNE $F7 [$8553] ;/
$86:855C 4C 71 85 JMP $8571 [$86:8571] ; Go to BRANCH_MERGE
; BRANCH_NEGATIVE
$86:855F 09 00 FF ORA #$FF00 ;\
$86:8562 8D D4 0D STA $0DD4 [$7E:0DD4] ;|
$86:8565 AD C4 0D LDA $0DC4 [$7E:0DC4] ;|
;|
$86:8568 38 SEC ;} Current block -= [current block BTS] * [room width]
$86:8569 ED A5 07 SBC $07A5 [$7E:07A5] ;|
$86:856C EE D4 0D INC $0DD4 [$7E:0DD4] ;|
$86:856F D0 F7 BNE $F7 [$8568] ;/
; BRANCH_MERGE
$86:8571 8D C4 0D STA $0DC4 [$7E:0DC4]
$86:8574 0A ASL A ;\
$86:8575 AA TAX ;|
$86:8576 BF 02 00 7F LDA $7F0002,x[$7F:00C4];|
$86:857A 29 00 F0 AND #$F000 ;|
$86:857D EB XBA ;} X = [current block type] * 2 (index for JSR on return)
$86:857E 4A LSR A ;|
$86:857F 4A LSR A ;|
$86:8580 4A LSR A ;|
$86:8581 AA TAX ;/