-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBank $A6.asm
11827 lines (10149 loc) · 413 KB
/
Bank $A6.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..8686: Common to all enemy banks ;;;
{
; See bank $A0
}
;;; $8687..8B08: Boulder ;;;
{
;;; $8687: Palette - enemy $DFBF (boulder) ;;;
{
$A6:8687 dw 3800, 49EF, 45CE, 3D8C, 396B, 3529, 2D08, 28C6, 20A5, 1C63, 2506, 1CC4, 1083, 0841, 6EF7, 0000
}
;;; $86A7: Instruction list - facing left ;;;
{
$A6:86A7 dx 0008,8A59,
0008,8A6F,
0008,8A85,
0008,8A9B,
0008,8AB1,
0008,8AC7,
0008,8ADD,
0008,8AF3,
80ED,86A7 ; Go to $86A7
}
;;; $86CB: Instruction list - facing right ;;;
{
$A6:86CB dx 0008,8A59,
0008,8AF3,
0008,8ADD,
0008,8AC7,
0008,8AB1,
0008,8A9B,
0008,8A85,
0008,8A6F,
80ED,86CB ; Go to $86CB
}
;;; $86EF: Bounce speed table indices ;;;
{
; Y speed table index * 100h. Indexed by [enemy bounce index] * 2
$A6:86EF dw 0000, 1000, 1800
}
;;; $86F5: Initialisation AI - enemy $DFBF (boulder) ;;;
{
$A6:86F5 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:86F8 9E AC 0F STZ $0FAC,x[$7E:0FAC] ; Enemy Y speed table index = 0
$A6:86FB A9 00 00 LDA #$0000 ;\
$A6:86FE 9D AA 0F STA $0FAA,x[$7E:0FAA] ;} Enemy X speed table index = 0
$A6:8701 A9 02 00 LDA #$0002 ;\
$A6:8704 9D AE 0F STA $0FAE,x[$7E:0FAE] ;} Enemy bounce index = 2
$A6:8707 A9 9A 87 LDA #$879A ;\
$A6:870A 9D A8 0F STA $0FA8,x[$7E:0FA8] ;} Enemy function = $879A (wait for Samus to get near)
$A6:870D BD 7A 0F LDA $0F7A,x[$7E:0F7A] ;\
$A6:8710 9F 08 78 7E STA $7E7808,x[$7E:7808];} Enemy $7E:7808 = [enemy X position] (never read)
$A6:8714 BD 7E 0F LDA $0F7E,x[$7E:0F7E] ;\
$A6:8717 9F 0A 78 7E STA $7E780A,x[$7E:780A];} Enemy falling target Y position = [enemy Y position]
$A6:871B 9F 06 78 7E STA $7E7806,x[$7E:7806]; Enemy previous enemy Y position = [enemy Y position]
$A6:871F BD 80 0F LDA $0F80,x[$7E:0F80] ;\
$A6:8722 9F 04 78 7E STA $7E7804,x[$7E:7804];} Enemy previous enemy Y subposition = [enemy Y subposition]
$A6:8726 BD B7 0F LDA $0FB7,x[$7E:0FB7] ;\
$A6:8729 29 FF 00 AND #$00FF ;} A = [enemy parameter 2 high]
$A6:872C D0 07 BNE $07 [$8735] ; If [A] = 0:
$A6:872E A9 01 00 LDA #$0001 ; A = 1
$A6:8731 9F 0E 78 7E STA $7E780E,x[$7E:794E]; Enemy type = rolling
$A6:8735 49 FF FF EOR #$FFFF ;\
$A6:8738 1A INC A ;|
$A6:8739 18 CLC ;} Enemy Y position -= [A]
$A6:873A 7F 0A 78 7E ADC $7E780A,x[$7E:780A];|
$A6:873E 9D 7E 0F STA $0F7E,x[$7E:0F7E] ;/
$A6:8741 BD B6 0F LDA $0FB6,x[$7E:0FB6] ;\
$A6:8744 29 FF 00 AND #$00FF ;|
$A6:8747 49 FF FF EOR #$FFFF ;} Enemy X proximity = -[enemy parameter 2 low]
$A6:874A 1A INC A ;|
$A6:874B 9F 00 78 7E STA $7E7800,x[$7E:7800];/
$A6:874F BD 92 0F LDA $0F92,x[$7E:0F92] ;\
$A6:8752 29 FF 00 AND #$00FF ;} Enemy Y proximity = [enemy initialisation parameter] & FFh
$A6:8755 9F 0C 78 7E STA $7E780C,x[$7E:780C];/
$A6:8759 A9 A7 86 LDA #$86A7 ;\
$A6:875C 9D 92 0F STA $0F92,x[$7E:0F92] ;} Enemy instruction list pointer = $86A7 (facing left)
$A6:875F BD B5 0F LDA $0FB5,x[$7E:0FB5] ;\
$A6:8762 29 FF 00 AND #$00FF ;} Enemy direction = [enemy parameter 1 high]
$A6:8765 9D B0 0F STA $0FB0,x[$7E:0FB0] ;/
$A6:8768 D0 12 BNE $12 [$877C] ; If [enemy direction] = right:
$A6:876A BF 00 78 7E LDA $7E7800,x[$7E:7940];\
$A6:876E 49 FF FF EOR #$FFFF ;|
$A6:8771 1A INC A ;} Negate enemy X proximity
$A6:8772 9F 00 78 7E STA $7E7800,x[$7E:7940];/
$A6:8776 A9 CB 86 LDA #$86CB ;\
$A6:8779 9D 92 0F STA $0F92,x[$7E:10D2] ;} Enemy instruction list pointer = $86CB (facing right)
$A6:877C A9 02 00 LDA #$0002 ;\
$A6:877F 9F 02 78 7E STA $7E7802,x[$7E:7802];} Enemy minimum distance from ground = 2
$A6:8783 BD B4 0F LDA $0FB4,x[$7E:0FB4] ;\
$A6:8786 29 FF 00 AND #$00FF ;} If [enemy parameter 1 low] != 0: (never true in vanilla)
$A6:8789 F0 07 BEQ $07 [$8792] ;/
$A6:878B A9 05 00 LDA #$0005 ;\
$A6:878E 9F 02 78 7E STA $7E7802,x ;} Enemy minimum distance from ground = 5
$A6:8792 6B RTL
}
;;; $8793: Main AI - enemy $DFBF (boulder) ;;;
{
$A6:8793 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8796 FC A8 0F JSR ($0FA8,x)[$A6:879A]; Execute [enemy function]
$A6:8799 6B RTL
}
;;; $879A: Boulder function - wait for Samus to get near ;;;
{
$A6:879A AE 54 0E LDX $0E54 [$7E:0E54]
$A6:879D 22 DD AE A0 JSL $A0AEDD[$A0:AEDD] ;\
$A6:87A1 30 49 BMI $49 [$87EC] ;|
$A6:87A3 DF 0C 78 7E CMP $7E780C,x[$7E:780C];} If not 0 <= [Samus Y position] - [enemy Y position] < [enemy Y proximity]: return
$A6:87A7 10 43 BPL $43 [$87EC] ;/
$A6:87A9 BD B0 0F LDA $0FB0,x[$7E:0FB0] ;\
$A6:87AC D0 20 BNE $20 [$87CE] ;} If [enemy direction] = right:
$A6:87AE 22 E5 AE A0 JSL $A0AEE5[$A0:AEE5] ;\
$A6:87B2 30 38 BMI $38 [$87EC] ;|
$A6:87B4 DF 00 78 7E CMP $7E7800,x[$7E:79C0];} If not 0 <= [Samus X position] - [enemy X position] < [enemy X proximity]: return
$A6:87B8 10 32 BPL $32 [$87EC] ;/
$A6:87BA A9 ED 87 LDA #$87ED ;\
$A6:87BD 9D A8 0F STA $0FA8,x[$7E:1168] ;} Enemy function = $87ED (falling)
$A6:87C0 BF 0E 78 7E LDA $7E780E,x[$7E:79CE];\
$A6:87C4 F0 26 BEQ $26 [$87EC] ;} If [enemy type] = falling: return
$A6:87C6 A9 42 89 LDA #$8942 ;\
$A6:87C9 9D A8 0F STA $0FA8,x[$7E:1168] ;} Enemy function = $8942 (rolling)
$A6:87CC 80 1E BRA $1E [$87EC] ; Return
$A6:87CE 22 E5 AE A0 JSL $A0AEE5[$A0:AEE5] ;\
$A6:87D2 10 18 BPL $18 [$87EC] ;|
$A6:87D4 DF 00 78 7E CMP $7E7800,x[$7E:7800];} If not [enemy X proximity] <= [Samus X position] - [enemy X position] < 0: return
$A6:87D8 30 12 BMI $12 [$87EC] ;/
$A6:87DA A9 ED 87 LDA #$87ED ;\
$A6:87DD 9D A8 0F STA $0FA8,x[$7E:1028] ;} Enemy function = $87ED (falling)
$A6:87E0 BF 0E 78 7E LDA $7E780E,x[$7E:788E];\
$A6:87E4 F0 06 BEQ $06 [$87EC] ;} If [enemy type] = falling: return
$A6:87E6 A9 42 89 LDA #$8942 ;\
$A6:87E9 9D A8 0F STA $0FA8,x[$7E:1128] ;} Enemy function = $8942 (rolling)
$A6:87EC 60 RTS
}
;;; $87ED: Boulder function - falling ;;;
{
$A6:87ED AE 54 0E LDX $0E54 [$7E:0E54]
$A6:87F0 BD AC 0F LDA $0FAC,x[$7E:102C] ;\
$A6:87F3 29 00 FF AND #$FF00 ;|
$A6:87F6 EB XBA ;|
$A6:87F7 0A ASL A ;} Y = [enemy Y speed table index] * 8 (quadratic speed table index)
$A6:87F8 0A ASL A ;|
$A6:87F9 0A ASL A ;|
$A6:87FA A8 TAY ;/
$A6:87FB 20 3A 8A JSR $8A3A [$A6:8A3A] ; Move boulder vertically
$A6:87FE BD 7E 0F LDA $0F7E,x[$7E:0FFE] ;\
$A6:8801 DF 0A 78 7E CMP $7E780A,x[$7E:788A];} If [enemy Y position] >= [enemy falling target Y position]:
$A6:8805 30 15 BMI $15 [$881C] ;/
$A6:8807 BF 0A 78 7E LDA $7E780A,x[$7E:788A];\
$A6:880B 9D 7E 0F STA $0F7E,x[$7E:0FFE] ;} Enemy Y position = [enemy falling target Y position]
$A6:880E A9 32 88 LDA #$8832 ;\
$A6:8811 9D A8 0F STA $0FA8,x[$7E:1028] ;} Enemy function = $8832 (bounce - rising)
$A6:8814 A9 00 20 LDA #$2000 ;\
$A6:8817 9D AC 0F STA $0FAC,x[$7E:102C] ;} Enemy Y speed table index = 20h
$A6:881A 80 15 BRA $15 [$8831] ; Return
$A6:881C BD AC 0F LDA $0FAC,x[$7E:102C] ;\
$A6:881F 18 CLC ;|
$A6:8820 69 00 01 ADC #$0100 ;|
$A6:8823 9D AC 0F STA $0FAC,x[$7E:102C] ;|
$A6:8826 C9 00 50 CMP #$5000 ;} Enemy Y speed table index = min(50h, [enemy Y speed table index] + 1)
$A6:8829 30 06 BMI $06 [$8831] ;|
$A6:882B A9 00 50 LDA #$5000 ;|
$A6:882E 9D AC 0F STA $0FAC,x ;/
$A6:8831 60 RTS
}
;;; $8832: Boulder function - bounce - rising ;;;
{
$A6:8832 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8835 BD AC 0F LDA $0FAC,x[$7E:102C] ;\
$A6:8838 29 00 FF AND #$FF00 ;|
$A6:883B EB XBA ;|
$A6:883C 0A ASL A ;|
$A6:883D 0A ASL A ;|
$A6:883E 0A ASL A ;} Y = [enemy Y speed table index] * 8 + 4 (negated quadratic speed table index)
$A6:883F 1A INC A ;|
$A6:8840 1A INC A ;|
$A6:8841 1A INC A ;|
$A6:8842 1A INC A ;|
$A6:8843 A8 TAY ;/
$A6:8844 20 3A 8A JSR $8A3A [$A6:8A3A] ; Move boulder vertically
$A6:8847 BD AC 0F LDA $0FAC,x[$7E:102C] ;\
$A6:884A 38 SEC ;|
$A6:884B E9 00 01 SBC #$0100 ;} Enemy Y speed table index -= 1
$A6:884E 9D AC 0F STA $0FAC,x[$7E:102C] ;/
$A6:8851 10 0B BPL $0B [$885E] ; If [enemy Y speed table index] < 0:
$A6:8853 9E AC 0F STZ $0FAC,x[$7E:102C] ; Enemy Y speed table index = 0
$A6:8856 A9 8B 88 LDA #$888B ;\
$A6:8859 9D A8 0F STA $0FA8,x[$7E:1028] ;} Enemy function = $888B (bounce - falling)
$A6:885C 80 2C BRA $2C [$888A] ; Return
$A6:885E BD AA 0F LDA $0FAA,x[$7E:102A] ;\
$A6:8861 29 00 FF AND #$FF00 ;|
$A6:8864 EB XBA ;|
$A6:8865 0A ASL A ;} Y = [enemy X speed table index] * 8 (quadratic speed table index)
$A6:8866 0A ASL A ;|
$A6:8867 0A ASL A ;|
$A6:8868 A8 TAY ;/
$A6:8869 BD B0 0F LDA $0FB0,x[$7E:1030] ;\
$A6:886C F0 04 BEQ $04 [$8872] ;} If [enemy direction] != right:
$A6:886E C8 INY ;\
$A6:886F C8 INY ;|
$A6:8870 C8 INY ;} Y += 4 (negated speed)
$A6:8871 C8 INY ;/
$A6:8872 20 00 8A JSR $8A00 [$A6:8A00] ; Move boulder horizontally
$A6:8875 BD AA 0F LDA $0FAA,x[$7E:102A] ;\
$A6:8878 18 CLC ;|
$A6:8879 69 20 00 ADC #$0020 ;|
$A6:887C 9D AA 0F STA $0FAA,x[$7E:102A] ;|
$A6:887F C9 00 50 CMP #$5000 ;} Enemy X speed table index = min(50.00h, [enemy X speed table index] + 0.20h)
$A6:8882 30 06 BMI $06 [$888A] ;|
$A6:8884 A9 00 50 LDA #$5000 ;|
$A6:8887 9D AA 0F STA $0FAA,x ;/
$A6:888A 60 RTS
}
;;; $888B: Boulder function - bounce - falling ;;;
{
$A6:888B AE 54 0E LDX $0E54 [$7E:0E54]
$A6:888E BD AC 0F LDA $0FAC,x[$7E:102C] ;\
$A6:8891 29 00 FF AND #$FF00 ;|
$A6:8894 EB XBA ;|
$A6:8895 0A ASL A ;} Y = [enemy Y speed table index] * 8 (quadratic speed table index)
$A6:8896 0A ASL A ;|
$A6:8897 0A ASL A ;|
$A6:8898 A8 TAY ;/
$A6:8899 B9 8F 83 LDA $838F,y[$A6:838F] ;\
$A6:889C 85 12 STA $12 [$7E:0012] ;|
$A6:889E B9 91 83 LDA $8391,y[$A6:8391] ;} $14.$12 = [$838F + [Y] + 2].[$838F + [Y]]
$A6:88A1 85 14 STA $14 [$7E:0014] ;/
$A6:88A3 22 86 C7 A0 JSL $A0C786[$A0:C786] ; Move enemy down by [$14].[$12]
$A6:88A7 90 62 BCC $62 [$890B] ; If not collided with block: go to BRANCH_NO_COLLISION
$A6:88A9 A9 42 00 LDA #$0042 ;\
$A6:88AC 22 CB 90 80 JSL $8090CB[$80:90CB] ;} Queue sound 42h, sound library 2, max queued sounds allowed = 6 (boulder bounces)
$A6:88B0 BD B0 0F LDA $0FB0,x[$7E:1030] ;\
$A6:88B3 C9 02 00 CMP #$0002 ;} If [enemy direction] = 2 (left - destroy after bounce): (always true in vanilla)
$A6:88B6 D0 26 BNE $26 [$88DE] ;/
$A6:88B8 BD 86 0F LDA $0F86,x[$7E:1006] ;\
$A6:88BB 09 00 02 ORA #$0200 ;} Mark enemy for deletion
$A6:88BE 9D 86 0F STA $0F86,x[$7E:1006] ;/
$A6:88C1 BD 7A 0F LDA $0F7A,x[$7E:0FFA] ;\
$A6:88C4 85 12 STA $12 [$7E:0012] ;} $12 = [enemy X position]
$A6:88C6 BD 7E 0F LDA $0F7E,x[$7E:0FFE] ;\
$A6:88C9 85 14 STA $14 [$7E:0014] ;} $14 = [enemy Y position]
$A6:88CB A9 11 00 LDA #$0011 ; A = 11h (rock particles)
$A6:88CE A0 09 E5 LDY #$E509 ;\
$A6:88D1 22 97 80 86 JSL $868097[$86:8097] ;} Spawn dust cloud / explosion enemy projectile
$A6:88D5 A9 43 00 LDA #$0043 ;\
$A6:88D8 22 CB 90 80 JSL $8090CB[$80:90CB] ;} Queue sound 43h, sound library 2, max queued sounds allowed = 6 (boulder explodes)
$A6:88DC 80 63 BRA $63 [$8941] ; Return
$A6:88DE A9 32 88 LDA #$8832 ;\
$A6:88E1 9D A8 0F STA $0FA8,x ;} Enemy function = $8832 (bounce - rising)
$A6:88E4 BD AE 0F LDA $0FAE,x ;\
$A6:88E7 3A DEC A ;|
$A6:88E8 0A ASL A ;|
$A6:88E9 A8 TAY ;} Enemy Y speed table index = [$86EF + [enemy bounce index] * 2] / 100h
$A6:88EA B9 F1 86 LDA $86F1,y ;|
$A6:88ED 9D AC 0F STA $0FAC,x ;/
$A6:88F0 DE AE 0F DEC $0FAE,x ; Decrement enemy bounce index
$A6:88F3 10 4C BPL $4C [$8941] ; If [enemy bounce index] >= 0: return
$A6:88F5 BD 7E 0F LDA $0F7E,x ;\
$A6:88F8 9F 06 78 7E STA $7E7806,x ;} Enemy previous enemy Y position = [enemy Y position]
$A6:88FC BD 80 0F LDA $0F80,x ;\
$A6:88FF 9F 04 78 7E STA $7E7804,x ;} Enemy previous enemy Y subposition = [enemy Y subposition]
$A6:8903 A9 42 89 LDA #$8942 ;\
$A6:8906 9D A8 0F STA $0FA8,x ;} Enemy function = $8942 (rolling)
$A6:8909 80 36 BRA $36 [$8941] ; Return
; BRANCH_NO_COLLISION
$A6:890B BD AC 0F LDA $0FAC,x[$7E:102C] ;\
$A6:890E 18 CLC ;|
$A6:890F 69 00 01 ADC #$0100 ;} Enemy Y speed table index += 1
$A6:8912 9D AC 0F STA $0FAC,x[$7E:102C] ;/
$A6:8915 BD AA 0F LDA $0FAA,x[$7E:102A] ;\
$A6:8918 29 00 FF AND #$FF00 ;|
$A6:891B EB XBA ;|
$A6:891C 0A ASL A ;} Y = [enemy X speed table index] * 8 (quadratic speed table index)
$A6:891D 0A ASL A ;|
$A6:891E 0A ASL A ;|
$A6:891F A8 TAY ;/
$A6:8920 BD B0 0F LDA $0FB0,x[$7E:1030] ;\
$A6:8923 F0 04 BEQ $04 [$8929] ;} If [enemy direction] != right:
$A6:8925 C8 INY ;\
$A6:8926 C8 INY ;|
$A6:8927 C8 INY ;} Y += 4 (negated speed)
$A6:8928 C8 INY ;/
$A6:8929 20 00 8A JSR $8A00 [$A6:8A00] ; Move boulder horizontally
$A6:892C BD AA 0F LDA $0FAA,x[$7E:102A] ;\
$A6:892F 18 CLC ;|
$A6:8930 69 20 00 ADC #$0020 ;|
$A6:8933 9D AA 0F STA $0FAA,x[$7E:102A] ;|
$A6:8936 C9 00 50 CMP #$5000 ;} Enemy X speed table index = min(50.00h, [enemy X speed table index] + 0.20h)
$A6:8939 30 06 BMI $06 [$8941] ;|
$A6:893B A9 00 50 LDA #$5000 ;|
$A6:893E 9D AA 0F STA $0FAA,x ;/
$A6:8941 60 RTS
}
;;; $8942: Boulder function - rolling ;;;
{
$A6:8942 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8945 BD AA 0F LDA $0FAA,x[$7E:116A] ;\
$A6:8948 29 00 FF AND #$FF00 ;|
$A6:894B EB XBA ;|
$A6:894C 0A ASL A ;} Y = [enemy X speed table index] * 8 (quadratic speed table index)
$A6:894D 0A ASL A ;|
$A6:894E 0A ASL A ;|
$A6:894F A8 TAY ;/
$A6:8950 B9 8F 83 LDA $838F,y[$A6:838F] ;\
$A6:8953 85 12 STA $12 [$7E:0012] ;|
$A6:8955 B9 91 83 LDA $8391,y[$A6:8391] ;|
$A6:8958 18 CLC ;} $14.$12 = [$838F + [Y] + 2].[$838F + [Y]] + [enemy minimum distance from ground]
$A6:8959 7F 02 78 7E ADC $7E7802,x[$7E:79C2];|
$A6:895D 85 14 STA $14 [$7E:0014] ;/
$A6:895F 5A PHY
$A6:8960 22 86 C7 A0 JSL $A0C786[$A0:C786] ; Move enemy down by [$14].[$12]
$A6:8964 7A PLY
$A6:8965 BD 7E 0F LDA $0F7E,x[$7E:113E] ;\
$A6:8968 38 SEC ;|
$A6:8969 FF 02 78 7E SBC $7E7802,x[$7E:79C2];} Enemy Y position -= [enemy minimum distance from ground]
$A6:896D 9D 7E 0F STA $0F7E,x[$7E:113E] ;/
$A6:8970 BD B0 0F LDA $0FB0,x[$7E:1170] ;\
$A6:8973 F0 04 BEQ $04 [$8979] ;} If [enemy direction] != right:
$A6:8975 C8 INY ;\
$A6:8976 C8 INY ;|
$A6:8977 C8 INY ;} Y += 4 (negated speed)
$A6:8978 C8 INY ;/
$A6:8979 B9 8F 83 LDA $838F,y[$A6:838F] ;\
$A6:897C 85 12 STA $12 [$7E:0012] ;|
$A6:897E B9 91 83 LDA $8391,y[$A6:8391] ;} Move enemy right by [$838F + [Y] + 2].[$838F + [Y]]
$A6:8981 85 14 STA $14 [$7E:0014] ;|
$A6:8983 22 AB C6 A0 JSL $A0C6AB[$A0:C6AB] ;/
$A6:8987 90 36 BCC $36 [$89BF] ; If collided with wall:
$A6:8989 BD 86 0F LDA $0F86,x[$7E:1146] ;\
$A6:898C 09 00 01 ORA #$0100 ;|
$A6:898F 09 00 02 ORA #$0200 ;} Set enemy as invisible and mark for deletion
$A6:8992 9D 86 0F STA $0F86,x[$7E:1146] ;/
$A6:8995 A9 FC 89 LDA #$89FC ;\
$A6:8998 9D A8 0F STA $0FA8,x[$7E:1168] ;} Enemy function = RTS
$A6:899B A9 42 00 LDA #$0042 ;\
$A6:899E 22 CB 90 80 JSL $8090CB[$80:90CB] ;} Queue sound 42h, sound library 2, max queued sounds allowed = 6 (boulder bounces)
$A6:89A2 BD 7A 0F LDA $0F7A,x[$7E:113A] ;\
$A6:89A5 85 12 STA $12 [$7E:0012] ;} $12 = [enemy X position]
$A6:89A7 BD 7E 0F LDA $0F7E,x[$7E:113E] ;\
$A6:89AA 85 14 STA $14 [$7E:0014] ;} $14 = [enemy Y position]
$A6:89AC A9 11 00 LDA #$0011 ; A = 11h (rock particles)
$A6:89AF A0 09 E5 LDY #$E509 ;\
$A6:89B2 22 97 80 86 JSL $868097[$86:8097] ;} Spawn dust cloud / explosion enemy projectile
$A6:89B6 A9 43 00 LDA #$0043 ;\
$A6:89B9 22 CB 90 80 JSL $8090CB[$80:90CB] ;} Queue sound 43h, sound library 2, max queued sounds allowed = 6 (boulder explodes)
$A6:89BD 80 2E BRA $2E [$89ED] ; Go to BRANCH_RETURN
$A6:89BF BD AA 0F LDA $0FAA,x[$7E:116A] ;\
$A6:89C2 18 CLC ;|
$A6:89C3 69 40 00 ADC #$0040 ;|
$A6:89C6 9D AA 0F STA $0FAA,x[$7E:116A] ;|
$A6:89C9 C9 00 40 CMP #$4000 ;} Enemy X speed table index = min(40.00h, [enemy X speed table index] + 0.40h)
$A6:89CC 30 06 BMI $06 [$89D4] ;|
$A6:89CE A9 00 40 LDA #$4000 ;|
$A6:89D1 9D AA 0F STA $0FAA,x ;/
$A6:89D4 BD 7E 0F LDA $0F7E,x[$7E:113E] ;\
$A6:89D7 DF 06 78 7E CMP $7E7806,x[$7E:79C6];} If [enemy Y position] = [enemy previous enemy Y position]:
$A6:89DB D0 10 BNE $10 [$89ED] ;/
$A6:89DD BD 80 0F LDA $0F80,x[$7E:1140] ;\
$A6:89E0 DF 04 78 7E CMP $7E7804,x[$7E:79C4];} If [enemy Y subposition] = [enemy previous enemy Y subposition]:
$A6:89E4 D0 07 BNE $07 [$89ED] ;/
$A6:89E6 A9 00 00 LDA #$0000 ;\
$A6:89E9 9F 02 78 7E STA $7E7802,x[$7E:79C2];} Enemy minimum distance from ground = 0
; BRANCH_RETURN
$A6:89ED BD 7E 0F LDA $0F7E,x[$7E:113E] ;\
$A6:89F0 9F 06 78 7E STA $7E7806,x[$7E:79C6];} Enemy previous enemy Y position = [enemy Y position]
$A6:89F4 BD 80 0F LDA $0F80,x[$7E:1140] ;\
$A6:89F7 9F 04 78 7E STA $7E7804,x[$7E:79C4];} Enemy previous enemy Y subposition = [enemy Y subposition]
$A6:89FB 60 RTS
}
;;; $89FC: RTS ;;;
{
$A6:89FC AE 54 0E LDX $0E54 [$7E:0E54]
$A6:89FF 60 RTS
}
;;; $8A00: Move boulder horizontally ;;;
{
;; Parameters:
;; Y: Quadratic speed table index
$A6:8A00 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8A03 BD 7C 0F LDA $0F7C,x[$7E:0FFC] ;\
$A6:8A06 18 CLC ;|
$A6:8A07 79 8F 83 ADC $838F,y[$A6:8393] ;|
$A6:8A0A 90 03 BCC $03 [$8A0F] ;|
$A6:8A0C FE 7A 0F INC $0F7A,x[$7E:0FFA] ;|
;} Enemy X position += [$838F + [Y] + 2].[$838F + [Y]]
$A6:8A0F 9D 7C 0F STA $0F7C,x[$7E:0FFC] ;|
$A6:8A12 BD 7A 0F LDA $0F7A,x[$7E:0FFA] ;|
$A6:8A15 18 CLC ;|
$A6:8A16 79 91 83 ADC $8391,y[$A6:8395] ;|
$A6:8A19 9D 7A 0F STA $0F7A,x[$7E:0FFA] ;/
$A6:8A1C 60 RTS
}
;;; $8A1D: Unused. Move boulder horizontally with linear speed table ;;;
{
;; Parameters:
;; Y: Linear speed table index
$A6:8A1D AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8A20 BD 7C 0F LDA $0F7C,x ;\
$A6:8A23 18 CLC ;|
$A6:8A24 79 89 81 ADC $8189,y ;|
$A6:8A27 90 03 BCC $03 [$8A2C] ;|
$A6:8A29 FE 7A 0F INC $0F7A,x ;|
;} Enemy X position += [$8187 + [Y]].[$8187 + [Y] + 2]
$A6:8A2C 9D 7C 0F STA $0F7C,x ;|
$A6:8A2F BD 7A 0F LDA $0F7A,x ;|
$A6:8A32 18 CLC ;|
$A6:8A33 79 87 81 ADC $8187,y ;|
$A6:8A36 9D 7A 0F STA $0F7A,x ;/
$A6:8A39 60 RTS
}
;;; $8A3A: Move boulder vertically ;;;
{
;; Parameters:
;; Y: Quadratic speed table index
$A6:8A3A AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8A3D BD 80 0F LDA $0F80,x[$7E:1000] ;\
$A6:8A40 18 CLC ;|
$A6:8A41 79 8F 83 ADC $838F,y[$A6:838F] ;|
$A6:8A44 90 03 BCC $03 [$8A49] ;|
$A6:8A46 FE 7E 0F INC $0F7E,x[$7E:0FFE] ;|
;} Enemy Y position += [$838F + [Y] + 2].[$838F + [Y]]
$A6:8A49 9D 80 0F STA $0F80,x[$7E:1000] ;|
$A6:8A4C BD 7E 0F LDA $0F7E,x[$7E:0FFE] ;|
$A6:8A4F 18 CLC ;|
$A6:8A50 79 91 83 ADC $8391,y[$A6:8391] ;|
$A6:8A53 9D 7E 0F STA $0F7E,x[$7E:0FFE] ;/
$A6:8A56 60 RTS
}
;;; $8A57: RTL ;;;
{
$A6:8A57 6B RTL
}
;;; $8A58: RTL ;;;
{
$A6:8A58 6B RTL
}
;;; $8A59: Boulder spritemaps ;;;
{
$A6:8A59 dx 0004, 8000,00,2122, 81F0,00,2120, 8000,F0,2102, 81F0,F0,2100
$A6:8A6F dx 0004, 8000,00,2162, 81F0,00,2160, 8000,F0,2142, 81F0,F0,2140
$A6:8A85 dx 0004, 8000,00,2126, 81F0,00,2124, 8000,F0,2106, 81F0,F0,2104
$A6:8A9B dx 0004, 8000,00,2166, 81F0,00,2164, 8000,F0,2146, 81F0,F0,2144
$A6:8AB1 dx 0004, 8000,00,212A, 81F0,00,2128, 8000,F0,210A, 81F0,F0,2108
$A6:8AC7 dx 0004, 8000,00,216A, 81F0,00,2168, 8000,F0,214A, 81F0,F0,2148
$A6:8ADD dx 0004, 8000,00,212E, 81F0,00,212C, 8000,F0,210E, 81F0,F0,210C
$A6:8AF3 dx 0004, 8000,00,216E, 81F0,00,216C, 8000,F0,214E, 81F0,F0,214C
}
}
;;; $8B09..8CFA: Spike platform ;;;
{
;;; $8B09: Palette - enemy $DFFF/$E03F (spike platform) ;;;
{
$A6:8B09 dw 3800, 62BA, 49F3, 2D4D, 0C44, 49F3, 356E, 20C9, 1486, 241F, 1C17, 142F, 0C47, 0000, 0000, 0000
}
;;; $8B29: Instruction list - spike platform ;;;
{
$A6:8B29 dx 0001,8CE5,
812F ; Sleep
}
;;; $8B2F: Initialisation AI - enemy $DFFF (spike platform top) ;;;
{
$A6:8B2F AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8B32 A9 29 8B LDA #$8B29 ;\
$A6:8B35 9D 92 0F STA $0F92,x[$7E:14D2] ;} Enemy instruction list pointer = $8B29
$A6:8B38 A9 B4 8B LDA #$8BB4 ;\
$A6:8B3B 9D A8 0F STA $0FA8,x[$7E:14E8] ;} Enemy function = $8BB4 (waiting to fall)
$A6:8B3E BD B4 0F LDA $0FB4,x[$7E:14F4] ;\
$A6:8B41 29 FF 00 AND #$00FF ;|
$A6:8B44 0A ASL A ;|
$A6:8B45 0A ASL A ;} Enemy falling Y speed table index = [enemy parameter 1 low] * 8
$A6:8B46 0A ASL A ;|
$A6:8B47 9F 04 78 7E STA $7E7804,x[$7E:7D44];/
$A6:8B4B AA TAX ;\
$A6:8B4C BD 87 81 LDA $8187,x[$A6:8187] ;|
$A6:8B4F 85 12 STA $12 [$7E:0012] ;|
$A6:8B51 BD 89 81 LDA $8189,x[$A6:8189] ;|
$A6:8B54 85 14 STA $14 [$7E:0014] ;} Enemy $0FB0 = [$8187 + [enemy falling Y speed table index] + 2] (never read)
$A6:8B56 AE 54 0E LDX $0E54 [$7E:0E54] ;} Enemy $0FB2 = [$8187 + [enemy falling Y speed table index]] (never read)
$A6:8B59 A5 14 LDA $14 [$7E:0014] ;|
$A6:8B5B 9D B0 0F STA $0FB0,x[$7E:14F0] ;|
$A6:8B5E A5 12 LDA $12 [$7E:0012] ;|
$A6:8B60 9D B2 0F STA $0FB2,x[$7E:14F2] ;/
$A6:8B63 BD B6 0F LDA $0FB6,x[$7E:14F6] ;\
$A6:8B66 29 00 FF AND #$FF00 ;|
$A6:8B69 EB XBA ;|
$A6:8B6A 18 CLC ;} Enemy falling target Y position = [enemy Y position] + [enemy parameter 2 high]
$A6:8B6B 7D 7E 0F ADC $0F7E,x[$7E:14BE] ;|
$A6:8B6E 9D AE 0F STA $0FAE,x[$7E:14EE] ;/
$A6:8B71 BD 7E 0F LDA $0F7E,x[$7E:14BE] ;\
$A6:8B74 9D AC 0F STA $0FAC,x[$7E:14EC] ;} Enemy rising target Y position = [enemy Y position]
$A6:8B77 BD B6 0F LDA $0FB6,x[$7E:14F6] ;\
$A6:8B7A 29 FF 00 AND #$00FF ;|
$A6:8B7D 9F 00 78 7E STA $7E7800,x[$7E:7D40];} Enemy fall wait timer reset value = [enemy parameter 2 low]
$A6:8B81 9D AA 0F STA $0FAA,x[$7E:14EA] ; Enemy fall wait timer = [enemy fall wait timer reset value]
$A6:8B84 6B RTL
}
;;; $8B85: Initialisation AI - enemy $E03F (spike platform bottom) ;;;
{
$A6:8B85 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8B88 BD 3A 0F LDA $0F3A,x[$7E:14BA] ;\
$A6:8B8B 9D 7A 0F STA $0F7A,x[$7E:14FA] ;} Enemy X position = [enemy ([X] - 1) X position]
$A6:8B8E BD 3E 0F LDA $0F3E,x[$7E:14BE] ;\
$A6:8B91 18 CLC ;|
$A6:8B92 69 0C 00 ADC #$000C ;} Enemy Y position = [enemy ([X] - 1) Y position] + Ch
$A6:8B95 9D 7E 0F STA $0F7E,x[$7E:14FE] ;/
$A6:8B98 6B RTL
}
;;; $8B99: Main AI - enemy $E03F (spike platform bottom) ;;;
{
$A6:8B99 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8B9C BD 3A 0F LDA $0F3A,x[$7E:123A] ;\
$A6:8B9F 9D 7A 0F STA $0F7A,x[$7E:127A] ;} Enemy X position = [enemy ([X] - 1) X position]
$A6:8BA2 BD 3E 0F LDA $0F3E,x[$7E:123E] ;\
$A6:8BA5 18 CLC ;|
$A6:8BA6 69 0C 00 ADC #$000C ;} Enemy Y position = [enemy ([X] - 1) Y position] + Ch
$A6:8BA9 9D 7E 0F STA $0F7E,x[$7E:127E] ;/
$A6:8BAC 6B RTL
}
;;; $8BAD: Main AI - enemy $DFFF (spike platform top) ;;;
{
$A6:8BAD AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8BB0 FC A8 0F JSR ($0FA8,x)[$A6:8BB4]; Execute [enemy function]
$A6:8BB3 6B RTL
}
;;; $8BB4: Spike platform function - waiting to fall ;;;
{
$A6:8BB4 DA PHX
$A6:8BB5 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8BB8 DE AA 0F DEC $0FAA,x[$7E:126A] ; Decrement enemy fall wait timer
$A6:8BBB BD AA 0F LDA $0FAA,x[$7E:126A] ;\
$A6:8BBE D0 1A BNE $1A [$8BDA] ;} If [enemy fall wait timer] != 0: return
$A6:8BC0 BF 00 78 7E LDA $7E7800,x[$7E:7AC0];\
$A6:8BC4 9D AA 0F STA $0FAA,x[$7E:126A] ;} Enemy fall wait timer = [enemy fall wait timer reset value]
$A6:8BC7 BD B4 0F LDA $0FB4,x[$7E:1274] ;\
$A6:8BCA 29 FF 00 AND #$00FF ;|
$A6:8BCD 0A ASL A ;|
$A6:8BCE 0A ASL A ;} Enemy falling Y speed table index = [enemy parameter 1 low] * 8
$A6:8BCF 0A ASL A ;|
$A6:8BD0 9F 04 78 7E STA $7E7804,x[$7E:7AC4];/
$A6:8BD4 A9 DC 8B LDA #$8BDC ;\
$A6:8BD7 9D A8 0F STA $0FA8,x[$7E:1268] ;} Enemy function = $8BDC (falling)
$A6:8BDA FA PLX
$A6:8BDB 60 RTS
}
;;; $8BDC: Spike platform function - falling ;;;
{
$A6:8BDC DA PHX
$A6:8BDD AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8BE0 BD 7E 0F LDA $0F7E,x[$7E:123E] ;\
$A6:8BE3 9F 02 78 7E STA $7E7802,x[$7E:7AC2];} Enemy previous Y position = [enemy Y position]
$A6:8BE7 BF 04 78 7E LDA $7E7804,x[$7E:7AC4];\
$A6:8BEB AA TAX ;} X = [enemy falling Y speed table index] (linear speed table index)
$A6:8BEC BD 87 81 LDA $8187,x[$A6:8287] ;\
$A6:8BEF 85 14 STA $14 [$7E:0014] ;|
$A6:8BF1 BD 89 81 LDA $8189,x[$A6:8289] ;|
$A6:8BF4 85 12 STA $12 [$7E:0012] ;} Enemy Y position += [$8187 + [X]].[$8187 + [X] + 2] (speed)
$A6:8BF6 AE 54 0E LDX $0E54 [$7E:0E54] ;|
$A6:8BF9 22 90 AF A0 JSL $A0AF90[$A0:AF90] ;/
$A6:8BFD BD 7E 0F LDA $0F7E,x[$7E:123E] ;\
$A6:8C00 DD AE 0F CMP $0FAE,x[$7E:126E] ;} If [enemy Y position] >= [enemy falling target Y position]:
$A6:8C03 30 1A BMI $1A [$8C1F] ;/
$A6:8C05 A9 40 00 LDA #$0040 ;\
$A6:8C08 9F 06 78 7E STA $7E7806,x[$7E:7AC6];} Enemy rise wait timer = 40h
$A6:8C0C A9 4A 8C LDA #$8C4A ;\
$A6:8C0F 9D A8 0F STA $0FA8,x[$7E:1268] ;} Enemy function = $8C4A (waiting to rise)
$A6:8C12 BD AE 0F LDA $0FAE,x[$7E:126E] ;\
$A6:8C15 9D 7E 0F STA $0F7E,x[$7E:123E] ;} Enemy Y position = [enemy falling target Y position]
$A6:8C18 A9 1B 00 LDA #$001B ;\
$A6:8C1B 22 CB 90 80 JSL $8090CB[$80:90CB] ;} Queue sound 1Bh, sound library 2, max queued sounds allowed = 6 (spike platform stops)
$A6:8C1F 22 A1 8C A6 JSL $A68CA1[$A6:8CA1] ;\
$A6:8C23 F0 0F BEQ $0F [$8C34] ;} If spike platform is touching Samus from below:
$A6:8C25 BD 7E 0F LDA $0F7E,x[$7E:13BE] ;\
$A6:8C28 38 SEC ;|
$A6:8C29 FF 02 78 7E SBC $7E7802,x[$7E:7C42];|
$A6:8C2D 18 CLC ;} Extra Samus Y displacement += [enemy Y position] - [enemy previous Y position]
$A6:8C2E 6D 5C 0B ADC $0B5C [$7E:0B5C] ;|
$A6:8C31 8D 5C 0B STA $0B5C [$7E:0B5C] ;/
$A6:8C34 BF 04 78 7E LDA $7E7804,x[$7E:7AC4];\
$A6:8C38 18 CLC ;|
$A6:8C39 69 08 00 ADC #$0008 ;|
$A6:8C3C C9 00 02 CMP #$0200 ;|
$A6:8C3F 30 03 BMI $03 [$8C44] ;} Enemy falling Y speed table index = min(200h, [enemy falling Y speed table index] + 8)
$A6:8C41 A9 00 02 LDA #$0200 ;|
;|
$A6:8C44 9F 04 78 7E STA $7E7804,x[$7E:7AC4];/
$A6:8C48 FA PLX
$A6:8C49 60 RTS
}
;;; $8C4A: Spike platform function - waiting to rise ;;;
{
$A6:8C4A BF 06 78 7E LDA $7E7806,x[$7E:7AC6];\
$A6:8C4E 3A DEC A ;} Decrement enemy rise wait timer
$A6:8C4F 9F 06 78 7E STA $7E7806,x[$7E:7AC6];/
$A6:8C53 F0 01 BEQ $01 [$8C56] ; If [enemy rise wait timer] != 0:
$A6:8C55 60 RTS ; Return
$A6:8C56 A9 5D 8C LDA #$8C5D ;\
$A6:8C59 9D A8 0F STA $0FA8,x[$7E:12E8] ;} Enemy function = $8C5D (rising)
$A6:8C5C 60 RTS
}
;;; $8C5D: Spike platform function - rising ;;;
{
$A6:8C5D DA PHX
$A6:8C5E AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8C61 BD 7E 0F LDA $0F7E,x[$7E:12BE] ;\
$A6:8C64 9F 02 78 7E STA $7E7802,x[$7E:7B42];} Enemy previous Y position = [enemy Y position]
$A6:8C68 A9 00 80 LDA #$8000 ;\
$A6:8C6B 85 12 STA $12 [$7E:0012] ;|
$A6:8C6D A9 00 00 LDA #$0000 ;} Enemy Y position -= 0.8000h
$A6:8C70 85 14 STA $14 [$7E:0014] ;|
$A6:8C72 22 7E AF A0 JSL $A0AF7E[$A0:AF7E] ;/
$A6:8C76 BD 7E 0F LDA $0F7E,x[$7E:12BE] ;\
$A6:8C79 DD AC 0F CMP $0FAC,x[$7E:12EC] ;} If [enemy Y position] < [enemy rising target Y position]:
$A6:8C7C 10 0C BPL $0C [$8C8A] ;/
$A6:8C7E A9 B4 8B LDA #$8BB4 ;\
$A6:8C81 9D A8 0F STA $0FA8,x[$7E:13E8] ;} Enemy function = $8BB4 (waiting to fall)
$A6:8C84 BD AC 0F LDA $0FAC,x[$7E:13EC] ;\
$A6:8C87 9D 7E 0F STA $0F7E,x[$7E:13BE] ;} Enemy Y position = [enemy rising target Y position]
$A6:8C8A 22 A1 8C A6 JSL $A68CA1[$A6:8CA1] ;\
$A6:8C8E F0 0F BEQ $0F [$8C9F] ;} If spike platform is touching Samus from below:
$A6:8C90 BD 7E 0F LDA $0F7E,x[$7E:12BE] ;\
$A6:8C93 38 SEC ;|
$A6:8C94 FF 02 78 7E SBC $7E7802,x[$7E:7B42];|
$A6:8C98 18 CLC ;} Extra Samus Y displacement += [enemy Y position] - [enemy previous Y position]
$A6:8C99 6D 5C 0B ADC $0B5C [$7E:0B5C] ;|
$A6:8C9C 8D 5C 0B STA $0B5C [$7E:0B5C] ;/
$A6:8C9F FA PLX
$A6:8CA0 60 RTS
}
;;; $8CA1: Check if spike platform is touching Samus from below ;;;
{
;; Returns:
;; Zero: clear if touching Samus, otherwise set
; This is a copy+paste of $A0:ABE7 with the Y delta threshold changed from 3 to 5
$A6:8CA1 AD F6 0A LDA $0AF6 [$7E:0AF6] ;\
$A6:8CA4 38 SEC ;|
$A6:8CA5 FD 7A 0F SBC $0F7A,x[$7E:123A] ;|
$A6:8CA8 10 04 BPL $04 [$8CAE] ;|
$A6:8CAA 49 FF FF EOR #$FFFF ;|
$A6:8CAD 1A INC A ;|
;} If |[Samus X position] - [enemy X position]| >= [Samus X radius] + [enemy X radius]:
$A6:8CAE 38 SEC ;|
$A6:8CAF ED FE 0A SBC $0AFE [$7E:0AFE] ;|
$A6:8CB2 90 09 BCC $09 [$8CBD] ;|
$A6:8CB4 DD 82 0F CMP $0F82,x[$7E:1242] ;|
$A6:8CB7 90 04 BCC $04 [$8CBD] ;/
$A6:8CB9 A9 00 00 LDA #$0000 ;\
$A6:8CBC 6B RTL ;} Return zero set
$A6:8CBD AD FA 0A LDA $0AFA [$7E:0AFA] ;\
$A6:8CC0 18 CLC ;|
$A6:8CC1 69 05 00 ADC #$0005 ;|
$A6:8CC4 38 SEC ;} If [Samus Y position] + 5 >= [enemy Y position]: return zero set
$A6:8CC5 FD 7E 0F SBC $0F7E,x[$7E:12BE] ;|
$A6:8CC8 10 11 BPL $11 [$8CDB] ;/
$A6:8CCA 49 FF FF EOR #$FFFF ;\
$A6:8CCD 1A INC A ;|
$A6:8CCE 38 SEC ;|
$A6:8CCF ED 00 0B SBC $0B00 [$7E:0B00] ;|
$A6:8CD2 90 0B BCC $0B [$8CDF] ;} If [enemy Y position] - ([Samus Y position] + 3) <= [Samus Y radius] + [enemy Y radius]: return zero clear
$A6:8CD4 DD 84 0F CMP $0F84,x[$7E:12C4] ;|
$A6:8CD7 F0 06 BEQ $06 [$8CDF] ;|
$A6:8CD9 90 04 BCC $04 [$8CDF] ;/
$A6:8CDB A9 00 00 LDA #$0000 ;\
$A6:8CDE 6B RTL ;} Return zero set
$A6:8CDF A9 FF FF LDA #$FFFF
$A6:8CE2 6B RTL
}
;;; $8CE3: RTL ;;;
{
$A6:8CE3 6B RTL
}
;;; $8CE4: RTL ;;;
{
$A6:8CE4 6B RTL
}
;;; $8CE5: Spike platform spritemap ;;;
{
$A6:8CE5 dx 0004, 8000,04,2106, 81F0,04,2104, 8000,F4,2102, 81F0,F4,2100
}
}
;;; $8CFB..946F: Fire pillar ;;;
{
;;; $8CFB: Palette - enemy $E07F (fire pillar) ;;;
{
$A6:8CFB dw 3800, 3E7F, 2DFD, 10FB, 0097, 73FF, 53FF, 37FF, 17FF, 24DF, 189B, 1076, 0C50, 084B, 5EFF, 0880
}
;;; $8D1B: Instruction list - graphics part ;;;
{
$A6:8D1B dx 8DAF, ; Queue fire pillar sound effect
0002,9082,
8E13, ; Activity frame 0
0002,9089,
8E2D, ; Activity frame 1
0002,909F,
8E41, ; Activity frame 2
0002,90BA,
8E55, ; Activity frame 3
0001,90DA,
8E69, ; Activity frame 4
0001,90FF,
8E7D, ; Activity frame 5
0001,9124,
8E91, ; Activity frame 6
0001,9149,
8EA5, ; Activity frame 7
0002,916E,
8EB9, ; Activity frame 8
0002,9198,
8ECD, ; Activity frame 9
0002,91C2,
8EE1, ; Activity frame Ah
0002,91F1,
8EF5, ; Activity frame Bh
0002,9234,
8F09, ; Activity frame Ch
0002,927C,
8F1D, ; Activity frame Dh
0002,92C4,
8F31, ; Activity frame Eh
0002,9302,
8F45, ; Activity frame Fh
0004,934A,
8F59, ; Activity frame 10h
0004,938D,
8F6D, ; Activity frame 11h
0004,93CB,
8F81, ; Activity frame 12h
0004,9404,
8F95, ; Activity frame 13h
0004,942E,
8FA9, ; Activity frame 14h
0004,944E,
8FBD, ; Activity frame 15h
0004,9469,
8FD1, ; Finish activity
812F ; Sleep
}
;;; $8DA9: Instruction list - hitbox part ;;;
{
$A6:8DA9 dx 0002,9082,
812F ; Sleep
}
;;; $8DAF: Instruction - queue fire pillar sound effect ;;;
{
$A6:8DAF DA PHX
$A6:8DB0 5A PHY
$A6:8DB1 A9 61 00 LDA #$0061 ;\
$A6:8DB4 22 CB 90 80 JSL $8090CB[$80:90CB] ;} Queue sound 61h, sound library 2, max queued sounds allowed = 6 (fire pillar)
$A6:8DB8 7A PLY
$A6:8DB9 FA PLX
$A6:8DBA 6B RTL
}
;;; $8DBB: Y offsets ;;;
{
$A6:8DBB dw 0005
$A6:8DBD dw 000A
$A6:8DBF dw 000F
$A6:8DC1 dw 0014
$A6:8DC3 dw 0019
$A6:8DC5 dw 001E
$A6:8DC7 dw 0023
$A6:8DC9 dw 0028
$A6:8DCB dw 002D
$A6:8DCD dw 0032
$A6:8DCF dw 0037
$A6:8DD1 dw 003C
$A6:8DD3 dw 0041
$A6:8DD5 dw 0046
$A6:8DD7 dw 004B
$A6:8DD9 dw 0050
$A6:8DDB dw 0055
$A6:8DDD dw 005A
$A6:8DDF dw 005F
$A6:8DE1 dw 0064
$A6:8DE3 dw 0069
$A6:8DE5 dw 006E
}
;;; $8DE7: Y radii ;;;
{
$A6:8DE7 dw 0018
$A6:8DE9 dw 0018
$A6:8DEB dw 0018
$A6:8DED dw 0018
$A6:8DEF dw 0018
$A6:8DF1 dw 0018
$A6:8DF3 dw 0018
$A6:8DF5 dw 0018
$A6:8DF7 dw 0018
$A6:8DF9 dw 0018
$A6:8DFB dw 0018
$A6:8DFD dw 0018
$A6:8DFF dw 0018
$A6:8E01 dw 0018
$A6:8E03 dw 0018
$A6:8E05 dw 0018
$A6:8E07 dw 0018
$A6:8E09 dw 0018
$A6:8E0B dw 0014
$A6:8E0D dw 0010
$A6:8E0F dw 000C
$A6:8E11 dw 0008
}
;;; $8E13..8FFB: Fire pillar instructions ;;;
{
;;; $8E13: Instruction - activity frame 0 ;;;
{
$A6:8E13 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8E16 BD AE 0F LDA $0FAE,x[$7E:126E] ;\
$A6:8E19 38 SEC ;|
$A6:8E1A ED BB 8D SBC $8DBB [$A6:8DBB] ;} Enemy ([X] + 1) Y position = [enemy spawn Y position] - 5
$A6:8E1D 9D BE 0F STA $0FBE,x[$7E:127E] ;/
$A6:8E20 AD E7 8D LDA $8DE7 [$A6:8DE7] ;\
$A6:8E23 9D C4 0F STA $0FC4,x[$7E:1284] ;} Enemy ([X] + 1) Y radius = 18h
$A6:8E26 A9 08 00 LDA #$0008 ;\
$A6:8E29 9D C2 0F STA $0FC2,x[$7E:1282] ;} Enemy ([X] + 1) radius = 8
$A6:8E2C 6B RTL
}
;;; $8E2D: Instruction - activity frame 1 ;;;
{
$A6:8E2D AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8E30 BD AE 0F LDA $0FAE,x[$7E:126E] ;\
$A6:8E33 38 SEC ;|
$A6:8E34 ED BD 8D SBC $8DBD [$A6:8DBD] ;} Enemy ([X] + 1) Y position = [enemy spawn Y position] - Ah
$A6:8E37 9D BE 0F STA $0FBE,x[$7E:127E] ;/
$A6:8E3A AD E9 8D LDA $8DE9 [$A6:8DE9] ;\
$A6:8E3D 9D C4 0F STA $0FC4,x[$7E:1284] ;} Enemy ([X] + 1) Y radius = 18h
$A6:8E40 6B RTL
}
;;; $8E41: Instruction - activity frame 2 ;;;
{
$A6:8E41 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8E44 BD AE 0F LDA $0FAE,x[$7E:126E] ;\
$A6:8E47 38 SEC ;|
$A6:8E48 ED BF 8D SBC $8DBF [$A6:8DBF] ;} Enemy ([X] + 1) Y position = [enemy spawn Y position] - Fh
$A6:8E4B 9D BE 0F STA $0FBE,x[$7E:127E] ;/
$A6:8E4E AD EB 8D LDA $8DEB [$A6:8DEB] ;\
$A6:8E51 9D C4 0F STA $0FC4,x[$7E:1284] ;} Enemy ([X] + 1) Y radius = 18h
$A6:8E54 6B RTL
}
;;; $8E55: Instruction - activity frame 3 ;;;
{
$A6:8E55 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8E58 BD AE 0F LDA $0FAE,x[$7E:126E] ;\
$A6:8E5B 38 SEC ;|
$A6:8E5C ED C1 8D SBC $8DC1 [$A6:8DC1] ;} Enemy ([X] + 1) Y position = [enemy spawn Y position] - 14h
$A6:8E5F 9D BE 0F STA $0FBE,x[$7E:127E] ;/
$A6:8E62 AD ED 8D LDA $8DED [$A6:8DED] ;\
$A6:8E65 9D C4 0F STA $0FC4,x[$7E:1284] ;} Enemy ([X] + 1) Y radius = 18h
$A6:8E68 6B RTL
}
;;; $8E69: Instruction - activity frame 4 ;;;
{
$A6:8E69 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8E6C BD AE 0F LDA $0FAE,x[$7E:126E] ;\
$A6:8E6F 38 SEC ;|
$A6:8E70 ED C3 8D SBC $8DC3 [$A6:8DC3] ;} Enemy ([X] + 1) Y position = [enemy spawn Y position] - 19h
$A6:8E73 9D BE 0F STA $0FBE,x[$7E:127E] ;/
$A6:8E76 AD EF 8D LDA $8DEF [$A6:8DEF] ;\
$A6:8E79 9D C4 0F STA $0FC4,x[$7E:1284] ;} Enemy ([X] + 1) Y radius = 18h
$A6:8E7C 6B RTL
}
;;; $8E7D: Instruction - activity frame 5 ;;;
{
$A6:8E7D AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8E80 BD AE 0F LDA $0FAE,x[$7E:126E] ;\
$A6:8E83 38 SEC ;|
$A6:8E84 ED C5 8D SBC $8DC5 [$A6:8DC5] ;} Enemy ([X] + 1) Y position = [enemy spawn Y position] - 1Eh
$A6:8E87 9D BE 0F STA $0FBE,x[$7E:127E] ;/
$A6:8E8A AD F1 8D LDA $8DF1 [$A6:8DF1] ;\
$A6:8E8D 9D C4 0F STA $0FC4,x[$7E:1284] ;} Enemy ([X] + 1) Y radius = 18h
$A6:8E90 6B RTL
}
;;; $8E91: Instruction - activity frame 6 ;;;
{
$A6:8E91 AE 54 0E LDX $0E54 [$7E:0E54]
$A6:8E94 BD AE 0F LDA $0FAE,x[$7E:126E] ;\
$A6:8E97 38 SEC ;|
$A6:8E98 ED C7 8D SBC $8DC7 [$A6:8DC7] ;} Enemy ([X] + 1) Y position = [enemy spawn Y position] - 23h
$A6:8E9B 9D BE 0F STA $0FBE,x[$7E:127E] ;/
$A6:8E9E AD F3 8D LDA $8DF3 [$A6:8DF3] ;\
$A6:8EA1 9D C4 0F STA $0FC4,x[$7E:1284] ;} Enemy ([X] + 1) Y radius = 18h
$A6:8EA4 6B RTL
}