-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBank09.asm
2678 lines (1668 loc) · 61.4 KB
/
Bank09.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
; ==============================================================================
incsrc "ancilla_init.asm"
incsrc "tagalong.asm"
; ==============================================================================
; *$4AC6B-$4ACF2 LONG
Ancilla_TerminateSelectInteractives:
{
PHB : PHK : PLB
LDX.b #$05
.nextObject
; check for 3D crystal
LDA $0C4A, X : CMP.b #$3E : BNE .not3DCrystal
TXY
BRA .checkIfCarryingObject
.not3DCrystal
; checks if any cane of somaria blocks are in play?
LDA $0C4A, X : CMP.b #$2C : BNE .checkIfCarryingObject
STZ $0646
LDA $48 : AND.b #$80 : BEQ .checkIfCarryingObject
; reset Link's grabby status
STZ $48 : STZ $5E
.checkIfCarryingObject
LDA $0308 : BPL .notCarryingAnything
TXA : INC A : CMP $02EC : BEQ .spareObject
BRA .terminateObject
.notCarryingAnything
TXA : INC A : CMP $02EC : BNE .terminateObject
STZ $02EC
.terminateObject
STZ $0C4A, X
.spareObject
DEX : BPL .nextObject
LDA $037A : AND.b #$10 : BEQ .theta
STZ $46
STZ $037A
.theta
; Reset flute playing interval timer.
STZ $03F0
; Reset tagalong detatchment timer.
STZ $02F2
; Only place this is written to. Never read.
STZ $02F3
STZ $035F
STZ $03FC
STZ $037B
STZ $03FD
STZ $0360
LDA $5D : CMP.b #$13 : BNE .notUsingHookshot
LDA.b #$00 : STA $5D
LDA $3A : AND.b #$BF : STA $3A
LDA $50 : AND.b #$FE : STA $50
LDA $037A : AND.b #$FB : STA $037A
STZ $037E
.notUsingHookshot
PLB
RTL
}
; ==============================================================================
; *$4ACF3-$4AD05 LONG
Tagalong_Disable:
{
; Get rid of the tagalong following Link if it's
; Kiki the Monkey or the creepy Middle Aged dude with the sign.
LDA $7EF3CC
CMP.b #$0A : BEQ .kill_tagalong
CMP.b #$09 : BNE .spare_tagalong
.terminate_tagalong
LDA.b #$00 : STA $7EF3CC
.spare_tagalong
RTL
}
; ==============================================================================
; *$4AD06-$4AD1A LOCAL
Ancilla_SetCoords:
{
LDA $00 : STA $0BFA, X
LDA $01 : STA $0C0E, X
LDA $02 : STA $0C04, X
LDA $03 : STA $0C18, X
RTS
}
; ==============================================================================
; *$4AD1B-$4AD2F LOCAL
Ancilla_GetCoords:
{
LDA $0BFA, X : STA $00
LDA $0C0E, X : STA $01
LDA $0C04, X : STA $02
LDA $0C18, X : STA $03
RTS
}
; ==============================================================================
; \note Could this routine's placement indicate that dividing the blocks
; came later as a designed feature?
; *$4AD30-$4AD66 LONG
AddSomarianBlockDivide:
{
PHB : PHK : PLB
LDA.b #$2E : STA $0C4A, X
PHX
TAX : LDA $08806F, X
PLX
STA $0C90, X
LDA.b #$03 : STA $03B1, X
STZ $0C54, X
STZ $0C5E, X
STZ $039F, X
STZ $03A4, X
STZ $03EA, X
STZ $0280, X
STZ $0646
JSL Sound_SfxPanObjectCoords : ORA.b #$01 : STA $012F
PLB
RTL
}
; ==============================================================================
; $4AD67-$4AD6B DATA
pool GiveRupeeGift:
{
.gift_amounts
db 1, 5, 20, 100, 50
}
; ==============================================================================
; *$4AD6C-$4ADC6 LONG
GiveRupeeGift:
{
; This routine handles rupee gift
PHB : PHK : PLB
LDA $0C5E, X
CMP.b #$34 : BEQ .lowSize
CMP.b #$35 : BEQ .lowSize
CMP.b #$36 : BEQ .lowSize
CMP.b #$40 : BEQ .mediumSize
CMP.b #$41 : BEQ .mediumSize
CMP.b #$46 : BEQ .largeSize
CMP.b #$47 : BNE .notRupeeGift
.largeSize
LDY.b #$02
; Give 20 rupees for this gift (redundant, I think)
; Perhaps it uses a different graphic
CMP.b #$47 : BEQ .setGiftIndex
LDA.b #$2C : STA $00
; Gives me 300 rupees.
LDA.b #$01 : STA $01
BRA .giveRupees
.mediumSize
SUB.b #$40 : ADD.b #$03 : TAY
BRA .setGiftIndex
.lowSize
; Give 1, 5, or 20 rupees
SUB.b #$34 : TAY
.setGiftIndex
LDA .gift_amounts, Y : STA $00 : STZ $01
.giveRupees
REP #$20
; Add this amount to my rupee collection.
LDA $7EF360 : ADD $00 : STA $7EF360
SEP #$20
SEC
PLB
RTL
.notRupeeGift
CLC
PLB
RTL
}
; ==============================================================================
; *$4ADC7-$4ADF0 LONG
Ancilla_TerminateSparkleObjects:
{
PHX
LDX.b #$04
.next_slot
LDA $0C4A, X
CMP.b #$2A : BEQ .terminate_object
CMP.b #$2B : BEQ .terminate_object
CMP.b #$30 : BEQ .terminate_object
CMP.b #$31 : BEQ .terminate_object
CMP.b #$18 : BEQ .terminate_object
CMP.b #$19 : BEQ .terminate_object
CMP.b #$0C : BNE .dont_terminate
.terminate_object
STZ $0C4A, X
.dont_terminate
DEX : BPL .next_slot
PLX
RTL
}
; ==============================================================================
incsrc "ancilla_motive_dash_dust.asm"
; ==============================================================================
; $4AE3E-$4AE3F DATA
pool Empty:
{
fillbyte $FF
fill $02
}
; ==============================================================================
; *$4AE40-$4AE7D LONG
Sprite_SpawnSuperficialBombBlast:
{
; Create a blast that looks like a green bomb going off? (Somaria
; platform uses during creation? Magic powder tossed on green altar?)
LDA.b #$4A : JSL Sprite_SpawnDynamically : BMI .spawn_failed
LDA.b #$06 : STA $0DD0, Y
LDA.b #$1F : STA $0E00, Y
LDA #$03 : STA $0DB0, Y : STA $0E40, Y
INC A : STA $0F50, Y
LDA.b #$15 : JSL Sound_SetSfx2PanLong
; *$4AE64 ALTERNATE ENTRY POINT
shared Sprite_SetSpawnedCoords:
LDA $00 : STA $0D10, Y
LDA $01 : STA $0D30, Y
LDA $02 : STA $0D00, Y
LDA $03 : STA $0D20, Y
LDA $04 : STA $0F70, Y
.spawn_failed
RTL
}
; ==============================================================================
; $4AE7E-$4AE9F LONG
Sprite_SpawnDummyDeathAnimation:
{
; Used for the chicken swarm (has to be, I'm sure of it)
; Update: This seems to be used by the contradiction bat.
LDA.b #$0B : JSL Sprite_SpawnDynamically : BMI .spawn_failed
JSL Sprite_SetSpawnedCoords
LDA.b #$06 : STA $0DD0, Y
LDA.b #$0F : STA $0DF0, Y
LDA.b #$14 : JSL Sound_SetSfx2PanLong
; Ensure the spawned death sprite is visible by giving it high priority.
LDA.b #$02 : STA $0F20, Y
.spawn_failed
RTL
}
; ==============================================================================
; $4AEA0-$4AEA7 DATA
pool Sprite_SpawnMadBatterBolts:
{
.x_speeds
-8, -4, 4, 8
.initial_cycling_states
0, 17, 34, 51
}
; ==============================================================================
; \note Only used by the mad batter (naturally).
; *$4AEA8-$4AF31 LONG
Sprite_SpawnMadBatterBolts:
{
JSL .attempt_bold_spawn
JSL .attempt_bold_spawn
JSL .attempt_bold_spawn
; *$4AEB4 ALTERNATE ENTRY POINT
.attempt_bold_spawn
LDA.b #$3A : JSL Sprite_SpawnDynamically : BMI .spawnFailed
LDA.b #$01 : JSL Sound_SetSfx3PanLong
JSL Sprite_SetSpawnedCoords
LDA $00 : ADD.b #$04 : STA $0D10, Y
LDA $01 : ADC.b #$00 : STA $0D30, Y
LDA $02 : ADD.b #$0C : PHP : SUB $0F70, X : STA $0D00, Y
LDA $03 : SBC.b #$00 : PLP : ADC.b #$00 : STA $0D20, Y
LDA.b #$00 : STA $0F70, Y
LDA.b #$18 : STA $0D40, Y : STA $0EB0, Y : STA $0BA0, Y
LDA.b #$80 : STA $0E40, Y
LDA.b #$03 : STA $0E60, Y
AND.b #$03 : STA $0F50, Y
LDA.b #$20 : STA $0DF0, Y
LDA.b #$02 : STA $0DC0, Y
PHX
LDA $0ED0, X : TAX
LDA.l .x_speeds, X : STA $0D50, Y
LDA.l .initial_cycling_states, X : STA $0E80, Y
LDA.b #$02 : STA $0F20, Y
PLX
INC $0ED0, X
.spawnFailed
RTL
}
; ==============================================================================
; *$4AF32-$4AF88 LONG
Sprite_VerifyAllOnScreenDefeated:
{
PHX
LDX.b #$0F ; Going to cycle through all sprite entries
.next_sprite
LDA $0DD0, X : BEQ .dead
; check if the sprite is always considered dead for these purposes
; (some sprites have this property set at load and some dynamically)
LDA $0F60, X : AND.b #$40 : BNE .dead
; In these cases Dead apparently means offscreen.
LDA $0D10, X : CMP $E2
LDA $0D30, X : SBC $E3 : BNE .dead
; In these cases Dead apparently means offscreen.
LDA $0D00, X : CMP $E8
LDA $0D20, X : SBC $E9 : BNE .dead
PLX
CLC ; Not all enemies are dead, return false.
RTL
.dead
DEX : BPL .next_sprite
BRA .check_overlords
; *$4AF61 ALTERNATE ENTRY POINT
shared Sprite_CheckIfAllDefeated:
PHX
; Were going to cycle through all the sprites in the room.
LDX.b #$0F
.next_sprite_2
; Is the sprite alive?
LDA $0DD0, X : BEQ .dead_2
; Its alive, but not in this room... i.e. good as dead.
LDA $0F60, X : AND.b #$40 : BNE .dead_2
.failure
PLX
CLC ; Not all the enemies are dead, its a failure
RTL
.dead_2
DEX : BPL .next_sprite_2
.check_overlords
LDX.b #$07
.next_overlord
; Now check to see if there are any overlords "alive"
LDA $0B00, X
CMP.b #$14 : BEQ .failure
CMP.b #$18 : BEQ .failure
; Move on to the next value.
DEX : BPL .next_overlord
PLX
; Weve succeeded (so do something?)
SEC
RTL
}
; ==============================================================================
; *$4AF89-$4AFD5 LONG
Sprite_ReinitWarpVortex:
{
PHB : PHK : PLB
LDX.b #$0F
.nextSprite
LDA $0DD0, X : BEQ .dead
; Trying to kill the warp vortex
LDA $0E20, X : CMP.b #$6C : BNE .notWarpVortex
; Kill the warp vortex!
STZ $0DD0, X
.dead
.notWarpVortex
DEX : BPL .nextSprite
LDA.b #$6C
JSL Sprite_SpawnDynamically : BPL .spawnSucceeded
LDY.b #$00
.spawnSuceeded
LDA $001ABF : STA $0D10, Y
LDA $001ACF : STA $0D30, Y
LDA $001ADF : ADD.b #$08 : STA $0D00, Y
LDA $001AEF : ADC.b #$00 : STA $0D20, Y
LDA.b #$00 : STA $0F20, Y : INC A : STA $0BA0, Y
PLB
RTL
}
; ==============================================================================
; *$4AFD6-$4B01F LONG
InitSpriteSlots:
{
PHB: PHK : PLB
LDX.b #$0F
.nextSprite
LDA $0DD0, X : BEQ .deadSprite
LDY $0E20, X
; carrying something
CMP.b #$0A : BNE .notCarrying
; carrying a bush or rock
CPY.b #$EC : BEQ .ignoreSprite
; or carrying a fish
CPY.b #$D2 : BEQ .ignoreSprite
; if it's not one of those two things you're carrying, you lose it
STZ $0309 : STZ $0308
BRA .killSprite
.notCarrying
; is it a warp vortex?
CPY.b #$6C : BEQ .ignoreSprite
; ignore the sprite if the area that it was loaded in is the same as the area we're in
LDA $0C9A, X : CMP $040A : BEQ .ignoreSprite
.killSprite
STZ $0DD0, X
.deadSprite
.ignoreSprite
DEX : BPL .nextSprite
LDX.b #$07
.nextOverlord
; There's no overlord loaded in that slot to begin with
LDA $0B00, X : BEQ .noOverlord
; ignore the overlord b/c it matches the area we're already in
LDA $0CCA, X : CMP $040A : BEQ .ignoreOverlord
STZ $0B00, X
.noOverlord
.ignoreOverlord
DEX : BPL .nextOverlord
PLB
RTL
}
; ==============================================================================
incsrc "garnish.asm"
incsrc "overlord.asm"
; ==============================================================================
; $4C023-$4C02E DATA
pool SpawnCrazyVillageSoldier:
{
; \tcrf (verified)
; The inn keeper's data is unused because he's not a snitch, naturally.
; Use Pro Action Replay Code 09C04834 to switch the young snitch girl's
; soldier spawn data with that of the innkeeper's.
.x_offsets_low
db $20, $40, $E0
.x_offsets_high
db $01, $03, $02
.y_offsets_low
db $00, $B0, $60
.y_offsets_high
db $01, $03, $01
}
; ==============================================================================
; *$4C02F-$4C087 LONG
SpawnCrazyVillageSoldier:
{
; Spawn the crazy nutjob that shows up when you run into the scared ladies outside
; their houses
PHB : PHK : PLB
LDA.b #$45
LDY.b #$00
JSL Sprite_SpawnDynamically.arbitrary : BMI .spawn_failed
PHX
LDA $0E20, X
LDX.b #$00
; Is it one of the ladies outside of their houses?
CMP.b #$3D : BEQ .place_soldier
INX
; Innkeeper sprite... he was originally planned as someone that snitches on you?
CMP.b #$35 : BEQ .place_soldier
INX
.place_soldier
LDA .x_offsets_low, X : STA $0D10, Y
LDA .x_offsets_high, X : ADD $0FBD : STA $0D30, Y
LDA .y_offsets_low, X : STA $0D00, Y
LDA .y_offsets_high, X : ADD $0FBF : STA $0D20, Y
PLX
LDA.b #$00 : STA $0F20, Y
LDA.b #$04 : STA $0E50, Y
LDA.b #$80 : STA $0CAA, Y
LDA.b #$90 : STA $0BE0, Y
LDA.b #$0B : STA $0F50, Y
.spawn_failed
PLB
RTL
}
; ==============================================================================
; $4C088-$4C08C DATA
pool Overlord_CheckInRangeStatus:
{
.offsets_low
db $30, $C0
.offsets_high
db $01, $FF
.easy_out
RTS
}
; ==============================================================================
; I think this... might terminate overlord sprites on the overworld.
; But we don't realy use them there anyways...
; *$4C08D-$4C113 LOCAL
Overlord_CheckInRangeStatus:
{
LDA $1B : BNE .easy_out
LDA $1A : AND.b #$01 : STA $01
STA $02
TAY
; \optimize This would be so much faster in 16-bit code, even if
; this code isn't used very often, if at all.
LDA $E2 : ADD .offsets_low, Y : ROL $00 : CMP $0B08, X : PHP
LDA $E3 : LSR $00 : ADC .offsets_high, Y : PLP : SBC $0B10, X : STA $00
; We want the upper byte of the absolute difference between the
; offset from the scroll value to the overlord. Since that offset
; is negative on odd frames, we only negate the result on those frames.
LSR $01 : BCC .sign_normalize_dx
EOR.b #$80 : STA $00
.sign_normalize_dx
LDA $00 : BMI .terminate
LDA $E8 : ADD .offsets_low, Y : ROL $00 : CMP $0B18, X : PHP
LDA $E9 : LSR $00 : ADC .offsets_high, Y : PLP : SBC $0B20, X : STA $00
; See previous comment regarding sign normalization.
LSR $02 : BCC .sign_normalize_dy
EOR.b #$80 : STA $00
.sign_normalize_dy
LDA $00 : BPL .in_range_xy
.terminate
; Terminate the overlord.
STZ $0B00, X
TXA : ASL A : TAY
REP #$20
LDA $0B48, Y : STA $00 : CMP.w #$FFFF : PHP
LSR #3 : ADD.w #$EF80 : STA $01
; Why it wouldn't participate, I don't really know.
PLP : SEP #$20 : BCS .not_participating_in_death_buffer
LDA.b #$7F : STA $03
LDA $00 : AND.b #$07 : TAY
LDA [$01] : AND $F24B, Y : STA [$01]
.in_range_xy
.not_participating_in_death_buffer
RTS
}
; ==============================================================================
; *$4C114-$4C174 LONG
Dungeon_ResetSprites:
{
; Moves current room's data into reserve (gets ready for transition)
PHB : PHK : PLB
; $4C176 IN ROM; Transfer a lot of sprite data to other places.
JSR Dungeon_CacheTransSprites
; Make Link drop whatever hes carrying.
STZ $0309 : STZ $0308
; $4C22F IN ROM; Zeroes out and disables a number of memory locations.
JSL Sprite_DisableAll
REP #$20
LDA.w #$FFFF : STA $0FBA : STA $0FB8
LDX.b #$00
LDA $048E
.updateRecentRoomsList
CMP $0B80, X : BEQ .alreadyInList
INX #2 : CPX.b #$07 : BCC .updateRecentRoomsList
LDA $0B86 : STA $00
LDA $0B84 : STA $0B86
LDA $0B82 : STA $0B84
LDA $0B80 : STA $0B82
LDA $048E : STA $0B80
REP #$10
LDA $00 : CMP.w #$FFFF : BEQ .nullEntry
ASL A : TAX
; Tells the game that next time we enter that room the sprites need
; a complete fresh (e.g. if any have gotten killed)
LDA.w #$0000 : STA $7FDF80, X
.nullEntry
.alreadyInList
SEP #$30
JSR Dungeon_LoadSprites
PLB
RTL
}
; ==============================================================================
; *$4C175-$4C22E BRANCH LOCATION
pool Dungeon_CacheTransSprites:
{
.easy_out
RTS
; *$4C176 ENTRY POINT
Dungeon_CacheTransSprites:
{
; Don't do this routine if were outside.
LDA $1B : BEQ .easy_out
; Use $0FFA as a place holder.
STA $0FFA
; Were going to cycle through all 16 sprites.
LDX.b #$0F
.nextSprite
; Transfer sprite data to an extended region
STZ $1D00, X
LDA $0E20, X : STA $1D10, X
LDA $0D10, X : STA $1D20, X
LDA $0DC0, X : STA $1D60, X
LDA $0D30, X : STA $1D30, X
LDA $0D00, X : STA $1D40, X
LDA $0D20, X : STA $1D50, X
LDA $0F00, X : BNE .inactiveSprite
LDA $0DD0, X : CMP.b #$04 : BEQ .inactiveSprite
; frozen
CMP.b #$0A : BEQ .inactiveSprite
STA $1D00, X
LDA $0D90, X : STA $1D70, X
LDA $0EB0, X : STA $1D80, X
LDA $0F50, X : STA $1D90, X
LDA $0B89, X : STA $1DA0, X
LDA $0DE0, X : STA $1DB0, X
LDA $0E40, X : STA $1DC0, X
LDA $0F20, X : STA $1DD0, X
LDA $0D80, X : STA $1DE0, X
LDA $0E60, X : STA $1DF0, X
LDA $0DA0, X : STA $7FFA5C, X
LDA $0DB0, X : STA $7FFA6C, X
LDA $0E90, X : STA $7FFA7C, X
LDA $0E80, X : STA $7FFA8C, X
LDA $0F70, X : STA $7FFA9C, X
LDA $0DF0, X : STA $7FFAAC, X
LDA $7FF9C2, X : STA $7FFACC, X
LDA $0BA0, X : STA $7FFADC, X
.inactiveSprite
DEX : BMI .done
JMP .nextSprite
.return
RTS
}
; =============================================================
; *$4C22F-$4C28F LONG
Sprite_DisableAll:
{
LDX.b #$0F
.nextSprite
; sprite is deactivated already, ignore it
LDA $0DD0, X : BEQ .ignoreSprite
; Are we indoors?
LDA $1B : BNE .indoors
; Is it a warp vortex? (created my mirror)
LDA $0E20, X : CMP.b #$6C : BEQ .ignoreSprite
.indoors
; kill the sprite momentarily
STZ $0DD0, X
.ignoreSprite
DEX : BPL .nextSprite
; going to cycle through the special effects
LDX.b #$09
.deactivateEffects
; Deactivate all special effects
STZ $0C4A, X
DEX : BPL .deactivateEffects
STZ $02EC
STZ $0B6A : STZ $0B9B : STZ $0B88 : STZ $0B99
STZ $0FB4
STZ $0B9E : STZ $0CF4
STZ $0FF9 : STZ $0FF8 : STZ $0FFB : STZ $0FFC : STZ $0FFD : STZ $0FC6
STZ $03FC