forked from IsoFrieze/SMWDisX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bank_01.asm
17119 lines (15972 loc) · 393 KB
/
bank_01.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
ORG $018000
DATA_018000:
db $80,$40,$20,$10,$08,$04,$02,$01
IsTouchingObjSide:
LDA.W SpriteBlockedDirs,X ; \ Set A to lower two bits of
AND.B #$03 ; / current sprite's Position Status
RTS
IsOnGround:
LDA.W SpriteBlockedDirs,X ; \ Set A to bit 2 of
AND.B #$04 ; / current sprite's Position Status
RTS
IsTouchingCeiling:
LDA.W SpriteBlockedDirs,X ; \ Set A to bit 3 of
AND.B #$08 ; / current sprite's Position Status
RTS
UpdateYPosNoGvtyW:
PHB
PHK
PLB
JSR SubSprYPosNoGrvty
PLB
RTL
UpdateXPosNoGvtyW:
PHB
PHK
PLB
JSR SubSprXPosNoGrvty
PLB
RTL
UpdateSpritePos:
PHB
PHK
PLB
JSR SubUpdateSprPos
PLB
RTL
SprSprInteract:
PHB
PHK
PLB
JSR SubSprSprInteract
PLB
RTL
SprSpr_MarioSprRts:
PHB
PHK
PLB
JSR SubSprSpr_MarioSpr
PLB
RTL
GenericSprGfxRt0:
PHB
PHK
PLB
JSR SubSprGfx0Entry0
PLB
RTL
InvertAccum:
EOR.B #$FF ; \ Set A to -A
INC A ; /
RTS
CODE_01804E:
LDA.W SpriteBlockedDirs,X ; \ Branch if in air
BEQ Return018072 ; /
LDA.B TrueFrame
AND.B #$03
ORA.B LevelIsSlippery
BNE Return018072
LDA.B #$04
STA.B _0
LDA.B #$0A
STA.B _1
CODE_018063:
JSR IsSprOffScreen
BNE Return018072
LDY.B #$03
CODE_01806A:
LDA.W SmokeSpriteNumber,Y
BEQ CODE_018073
DEY
BPL CODE_01806A
Return018072:
RTS
CODE_018073:
LDA.B #$03
STA.W SmokeSpriteNumber,Y
LDA.B SpriteXPosLow,X
ADC.B _0
STA.W SmokeSpriteXPos,Y
LDA.B SpriteYPosLow,X
ADC.B _1
STA.W SmokeSpriteYPos,Y
LDA.B #$13
STA.W SmokeSpriteTimer,Y
RTS
CODE_01808C:
PHB
PHK
PLB
LDA.W IsCarryingItem
STA.W CarryingFlag ; Reset carrying enemy flag
STZ.W IsCarryingItem
STZ.W StandOnSolidSprite
STZ.W PlayerInCloud
LDA.W CurrentYoshiSlot
STA.W YoshiIsLoose
STZ.W CurrentYoshiSlot
LDX.B #$0B
- STX.W CurSpriteProcess
JSR CODE_0180D2
JSR HandleSprite
DEX
BPL -
LDA.W ActivateClusterSprite
BEQ +
JSL CODE_02F808
+ LDA.W CurrentYoshiSlot
BNE +
STZ.W PlayerRidingYoshi
STZ.W ScrShakePlayerYOffset
+ PLB
RTL
IsSprOffScreen:
LDA.W SpriteOffscreenX,X ; \ A = Current sprite is offscreen
ORA.W SpriteOffscreenVert,X ; /
RTS
CODE_0180D2:
PHX ; In all sprite routines, X = current sprite
TXA
LDX.W SpriteMemorySetting ; $1692 = Current Sprite memory settings
CLC ; \
ADC.L DATA_07F0B4,X ; |Add $07:F0B4,$1692 to sprite index. i.e. minimum one tile allotted to each sprite
TAX ; |the bytes read go straight to the OAM indexes
LDA.L DATA_07F000,X ; |
PLX ; /
STA.W SpriteOAMIndex,X ; Current sprite's OAM index
LDA.W SpriteStatus,X ; If (something related to current sprite) is 0
BEQ Return018126 ; do not decrement these counters
LDA.B SpriteLock ; Lock sprites timer
BNE Return018126 ; if sprites locked, do not decrement counters
LDA.W SpriteMisc1540,X ; \ Decrement a bunch of sprite counter tables
BEQ + ; |
DEC.W SpriteMisc1540,X ; |Do not decrement any individual counter if it's already at zero
+ LDA.W SpriteMisc154C,X ; |
BEQ + ; |
DEC.W SpriteMisc154C,X ; |
+ LDA.W SpriteMisc1558,X ; |
BEQ + ; |
DEC.W SpriteMisc1558,X ; |
+ LDA.W SpriteMisc1564,X ; |
BEQ + ; |
DEC.W SpriteMisc1564,X ; |
+ LDA.W SpriteMisc1FE2,X ; |
BEQ + ; |
DEC.W SpriteMisc1FE2,X ; |
+ LDA.W SpriteMisc15AC,X ; |
BEQ + ; |
DEC.W SpriteMisc15AC,X ; |
+ LDA.W SpriteMisc163E,X ; |
BEQ Return018126 ; |
DEC.W SpriteMisc163E,X ; |
Return018126:
RTS ; /
HandleSprite:
LDA.W SpriteStatus,X ; Call a routine based on the sprite's status
BEQ EraseSprite ; Routine for status 0 hardcoded, maybe for performance
CMP.B #$08
BNE + ; Routine for status 8 hardcoded, maybe for preformance
JMP CallSpriteMain
+ JSL ExecutePtr
dw EraseSprite ; 0 - Non-existant (Bypassed above)
dw CallSpriteInit ; 1 - Initialization
dw HandleSprKilled ; 2 - Falling off screen (hit by star, shell, etc)
dw HandleSprSmushed ; 3 - Smushed
dw HandleSprSpinJump ; 4 - Spin Jumped
dw CODE_019A7B ; 5
dw HandleSprLvlEnd ; 6 - End of level turn to coin
dw Return018156 ; 7 - Unused
dw Return0185C2 ; 8 - Normal (Bypassed above)
dw HandleSprStunned ; 9 - Stationary (Carryable, flipped, stunned)
dw HandleSprKicked ; A - Kicked
dw HandleSprCarried ; B - Carried
dw HandleGoalPowerup ; C - Power up from carrying a sprite past the goal tape
EraseSprite:
LDA.B #$FF ; \ Permanently erase sprite:
STA.W SpriteLoadIndex,X ; | By changing the sprite's index into the level tables
Return018156:
RTS ; / the actual sprite won't get marked for reloading
HandleGoalPowerup:
JSR CallSpriteMain
JSR SubOffscreen0Bnk1
JSR SubUpdateSprPos
DEC.B SpriteYSpeed,X
DEC.B SpriteYSpeed,X
JSR IsOnGround
BEQ +
JSR SetSomeYSpeed__
+ RTS
HandleSprLvlEnd:
JSL LvlEndSprCoins
RTS
CallSpriteInit:
LDA.B #$08 ; \ Sprite status = Normal
STA.W SpriteStatus,X ; /
LDA.B SpriteNumber,X
JSL ExecutePtr
dw InitStandardSprite ; 00 - Green Koopa, no shell
dw InitStandardSprite ; 01 - Red Koopa, no shell
dw InitStandardSprite ; 02 - Blue Koopa, no shell
dw InitStandardSprite ; 03 - Yellow Koopa, no shell
dw InitStandardSprite ; 04 - Green Koopa
dw InitStandardSprite ; 05 - Red Koopa
dw InitStandardSprite ; 06 - Blue Koopa
dw InitStandardSprite ; 07 - Yellow Koopa
dw InitStandardSprite ; 08 - Green Koopa, flying left
dw InitGrnBounceKoopa ; 09 - Green bouncing Koopa
dw InitStandardSprite ; 0A - Red vertical flying Koopa
dw InitStandardSprite ; 0B - Red horizontal flying Koopa
dw InitStandardSprite ; 0C - Yellow Koopa with wings
dw InitBomb ; 0D - Bob-omb
dw InitKeyHole ; 0E - Keyhole
dw InitStandardSprite ; 0F - Goomba
dw InitStandardSprite ; 10 - Bouncing Goomba with wings
dw InitStandardSprite ; 11 - Buzzy Beetle
dw UnusedInit ; 12 - Unused
dw InitStandardSprite ; 13 - Spiny
dw InitStandardSprite ; 14 - Spiny falling
dw Return01B011 ; 15 - Fish, horizontal
dw InitVerticalFish ; 16 - Fish, vertical
dw InitFish ; 17 - Fish, created from generator
dw InitFish ; 18 - Surface jumping fish
dw InitMsg_SideExit ; 19 - Display text from level Message Box #1
dw InitPiranha ; 1A - Classic Piranha Plant
dw Return0185C2 ; 1B - Bouncing football in place
dw InitBulletBill ; 1C - Bullet Bill
dw InitStandardSprite ; 1D - Hopping flame
dw InitLakitu ; 1E - Lakitu
dw InitMagikoopa ; 1F - Magikoopa
dw Return018583 ; 20 - Magikoopa's magic
dw FaceMario ; 21 - Moving coin
dw InitVertNetKoopa ; 22 - Green vertical net Koopa
dw InitVertNetKoopa ; 23 - Red vertical net Koopa
dw InitHorzNetKoopa ; 24 - Green horizontal net Koopa
dw InitHorzNetKoopa ; 25 - Red horizontal net Koopa
dw InitThwomp ; 26 - Thwomp
dw Return01AEA2 ; 27 - Thwimp
dw InitBigBoo ; 28 - Big Boo
dw InitKoopaKid ; 29 - Koopa Kid
dw InitDownPiranha ; 2A - Upside down Piranha Plant
dw Return0185C2 ; 2B - Sumo Brother's fire lightning
dw InitYoshiEgg ; 2C - Yoshi egg
dw InitKey_BabyYoshi ; 2D - Baby green Yoshi
dw InitSpikeTop ; 2E - Spike Top
dw Return0185C2 ; 2F - Portable spring board
dw FaceMario ; 30 - Dry Bones, throws bones
dw FaceMario ; 31 - Bony Beetle
dw FaceMario ; 32 - Dry Bones, stay on ledge
dw InitFireball ; 33 - Fireball
dw Return0185C2 ; 34 - Boss fireball
dw InitYoshi ; 35 - Green Yoshi
dw Return0185C2 ; 36 - Unused
dw InitBigBoo ; 37 - Boo
dw InitEerie ; 38 - Eerie
dw InitEerie ; 39 - Eerie, wave motion
dw InitUrchin ; 3A - Urchin, fixed
dw InitUrchin ; 3B - Urchin, wall detect
dw InitUrchinWallFllw ; 3C - Urchin, wall follow
dw InitRipVanFish ; 3D - Rip Van Fish
dw InitPSwitch ; 3E - POW
dw Return0185C2 ; 3F - Para-Goomba
dw Return0185C2 ; 40 - Para-Bomb
dw Return01843D ; 41 - Dolphin, horizontal
dw Return01843D ; 42 - Dolphin2, horizontal
dw Return01843D ; 43 - Dolphin, vertical
dw Return01843D ; 44 - Torpedo Ted
dw Return0185C2 ; 45 - Directional coins
dw InitDigginChuck ; 46 - Diggin' Chuck
dw Return0183EE ; 47 - Swimming/Jumping fish
dw Return0183EE ; 48 - Diggin' Chuck's rock
dw InitGrowingPipe ; 49 - Growing/shrinking pipe end
dw Return0183EE ; 4A - Goal Point Question Sphere
dw InitPiranha ; 4B - Pipe dwelling Lakitu
dw InitExplodingBlk ; 4C - Exploding Block
dw InitMontyMole ; 4D - Ground dwelling Monty Mole
dw InitMontyMole ; 4E - Ledge dwelling Monty Mole
dw InitPiranha ; 4F - Jumping Piranha Plant
dw InitPiranha ; 50 - Jumping Piranha Plant, spit fire
dw FaceMario ; 51 - Ninji
dw InitMovingLedge ; 52 - Moving ledge hole in ghost house
dw Return0185C2 ; 53 - Throw block sprite
dw InitClimbingDoor ; 54 - Climbing net door
dw InitChckbrdPlat ; 55 - Checkerboard platform, horizontal
dw Return01B25D ; 56 - Flying rock platform, horizontal
dw InitChckbrdPlat ; 57 - Checkerboard platform, vertical
dw Return01B25D ; 58 - Flying rock platform, vertical
dw Return01B267 ; 59 - Turn block bridge, horizontal and vertical
dw Return01B267 ; 5A - Turn block bridge, horizontal
dw InitFloatingPlat ; 5B - Brown platform floating in water
dw InitFallingPlat ; 5C - Checkerboard platform that falls
dw InitFloatingPlat ; 5D - Orange platform floating in water
dw InitOrangePlat ; 5E - Orange platform, goes on forever
dw InitBrwnChainPlat ; 5F - Brown platform on a chain
dw Return01AE90 ; 60 - Flat green switch palace switch
dw InitFloatingSkull ; 61 - Floating skulls
dw InitLineBrwnPlat ; 62 - Brown platform, line-guided
dw InitLinePlat ; 63 - Checker/brown platform, line-guided
dw InitLineRope ; 64 - Rope mechanism, line-guided
dw InitLineGuidedSpr ; 65 - Chainsaw, line-guided
dw InitLineGuidedSpr ; 66 - Upside down chainsaw, line-guided
dw InitLineGuidedSpr ; 67 - Grinder, line-guided
dw InitLineGuidedSpr ; 68 - Fuzz ball, line-guided
dw Return01D6C3 ; 69 - Unused
dw Return0185C2 ; 6A - Coin game cloud
dw Return01843D ; 6B - Spring board, left wall
dw InitPeaBouncer ; 6C - Spring board, right wall
dw Return0185C2 ; 6D - Invisible solid block
dw InitDinos ; 6E - Dino Rhino
dw InitDinos ; 6F - Dino Torch
dw InitPokey ; 70 - Pokey
dw InitSuperKoopa ; 71 - Super Koopa, red cape
dw InitSuperKoopa ; 72 - Super Koopa, yellow cape
dw InitSuperKoopaFthr ; 73 - Super Koopa, feather
dw InitPowerUp ; 74 - Mushroom
dw InitPowerUp ; 75 - Flower
dw InitPowerUp ; 76 - Star
dw InitPowerUp ; 77 - Feather
dw InitPowerUp ; 78 - 1-Up
dw Return018583 ; 79 - Growing Vine
dw Return018583 ; 7A - Firework
dw InitGoalTape ; 7B - Goal Point
dw Return0185C2 ; 7C - Princess Peach
dw Return0185C2 ; 7D - Balloon
dw Return0185C2 ; 7E - Flying Red coin
dw Return0185C2 ; 7F - Flying yellow 1-Up
dw InitKey_BabyYoshi ; 80 - Key
dw InitChangingItem ; 81 - Changing item from translucent block
dw InitBonusGame ; 82 - Bonus game sprite
dw InitFlying_Block ; 83 - Left flying question block
dw InitFlying_Block ; 84 - Flying question block
dw Return0185C2 ; 85 - Unused (Pretty sure)
dw InitWiggler ; 86 - Wiggler
dw Return0185C2 ; 87 - Lakitu's cloud
dw InitWingedCage ; 88 - Unused (Winged cage sprite)
dw Return01843D ; 89 - Layer 3 smash
dw Return0185C2 ; 8A - Bird from Yoshi's house
dw Return0185C2 ; 8B - Puff of smoke from Yoshi's house
dw InitMsg_SideExit ; 8C - Fireplace smoke/exit from side screen
dw Return0185C2 ; 8D - Ghost house exit sign and door
dw Return0185C2 ; 8E - Invisible "Warp Hole" blocks
dw InitScalePlats ; 8F - Scale platforms
dw FaceMario ; 90 - Large green gas bubble
dw Return018869 ; 91 - Chargin' Chuck
dw InitChuck ; 92 - Splittin' Chuck
dw InitChuck ; 93 - Bouncin' Chuck
dw InitWhistlinChuck ; 94 - Whistlin' Chuck
dw InitClappinChuck ; 95 - Clapin' Chuck
dw Return018869 ; 96 - Unused (Chargin' Chuck clone)
dw InitPuntinChuck ; 97 - Puntin' Chuck
dw InitPitchinChuck ; 98 - Pitchin' Chuck
dw Return0183EE ; 99 - Volcano Lotus
dw InitSumoBrother ; 9A - Sumo Brother
dw InitHammerBrother ; 9B - Hammer Brother
dw Return0185C2 ; 9C - Flying blocks for Hammer Brother
dw InitBubbleSpr ; 9D - Bubble with sprite
dw InitBallNChain ; 9E - Ball and Chain
dw InitBanzai ; 9F - Banzai Bill
dw InitBowserScene ; A0 - Activates Bowser scene
dw Return0185C2 ; A1 - Bowser's bowling ball
dw Return0185C2 ; A2 - MechaKoopa
dw InitGreyChainPlat ; A3 - Grey platform on chain
dw InitFloatSpkBall ; A4 - Floating Spike ball
dw InitFuzzBall_Spark ; A5 - Fuzzball/Sparky, ground-guided
dw InitFuzzBall_Spark ; A6 - HotHead, ground-guided
dw Return0185C2 ; A7 - Iggy's ball
dw Return0185C2 ; A8 - Blargg
dw InitReznor ; A9 - Reznor
dw InitFishbone ; AA - Fishbone
dw FaceMario ; AB - Rex
dw InitWoodSpike ; AC - Wooden Spike, moving down and up
dw InitWoodSpike2 ; AD - Wooden Spike, moving up/down first
dw Return0185C2 ; AE - Fishin' Boo
dw Return0185C2 ; AF - Boo Block
dw InitDiagBouncer ; B0 - Reflecting stream of Boo Buddies
dw InitCreateEatBlk ; B1 - Creating/Eating block
dw Return0185C2 ; B2 - Falling Spike
dw InitBowsersFire ; B3 - Bowser statue fireball
dw FaceMario ; B4 - Grinder, non-line-guided
dw Return0185C2 ; B5 - Sinking fireball used in boss battles
dw InitDiagBouncer ; B6 - Reflecting fireball
dw Return0185C2 ; B7 - Carrot Top lift, upper right
dw Return0185C2 ; B8 - Carrot Top lift, upper left
dw Return0185C2 ; B9 - Info Box
dw InitTimedPlat ; BA - Timed lift
dw Return0185C2 ; BB - Grey moving castle block
dw InitBowserStatue ; BC - Bowser statue
dw InitSlidingKoopa ; BD - Sliding Koopa without a shell
dw Return0185C2 ; BE - Swooper bat
dw FaceMario ; BF - Mega Mole
dw InitGreyLavaPlat ; C0 - Grey platform on lava
dw InitMontyMole ; C1 - Flying grey turnblocks
dw FaceMario ; C2 - Blurp fish
dw FaceMario ; C3 - Porcu-Puffer fish
dw Return0185C2 ; C4 - Grey platform that falls
dw FaceMario ; C5 - Big Boo Boss
dw Return018313 ; C6 - Dark room with spot light
dw Return0185C2 ; C7 - Invisible mushroom
dw Return0185C2 ; C8 - Light switch block for dark room
InitGreyLavaPlat:
INC.B SpriteYPosLow,X
INC.B SpriteYPosLow,X
Return018313:
RTS
InitBowserStatue:
INC.W SpriteMisc157C,X
JSR InitExplodingBlk
STY.B SpriteTableC2,X
CPY.B #$02
BNE +
LDA.B #$01
STA.W SpriteOBJAttribute,X
+ RTS
InitTimedPlat:
LDY.B #$3F
LDA.B SpriteXPosLow,X
AND.B #$10
BNE +
LDY.B #$FF
+ TYA
STA.W SpriteMisc1570,X
RTS
YoshiPal:
db $09,$07,$05,$07
InitYoshiEgg:
LDA.B SpriteXPosLow,X
LSR A
LSR A
LSR A
LSR A
AND.B #$03
TAY
LDA.W YoshiPal,Y
STA.W SpriteOBJAttribute,X
INC.W SpriteMisc187B,X
RTS
DATA_01834C:
db $10,$F0
InitDiagBouncer:
JSR FaceMario
LDA.W DATA_01834C,Y
STA.B SpriteXSpeed,X
LDA.B #$F0
STA.B SpriteYSpeed,X
RTS
InitWoodSpike:
LDA.B SpriteYPosLow,X
SEC
SBC.B #$40
STA.B SpriteYPosLow,X
LDA.W SpriteYPosHigh,X
SBC.B #$00
STA.W SpriteYPosHigh,X
RTS
InitWoodSpike2:
JMP InitMontyMole
InitBowserScene:
JSL CODE_03A0F1
RTS
InitSumoBrother:
LDA.B #$03
STA.B SpriteTableC2,X
LDA.B #$70
- STA.W SpriteMisc1540,X
RTS
InitSlidingKoopa:
LDA.B #$04
BRA -
InitGrowingPipe:
LDA.B #$40
STA.W SpriteMisc1534,X
RTS
InitBanzai:
JSR SubHorizPos
TYA
BNE +
JMP OffScrEraseSprite
+ LDA.B #!SFX_KAPOW
STA.W SPCIO3 ; / Play sound effect
RTS
InitBallNChain:
LDA.B #$38
BRA +
InitGreyChainPlat:
LDA.B #$30
+ STA.W SpriteMisc187B,X
RTS
ExplodingBlkSpr:
db $15,$0F,$00,$04
InitExplodingBlk:
LDA.B SpriteXPosLow,X
LSR A
LSR A
LSR A
LSR A
AND.B #$03
TAY
LDA.W ExplodingBlkSpr,Y
STA.B SpriteTableC2,X
RTS
DATA_0183B3:
db $80,$40
InitScalePlats:
LDA.B SpriteYPosLow,X
STA.W SpriteMisc1534,X
LDA.W SpriteYPosHigh,X
STA.W SpriteMisc151C,X
LDA.B SpriteXPosLow,X
AND.B #$10
LSR A
LSR A
LSR A
LSR A
TAY
LDA.B SpriteXPosLow,X
CLC
ADC.W DATA_0183B3,Y
STA.B SpriteTableC2,X
LDA.W SpriteXPosHigh,X
ADC.B #$00
STA.W SpriteMisc1602,X
RTS
InitMsg_SideExit:
LDA.B #$28 ; \ Set current sprite's "disable contact with other sprites" timer to x28
STA.W SpriteMisc1564,X ; /
RTS
InitYoshi:
DEC.W SpriteMisc160E,X
INC.W SpriteMisc157C,X
LDA.W CarryYoshiThruLvls
BEQ Return0183EE
STZ.W SpriteStatus,X
Return0183EE:
RTS
DATA_0183EF:
db $08
DATA_0183F0:
db $00,$08
InitSpikeTop:
JSR SubHorizPos
TYA
EOR.B #$01
ASL A
ASL A
ASL A
ASL A
JSR CODE_01841D
STZ.W SpriteInLiquid,X
BRA CODE_01840E
InitUrchinWallFllw:
INC.B SpriteYPosLow,X
BNE InitFuzzBall_Spark
INC.W SpriteYPosHigh,X
InitFuzzBall_Spark:
JSR InitUrchin
CODE_01840E:
LDA.W SpriteMisc151C,X
EOR.B #$10
STA.W SpriteMisc151C,X
LSR A
LSR A
STA.B SpriteTableC2,X
RTS
InitUrchin:
LDA.B SpriteXPosLow,X
CODE_01841D:
LDY.B #$00
AND.B #$10
STA.W SpriteMisc151C,X
BNE +
INY
+ LDA.W DATA_0183EF,Y
STA.B SpriteXSpeed,X
LDA.W DATA_0183F0,Y
STA.B SpriteYSpeed,X
InitRipVanFish:
INC.W SpriteInLiquid,X
RTS
InitKey_BabyYoshi:
LDA.B #$09 ; \ Sprite status = Carryable
STA.W SpriteStatus,X ; /
RTS
InitChangingItem:
INC.B SpriteTableC2,X
Return01843D:
RTS
InitPeaBouncer:
LDA.B SpriteXPosLow,X
SEC
SBC.B #$08
STA.B SpriteXPosLow,X
LDA.W SpriteXPosHigh,X
SBC.B #$00
STA.W SpriteXPosHigh,X
RTS
InitPSwitch:
LDA.B SpriteXPosLow,X ; \ $151C,x = Blue/Silver,
LSR A ; | depending on initial X position
LSR A ; |
LSR A ; |
LSR A ; |
AND.B #$01 ; |
STA.W SpriteMisc151C,X ; /
TAY ; \ Store appropriate palette to RAM
LDA.W PSwitchPal,Y ; |
STA.W SpriteOBJAttribute,X ; /
LDA.B #$09 ; \ Sprite status = Carryable
STA.W SpriteStatus,X ; /
RTS
PSwitchPal:
db $06,$02
ADDR_018468:
JMP OffScrEraseSprite
InitLakitu:
LDY.B #$09
CODE_01846D:
CPY.W CurSpriteProcess
BEQ CODE_018484
LDA.W SpriteStatus,Y
CMP.B #$08
BNE CODE_018484
LDA.W SpriteNumber,Y
CMP.B #$87
BEQ ADDR_018468
CMP.B #$1E
BEQ ADDR_018468
CODE_018484:
DEY
BPL CODE_01846D
STZ.W SpriteRespawnTimer
STZ.W SpriteWillAppear
STZ.W CurrentGenerator
LDA.B SpriteYPosLow,X
STA.W SpriteRespawnYPos
LDA.W SpriteYPosHigh,X
STA.W SpriteRespawnYPos+1
JSL FindFreeSprSlot
BMI InitMontyMole
STY.W LakituCloudSlot
LDA.B #$87 ; \ Sprite = Lakitu Cloud
STA.W SpriteNumber,Y ; /
LDA.B #$08 ; \ Sprite status = Normal
STA.W SpriteStatus,Y ; /
LDA.B SpriteXPosLow,X
STA.W SpriteXPosLow,Y
LDA.W SpriteXPosHigh,X
STA.W SpriteXPosHigh,Y
LDA.B SpriteYPosLow,X
STA.W SpriteYPosLow,Y
LDA.W SpriteYPosHigh,X
STA.W SpriteYPosHigh,Y
PHX
TYX
JSL InitSpriteTables
PLX
STZ.W LakituCloudTimer
InitMontyMole:
LDA.B SpriteXPosLow,X
AND.B #$10
STA.W SpriteMisc151C,X
RTS
InitCreateEatBlk:
LDA.B #$FF
STA.W BlockSnakeActive
BRA InitMontyMole
InitBulletBill:
JSR SubHorizPos
TYA
STA.B SpriteTableC2,X
LDA.B #$10
STA.W SpriteMisc1540,X
RTS
InitClappinChuck:
LDA.B #$08
BRA +
InitPitchinChuck:
LDA.B SpriteXPosLow,X
AND.B #$30
LSR A
LSR A
LSR A
LSR A
STA.W SpriteMisc187B,X
LDA.B #$0A
BRA +
InitPuntinChuck:
LDA.B #$09
BRA +
InitWhistlinChuck:
LDA.B #$0B
BRA +
InitChuck:
LDA.B #$05
BRA +
InitDigginChuck:
LDA.B #$30
STA.W SpriteMisc1540,X
LDA.B SpriteXPosLow,X
AND.B #$10
LSR A
LSR A
LSR A
LSR A
STA.W SpriteMisc157C,X
LDA.B #$04
+ STA.B SpriteTableC2,X
JSR FaceMario
LDA.W DATA_018526,Y
STA.W SpriteMisc151C,X
RTS
DATA_018526:
db $00,$04
InitSuperKoopa:
LDA.B #$28
STA.B SpriteYSpeed,X
BRA FaceMario
InitSuperKoopaFthr:
JSR FaceMario
LDA.B SpriteXPosLow,X
AND.B #$10
BEQ +
LDA.B #$10 ; \ Can be jumped on
STA.W SpriteTweakerA,X ; /
LDA.B #$80
STA.W SpriteTweakerB,X
LDA.B #$10
STA.W SpriteTweakerE,X
RTS
+ INC.W SpriteMisc1534,X
RTS
InitPokey:
LDA.B #$1F ; \ If on Yoshi, $C2,x = #$1F
LDY.W PlayerRidingYoshi ; | (5 segments, 1 bit each)
BNE + ; |
LDA.B #$07 ; | If not on Yoshi, $C2,x = #$07
+ STA.B SpriteTableC2,X ; / (3 segments, 1 bit each)
BRA FaceMario
InitDinos:
LDA.B #$04
STA.W SpriteMisc151C,X
InitBomb:
LDA.B #$FF
STA.W SpriteMisc1540,X
BRA FaceMario
InitBubbleSpr:
JSR InitExplodingBlk
STY.B SpriteTableC2,X
DEC.W SpriteMisc1534,X
BRA FaceMario
InitGrnBounceKoopa:
LDA.B SpriteYPosLow,X
AND.B #$10
STA.W SpriteMisc160E,X
InitStandardSprite:
JSL GetRand
STA.W SpriteMisc1570,X
FaceMario:
JSR SubHorizPos
TYA
STA.W SpriteMisc157C,X
Return018583:
RTS
InitBowsersFire:
LDA.B #!SFX_FIRESPIT
STA.W SPCIO3 ; / Play sound effect
BRA FaceMario
InitPowerUp:
INC.B SpriteTableC2,X
RTS
InitFishbone:
JSL GetRand
AND.B #$1F
STA.W SpriteMisc1540,X
JMP FaceMario
InitDownPiranha:
ASL.W SpriteOBJAttribute,X
SEC
ROR.W SpriteOBJAttribute,X
LDA.B SpriteYPosLow,X
SEC
SBC.B #$10
STA.B SpriteYPosLow,X
LDA.W SpriteYPosHigh,X
SBC.B #$00
STA.W SpriteYPosHigh,X
InitPiranha:
LDA.B SpriteXPosLow,X ; \ Center sprite between two tiles
CLC ; |
ADC.B #$08 ; |
STA.B SpriteXPosLow,X ; /
DEC.B SpriteYPosLow,X
LDA.B SpriteYPosLow,X
CMP.B #$FF
BNE Return0185C2
DEC.W SpriteYPosHigh,X
Return0185C2:
RTS
CallSpriteMain:
STZ.W SpriteXMovement ; CallSpriteMain
LDA.B SpriteNumber,X
JSL ExecutePtr
dw ShellessKoopas ; 00 - Green Koopa, no shell
dw ShellessKoopas ; 01 - Red Koopa, no shell
dw ShellessKoopas ; 02 - Blue Koopa, no shell
dw ShellessKoopas ; 03 - Yellow Koopa, no shell
dw Spr0to13Start ; 04 - Green Koopa
dw Spr0to13Start ; 05 - Red Koopa
dw Spr0to13Start ; 06 - Blue Koopa
dw Spr0to13Start ; 07 - Yellow Koopa
dw GreenParaKoopa ; 08 - Green Koopa, flying left
dw GreenParaKoopa ; 09 - Green bouncing Koopa
dw RedVertParaKoopa ; 0A - Red vertical flying Koopa
dw RedHorzParaKoopa ; 0B - Red horizontal flying Koopa
dw Spr0to13Start ; 0C - Yellow Koopa with wings
dw Bobomb ; 0D - Bob-omb
dw Keyhole ; 0E - Keyhole
dw Spr0to13Start ; 0F - Goomba
dw WingedGoomba ; 10 - Bouncing Goomba with wings
dw Spr0to13Start ; 11 - Buzzy Beetle
dw Return01F87B ; 12 - Unused
dw Spr0to13Start ; 13 - Spiny
dw SpinyEgg ; 14 - Spiny falling
dw Fish ; 15 - Fish, horizontal
dw Fish ; 16 - Fish, vertical
dw GeneratedFish ; 17 - Fish, created from generator
dw JumpingFish ; 18 - Surface jumping fish
dw PSwitch ; 19 - Display text from level Message Box #1
dw ClassicPiranhas ; 1A - Classic Piranha Plant
dw Bank3SprHandler ; 1B - Bouncing football in place
dw BulletBill ; 1C - Bullet Bill
dw HoppingFlame ; 1D - Hopping flame
dw Lakitu ; 1E - Lakitu
dw Magikoopa ; 1F - Magikoopa
dw MagikoopasMagic ; 20 - Magikoopa's magic
dw PowerUpRt ; 21 - Moving coin
dw ClimbingKoopa ; 22 - Green vertical net Koopa
dw ClimbingKoopa ; 23 - Red vertical net Koopa
dw ClimbingKoopa ; 24 - Green horizontal net Koopa
dw ClimbingKoopa ; 25 - Red horizontal net Koopa
dw Thwomp ; 26 - Thwomp
dw Thwimp ; 27 - Thwimp
dw BigBoo ; 28 - Big Boo
dw KoopaKid ; 29 - Koopa Kid
dw ClassicPiranhas ; 2A - Upside down Piranha Plant
dw SumosLightning ; 2B - Sumo Brother's fire lightning
dw YoshiEgg ; 2C - Yoshi egg
dw Return0185C2 ; 2D - Baby green Yoshi
dw WallFollowers ; 2E - Spike Top
dw SpringBoard ; 2F - Portable spring board
dw DryBonesAndBeetle ; 30 - Dry Bones, throws bones
dw DryBonesAndBeetle ; 31 - Bony Beetle
dw DryBonesAndBeetle ; 32 - Dry Bones, stay on ledge
dw Fireballs ; 33 - Fireball
dw BossFireball ; 34 - Boss fireball
dw Yoshi ; 35 - Green Yoshi
dw DATA_01E41F ; 36 - Unused
dw Boo_BooBlock ; 37 - Boo
dw Eerie ; 38 - Eerie
dw Eerie ; 39 - Eerie, wave motion
dw WallFollowers ; 3A - Urchin, fixed
dw WallFollowers ; 3B - Urchin, wall detect
dw WallFollowers ; 3C - Urchin, wall follow
dw RipVanFish ; 3D - Rip Van Fish
dw PSwitch ; 3E - POW
dw ParachuteSprites ; 3F - Para-Goomba
dw ParachuteSprites ; 40 - Para-Bomb
dw Dolphin ; 41 - Dolphin, horizontal
dw Dolphin ; 42 - Dolphin2, horizontal
dw Dolphin ; 43 - Dolphin, vertical
dw TorpedoTed ; 44 - Torpedo Ted
dw DirectionalCoins ; 45 - Directional coins
dw DigginChuck ; 46 - Diggin' Chuck
dw SwimJumpFish ; 47 - Swimming/Jumping fish
dw DigginChucksRock ; 48 - Diggin' Chuck's rock
dw GrowingPipe ; 49 - Growing/shrinking pipe end
dw GoalSphere ; 4A - Goal Point Question Sphere
dw PipeLakitu ; 4B - Pipe dwelling Lakitu
dw ExplodingBlock ; 4C - Exploding Block
dw MontyMole ; 4D - Ground dwelling Monty Mole
dw MontyMole ; 4E - Ledge dwelling Monty Mole
dw JumpingPiranha ; 4F - Jumping Piranha Plant
dw JumpingPiranha ; 50 - Jumping Piranha Plant, spit fire
dw Bank3SprHandler ; 51 - Ninji
dw MovingLedge ; 52 - Moving ledge hole in ghost house
dw Return0185C2 ; 53 - Throw block sprite
dw ClimbingDoor ; 54 - Climbing net door
dw Platforms ; 55 - Checkerboard platform, horizontal
dw Platforms ; 56 - Flying rock platform, horizontal
dw Platforms ; 57 - Checkerboard platform, vertical
dw Platforms ; 58 - Flying rock platform, vertical
dw TurnBlockBridge ; 59 - Turn block bridge, horizontal and vertical
dw HorzTurnBlkBridge ; 5A - Turn block bridge, horizontal
dw Platforms2 ; 5B - Brown platform floating in water
dw Platforms2 ; 5C - Checkerboard platform that falls
dw Platforms2 ; 5D - Orange platform floating in water
dw OrangePlatform ; 5E - Orange platform, goes on forever
dw BrownChainedPlat ; 5F - Brown platform on a chain
dw PalaceSwitch ; 60 - Flat green switch palace switch
dw FloatingSkulls ; 61 - Floating skulls
dw LineFuzzy_Plats ; 62 - Brown platform, line-guided
dw LineFuzzy_Plats ; 63 - Checker/brown platform, line-guided
dw LineRope_Chainsaw ; 64 - Rope mechanism, line-guided
dw LineRope_Chainsaw ; 65 - Chainsaw, line-guided
dw LineRope_Chainsaw ; 66 - Upside down chainsaw, line-guided