-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBank0C.asm
6195 lines (3766 loc) · 128 KB
/
Bank0C.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
; ==============================================================================
; *$64120 - $6415C JUMP LOCATION
Module_Intro:
{
; Beginning of Module 0x00, Startup Screen:
LDA $11 : CMP.b #$08 : BCC .dontCheckInput
LDA $F6 : AND.b #$C0 : ORA $F4 : AND.b #$D0 : BEQ .noPressedButtons
; If ABXY, or Start is pressed, then go to the file selection menu module.
JMP $C2F0
.noPressedButtons
.dontCheckInput
; Otherwise, branch to the appropriate part of the intro.
LDA $11
JSL UseImplicitRegIndexedLongJumpTable
dl Intro_Init ; Blank Screen
dl Intro_Init.justLogo ; -Nintendo presents-
dl Intro_InitGfx ; $6433C* Sets up myriad graphics settings
dl $0CC404 ; = $64404* ; Copyright Nintendo 1992
dl $0CC404 ; = $64404* ; Triforces swooping in.
dl $0CC25C ; = $6425C* ; "Zelda" logo fade in.
dl $0CC2AE ; = $642AE* ; Sword coming down...
dl $0CC284 ; = $64284* ; Fades in bg, Zelda Symbol is sparkling, looking pretty.
dl $0CC2D4 ; = $642D4* ; Wait to see if the player does anything.
dl $0CC404 ; = $64404* ;
dl Intro_InitGfx ; $0CC33C ; = $6433C*
dl $0CC404 ; = $64404*
}
; ==============================================================================
; *$6415D-$6419F JUMP LOCATION
Intro_Init:
{
JSL Intro_SetupScreen
; Push the screen to full brightness next frame
LDA.b #$0F : STA $13
; Initialize the sub-submodule index.
STZ $B0
; Indicates that CGRAM needs to be updated next frame
INC $15
; Move into the next submodule.
INC $11
; Plays the twinkle as the 'Nintendo' logo pops up.
LDA.b #$0A : STA $012F
; *$64170 ALTERNATE ENTRY POINT
.justLogo
; $66D82 in Rom, sets up sprite information for the N-logo.
; (OAM buffer is refreshed every frame, so this must be repeatedly called)
JSR Intro_DisplayNintendoLogo
; as long as $B0 is less than 0xB, no branch occurs.
LDA $B0 : INC $B0 : CMP.b #$0B : BCS Intro_LoadTitleGraphics
JSL UseImplicitRegIndexedLongJumpTable
dl Intro_InitWram
dl Intro_InitWram
dl Intro_InitWram
dl Intro_InitWram
dl Intro_InitWram
dl Intro_InitWram
dl Intro_InitWram
dl Intro_InitWram
dl Intro_LoadTextPointersAndPalettes
dl $00D231 ; = $5231*
dl Tagalong_LoadGfx
}
; ==============================================================================
; *$641A0-$641F4 JUMP LOCATION
Intro_InitWram
{
; Zerores out a 0x400 byte chunk of wram
REP #$30
; $C8 is the Upper Bound
; $CA stores the Lower Bound
LDX $C8
LDA.w #$0000
.zeroLoop
; Erases $7E0000-$7FFFF (all work ram)
STA $7E2000, X : STA $7E4000, X
STA $7E6000, X : STA $7E8000, X
STA $7EA000, X : STA $7EC000, X
STA $7EE000, X : STA $7F0000, X
STA $7F2000, X : STA $7F4000, X
STA $7F6000, X : STA $7F8000, X
STA $7FA000, X : STA $7FC000, X
STA $7FE000, X
DEX #2 : CPX $CA : BNE .zeroLoop
; The old lower bound is the new upper bound
STX $C8
; Reindex $CA 0x400 bytes lower for the next time this gets called
TXA : SUB.w #$0400 : STA $CA
SEP #$30
RTL
}
; ==============================================================================
; *$641F5-$6425B BRANCH LOCATION
Intro_LoadTitleGraphics:
{
DEC $13 : BNE .waitTillForceBlank
; *$641F9 ALTERNATE ENTRY POINT
.noWait
; $93D IN ROM
JSL EnableForceBlank
JSL Vram_EraseTilemaps.normal
LDA.b #$02 : STA $2101
; What tiles shall we put on the start up screen?
LDA.b #$23 : STA $0AA1
; Determines the tiles for the sword on the title screen.
LDA.b #$7D : STA $0AA3
; Deterines some of the other tiles used for the title screen.
LDA.b #$51 : STA $0AA2
; Extra sprite graphics pack
LDA.b #$08 : STA $0AA4
; Why we're calling this prior to InitTileSets.... no idea. It seems that
; InitTileSets would overwrite any graphics this routine would decompress
JSL LoadDefaultGfx ; $62D0 IN ROM
JSL InitTileSets ; $619B IN ROM
LDY.b #$5D
JSL DecompDungAnimatedTiles ; $5337 IN ROM
LDA.b #$02 : STA $7EC00D
LDA.b #$00 : STA $7EC00E
STZ $8A
STZ $0AB6
STA $0AB8
STZ $C8
STZ $C9
STZ $CA
STZ $CB
LDA.b #$02 : STA $7EC009
LDA.b #$1F : STA $7EC007
LDA.b #$00 : STA $7EC00B
STZ $0AA6
INC $11
.waitTillForceBlank
RTL
}
; ==============================================================================
; *$6425C-$64283 JUMP LOCATION
{
JSL $0CC404 ; $64404*
LDA $1A : LSR A : BCC .evenFrame
JSL $00ED7C ; $6D7C IN ROM
LDA $7EC007 : BNE BRANCH_2
LDA.b #$2A : STA $B0
INC $11
JSR $FE45 ; $67E45 IN ROM
.evenFrame
RTL
BRANCH_2:
CMP.b #$0D : BNE .dontEnableBGs
LDA.b #$15 : STA $1C
STZ $1D
.dontEnableBGs
RTL
}
; ==============================================================================
; *$64284-$642AD JUMP LOCATION
{
JSR $FE56 ; $67E56 in Rom
JSL $0CC404 ; $64404
LDA $7EC007 : BEQ .alpha
LDA $1A : LSR A : BCC .dontAdvanceYet
JML $00ED8F ; $6D8F IN ROM
.alpha
LDA $F6 : AND.b #$C0 : ORA $F4 : AND.b #$D0 : BEQ .waitForButtonPress
JMP $C2F0 ; $642F0 IN ROM
.waitForButtonPress
DEC $B0 : BNE .dontAdvanceYet
INC $11
.dontAdvanceYet
RTL
}
; ==============================================================================
; *$642AE-$642D3 JUMP LOCATION
{
JSL $0CC404 ; $64404 IN ROM
STZ $1F00
STZ $012A
JSR $FE56 ; $67E56 IN ROM
DEC $B0 : BNE BRANCH_1
INC $11
LDA.b #$02 : STA $99
LDA.b #$22 : STA $9A
LDA.b #$1F : STA $7EC007
LDA.b #$02 : STA $1D
BRANCH_1:
RTL
}
; ==============================================================================
; *$642D4-$642EF JUMP LOCATION
{
JSL $0CC404 ; $64404 IN ROM
STZ $1F00
STZ $012A
JSR $FE56 ; $67E56 IN ROM
DEC $B0 : BNE BRANCH_1
; note that this instruction does nothing since
; $11 is zeroed out a few lines down. programmers aren't perfect!
INC $11
; Change to mode 0x14
LDA.b #$14 : STA $10
; Reset the submodule index
STZ $11
; Reset the attract mode sequencing index.
STZ $22
BRANCH_1:
RTL
}
; ==============================================================================
; *$642F0-$6433B JUMP LOCATION
{
LDA.b #$FF : STA $0128
; Main screen designation.
LDA.b #$15 : STA $1C
STZ $1D
STZ $1B
; Give the silence command for music.
LDA.b #$F1 : STA $012C
JSL Palette_BgAndFixedColor_justFixedColor
REP #$30
LDX.w #$006E
BRANCH_1:
; Zeroes out $20-$8E
STZ $20, X
DEX #2 : BPL BRANCH_1
LDX.w #$0000
TXA
.initSramBuffer
; Clear the save memory area.
STA $7EF000, X : STA $7EF100, X : STA $7EF200, X : STA $7EF300, X : STA $7EF400, X
INX #2 : CPX.w #$0100 : BNE .initSramBuffer
SEP #$30
; Go to select screen mode.
LDA.b #$01 : STA $10 : STA $04AA
STZ $11
RTL
}
; ==============================================================================
; *$6433C-$6436E JUMP LOCATION
{
; Module 0x00.0x02, 0x00.0x0A
; Set misc. sprite graphica
LDA.b #$08 : STA $0AA4
JSL Graphics_LoadCommonSprLong ; $6384 IN ROM
JSR $C36F ; $6436F IN ROM
LDA.b #$01 : STA $1E10 : STA $1E11 : STA $1E12
LDA.b #$00 : STA $1E18 : STA $1E19 : STA $1E1A
LDA.b #$01 : STA $1E14
LDA.b #$02 : STA $1E1C
; Bring screen to full brightness
LDA.b #$0F : STA $13
INC $11
RTL
}
; ==============================================================================
; *$6436F-$643BC LOCAL
{
JSL Polyhedral_InitThread
JSR $C3BD ; $643BD in Rom
; Set vertical IRQ trigger scanline
LDA.b #$90 : STA $FF
LDA.b #$FF : STA $1F02
LDA.b #$20 : STA $1F06 : STA $1F07 : STA $1F08
LDA.b #$A0 : STA $1F04
LDA.b #$60 : STA $1F05
LDA.b #$01 : STA $1F01 : STA $1F03 : STA $012A : STA $1F00
; Initialize RAM for starting Module 0x00
LDX.b #$0F
.loop
STZ $1E00, X : STZ $1E10, X : STZ $1E20, X
STZ $1E30, X : STZ $1E40, X : STZ $1E50, X
STZ $1E60, X
DEX : BPL .loop
RTS
}
; ==============================================================================
; *$643BD-$64403 LOCAL
{
; The guy who wrote this routine had never heard of MVN or MVP apparently
; or DMA, for that matter.
; This routine writes a fixed set of colors to SP-6 (first half)
REP #$20
LDA $0CC425 : STA $7EC6A0
LDA $0CC427 : STA $7EC6A2
LDA $0CC429 : STA $7EC6A4
LDA $0CC42B : STA $7EC6A6
LDA $0CC42D : STA $7EC6A8
LDA $0CC42F : STA $7EC6AA
LDA $0CC431 : STA $7EC6AC
LDA $0CC433 : STA $7EC6AE
SEP #$30
; Perform palette update this frame
INC $15
RTS
}
; ==============================================================================
; *$64404-$64411 LONG JUMP LOCATION
{
PHB : PHK : PLB
INC $1E0A
JSR $C435 ; $64435 IN ROM
JSR $C412 ; $64412 IN ROM
PLB
RTL
}
; ==============================================================================
; *$64412-$64424 LOCAL
{
LDA.b #$00 : STA $1E08
LDA.b #$09 : STA $1E09
LDX.b #$07
.loop
JSR $C534 ; $64534 in Rom
DEX : BPL .loop
RTS
}
; ==============================================================================
; $64425-$64434 DATA
{
; FOR USE WITH $643BD
dw $0000, $014D, $01B0, $01F3, $0256, $0279, $02FD, $035F
}
; ==============================================================================
; *$64435-$64447 LOCAL
{
LDA.b #$01 : STA $012A
; Is this some sort of "IRQ busy" flag?
LDA $1F00 : BNE .waitForTriforceThread
JSR $C448 ; $64448 in Rom
LDA.b #$01 : STA $1F00
.waitForTriforceThread
RTS
}
; ==============================================================================
; *$64448-$6445A LOCAL
{
LDA $1E00
JSL UseImplicitRegIndexedLocalJumpTable
dw $C45B ; = $6445B*
dw $C47B ; = $6447B*
dw $C4BA ; = $644BA*
dw $C4D6 ; = $644D6*
dw $C500 ; = $64500*
dw $C533 ; = $64533* (Empty unimplemented step - RTS)
}
; *$6445B-$6447A JUMP LOCATION
{
INC $1E01
LDA $1E01 : CMP.b #$40 : BNE .countingUp
INC $1E00
.countingUp
LDA $1F05 : ADD.b #$05 : STA $1F05
LDA $1F04 : ADD.b #$03 : STA $1F04
RTS
}
; *$6447B - $644B9 JUMP LOCATION
{
LDA $1F02 : CMP.b #$02 : BCS .alpha
STZ $1F02
INC $1E00
LDA.b #$40 : STA $1E01
RTS
.alpha
SBC.b #$02 : STA $1F02
LDA $1F05 : ADD.b #$05 : STA $1F05
LDA $1F04 : ADD.b #$03 : STA $1F04
LDA $1F02 : CMP.b #$E1 : BCS .beta
LDX.b #$04 : STX $11
.beta
CMP.b #$71 : BNE .dontStartMusic
;Selects the opening theme during the triforce scene/ intro.
LDA.b #$01 : STA $012C
.dontStartMusic
RTS
}
; *$644BA - $644D5 JUMP LOCATION
{
DEC $1E01 : BNE .countingDown
INC $1E00
RTS
.countingDown
LDA $1F05 : ADD.b #$05 : STA $1F05
LDA $1F04 : ADD.b #$03 : STA $1F04
RTS
}
; *$644D6-$644FF JUMP LOCATION
{
LDA $1F05 : CMP.b #$FA : BCC .alpha
LDA $1F04 : CMP.b #$FC : BCC .alpha
INC $1E00
LDA.b #$20 : STA $1E01
RTS
.alpha
LDA $1F05 : ADD.b #$05 : STA $1F05
LDA $1F04 : ADD.b #$03 : STA $1F04
RTS
}
; *$64500-$64532 JUMP LOCATION
{
STZ $1F05
STZ $1F04
DEC $1E01 : BNE .countingDown
INC $1E00
LDA.b #$01 : STA $1E15
LDA.b #$03 : STA $1E1D
LDA.b #$10 : STA $1C
LDA.b #$05 : STA $1D
LDA.b #$02 : STA $99
LDA.b #$31 : STA $9A
STZ $B0
INC $15
LDA.b #$03
; *$6452E ALTERNATE ENTRY POINT
.doTilemapUpdate
STA $14
INC $11
.countingDown
RTS
}
; *$64533-$64533 JUMP LOCATION
{
; Empty step ... put here for a purpose probably though
; from what I can tell. I think this does get executed,
; contrary to what one might think by looking at the previous step.
RTS
}
; *$64534 - $64542 LOCAL
{
LDA $1E10, X : BEQ .alpha
JSL UseImplicitRegIndexedLocalJumpTable
; Jump table
dw $C543 ; = $64543*
dw $C544 ; = $64544*
dw $C55B ; = $6455B*
.alpha
RTS
}
; *$64543-$64543 JUMP LOCATION
{
RTS
}
; *$64544-$6455A JUMP LOCATION
{
LDA $1E18, X
JSL UseImplicitRegIndexedLocalJumpTable
dw $C57E ; = $6457E*
dw $C84F ; = $6484F*
dw $C850 ; = $64850*
dw $C8E2 ; = $648E2*
dw $CBE8 ; = $64BE8*
dw $CBE8 ; = $64BE8*
dw $CBE8 ; = $64BE8*
dw $CD19 ; = $64D19*
}
; *$6455B-$64571 JUMP LOCATION
{
LDA $1E18, X
JSR UseImplicitRegIndexedLocalJumpTable
dw $C5B1 ; = $645B1*
dw $C84F ; = $6484F*
dw $C864 ; = $64864*
dw $C90D ; = $6490D*
dw $CC13 ; = $64C13*
dw $CC13 ; = $64C13*
dw $CC13 ; = $64C13*
dw $CD3E ; = $64D3E*
}
; $64572-$6457D DATA
{
db $DA, $FF, $5F, $00, $E6, $00, $C8, $00, $BD, $FF, $C8, $00
}
; *$6457E-$645B0 JUMP LOCATION
{
TXA : ASL : TAY
LDA $C572, Y : STA $1E30, X
LDA $C573, Y : STA $1E38, X
LDA $C578, Y : STA $1E48, X
LDA $C579, Y : STA $1E50, X
LDA $C5CA, X : ADD $1E58, X : STA $1E58, X
LDA $C5CD, X : ADD $1E60, X : STA $1E60, X
INC $1E10, X
RTS
}
; *$645B1-$645C9 JUMP LOCATION
{
JSR $C70F ; $6470F IN ROM
JSR $C9F1 ; $649F1 IN ROM
LDA $1E00
JSL UseImplicitRegIndexedLocalJumpTable
dw $C5D6 ; $645D6*
dw $C5D6 ; $645D6*
dw $C5D6 ; $645D6*
dw $C5D6 ; $645D6*
dw $C5D6 ; $645D6*
dw $C608 ; $64608*
}
; $645CA-$645D5 DATA
{
; USED WITH $645D6
dw $0001, $FFFF, $FF01, $5F4B, $5875, $5830
}
; *$645D6-$64607 JUMP LOCATION
{
LDA $1E0A : AND.b #$1F : BNE BRANCH_1
LDA $C5CA, X : ADD $1E58, X : STA $1E58, X
LDA $C5CD, X : ADD $1E60, X : STA $1E60, X
BRANCH_1:
LDA $C5D0, X : CMP $1E30, X : BNE BRANCH_2
STZ $1E58, X
BRANCH_2:
LDA $C5D3, X : CMP $1E48, X : BNE BRANCH_3
STZ $1E60, X
BRANCH_3:
RTS
}
; *$64608-$6460E JUMP LOCATION
{
STZ $1E58, X
STZ $1E60, X
RTS
}
; $6460F
; What the hell is here????
; *$6470F-$6472E LOCAL
{
LDA.b #$10 : STA $06
STZ $07
CPX.b #$02 : BEQ BRANCH_1
LDA.b #$0F : STA $08
LDA.b #$C6 : STA $09
BRA BRANCH_2
BRANCH_1:
LDA.b #$8F : STA $08
LDA $C6 : STA $09
BRANCH_2:
JSR $C972 ; $64972
RTS
}
; *$6482F-$6484E LOCAL
{
LDA.b #$10 : STA $06
STZ $07
CPX.b #$02 : BEQ BRANCH_1
LDA.b #$2F : STA $08
LDA $C7 : STA $09
BRA BRANCH_2
BRANCH_1:
LDA.b #$AF : STA $08
LDA.b #$C7 : STA $09
BRANCH_2:
JSR $C972 ; $64972
RTS
}
; *$6484F-$6484F JUMP LOCATION
{
RTS
}
; *$64850-$64863 JUMP LOCATION
{
LDA.b #$4C : STA $1E30, X
STZ $1E38, X
LDA.b #$B8 : STA $1E48, X
STZ $1E50, X
INC $1E10, X
RTS
}
; *$64864-$64867 JUMP LOCATION
{
JSR $C8D0 ; $648D0 IN ROM
RTS
}
; *$648D0-$648E1 LOCAL
{
LDA.b #$0D : STA $06
STZ $07
LDA.b #$68 : STA $08
LDA.b #$C8 : STA $09
JSR $C972 ; $64972 in Rom
RTS
}
; *$648E2-$648FC JUMP LOCATION
{
LDA $1E0A : LSR #5 : AND.b #$03 : TAY
LDA $C8FD, Y : STA $1E30, X
LDA $C901, Y : STA $1E48, X
INC $1E10, X
RTS
}
; *$6490D-$64935 JUMP LOCATION
{
JSR $C956 ; $64956 in Rom
LDA $1E0A : LSR #2 : AND.b #$03 : TAY
LDA $C8FD, Y : STA $1E30, X
LDA $C901, Y : STA $1E48, X
RTS
}
; *$64956 - $64971 LOCAL
{
LDA.b #$01 : STA $06 : STZ $07
LDA $1E20, X : BMI BRANCH_1
ASL #3 : ADC.b #$36 : STA $08
LDA.b #$C9 : ADC.b #$00 : STA $09
JSR $C972 ; $64972 in Rom
BRANCH_1:
RTS
}
; ==============================================================================
; *$64972-$649F0 LOCAL
{
; Puts triforce sprites in OAM buffer.
LDA $1E30, X : STA $00
LDA $1E38, X : STA $01
LDA $1E48, X : STA $02
LDA $1E50, X : STA $03
STZ $04 : STZ $05
PHX
REP #$30
LDY.w #$0000
LDX $1E08
LDA $06 : ASL #2 : ADC $1E08 : STA $1E08
.nextSprite
LDA ($08), Y : ADD $00 : STA $0000, X
AND.w #$0100 : STA $0C
INY #2
LDA ($08), Y : ADD $02 : STA $0001, X
ADD.w #$0010 : CMP.w #$0100 : BCC .y_in_range
LDA.w #$00F0 : STA $0001, X
.y_in_range
INY #2
LDA ($08), Y : EOR $04 : STA $0002, X
PHX
TXA : SUB.w #$0800 : LSR #2 : TAX
SEP #$20
INY #3
LDA ($08), Y : ORA $0D : STA $0A20, X
PLX
REP #$20
INY
INX #4
DEC $06 : BNE .nextSprite
SEP #$30
PLX
RTS
}
; ==============================================================================
; *$649F1-$64A4B LOCAL
{
LDA $1E58, X : BEQ BRANCH_2
ASL #4 : ADD $1E28, X : STA $1E28, X
LDA $1E58, X : PHP : LSR #4
LDY.b #$00
PLP : BPL BRANCH_1
ORA.b #$F0
DEY