-
Notifications
You must be signed in to change notification settings - Fork 3
/
Bank1B.asm
2831 lines (1706 loc) · 59 KB
/
Bank1B.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
; $D8000 - $DB1D6 - tail end of the music (spc) data
; $DB1D7 - $DB29A - possibly a test block of spc data, but seems to be unused
{
; \task Fill in data and find out if that part about spc data seems
; credible.
}
; $DB29B - $DB7FF - null bytes / empty space
pool Null:
{
; \task Put in fillbyte / fill directives.
}
; ==============================================================================
; $DB800-$DB85F DATA
pool Overworld_Hole:
{
.map16
; $DB800 - map16 coordinates for holes
dw $0CE0, $124E, $12CE, $1162, $11E2, $073C, $07BC, $0CE0
dw $003C, $00BE, $003E, $0388, $0170, $03A4, $0424, $0518
dw $028A, $020A, $0108
.area
; $DB826 - area numbers for holes
dw $0040, $0040, $0040, $0040, $0040, $0040, $0040, $0000
dw $005B, $005B, $005B, $0015, $001B, $0022, $0022, $0002, $0018, $0018, $0014
.entrance
; $DB84C - dungeon entrance to go into
db $76, $77, $77, $78, $78, $79, $79, $7A
db $7B, $7B, $7B, $7C, $7D, $7E, $7E, $7F
db $80, $80, $81, $82
}
; ==============================================================================
; *$DB860-$DB8BE LONG
Overworld_Hole:
{
; routine used to find the entrance to send Link to when he falls into a hole
PHB : PHK : PLB
REP #$31
LDA $20 : AND.w #$FFF8 : STA $00 : SUB $0708 : AND $070A : ASL #3 : STA $06
LDA $22 : AND.w #$FFF8 : LSR #3 : STA $02 : SUB $070C : AND $070E : ADD $06 : STA $00
LDX.w #$0024
.nextHole
LDA $00 : CMP .map16, X
BNE .wrongMap16
LDA $040A : CMP .area, X
BEQ .matchedHole
.wrongMap16
DEX #2
BPL .nextHole
; Send us to the Chris Houlihan room
LDX.w #$0026
SEP #$20
; Put Link in the Light World
LDA.b #$00 : STA $7EF3CA
.matchedHole
SEP #$30
TXA : LSR A : TAX
; Set an entrance index...
LDA .entrance, X : STA $010E : STZ $010F
PLB
RTL
}
; $DB8BF-$DB916 - chr types indicating door entrances
dw $00FE, $00C5, $00FE, $0114, $0115, $0175, $0156, $00F5
dw $00E2, $01EF, $0119, $00FE, $0172, $0177, $013F, $0172
dw $0112, $0161, $0172, $014C, $0156, $01EF, $00FE, $00FE
dw $00FE, $010B, $0173, $0143, $0149, $0175, $0103, $0100
dw $01CC, $015E, $0167, $0128, $0131, $0112, $016D, $0163
dw $0173, $00FE, $0113, $0177
; $DB917 - $DB96E
dw $014A, $00C4, $014F, $0115, $0114, $0174, $0155, $00F5
dw $00EE, $01EB, $0118, $0146, $0171, $0155, $0137, $0174
dw $0173, $0121, $0164, $0155, $0157, $0128, $0114, $0123
dw $0113, $0109, $0118, $0161, $0149, $0171, $0174, $0101
dw $01CC, $0131, $0051, $014E, $0131, $0121, $017A, $0163
dw $0172, $01BD, $0152, $0167
; $DB96F - $DBA70 - Area list for entrances
dw $002C, $0013, $001B, $001B, $001B, $000A, $0003, $001E
; $DBA71 - $DBB72 - Map16 list for entrances
; $DBB73 - $DBBF3 - references to the dungeon entrance to go into for each entry
db $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F, $10
db $11, $12, $13, $14, $15, $16, $17, $18, $19, $1A, $1B, $1C, $1D, $1E, $1F, $20
db $21, $22, $23, $24, $25, $26, $27, $28, $29, $2A, $2B, $2C, $2D, $2E, $2F, $30
db $31, $32, $33, $34, $35, $36, $37, $38, $39, $3A, $3B, $3C, $3D, $3E, $3F, $40
db $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F, $50
db $51, $52, $53, $54, $55, $5E, $60, $58, $59, $5A, $5B, $5C, $5D, $5E, $5F, $60
db $61, $62, $63, $64, $65, $66, $67, $68, $69, $6A, $56, $5E, $5E, $58, $60, $5E
db $4D, $5E, $65, $60, $57, $6B, $71, $71, $6D, $6E, $6F, $70, $6C, $72, $83, $84
db $5E
; *$DBBF4-$DBD79 LONG
Overworld_Entrance:
{
REP #$31
LDA $20 : ADD.w #$0007 : STA $00 : SUB $0708 : AND $070A : ASL #3 : STA $06
LDA $22 : LSR #3 : STA $02 : SUB $070C : AND $070E : ADD $06 : TAY : TAX
LDA $7E2000, X : ASL #3 : TAX
; If player is facing a different direction than up, branch
LDA $2F : AND.w #$00FF : BNE .notFacingUp
LDA $0F8002, X : AND.w #$41FF : CMP.w #$00E9 : BEQ BRANCH_BETA
CMP.w #$0149 : BEQ BRANCH_GAMMA
CMP.w #$0169 : BEQ BRANCH_GAMMA
TYX
LDA $7E2002, X : ASL #3 : TAX
LDA $0F8000, X : AND.w #$41FF : CMP.w #$4149 : BEQ BRANCH_DELTA
CMP.w #$4169 : BEQ BRANCH_DELTA
CMP.w #$40E9 : BNE BRANCH_EPSILON
DEY #2
BRANCH_BETA:
; This section opens a normal door on the overworld
; It replaces the existing tiles with an open door set of tiles
TYX
LDA.w #$0DA4
JSL Overworld_DrawPersistentMap16
LDA.w #$0DA6 : STA $7E2002, X
LDY.w #$0002
JSL Overworld_DrawMap16_Anywhere
SEP #$30
; Play a sound effect
LDA.b #$15 : STA $012F
; Make sure to update the tilemap
LDA.b #$01 : STA $14
RTL
.notFacingUp
BRA BRANCH_EPSILON
BRANCH_DELTA:
DEY #2
BRANCH_GAMMA:
STZ $0692
AND.w #$03FF : CMP.w #$0169 : BNE BRANCH_IOTA
; Check if we've beaten agahnim, and if so, don't open the door.
LDA $7EF3C5 : AND.w #$000F : CMP.w #$0003 : BCS BRANCH_EPSILON
LDA.w #$0018 : STA $0692
BRANCH_IOTA:
TYA : SUB.w #$0080 : STA $0698
SEP #$20
LDA.b #$15 : STA $012F
STZ $B0 : STZ $0690
LDA.b #$0C : STA $11
SEP #$30
RTL
BRANCH_EPSILON:
LDA $0F8004, X : AND.w #$01FF : STA $00
LDA $0F8006, X : AND.w #$01FF : STA $02
LDX.w #$0056
BRANCH_THETA:
LDA $00 : CMP $1BB8BF, X : BNE BRANCH_ZETA
LDA $02 : CMP $1BB917, X : BEQ BRANCH_KAPPA
BRANCH_ZETA:
DEX #2 : BPL BRANCH_THETA
STZ $04B8
BRANCH_MU:
SEP #$30
RTL
BRANCH_LAMBDA:
LDA $04B8 : BNE BRANCH_MU
INC $04B8
; "You can't enter with something following you" (this variable holds the message index.)
LDA.w #$0005 : STA $1CF0
SEP #$30
JML Main_ShowTextMessage
BRANCH_KAPPA:
TYA : STA $00
; Number of entrance entries * 2
LDX.w #$0102
BRANCH_PI:
LDA $00
BRANCH_OMICRON:
DEX #2 : BMI BRANCH_XI
CMP $1BBA71, X : BNE BRANCH_OMICRON
LDA $040A : CMP $1BB96F, X : BNE BRANCH_PI
LDA $7EF3D3 : AND.w #$00FF : BNE BRANCH_RHO
LDA $02DA : AND.w #$00FF : CMP.w #$0001 : BEQ BRANCH_LAMBDA
LDA $7EF3CC : AND.w #$00FF : BEQ BRANCH_RHO
CMP.w #$0005 : BEQ BRANCH_RHO
CMP.w #$000E : BEQ BRANCH_RHO
CMP.w #$0001 : BEQ BRANCH_RHO
CMP.w #$0007 : BEQ BRANCH_SIGMA
CMP.w #$0008 : BNE BRANCH_LAMBDA
CPX.w #$0076 : BCC BRANCH_LAMBDA
TXA : LSR A : TAX
SEP #$30
LDA $1BBB73, X : STA $010E
STZ $4D
STZ $46
LDA.b #$0F : STA $10
LDA.b #$06 : STA $010C
STZ $11
STZ $B0
SEP #$30
RTL
}
; ==============================================================================
; *$DBD7A-$DBF1D LONG
Overworld_Map16_ToolInteraction:
{
; Handles Map16 interactions with sword, hammer, shovel, magic powder, etc
LDA $1B : BEQ .outdoors ; Yes... branch
JML Dungeon_ToolAndTileInteraction
.outdoors
REP #$30
; Zero out ??? affected when dashing apparently, Zero out tile interaction
STZ $04B2 : STZ $76
LDA $00 : SUB $0708 : AND $070A : ASL #3 : STA $06
LDA $02 : SUB $070C : AND $070E : ADD $06 : TAX
; Is Link using the hammer?
LDA $0301 : AND.w #$0002 : BNE .usingHammer
; Is Link using anything else?
; No, branch
LDA $0301 : AND.w #$0040 : BEQ .notUsingMagicPowder
; We end up here if Link sprinkled magic powder on something.
LDA $7E2000, X : PHA
LDY.w #$0002
; Is it a bush?
CMP.w #$0036 : BEQ .isBush
LDY.w #$0004
; Is it a dark world bush?
CMP.w #$072A : BNE .notBush
.isBush
JMP .isBush2
; HAMMER TIME!
.usingHammer
; Is it a peg to be pounded down?
LDA $7E2000, X : PHA : CMP.w #$021B : BNE .notPeg
SEP #$20
; Play the peg gettin' knocked down sound.
LDA.b #$11 : STA $012E
REP #$20
JSL HandlePegPuzzles ; $75D67 IN ROM
; Choose the map16 tile with the "peg pounded down" tile
LDA.w #$0DCB
JMP .noSecret
.notPeg
JSR Overworld_HammerSfx
.notBush
JMP .return
.notUsingMagicPowder
; Normal tile interactions
LDA $7E2000, X : PHA
CMP.w #$0034 : BEQ .shovelable ; normal blank green ground
CMP.w #$0071 : BEQ .shovelable ; non thick grass
CMP.w #$0035 : BEQ .shovelable ; non thick grass
CMP.w #$010D : BEQ .shovelable ; non thick grass
CMP.w #$010F : BEQ .shovelable ; non thick grass
CMP.w #$00E1 : BEQ .shovelable ; animated flower tile
CMP.w #$00E2 : BEQ .shovelable ; animated flower tile
CMP.w #$00DA : BEQ .shovelable ; non thick grass
CMP.w #$00F8 : BEQ .shovelable ; non thick grass
CMP.w #$010E : BEQ .shovelable ; non thick grass
CMP.w #$037E : BEQ .isThickGrass ; thick grass
LDY.w #$0002
; normal bush
CMP.w #$0036 : BEQ .isBush2
LDY.w #$0004
; off color bush
CMP.w #$072A : BEQ .isBush2
.notShoveling
JMP .return
.shovelable
; Is Link shoveling?
LDA $037A : AND.w #$00FF : CMP.w #$0001 : BNE .notShoveling
; Is this the forest grove?
LDA $8A : CMP.w #$002A : BNE .notFluteLocation
; Is it that one special spot the flute is at?
CPX.w #$0492 : BNE .notFluteLocation
STX $04B2
.notFluteLocation
; replacement tile after you shovel out the ground
LDY.w #$0DC9
BRA .checkForSecret
.isThickGrass
LDA $037A : AND.w #$00FF : CMP.w #$0001 : BNE .notShoveling2
JMP .return
.notShoveling2
LDA $02 : ASL #3 : SUB.w #$0008 : PHA
LDA $00 : SUB.w #$0008 : AND.w #$FFF8 : STA $74
; why was it pushed in the first place? -____-
PLA : STA $72
LDA.w #$0003 : STA $76
LDY.w #$0DC5
BRA .checkForSecret
; *$DBE8D ALTERNATE ENTRY POINT
.isBush2
LDA $037A : AND.w #$00FF : CMP.w #$0001 : BEQ .shoveling
LDA $02 : AND.w #$FFFE : ASL #3 : PHA
LDA $00 : AND.w #$FFF0 : STA $74
; again... why?
PLA : STA $72
STY $76
PLA : PHA
LDY.w #$0DC7
CMP.w #$072A : BNE .notOffColorBush
; use a different replacement map16 tile for the off color bushes
LDY.w #$0DC8
.notOffColorBush
.checkForSecret
STY $0E
; check for secrets under the bush?
JSR Overworld_RevealSecret : BCS .noSecret
; if there's a secret under the bush, like a hole or a cave
; it would require a different replacement map16 tile
LDA $0E
.noSecret
STA $7E2000, X
JSL Overworld_Memorize_Map16_Change
JSL Overworld_DrawMap16
SEP #$20
; Tell NMI to update the tilemap
LDA.b #$01 : STA $14
REP #$20
PLA
BRA .setTileFlags
.shoveling
PLA
LDA $7E2000, X
.setTileFlags
ASL #2 : STA $06
LDA $00 : AND.w #$0008 : LSR #2 : TSB $06
LDA $02 : AND.w #$0001 : ORA $06 : ASL A : TAX
LDA $0F8000, X : AND.w #$01FF : TAX
LDA Overworld_TileAttr, X : PHA
LDA $72 : STA $00
LDA $74 : STA $02
SEP #$30
LDA $76 : BEQ .noAncilla
JSL Sprite_SpawnImmediatelySmashedTerrain
JSL AddDisintegratingBushPoof
.noAncilla
REP #$30
PLA
.return
SEP #$30
RTL
}
; ==================================================
; *$DBF1E-$DBF4B LOCAL
Overworld_HammerSfx:
{
ASL #3 : TAX
LDA $0F8000, X : AND.w #$01FF : TAX
LDA Overworld_TileAttr, X
SEP #$30
CMP.b #$50
BCC .noSoundEffect
; we're hitting a bush, so play the swish sound
LDY.b #$1A
CMP.b #$52
BCC .playSoundEffect
; we're hitting a sign post, so play the "hitting a peg" sound
LDY.b #$11
CMP.b #$54
BEQ .playSoundEffect
; we're hitting a small rock, so play the "tink" from hitting a rock
LDY.b #$05
CMP.b #$58
BCC .noSoundEffect
.playSoundEffect
STY $012E
.noSoundEffect
REP #$30
RTS
}
; ==============================================================================
; $DBF4C-$DBF63 DATA
{
dw 0, -2, -128, -130
; $DBF54
dw 0, 0, -128, -128
; $DBF5C
dw 0, -2, 0, -2
}
; ==============================================================================
; *$DBF64-$DBF9C LOCAL
Overworld_GetLinkMap16Coords:
{
LDA $2F : AND.w #$00FF : TAX
LDA $20 : ADD $07D365, X : AND.w #$FFF0 : STA $00
SUB $0708 : AND $070A : ASL #3 : STA $06
LDA $22 : ADD $07D36D, X : AND.w #$FFF0 : STA $02
LSR #3 : SUB $070C : AND $070E : ADD $06 : TAX
RTS
}
; ==================================================
; *$DBF9D-$DC054 LONG
Overworld_LiftableTiles:
{
; Handles Map16 tiles that are liftable.
REP #$30
JSR Overworld_GetLinkMap16Coords
LDA $00 : PHA
LDA $02 : PHA
LDA $7E2000, X
LDY.w #$0000
CMP.w #$036D ; Is it a big light colored rock?
BEQ .liftingLargeRock
INY
CMP.w #$036E ; Also a big light colored rock...
BEQ .liftingLargeRock
INY
CMP.w #$0374 ; ditto
BEQ .liftingLargeRock
INY
CMP.w #$0375 ; ditto
BEQ .liftingLargeRock
LDY.w #$0000
CMP.w #$023B ; dark colored big rock?
BEQ .liftingLargeRock
INY
CMP.w #$023C ; same
BEQ .liftingLargeRock
INY
CMP.w #$023D ; same
BEQ .liftingLargeRock
CMP.w #$023E ; same
BNE .notLiftingRock
INY
.liftingLargeRock
JMP Overworld_SmashRockPile_isRockPile
.notLiftingRock
LDY.w #$0DC7
CMP.w #$0036 ; Is it a green bush?
BEQ .liftingSmallObject
LDY.w #$0DC8
CMP.w #$072A ; Is it a brown bush?
BEQ .liftingSmallObject
LDY.w #$0DCA
CMP.w #$020F ; Is it a small light colored rock?
BEQ .liftingSmallObject
CMP.w #$0239 ; How about a small dark colored rock?
BEQ .liftingSmallObject
CMP.w #$0101 ; Is it one of those sign posts?
BNE .notLiftingSmallObject
LDY.w #$0DC6
.liftingSmallObject
STY $0E
PHA
JSR Overworld_RevealSecret
BCS .noSecret
LDA $0E
.noSecret
STA $7E2000, X
JSL Overworld_Memorize_Map16_Change
JSL Overworld_DrawMap16
SEP #$20
LDA.b #$01 : STA $14
.getTileAttribute
REP #$30
PLA
.notLiftingSmallObject
ASL #2 : STA $06
LDA $02 : AND.w #$0008 : LSR #2 : TSB $06
LDA $00 : LSR #3 : AND.w #$0001 : ORA $06 : ASL A : TAX
LDA $0F8000, X : AND.w #$01FF : TAX
PLA : STA $00
PLA : STA $02
LDA Overworld_TileAttr, X
SEP #$31
RTL
}
; ==================================================
; *$DC055-$DC062 BRANCH LOCATION
Overworld_SmashRockPile:
{
.checkForBush
LDY.w #$0DC7
CMP.w #$0036 ; check if the map16 tile is a bush
BEQ Overworld_LiftableTile_liftingSmallObject
PLA : PLA
SEP #$30
CLC
RTL
; *$DC063-$DC075 LONG
.downOneTile
REP #$30
LDA $20 : PHA
ADD.w #$0008 : STA $20
JSR Overworld_GetLinkMap16Coords
PLA : STA $20
.presetCoords
; *$DC076-$DC0F7 LONG
.normalCoords
REP #$30
JSR Overworld_GetLinkMap16Coords
.presetCoords
LDA $00 : PHA
LDA $02 : PHA
LDA $7E2000, X : LDY.w #$0000
CMP.w #$0226 ; check if it's a rock pile
BEQ .isRockPile
INY
CMP.w #$0227 ; same
BEQ .isRockPile
INY
CMP.w #$0228 ; same
BEQ .isRockPile
CMP.w #$0229 ; same
BNE .checkForBush
INY
.isRockPile
STY $0C
; why store to $0C then TSB it again...?
PHA : TSB $0C
TXA : CLC
LDX $0C : ADC $1BBF4C, X : STA $0698 : TAX
LDA.w #$0028 : STA $0692
STZ $0E
JSR Overworld_RevealSecret
LDA $0E : CMP.w #$FFFF
BNE .noBurrowUnderneath
SEP #$20
; Remember that the burrow has been uncovered.
LDY $8A : LDA $7EF280, X : ORA.b #$20 : STA $7EF280, X
; Play puzzle solved sound
LDA.b #$1B : STA $012F
REP #$20
LDA.b #$0050 : STA $0692
.noBurrowUnderneath
LDX $0C
LDA $00 : ADD $1BBF54, X : STA $00
LDA $02 : ADD $1BBF5C, X : STA $02
JSL Overworld_DoMapUpdate32x32_Long
JMP Overworld_LiftableTile_getTileAttribute
}
; ==================================================
; *$DC0F8-$DC154 LONG
Overworld_ApplyBombToTiles:
{
REP #$30
STZ $0E
STZ $08
LDA.w #$0003 : STA $C8
LDA $00 : SUB.w #$0014 : AND.w #$FFF8 : STA $0488
LDA $02 : SUB.w #$0017 : AND.w #$FFF8 : STA $0486
.downOneRow
LDA $0488 : SUB $0708 : AND $070A : ASL #3 : STA $CA
LDA $0486
JSR Overworld_ApplyBombToTile
LDA $0486 : ADD.w #$0010
JSR Overworld_ApplyBombToTile
LDA $0486 : ADD.w #$0020
JSR Overworld_ApplyBombToTile
LDA $0488 : ADD.w #$0010 : STA $0488
DEC $C8
BNE .downOneRow
SEP #$30
RTL
}
; ==================================================
; *$DC155-$DC21C LOCAL
Overworld_ApplyBombToTile:
{
PHA
LSR #3 : SUB $070C : AND $070E : ADD $CA : TAX : STX $04
; Check to see if Link has a super bomb.
LDA $7EF3CC : AND.w #$00FF : CMP.w #$000D
BEQ .checkForBomableCave
LDA $7E2000, X
LDY.w #$0DC7
LDX.w #$0002
CMP.w #$0036 ; normal bush
BEQ .grassOrBush
LDX.w #$0004
LDY.w #$0DC8
CMP.w #$072A ; off color bush
BEQ .grassOrBush
CMP.w #$037E ; thick grass
BNE .checkForBombableCave
LDY.w #$0DC5
LDX.w #$0003
.grassOrBush
STX $0A
STY $0E
LDX $04
JSR Overworld_RevealSecret
BCS .noSecret
LDA $0E
.noSecret
STA $7E2000, X
JSL Overworld_Memorize_Map16_Change
LDY.w #$0000
JSL Overworld_DrawMap16_Anywhere
PLA : AND.w #$FFF8 : STA $00
LDA $0488 : AND.w #$FFF8 : STA $02
LDA $08 : PHA
SEP #$30
LDA $0A
JSL Sprite_SpawnImmediatelySmashedTerrain
LDA.b #$01 : STA $14
REP #$30
PLA : STA $08
RTS