-
Notifications
You must be signed in to change notification settings - Fork 0
/
bank7.s
9825 lines (8567 loc) · 315 KB
/
bank7.s
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
.include "globals.inc"
/*
MEGAMAN 1 BANK 7 ROM MAP
This bank's disassembly is a MIXTURE of Rockman (J) and Mega Man (U)
*/
.segment "BANK7"
BankTable: .byte 0,1,2,3,4,5,6,7
Reset:
/* 1C008: 78 */ sei
/* 1C009: A9 01 */ lda #$01
/* 1C00B: 8D 00 20 */ sta $2000
/* 1C00E: A9 06 */ lda #$06
/* 1C010: 8D 01 20 */ sta $2001
/* 1C013: A9 05 */ lda #$05
/* 1C015: 8D 05 C0 */ sta BankTable+5
/* 1C018: 4C 00 90 */ jmp Reset2 ; $9000
;
; if MegamanStallTimer != 0 then don't get joypad input in this frame
;
; if ForcedInputFlag != 0 then JoyPad0 = ForcedInputData
;
NextFrame:
/* 1C01B: A5 95 */ lda MegamanStallTimer
/* 1C01D: D0 08 */ bne L1C027 ; + ; $C027
/* 1C01F: A5 14 */ lda JoyPad0
/* 1C021: 85 16 */ sta JoyPad0old
/* 1C023: A5 15 */ lda JoyPad1
/* 1C025: 85 17 */ sta JoyPad1old
L1C027: ; +
; Wait until our NMI's done what an NMI's gotta do...
/* 1C027: A9 00 */ lda #$00
/* 1C029: 85 1F */ sta NMI_GfxUpdateDone
L1C02B: ; -
/* 1C02B: A5 1F */ lda NMI_GfxUpdateDone
/* 1C02D: F0 FC */ beq L1C02B ; - ; $0001C02B
/* 1C02F: A5 68 */ lda ForcedInputFlag
/* 1C031: F0 07 */ beq L1C03A ; + ; $0001C03A
/* 1C033: A5 69 */ lda ForcedInputData
/* 1C035: 85 14 */ sta JoyPad0
/* 1C037: 4C 4B C0 */ jmp L1C04B ; ++ ; $C04B
L1C03A: ; +
/* 1C03A: A5 95 */ lda MegamanStallTimer
/* 1C03C: D0 1B */ bne L1C059 ; +++ ; $0001C059
/* 1C03E: 98 */ tya
/* 1C03F: 48 */ pha
/* 1C040: 8A */ txa
/* 1C041: 48 */ pha
/* 1C042: 20 8D D5 */ jsr ReadJoypads ; $D58D
/* 1C045: 68 */ pla
/* 1C046: AA */ tax
/* 1C047: 68 */ pla
/* 1C048: A8 */ tay
/* 1C049: A5 14 */ lda JoyPad0
L1C04B: ; ++
/* 1C04B: 45 16 */ eor JoyPad0old
/* 1C04D: 25 14 */ and JoyPad0
/* 1C04F: 85 18 */ sta JoyD0
/* 1C051: A5 15 */ lda JoyPad1
/* 1C053: 45 17 */ eor JoyPad1old
/* 1C055: 25 15 */ and JoyPad1
/* 1C057: 85 19 */ sta JoyD1
L1C059: ; +++
/* 1C059: 60 */ rts
StageClear:
; What happens in regular stages.
;1. Play item sound
;2. Play stage clear music
;3. Load levelend gfx
;4. Remove all objects except Megaman
;5. Delay 383 frames
;6. Hide energy bars
;7. Draw first patch of text
;8. Halt Megaman
;9. Calculate score, 1000 points per frame
;10. Delay 64 frames
;11. Draw second patch of text
;12. Calculate bonus pearls, one per frame (3000 points each)
;13. Delay 383 frames
;14. Reboot game without clearing game status
;
/* 1C05A: A9 00 */ lda #$00
/* 1C05C: 85 3E */ sta BossCurrentStrategy
/* 1C05E: A9 FE */ lda #$FE
/* 1C060: 20 77 C4 */ jsr IssueSound ; $C477
/* 1C063: A5 AC */ lda FightingBossNum
/* 1C065: C9 0A */ cmp #$0A
/* 1C067: D0 08 */ bne PlayStageClearMusic ; $0001C071
/* 1C069: A9 00 */ lda #$00
/* 1C06B: 20 77 C4 */ jsr IssueSound ; $C477
/* 1C06E: 4C 79 C0 */ jmp L1C079 ; ++ ; $C079
; Play stage clear melody
PlayStageClearMusic:
/* 1C071: A9 04 */ lda #$04
/* 1C073: 20 77 C4 */ jsr IssueSound ; $C477
/* 1C076: 20 04 C2 */ jsr ClearAllObjectsExceptMegaman ; $C204
L1C079: ; ++
/* 1C079: A9 00 */ lda #$00
/* 1C07B: 85 5C */ sta $5C
/* 1C07D: A9 B7 */ lda #>LxB700
/* 1C07F: A2 0B */ ldx #$0B
/* 1C081: A0 08 */ ldy #$08
/* 1C083: 20 BE F0 */ jsr DoPPUtransferRoutineF0BE
/* 1C086: A5 AC */ lda FightingBossNum
/* 1C088: C9 0A */ cmp #$0A
/* 1C08A: D0 0A */ bne L1C096 ; + ; $C096
; Whole game cleared?
/* 1C08C: A9 FF */ lda #$FF
/* 1C08E: 20 16 D1 */ jsr TimeDelayWithAllObjectsHalted
/* 1C091: A9 FF */ lda #$FF
/* 1C093: 20 16 D1 */ jsr TimeDelayWithAllObjectsHalted
L1C096: ; + ;Nope
/* 1C096: A9 80 */ lda #$80
/* 1C098: 20 16 D1 */ jsr TimeDelayWithAllObjectsHalted
/* 1C09B: A9 FF */ lda #$FF
/* 1C09D: 20 16 D1 */ jsr TimeDelayWithAllObjectsHalted
/* 1C0A0: A5 AC */ lda FightingBossNum
/* 1C0A2: C9 0A */ cmp #$0A
/* 1C0A4: D0 08 */ bne L1C0AE ; + ; $C0AE
/* 1C0A6: 20 04 C2 */ jsr ClearAllObjectsExceptMegaman ; $C204
/* 1C0A9: A9 F8 */ lda #$F8 ; Disable Megaman object
/* 1C0AB: 8D 00 06 */ sta ObjectPosY+0 ; $0600
L1C0AE: ; +
/* 1C0AE: E6 BB */ inc DrawScoreAndMetersFlag
/* 1C0B0: A9 00 */ lda #$00
/* 1C0B2: 85 2F */ sta RefObjectNum
/* 1C0B4: A2 02 */ ldx #$02 ;into the given slot
/* 1C0B6: 20 63 C1 */ jsr SetNObjects
/* 1C0B9: A2 05 */ ldx #$05
L1C0BB: ; -
/* 1C0BB: 95 B5 */ sta $B5,x
/* 1C0BD: CA */ dex
/* 1C0BE: 10 FB */ bpl L1C0BB ; - ; $C0BB
/* 1C0C0: EE A0 06 */ inc ObjectLifeCycleCounter+0
L1C0C3: ; -
/* 1C0C3: A2 00 */ ldx #$00
/* 1C0C5: 20 81 C1 */ jsr LevelEndAddThousandPoints
/* 1C0C8: 20 AC C1 */ jsr F1C1AC
/* 1C0CB: 20 1B C0 */ jsr NextFrame ; $C01B
/* 1C0CE: C6 3D */ dec LevelClearScoreInThousands
/* 1C0D0: D0 F1 */ bne L1C0C3 ; - ; $C0C3
; wait 1 second
/* 1C0D2: A9 40 */ lda #$40
/* 1C0D4: 20 0F C2 */ jsr TimeDelayNoMove ; $C20F
/* 1C0D7: A9 00 */ lda #$00
/* 1C0D9: 85 2F */ sta RefObjectNum
/* 1C0DB: A2 05 */ ldx #$05
/* 1C0DD: 20 63 C1 */ jsr SetNObjects
/* 1C0E0: EE A0 06 */ inc ObjectLifeCycleCounter+0
/* 1C0E3: A5 AE */ lda BonusPearlCount
/* 1C0E5: F0 12 */ beq L1C0F9 ; + ; $C0F9
L1C0E7: ; -
/* 1C0E7: A2 03 */ ldx #$03
/* 1C0E9: 20 81 C1 */ jsr LevelEndAddThousandPoints
/* 1C0EC: 20 AC C1 */ jsr F1C1AC
/* 1C0EF: 20 BE C1 */ jsr F1C1BE
/* 1C0F2: 20 1B C0 */ jsr NextFrame ; $C01B
/* 1C0F5: C6 AE */ dec BonusPearlCount
/* 1C0F7: D0 EE */ bne L1C0E7 ; - ; $C0E7
L1C0F9: ; +
/* 1C0F9: 20 31 D1 */ jsr UpdateGraphics ; $D131
/* 1C0FC: 20 AC C1 */ jsr F1C1AC
/* 1C0FF: 20 BE C1 */ jsr F1C1BE
; Wait 6-7 seconds
/* 1C102: A9 FF */ lda #$FF
/* 1C104: 20 0F C2 */ jsr TimeDelayNoMove ; $C20F
/* 1C107: A9 80 */ lda #$80
/* 1C109: 20 0F C2 */ jsr TimeDelayNoMove ; $C20F
L1C10C:
/* 1C10C: 20 95 D4 */ jsr DisableNMIandPPU ; $D495
/* 1C10F: C6 BB */ dec DrawScoreAndMetersFlag
/* 1C111: A2 FF */ ldx #$FF
/* 1C113: 9A */ txs
/* 1C114: A9 05 */ lda #$05
/* 1C116: 8D 05 C0 */ sta BankTable+5
/* 1C119: 85 42 */ sta CurrentBank
/* 1C11B: A6 31 */ ldx CurrentStage
/* 1C11D: E0 09 */ cpx #$09
/* 1C11F: F0 16 */ beq L1C137 ; + ; $0001C137
/* 1C121: E0 06 */ cpx #$06
/* 1C123: B0 16 */ bcs L1C13B ; ++ ; $0001C13B
; Add new weapon/set boss defeated flag
/* 1C125: A5 5D */ lda WeaponsOwned
/* 1C127: 1D 48 C1 */ ora WeaponsOwnedTab,x
/* 1C12A: 85 5D */ sta WeaponsOwned
/* 1C12C: A9 00 */ lda #$00
/* 1C12E: 85 BC */ sta IgnoreStageSelection
/* 1C130: 85 55 */ sta MegamanBlinkState
/* 1C132: 85 68 */ sta ForcedInputFlag
/* 1C134: 4C 5A 90 */ jmp L1505A
; Prepare for ending
L1C137: ; +
/* 1C137: E6 31 */ inc CurrentStage
/* 1C139: C6 BB */ dec DrawScoreAndMetersFlag
; Prepare for Wilystage
L1C13B: ; ++
/* 1C13B: A9 00 */ lda #$00
/* 1C13D: 85 B4 */ sta UseTempScrollX
/* 1C13F: 85 AB */ sta LastRestartPointType
/* 1C141: 85 68 */ sta ForcedInputFlag
/* 1C143: E6 31 */ inc CurrentStage
/* 1C145: 4C 6A 90 */ jmp L1506A
;C148 C I B F E G
WeaponsOwnedTab: .byte $20, $10, $02, $40, $04, $08 ;See also: Lbl_b50d
;C14E
IndexIntoTheActiveThatPreventsEscapingRematch:
.byte 0*6, 5*6, 3*6, 4*6, 1*6, 6*6 ;indexes into RoomActiveTable
; Objects in order:
; 0: HP bar
; 1: Score
XPosTable1: .byte $80, $A0, $80, $88, $A0 ; C154
YPosTable1: .byte $40, $58, $68, $80, $80 ; C159
SpriteNumTable1: .byte $87, $89, $88, $8A, $89 ; C15e
SetNObjects:
/* 1C163: 20 7B F6 */ jsr InitActor
/* 1C166: BD 53 C1 */ lda XPosTable1-1,x
/* 1C169: 9D 80 04 */ sta ObjectPosX,x
/* 1C16C: BD 58 C1 */ lda YPosTable1-1,x
/* 1C16F: 9D 00 06 */ sta ObjectPosY,x
/* 1C172: BD 5D C1 */ lda SpriteNumTable1-1,x
/* 1C175: 9D 00 04 */ sta ObjectSpriteNum,x
/* 1C178: A9 00 */ lda #$00
/* 1C17A: 9D 20 04 */ sta ObjectFlags,x
/* 1C17D: CA */ dex
/* 1C17E: D0 E3 */ bne SetNObjects
/* 1C180: 60 */ rts
; X = index to the digits
LevelEndAddThousandPoints:
/* 1C181: A0 03 */ ldy #$03
/* 1C183: 18 */ clc
/* 1C184: A9 01 */ lda #$01
L1C186: ; -
/* 1C186: 75 B5 */ adc $B5,x
/* 1C188: C9 0A */ cmp #$0A
/* 1C18A: 90 02 */ bcc L1C18E ; + ; $0001C18E
/* 1C18C: E9 0A */ sbc #$0A
L1C18E: ; +
/* 1C18E: 95 B5 */ sta $B5,x
/* 1C190: A9 00 */ lda #$00
/* 1C192: E8 */ inx
/* 1C193: 88 */ dey
/* 1C194: D0 F0 */ bne L1C186 ; - ; $0001C186
/* 1C196: A9 10 */ lda #$10 ; Add 1,000 points to score
/* 1C198: 85 05 */ sta $05
/* 1C19A: 20 40 D4 */ jsr IncreaseScore ; $D440
/* 1C19D: 20 31 D1 */ jsr UpdateGraphics ; $D131
/* 1C1A0: A5 23 */ lda FrameCounter
/* 1C1A2: 29 03 */ and #$03
/* 1C1A4: D0 05 */ bne L1C1AB ; + ; $C1AB
/* 1C1A6: A9 21 */ lda #$21 ; SFX for points
/* 1C1A8: 20 77 C4 */ jsr IssueSound ; $C477
L1C1AB: ; +
/* 1C1AB: 60 */ rts
F1C1AC:
/* 1C1AC: A2 02 */ ldx #$02 ; 3 sprites
/* 1C1AE: 86 0E */ stx $0E
/* 1C1B0: A0 C0 */ ldy #$C0 ; spritepage index = #$C4
/* 1C1B2: A9 68 */ lda #$68 ; X position = #$68
/* 1C1B4: 85 0C */ sta $0C
/* 1C1B6: A9 50 */ lda #$50 ; Y position = #$50
/* 1C1B8: 85 0D */ sta $0D
/* 1C1BA: 20 DD C1 */ jsr ProcessSprites ; $C1DD
/* 1C1BD: 60 */ rts
;
;
;
F1C1BE:
/* 1C1BE: A2 04 */ ldx #$04
/* 1C1C0: A9 01 */ lda #$01 ; 2 sprites
/* 1C1C2: 85 0E */ sta $0E
/* 1C1C4: A9 78 */ lda #$78
/* 1C1C6: 85 0D */ sta $0D
/* 1C1C8: A9 70 */ lda #$70
/* 1C1CA: 85 0C */ sta $0C
/* 1C1CC: 20 DD C1 */ jsr ProcessSprites ; $C1DD
/* 1C1CF: A2 04 */ ldx #$04
/* 1C1D1: A9 01 */ lda #$01
/* 1C1D3: 85 0E */ sta $0E
/* 1C1D5: A9 60 */ lda #$60
/* 1C1D7: 85 0D */ sta $0D
/* 1C1D9: A9 90 */ lda #$90
/* 1C1DB: 85 0C */ sta $0C
;continues to ProcessSprites
;
;
; Process sprite information (write to spritepage)
;
; $0C = X position
; $0D = Y position
;
; $0E = Number of sprites - 1
;
; Palette # = 1
;
; X = index into $B5
;
ProcessSprites:
L1C1DD: ; -
/* 1C1DD: B5 B5 */ lda $B5,x ; Get tile number
/* 1C1DF: 09 F0 */ ora #$F0
/* 1C1E1: 99 05 02 */ sta CurrentSpriteData+1,y
/* 1C1E4: A5 0C */ lda $0C
/* 1C1E6: 99 07 02 */ sta CurrentSpriteData+3,y
/* 1C1E9: A5 0D */ lda $0D
/* 1C1EB: 99 04 02 */ sta CurrentSpriteData+0,y
/* 1C1EE: A9 01 */ lda #$01
/* 1C1F0: 99 06 02 */ sta CurrentSpriteData+2,y
/* 1C1F3: C8 */ iny
/* 1C1F4: C8 */ iny
/* 1C1F5: C8 */ iny
/* 1C1F6: C8 */ iny
/* 1C1F7: CA */ dex
/* 1C1F8: 18 */ clc
/* 1C1F9: A5 0C */ lda $0C ; X position += 8
/* 1C1FB: 69 08 */ adc #$08
/* 1C1FD: 85 0C */ sta $0C
/* 1C1FF: C6 0E */ dec $0E
/* 1C201: 10 DA */ bpl L1C1DD ; - ; $C1DD
/* 1C203: 60 */ rts
; Clears all objects except Megaman
ClearAllObjectsExceptMegaman:
/* 1C204: A9 F8 */ lda #$F8
/* 1C206: A2 1F */ ldx #$1F
L1C208: ; -
/* 1C208: 9D 00 06 */ sta ObjectPosY,x
/* 1C20B: CA */ dex
/* 1C20C: D0 FA */ bne L1C208 ; - ; $0001C208
/* 1C20E: 60 */ rts
;
; A = number of frames to freeze gameplay for
;
TimeDelayNoMove:
/* 1C20F: 85 3C */ sta MiscCounter1
L1C211: ; -
/* 1C211: 20 1B C0 */ jsr NextFrame ; $C01B
/* 1C214: C6 3C */ dec MiscCounter1
/* 1C216: D0 F9 */ bne L1C211 ; - ; $C211
/* 1C218: 60 */ rts
MegaManKilled:
/* 1C219: A9 FE */ lda #$FE
/* 1C21B: 20 77 C4 */ jsr IssueSound ; $C477
/* 1C21E: A9 FF */ lda #$FF
/* 1C220: 20 77 C4 */ jsr IssueSound ; $C477
/* 1C223: A9 20 */ lda #$20
/* 1C225: 20 16 D1 */ jsr TimeDelayWithAllObjectsHalted
/* 1C228: A9 31 */ lda #$31 ; Mega Man exploding
/* 1C22A: 20 77 C4 */ jsr IssueSound ; $C477
/* 1C22D: A9 00 */ lda #$00
/* 1C22F: 85 59 */ sta $59
/* 1C231: A9 7D */ lda #$7D
/* 1C233: 85 5A */ sta $5A
/* 1C235: 20 2A C3 */ jsr AtomicExplodeActor
/* 1C238: A9 00 */ lda #$00
/* 1C23A: 85 45 */ sta NumIssuedSounds
/* 1C23C: A9 F8 */ lda #$F8 ; Hide Megaman
/* 1C23E: 8D 00 06 */ sta ObjectPosY+0 ; $0600
/* 1C241: A9 C0 */ lda #$C0
/* 1C243: 85 3C */ sta MiscCounter1
L1C245: ; -
/* 1C245: 20 17 C3 */ jsr TimeDelayC317
/* 1C248: D0 FB */ bne L1C245 ; - ; $0001C245
/* 1C24A: 20 95 D4 */ jsr DisableNMIandPPU ; $D495
/* 1C24D: A9 00 */ lda #$00
/* 1C24F: 85 47 */ sta GutsmanStompCounter
/* 1C251: 85 B4 */ sta UseTempScrollX
/* 1C253: 85 55 */ sta MegamanBlinkState
/* 1C255: 85 94 */ sta MegamanWalkTimer
/* 1C257: 85 95 */ sta MegamanStallTimer
/* 1C259: C6 A6 */ dec ExtraLives
/* 1C25B: A5 A6 */ lda ExtraLives ; Branch if no lives left
/* 1C25D: 30 72 */ bmi L1C2D1 ; +++ ; $C2D1
/* 1C25F: 20 5B C7 */ jsr WriteChr ; $C75B
/* 1C262: A9 00 */ lda #$00
/* 1C264: 85 AB */ sta LastRestartPointType
/* 1C266: 85 59 */ sta $59
/* 1C268: AD 60 04 */ lda ObjectPosScreen+0 ; $0460
/* 1C26B: A6 31 */ ldx CurrentStage
/* 1C26D: DD D4 C2 */ cmp StageCheckPointA,x
/* 1C270: 90 35 */ bcc L1C2A7 ; ++ ; $C2A7
/* 1C272: A0 0C */ ldy #$0C
/* 1C274: DD E0 C2 */ cmp StageCheckPointB,x
/* 1C277: 90 02 */ bcc L1C27B ; + ; $C27B
/* 1C279: A0 18 */ ldy #$18
L1C27B: ; +
/* 1C27B: 98 */ tya
/* 1C27C: 85 AB */ sta LastRestartPointType
/* 1C27E: 18 */ clc
/* 1C27F: 65 31 */ adc CurrentStage
/* 1C281: AA */ tax
/* 1C282: BD EB C2 */ lda FirstScreenScreenTable,x
/* 1C285: 8D 60 04 */ sta ObjectPosScreen+0 ; $0460
/* 1C288: 20 58 C6 */ jsr SetupEnemyGraphicsPointer
L1C28B: ; -
/* 1C28B: 20 C4 C6 */ jsr LoadEnemyGraphics
/* 1C28E: 20 AF D5 */ jsr DoRawPPUtransfer
/* 1C291: A5 59 */ lda $59
/* 1C293: C9 28 */ cmp #$28
/* 1C295: D0 F4 */ bne L1C28B ; - ; $C28B
/* 1C297: 20 C4 C6 */ jsr LoadEnemyGraphics
/* 1C29A: A9 2C */ lda #$2C
/* 1C29C: 8D E1 03 */ sta SpritePalettes + $1
/* 1C29F: A9 11 */ lda #$11
/* 1C2A1: 8D E2 03 */ sta SpritePalettes + $2
/* 1C2A4: 20 0A D6 */ jsr UpdatePalettes ; $D60A
L1C2A7: ; ++
/* 1C2A7: A9 00 */ lda #$00
/* 1C2A9: 85 19 */ sta JoyD1
/* 1C2AB: A2 FF */ ldx #$FF
/* 1C2AD: 9A */ txs
/* 1C2AE: A9 05 */ lda #$05
/* 1C2B0: 85 42 */ sta CurrentBank
/* 1C2B2: 8D 05 C0 */ sta BankTable+5
/* 1C2B5: A5 AB */ lda LastRestartPointType
/* 1C2B7: C9 0C */ cmp #$0C
/* 1C2B9: B0 03 */ bcs L1C2BE ; + ; $C2BE
L1C2BB: ; -
/* 1C2BB: 4C 7E 90 */ jmp StageBegin
L1C2BE: ; +
/* 1C2BE: A5 31 */ lda CurrentStage
/* 1C2C0: C9 07 */ cmp #$07
/* 1C2C2: F0 04 */ beq L1C2C8 ; + ; $0001C2C8
/* 1C2C4: C9 09 */ cmp #$09
/* 1C2C6: D0 06 */ bne L1C2CE ; ++ ; $0001C2CE
L1C2C8: ; +
/* 1C2C8: A5 AB */ lda LastRestartPointType
/* 1C2CA: C9 0D */ cmp #$0D
/* 1C2CC: B0 ED */ bcs L1C2BB ; - ; $0001C2BB
L1C2CE: ; ++
/* 1C2CE: 4C 81 90 */ jmp StageBeginFromDeath
;Game over
L1C2D1: ; +++
/* 1C2D1: 4C 38 90 */ jmp GameOver
; Table that says what screen# Megaman's current screen# must be above or
; equal to in order for him to restart from it...
; Cutman #0
; Iceman #1
; Bombman #2
; Fireman #3
; Elecman #4
; Gutsman #5
StageCheckPointA: ;at C2D4
.byte $0A,$0A,$0E,$08,$07,$0A
.byte $22,$24,$2F,$1D,$1D,$1D
StageCheckPointB:
.byte $14,$14,$14,$10,$14,$0F
.byte $27,$29,$2F,$21,$1C
FirstScreenScreenTable: ;at C2EB
; Initial screen start?
.byte $00,$00,$00,$00,$00,$00
.byte $18,$18,$18,$14,$18,$1E ;Stored into ObjectPosScreen+0 or CurrentBeginScreen
; Restart point A
.byte $0A,$0A,$0E,$08,$07,$0A
.byte $22,$24,$2E,$1D,$1D,$1D
; Restart point B
.byte $14,$14,$14,$10,$14,$0F
.byte $26,$28,$2E,$21,$20
C30E_table:
.byte $FB,$05,$00 ;X increment of some kind
C311_table:
.byte $FF,$00,$00 ;screen increment of some kind
C314_table:
.byte $F8,$F4,$06 ;Y increment of some kind
TimeDelayC317:
/* 1C317: A5 */ lda RefObjectNum
/* 1C319: D0 03 */ bne L1C31E ; + ; $C31E
/* 1C31B: 20 8C DB */ jsr RunBossAI
L1C31E: ; +
/* 1C31E: 20 EA 98 */ jsr RunEnemyAI ; $98EA
/* 1C321: 20 31 D1 */ jsr UpdateGraphics ; $D131
/* 1C324: 20 1B C0 */ jsr NextFrame ; $C01B
/* 1C327: C6 3C */ dec MiscCounter1
/* 1C329: 60 */ rts
AtomicExplodeActor: ;Ah, explosions probably!
/* 1C32A: A9 0C */ lda #$0C ;How many atoms to create?
/* 1C32C: 85 3C */ sta MiscCounter1
L1C32E: ; -
/* 1C32E: A5 3C */ lda MiscCounter1
/* 1C330: 29 03 */ and #$03
/* 1C332: D0 43 */ bne L1C377 ; + ; $C377
/* 1C334: A5 59 */ lda $59
/* 1C336: 85 2F */ sta RefObjectNum
/* 1C338: A2 02 */ ldx #$02
/* 1C33A: 20 76 C5 */ jsr FindFreeObject ; $C576
/* 1C33D: B0 38 */ bcs L1C377 ; + ; $C377
/* 1C33F: 20 7B F6 */ jsr InitActor
/* 1C342: A5 5A */ lda $5A
/* 1C344: 9D 00 04 */ sta ObjectSpriteNum,x
/* 1C347: A9 08 */ lda #$08
/* 1C349: 9D 20 04 */ sta ObjectFlags,x
/* 1C34C: A9 10 */ lda #$10
/* 1C34E: 9D 40 04 */ sta ObjectUnknown440,x
/* 1C351: A5 3C */ lda MiscCounter1
/* 1C353: 4A */ lsr a
/* 1C354: 4A */ lsr a
/* 1C355: A8 */ tay
/* 1C356: BD 80 04 */ lda ObjectPosX,x
/* 1C359: 79 0D C3 */ adc C30E_table-1,y
/* 1C35C: 9D 80 04 */ sta ObjectPosX,x
/* 1C35F: BD 60 04 */ lda ObjectPosScreen,x
/* 1C362: 79 10 C3 */ adc C311_table-1,y
/* 1C365: 9D 60 04 */ sta ObjectPosScreen,x
/* 1C368: 18 */ clc
/* 1C369: BD 00 06 */ lda ObjectPosY,x
/* 1C36C: 79 13 C3 */ adc C314_table-1,y
/* 1C36F: 9D 00 06 */ sta ObjectPosY,x
/* 1C372: A0 08 */ ldy #$08
/* 1C374: 20 33 F5 */ jsr InitObjectDefaultSpeed
L1C377: ; +
/* 1C377: 20 17 C3 */ jsr TimeDelayC317
/* 1C37A: D0 B2 */ bne L1C32E ; - ; $C32E
/* 1C37C: A9 0B */ lda #$0B
/* 1C37E: 85 0C */ sta $0C
/* 1C380: A5 5A */ lda $5A
/* 1C382: 85 0D */ sta $0D
/* 1C384: A9 00 */ lda #$00
/* 1C386: 85 0E */ sta $0E
L1C388: ; -
/* 1C388: A4 59 */ ldy $59
/* 1C38A: A2 02 */ ldx #$02
/* 1C38C: 20 76 C5 */ jsr FindFreeObject ; FindFreeObject
/* 1C38F: B0 05 */ bcs L1C396
/* 1C391: 20 41 F8 */ jsr CreateExplosionObject
/* 1C394: 10 F2 */ bpl L1C388 ; -
L1C396:
/* 1C396: A9 12 */ lda #$12 ; Explosion
/* 1C398: 20 77 C4 */ jsr IssueSound ; $C477
/* 1C39B: 60 */ rts
;
;
;
SwitchBankStage: ;doesn't modify P,A. Modifies X.
/* 1C39C: 08 */ php
/* 1C39D: 48 */ pha
/* 1C39E: 8A */ txa
/* 1C39F: 48 */ pha
/* 1C3A0: A5 31 */ lda CurrentStage
/* 1C3A2: C9 06 */ cmp #$06 ; bank=(stage%6)
/* 1C3A4: 90 02 */ bcc L1C3A8 ; + ; $C3A8
/* 1C3A6: E9 06 */ sbc #$06
L1C3A8: ; +
/* 1C3A8: AA */ tax
/* 1C3A9: 85 42 */ sta CurrentBank
/* 1C3AB: 9D 00 C0 */ sta BankTable,x
/* 1C3AE: 68 */ pla
/* 1C3AF: AA */ tax
/* 1C3B0: 68 */ pla
/* 1C3B1: 28 */ plp
/* 1C3B2: 60 */ rts
SwitchBank05:
/* 1C3B3: 08 */ php
/* 1C3B4: 48 */ pha
/* 1C3B5: A9 05 */ lda #$05
/* 1C3B7: 85 42 */ sta CurrentBank
/* 1C3B9: 8D 05 C0 */ sta BankTable+5
/* 1C3BC: 68 */ pla
/* 1C3BD: 28 */ plp
/* 1C3BE: 60 */ rts
; Handle weapon select screen?
InvokeWeaponSelectDialog:
/* 1C3BF: A9 06 */ lda #$06
/* 1C3C1: 85 42 */ sta CurrentBank
/* 1C3C3: 8D 06 C0 */ sta BankTable+6
/* 1C3C6: A5 AC */ lda FightingBossNum
/* 1C3C8: C9 0A */ cmp #$0A
/* 1C3CA: F0 0E */ beq L1C3DA ; ++ ; $C3DA
/* 1C3CC: A5 31 */ lda CurrentStage
/* 1C3CE: C9 09 */ cmp #$09
/* 1C3D0: D0 04 */ bne L1C3D6 ; + ; $C3D6
/* 1C3D2: C5 AC */ cmp FightingBossNum
/* 1C3D4: F0 04 */ beq L1C3DA ; ++ ; $C3DA
L1C3D6: ; +
/* 1C3D6: C9 06 */ cmp #$06
/* 1C3D8: D0 06 */ bne L1C3E0 ; + ; $C3E0
L1C3DA: ; ++
/* 1C3DA: A5 3E */ lda BossCurrentStrategy
/* 1C3DC: F0 02 */ beq L1C3E0 ; + ; $C3E0
/* 1C3DE: E6 1B */ inc ScrollPosScreen
L1C3E0: ; +
/* 1C3E0: 4C F3 BF */ jmp DoWeaponSelectDialog
; Arrived from bank 6
Lbl_c3e3:
/* 1C3E3: A5 AC */ lda FightingBossNum
/* 1C3E5: C9 0A */ cmp #$0A
/* 1C3E7: F0 0E */ beq L1C3F7 ; ++ ; $C3F7
/* 1C3E9: A5 31 */ lda CurrentStage
/* 1C3EB: C9 09 */ cmp #$09
/* 1C3ED: D0 04 */ bne L1C3F3 ; + ; $C3F3
/* 1C3EF: C5 AC */ cmp FightingBossNum
/* 1C3F1: F0 04 */ beq L1C3F7 ; ++ ; $C3F7
L1C3F3: ; +
/* 1C3F3: C9 06 */ cmp #$06
/* 1C3F5: D0 06 */ bne L1C3FD ; +++ ; $C3FD
L1C3F7: ; ++
/* 1C3F7: A5 3E */ lda BossCurrentStrategy
/* 1C3F9: F0 02 */ beq L1C3FD ; +++ ; $C3FD
/* 1C3FB: C6 1A */ dec ScrollPosX
L1C3FD: ; +++
/* 1C3FD: 4C B3 C3 */ jmp SwitchBank05 ; $C3B3
; Arrived from bank 6
F1C400:
/* 1C400: AA */ tax
/* 1C401: 85 42 */ sta CurrentBank
/* 1C403: 9D 00 C0 */ sta BankTable,x
/* 1C406: A2 00 */ ldx #$00
L1C408: ; -
/* 1C408: B1 06 */ lda (CurrentRoomPointer),y
/* 1C40A: 9D 82 03 */ sta RawPPUtransferBuf,x
/* 1C40D: C8 */ iny
/* 1C40E: E8 */ inx
/* 1C40F: E0 10 */ cpx #$10
/* 1C411: D0 F5 */ bne L1C408 ; - ; $C408
SwitchBank6_a:
/* 1C413: A9 06 */ lda #$06
/* 1C415: 85 42 */ sta CurrentBank
/* 1C417: 8D 06 C0 */ sta BankTable+6
/* 1C41A: 60 */ rts
DrawBlockFromActiveLevelMap_Bank06callback:
/* 1C41B: 20 E8 CD */ jsr DrawBlockFromActiveLevelMap
SwitchBank6_b:
/* 1C41E: A9 06 */ lda #$06
/* 1C420: 85 42 */ sta CurrentBank
/* 1C422: 8D 06 C0 */ sta BankTable+6
/* 1C425: 60 */ rts
InitEndGameScene:
/* 1C426: A9 06 */ lda #$06
/* 1C428: 85 42 */ sta CurrentBank
/* 1C42A: 8D 06 C0 */ sta BankTable+6
/* 1C42D: 4C F0 BF */ jmp Lbl_bff0
TeleportToStage_Bank06callback:
/* 1C430: 20 E0 C4 */ jsr TeleportToStage ; $C4E0
/* 1C433: 4C 56 C4 */ jmp SwitchBank06_c
F1C436:
/* 1C436: 4C 7B F6 */ jmp InitActor
F1C439:
/* 1C439: 20 B3 C3 */ jsr SwitchBank05 ; $C3B3
/* 1C43C: 20 6D 9E */ jsr ObjectUpdateMovementLeft
/* 1C43F: 20 8F 98 */ jsr AutoCenterScreen
F1C442:
/* 1C442: 20 31 D1 */ jsr UpdateGraphics ; $D131
/* 1C445: 20 1B C0 */ jsr NextFrame ; $C01B
/* 1C448: E6 BD */ inc $BD
/* 1C44A: A5 BD */ lda $BD
/* 1C44C: C9 3E */ cmp #$3E
/* 1C44E: D0 06 */ bne SwitchBank06_c
/* 1C450: E6 BE */ inc $BE
/* 1C452: A9 00 */ lda #$00
/* 1C454: 85 BD */ sta $BD
SwitchBank06_c:
/* 1C456: A9 06 */ lda #$06
/* 1C458: 85 42 */ sta CurrentBank
/* 1C45A: 8D 06 C0 */ sta BankTable+6
/* 1C45D: 60 */ rts
Lbl_c45e:
; reset the current stage number?
/* 1C45E: A9 00 */ lda #$00
/* 1C460: 85 31 */ sta CurrentStage
/* 1C462: 4C 0C C1 */ jmp L1C10C
; inc $6A0 for every object except Megaman
LifeCycleTick_forEnemies:
/* 1C465: A2 01 */ ldx #$01
L1C467: ; -
/* 1C467: BD 00 06 */ lda ObjectPosY,x
/* 1C46A: C9 F8 */ cmp #$F8
/* 1C46C: F0 03 */ beq L1C471 ; + ; $C471
/* 1C46E: FE A0 06 */ inc ObjectLifeCycleCounter,x
L1C471: ; +
/* 1C471: E8 */ inx
/* 1C472: E0 20 */ cpx #$20
/* 1C474: D0 F1 */ bne L1C467 ; - ; $C467
/* 1C476: 60 */ rts
;
; Adds the sound with sound ID = A to the list of sounds to be issued
;
IssueSound:
/* 1C477: A6 45 */ ldx NumIssuedSounds ; Max 16 sounds in a frame
/* 1C479: E0 10 */ cpx #$10
/* 1C47B: F0 05 */ beq L1C482 ; + ; $0001C482
/* 1C47D: 9D 80 05 */ sta IssuedSoundsList,x
/* 1C480: E6 45 */ inc NumIssuedSounds
L1C482: ; +
/* 1C482: 60 */ rts
InitStagePaletteAndActives:
/* 1C483: 20 9C C3 */ jsr SwitchBankStage ; $C39C
/* 1C486: A5 31 */ lda CurrentStage
/* 1C488: C9 06 */ cmp #$06
/* 1C48A: 90 0B */ bcc L1C497 ; + ; $C497
/* 1C48C: A9 D0 */ lda #<RoomSpritePalettes2
/* 1C48E: 85 35 */ sta $35
/* 1C490: A9 8C */ lda #(>RoomSpritePalettes2)
/* 1C492: 85 36 */ sta $36
/* 1C494: 4C 9F C4 */ jmp L1C49F ; ++ ; $C49F
L1C497: ; +
/* 1C497: A9 A0 */ lda #<RoomSpritePalettes1
/* 1C499: 85 35 */ sta $35
/* 1C49B: A9 8C */ lda #>RoomSpritePalettes1
/* 1C49D: 85 36 */ sta $36
L1C49F: ; ++
; Write both BG and sprite palette
/* 1C49F: A9 20 */ lda #$20
/* 1C4A1: 20 47 D6 */ jsr WritePalette ; $D647
;
; Copies palette into RAM for continous updates? (only affects BG palette)
;
/* 1C4A4: A0 2F */ ldy #$2F
L1C4A6: ; -
/* 1C4A6: B1 35 */ lda ($35),y
/* 1C4A8: 99 D0 03 */ sta BGPalettes,y
/* 1C4AB: 88 */ dey
/* 1C4AC: 10 F8 */ bpl L1C4A6 ; - ; $C4A6
/* 1C4AE: A5 31 */ lda CurrentStage
/* 1C4B0: C9 06 */ cmp #$06
/* 1C4B2: 90 0A */ bcc L1C4BE ; ++ ; $C4BE
; 8E9F (8EA0-1)
/* 1C4B4: A9 9F */ lda #<(RoomActives2-1)
/* 1C4B6: 85 04 */ sta $04
/* 1C4B8: A9 8E */ lda #>(RoomActives2-1)
/* 1C4BA: 85 05 */ sta $05
/* 1C4BC: D0 08 */ bne L1C4C6 ; + ; $C4C6
L1C4BE: ; ++ ; 8DFF (8E00-1)
/* 1C4BE: A9 FF */ lda #<(RoomActives1-1)
/* 1C4C0: 85 04 */ sta $04
/* 1C4C2: A9 8D */ lda #>(RoomActives1-1)
/* 1C4C4: 85 05 */ sta $05
L1C4C6: ; +
/* 1C4C6: A0 01 */ ldy #$01
/* 1C4C8: B1 04 */ lda ($04),y
/* 1C4CA: 0A */ asl a
/* 1C4CB: 8D 20 07 */ sta RoomActiveTable ; tmp = count*2
/* 1C4CE: 0A */ asl a
/* 1C4CF: 18 */ clc
/* 1C4D0: 6D 20 07 */ adc RoomActiveTable ; A = tmp + count*4 (count*6)
/* 1C4D3: A8 */ tay
/* 1C4D4: C8 */ iny
L1C4D5: ; -
/* 1C4D5: B1 04 */ lda ($04),y
/* 1C4D7: 99 1F 07 */ sta RoomActiveTable-1,y
/* 1C4DA: 88 */ dey
/* 1C4DB: D0 F8 */ bne L1C4D5 ; - ; $C4D5
/* 1C4DD: 4C B3 C3 */ jmp SwitchBank05 ; $C3B3
;
; This routine handles the "teleportation" of Megaman, i.e. when he sweeps
; down to the stage from the sky after the "READY" message
;
TeleportToStage:
/* 1C4E0: 18 */ clc
/* 1C4E1: A5 31 */ lda CurrentStage
/* 1C4E3: 65 AB */ adc LastRestartPointType
/* 1C4E5: AA */ tax
; Let megaman transform
/* 1C4E6: A9 14 */ lda #$14
/* 1C4E8: 8D 00 04 */ sta ObjectSpriteNum+0 ; $0400
/* 1C4EB: A9 41 */ lda #$41
/* 1C4ED: 8D 20 04 */ sta ObjectFlags+0
; Move Megaman down 16 pixels/frame until his Y position equals starting spot
/* 1C4F0: BD 1A C5 */ lda TeleportYcoord,x
/* 1C4F3: 85 59 */ sta $59
L1C4F5: ; -
/* 1C4F5: A2 00 */ ldx #$00
/* 1C4F7: 8E 40 04 */ stx ObjectUnknown440+0
/* 1C4FA: 18 */ clc
/* 1C4FB: AD 00 06 */ lda ObjectPosY+0 ; $0600
/* 1C4FE: 69 10 */ adc #$10
/* 1C500: 8D 00 06 */ sta ObjectPosY+0 ; ObjectPosY+0
/* 1C503: 20 31 D1 */ jsr UpdateGraphics ; $D131
/* 1C506: 20 1B C0 */ jsr NextFrame ; $C01B
/* 1C509: AD 00 06 */ lda ObjectPosY+0 ; ObjectPosY+0
/* 1C50C: A6 31 */ ldx CurrentStage
/* 1C50E: C5 59 */ cmp $59 ; Until the Y coord matches.
/* 1C510: D0 E3 */ bne L1C4F5 ; - ; $C4F5
/* 1C512: A9 00 */ lda #$00
/* 1C514: 8D 80 06 */ sta ObjectYSpeed+0
/* 1C517: 4C B3 C3 */ jmp SwitchBank05 ; $C3B3
;At C51A
TeleportYcoord:
; Start of stage
.byte $94,$B4,$B4,$B4,$C4,$B4
.byte $B4,$74,$B4,$94,$84,$64
; Restart point A
.byte $94,$C4,$B4,$94,$94,$54
.byte $24,$64,$B4,$B4,$B4,$B4
; Restart point B
.byte $94,$94,$94,$94,$94,$94
.byte $B4,$94,$B4,$B4,$B4
C53D_routine:
/* 1C53D: A9 06 */ lda #$06
/* 1C53F: 85 */ sta CurrentBank
/* 1C541: 8D 06 C0 */ sta BankTable+6
/* 1C544: BD 00 04 */ lda ObjectSpriteNum,x
/* 1C547: A0 06 */ ldy #$06
L1C549: ; -
/* 1C549: D9 44 86 */ cmp Lbl_8644,y
/* 1C54C: F0 08 */ beq L1C556 ; + ; $C556
/* 1C54E: 88 */ dey
/* 1C54F: 10 F8 */ bpl L1C549 ; - ; $C549
/* 1C551: A0 00 */ ldy #$00
/* 1C553: 4C 64 C5 */ jmp L1C564 ; ++ ; $C564
L1C556: ; +
/* 1C556: B9 4A 86 */ lda Lbl_864a,y
/* 1C559: A8 */ tay
/* 1C55A: 4C 64 C5 */ jmp L1C564 ; ++ ; $C564
F1C55D:
/* 1C55D: A9 06 */ lda #$06
/* 1C55F: 85 42 */ sta CurrentBank
/* 1C561: 8D 06 C0 */ sta BankTable+6
L1C564: ; ++
/* 1C564: B9 3A 86 */ lda Lbl_863a,y
/* 1C567: 48 */ pha
/* 1C568: 29 F0 */ and #$F0
/* 1C56A: 9D E0 04 */ sta ObjectXSpeedFraction,x
/* 1C56D: 68 */ pla
/* 1C56E: 29 0F */ and #$0F
/* 1C570: 9D C0 04 */ sta ObjectXSpeed,x
/* 1C573: 4C B3 C3 */ jmp SwitchBank05 ; $C3B3
; This routine clears carry if #$F8 is found between $600+X and $600+TotalObjects
; and sets it otherwise
; C = 0 if found, 1 if not
FindFreeObject:
/* 1C576: A9 F8 */ lda #$F8
L1C578: ; -
/* 1C578: DD 00 06 */ cmp ObjectPosY,x
/* 1C57B: F0 07 */ beq L1C584 ; + ; $C584
/* 1C57D: E8 */ inx
/* 1C57E: E4 54 */ cpx TotalObjects
/* 1C580: D0 F6 */ bne L1C578 ; - ; $C578
/* 1C582: 38 */ sec
/* 1C583: 60 */ rts
L1C584: ; +
/* 1C584: 18 */ clc
/* 1C585: 60 */ rts
FindLastObjectOfType:
L1C586: ; -
/* 1C586: DD 00 04 */ cmp ObjectSpriteNum,x
/* 1C589: F0 07 */ beq L1C592 ; + ; $C592
L1C58B: ; --
/* 1C58B: E8 */ inx
/* 1C58C: E4 54 */ cpx TotalObjects
/* 1C58E: D0 F6 */ bne L1C586 ; -