-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.asm
executable file
·23855 lines (22649 loc) · 371 KB
/
main.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
INCLUDE "includes.asm"
INCLUDE "rst.asm"
INCLUDE "interrupts.asm"
INCLUDE "home.asm"
SECTION "bank 02", ROMX, BANK [$2]
Func_8000::
ld a, [wSubroutine]
jump_table
dw Func_801a
dw Func_8032
dw Func_8061
dw Func_8069
dw Func_807c
dw Func_808e
dw Func_80a0
dw Func_80b5
Func_801a::
call ClearBGMapAndAttrs
call ClearBGWindowAndAttrs
call ClearObjectAnimationBuffers
ld bc, $7
call DecompressGFXByIndex_
ld bc, $8
call DecompressGFXByIndex_
jp IncrementSubroutine
Func_8032::
lb bc, $0, $0
ld e, $3f
ld a, $0
call LoadStdBGMapLayout_
lb bc, $0, $0
ld e, $3f
ld a, $0
call LoadStdBGMapAttrLayout_
ld bc, $f
call GetCGB_BGLayout_
ld a, $f0
ld [wTileWhere0IsLoaded], a
call LoadSpecialFontTiles
ld a, $85
ld [wca65], a
ld a, $a0
ld [wTextBoxStartTile], a
jp IncrementSubroutine
Func_8061::
ld a, $4
call StartFade_
jp IncrementSubroutine
Func_8069::
ld a, $2
call PaletteFade_
or a
ret z
ld c, $2
ld b, $0
ld d, $c
call AnchorMapAndLoadTextPointer_
jp IncrementSubroutine
Func_807c::
ld a, [hJoyNew]
and START
jr nz, .start
call BattlePrintText
ld a, [wTextSubroutine]
cp $9
ret nz
.start
jp IncrementSubroutine
Func_808e::
ld a, SFX_03
ld [H_SFX_ID], a
ld a, $4
call StartFade_
ld a, $10
ld [wMusicFade], a
jp IncrementSubroutine
Func_80a0::
ld a, $1
call PaletteFade_
or a
ret z
ld bc, $0
call GetCGB_BGLayout_
ld a, $1
ld [wBGPalUpdate], a
jp IncrementSubroutine
Func_80b5::
ld a, $5
ld [wGameRoutine], a
xor a
ld [wSubroutine], a
ret
INCLUDE "engine/intro_movie.asm"
Func_84cf: ; 84cf (2:44cf)
ld a, [wSubroutine]
jump_table
dw Func_84e9
dw Func_8501
dw Func_8530
dw Func_8538
dw Func_854b
dw Func_855d
dw Func_856f
dw Func_8584
Func_84e9::
call ClearBGMapAndAttrs
call ClearBGWindowAndAttrs
call ClearObjectAnimationBuffers
ld bc, $7
call DecompressGFXByIndex_
ld bc, $8
call DecompressGFXByIndex_
jp IncrementSubroutine
Func_8501::
lb bc, $0, $0
ld e, $3f
ld a, $0
call LoadStdBGMapLayout_
lb bc, $0, $0
ld e, $3f
ld a, $0
call LoadStdBGMapAttrLayout_
ld bc, $f
call GetCGB_BGLayout_
ld a, $f0
ld [wTileWhere0IsLoaded], a
call LoadSpecialFontTiles
ld a, $85
ld [wca65], a
ld a, $a0
ld [wTextBoxStartTile], a
jp IncrementSubroutine
Func_8530::
ld a, $4
call StartFade_
jp IncrementSubroutine
Func_8538::
ld a, $2
call PaletteFade_
or a
ret z
ld c, $2
ld b, $0
ld d, $c
call AnchorMapAndLoadTextPointer_
jp IncrementSubroutine
Func_854b::
ld a, [hJoyNew]
and START
jr nz, .asm_855a
call BattlePrintText
ld a, [wTextSubroutine]
cp $9
ret nz
.asm_855a
jp IncrementSubroutine
Func_855d::
ld a, SFX_03
ld [H_SFX_ID], a
ld a, $4
call StartFade_
ld a, $10
ld [wMusicFade], a
jp IncrementSubroutine
Func_856f::
ld a, $1
call PaletteFade_
or a
ret z
ld bc, $0
call GetCGB_BGLayout_
ld a, $1
ld [wBGPalUpdate], a
jp IncrementSubroutine
Func_8584::
ld a, $5
ld [wGameRoutine], a
xor a
ld [wSubroutine], a
ret
INCLUDE "engine/game_over.asm"
Func_8630::
ld hl, $0
add hl, de
inc hl
jp Func_863f
Func_8638: ; 8638 (2:4638)
ld hl, $0
add hl, de
ld a, $1
ld [hli], a
Func_863f: ; 863f (2:463f)
ld a, $0
ld [hli], a
inc hl
ld a, b
ld [hli], a
ld a, c
ld [hli], a
ret
Func_8648: ; 8648 (2:4648)
ld a, [wSubroutine]
cp $1c
ret z
cp $22
ret z
cp $10
jr nz, .asm_8663
ld a, [wSubroutine2]
cp $e
ret z
cp $f
ret z
cp $15
ret z
jr .asm_867d
.asm_8663
ld a, [wSubroutine]
cp $16
jr nz, .asm_8670
ld a, [wSubroutine2]
cp $9
ret z
.asm_8670
ld a, [wSubroutine]
cp $18
jr nz, .asm_867d
ld a, [wSubroutine2]
cp $6
ret z
.asm_867d
ld a, [wc3df]
or a
ret nz
ld a, [hJoyNew]
and ($FF ^ (START | SELECT))
jr z, .load_gray_hue
xor a
ld [wcb74], a
ld a, [wcb75]
or a
ret z
ld hl, sBGPalsBackup
ld de, wCGB_BGPalsBuffer
ld bc, sBGPalsBackupEnd - sBGPalsBackup
call CopyBGPalBufferToOrFromBackup
ld a, $1
ld [wBGPalUpdate], a
xor a
ld [wcb75], a
ret
.load_gray_hue
ld a, [wcb75]
or a
ret nz
ld a, [wVBlankCounter]
and $3
ret nz
ld a, [wcb74]
inc a
ld [wcb74], a
cp $c8
ret nz
ld hl, wCGB_BGPalsBuffer
ld de, sBGPalsBackup
ld bc, sBGPalsBackupEnd - sBGPalsBackup
call CopyBGPalBufferToOrFromBackup
call LoadGrayHue
ld bc, $348
ld a, $7
call LoadNthStdBGPalette
ld a, $1
ld [wBGPalUpdate], a
ld a, $1
ld [wcb75], a
xor a
ld [wcb74], a
ret
Dummy_CopyBGPalBufferToOrFromBackup:
enable_sram sBGPalsBackup
.asm_86ec
ld a, [hli]
ld [de], a
inc de
dec bc
ld a, c
or b
jr nz, .asm_86ec
xor a
ld [MBC3SRamEnable], a
ret
CopyBGPalBufferToOrFromBackup: ; 86f9 (2:46f9)
enable_sram sBGPalsBackup
.asm_8703
ld a, [hli]
ld [de], a
inc de
dec bc
ld a, c
or b
jr nz, .asm_8703
xor a
ld [MBC3SRamEnable], a
ret
LoadGrayHue: ; 8710 (2:4710)
ld hl, wCGB_BGPalsBuffer + 1 palettes + 4
ld b, $6
.loop
ld de, .Palette
ld a, b
cp $5
jr z, .next
push hl
ld a, [de]
ld [hli], a
inc de
ld a, [de]
ld [hli], a
pop hl
.next
ld de, 1 palettes
add hl, de
dec b
jr nz, .loop
ret
.Palette RGB 20, 21, 14
Func_872e: ; 872e (2:472e)
ld c, $10
ld b, $0
Func_8732: ; 8732 (2:4732)
push bc
push bc
ld a, [wDMeloPage]
swap a
and $f0
add b
ld hl, wDMeloBuffer + 2
call Func_881b
ld a, [hli]
cp $fe
jp z, Func_87ba
ld [wcb20], a
ld a, [hl]
ld [wcb21], a
pop bc
ld a, b
ld hl, Pointers_47e2
call Func_881b
ld a, [hli]
ld h, [hl]
ld l, a
push hl
push hl
ld a, [wcb20]
swap a
and $f
ld hl, Data_8802
ld e, a
ld d, $0
add hl, de
ld a, [hl]
pop hl
call WaitStatAndLoad
push hl
ld a, [wcb20]
swap a
and $f
cp $4
jr z, .asm_878c
cp $b
jr z, .asm_878c
cp $c
jr nz, .asm_8787
ld a, $52
jr .asm_879b
.asm_8787
ld hl, Data_880f
jr .asm_878f
.asm_878c
ld hl, Data_8815
.asm_878f
ld a, [wcb21]
swap a
and $f
ld e, a
ld d, $0
add hl, de
ld a, [hl]
.asm_879b
pop hl
call WaitStatAndLoad
pop hl
ld de, $20
add hl, de
ld a, [wcb21]
and $7
adc $4d
call WaitStatAndLoad
ld a, $52
call WaitStatAndLoad
Func_87b3: ; 87b3 (2:47b3)
pop bc
inc b
dec c
jp nz, Func_8732
ret
Func_87ba: ; 87ba (2:47ba)
pop bc
ld a, b
ld hl, Pointers_47e2
call Func_881b
ld a, [hli]
ld h, [hl]
ld l, a
push hl
ld a, $52
call WaitStatAndLoad
ld a, $52
call WaitStatAndLoad
pop hl
ld de, BG_MAP_WIDTH
add hl, de
ld a, $52
call WaitStatAndLoad
ld a, $52
call WaitStatAndLoad
jp Func_87b3
Pointers_47e2:
dwbgcoord 1, 6
dwbgcoord 3, 6
dwbgcoord 5, 6
dwbgcoord 7, 6
dwbgcoord 1, 8
dwbgcoord 3, 8
dwbgcoord 5, 8
dwbgcoord 7, 8
dwbgcoord 1, 10
dwbgcoord 3, 10
dwbgcoord 5, 10
dwbgcoord 7, 10
dwbgcoord 1, 12
dwbgcoord 3, 12
dwbgcoord 5, 12
dwbgcoord 7, 12
Data_8802:
db $40, $40, $41, $41, $42, $43, $43, $44, $44, $45, $45, $46, $47
Data_880f:
db $52, $4c, $49, $4b, $48, $4a
Data_8815:
db $52, $49, $48, $52, $49, $48
Func_881b: ; 881b (2:481b)
ld d, $0
ld e, a
sla e
rl d
add hl, de
ret
Func_8824: ; 8824 (2:4824)
ld a, [wSubroutine]
jump_table
dw Func_883e
dw Func_885b
dw Func_8883
dw Func_8890
dw Func_889f
dw Func_88a7
dw Func_88b6
dw Func_88c3
Func_883e:
ld a, $c3
ld [wLCDC], a
xor a
ld [wSCX], a
ld [wSCY], a
ld [wWX], a
ld [wWY], a
ld a, MUSIC_NONE
call GetMusicBank
ld [H_MusicID], a
jp IncrementSubroutine
Func_885b:
ld a, [wSCX]
ld [wc3f0], a
ld a, [wSCY]
ld [wc3f1], a
xor a
ld [wSCX], a
ld [wSCY], a
call Func_88fb
ld hl, VTilesOB
ld de, VTilesShared
ld bc, $80 tiles
call SwapVideoData
call Func_88da
jp IncrementSubroutine
Func_8883:
ld a, $1
ld [wSpriteUpdatesEnabled], a
ld a, [hJoyNew]
and A_BUTTON
ret z
jp IncrementSubroutine
Func_8890:
ld hl, VTilesShared
ld de, VTilesOB
ld bc, $80 tiles
call SwapVideoData
jp IncrementSubroutine
Func_889f:
ld a, [hJoyNew]
and A_BUTTON
ret z
jp IncrementSubroutine
Func_88a7:
ld hl, VTilesShared
ld de, VTilesBG
ld bc, $80 tiles
call SwapVideoData
jp IncrementSubroutine
Func_88b6:
ld a, [hJoyNew]
and A_BUTTON
ret z
ld a, $4
call StartFade_
jp IncrementSubroutine
Func_88c3:
ld a, $1
call PaletteFade_
or a
ret z
xor a
ld [wGameRoutine], a
ld [wSubroutine], a
ret
Func_88d2:
ld a, $4
call StartFade_
jp IncrementSubroutine
Func_88da: ; 88da (2:48da)
ld hl, VBGMap
ld c, $8
ld d, $80
Func_88e1: ; 88e1 (2:48e1)
push hl
ld b, $10
.asm_88e4
ld a, d
di
call WaitStat
ld [hli], a
ei
inc d
dec b
jr nz, .asm_88e4
pop hl
push de
ld de, BG_MAP_WIDTH
add hl, de
pop de
dec c
jp nz, Func_88e1
ret
Func_88fb: ; 88fb (2:48fb)
ld hl, VBGMap
ld c, $12
Func_8900: ; 8900 (2:4900)
push hl
ld b, $14
.asm_8903
xor a
di
call WaitStat
ld [hli], a
ei
dec b
jr nz, .asm_8903
pop hl
push de
ld de, BG_MAP_WIDTH
add hl, de
pop de
dec c
jp nz, Func_8900
ret
SwapVideoData: ; 8919 (2:4919)
.loop
di
call WaitStat
ld a, [de]
ei
ld [wFontSourceBank], a
di
call WaitStat
ld a, [hl]
ei
di
call WaitStat
ld [de], a
ei
ld a, [wFontSourceBank]
di
call WaitStat
ld [hl], a
ei
inc de
inc hl
dec bc
ld a, c
or b
jr nz, .loop
ret
INCLUDE "engine/title_screen.asm"
INCLUDE "engine/stats_screen.asm"
INCLUDE "engine/opening_logos.asm"
SECTION "bank 03", ROMX, BANK [$3]
INCLUDE "engine/sgb.asm"
INCLUDE "engine/color.asm"
Func_f9b6:
push hl
push de
push bc
push hl
call Get2DigitBCD
pop hl
ld a, [wNumCGBPalettesToFade]
and $f0
or a
jr z, .asm_f9cf
swap a
add "0"
call WaitStatAndLoad
jr .asm_f9d3
.asm_f9cf
xor a
call WaitStatAndLoad
.asm_f9d3
ld a, [wNumCGBPalettesToFade]
and $f
add "0"
call WaitStatAndLoad
pop bc
pop de
pop hl
ret
Func_f9e1:
call Random
ld a, [wRandomSample]
ld h, $0
ld l, a
ld bc, $ff
call Func_1338
ld a, [wFontSourceBank]
ld [wc452], a
ld a, [wc441]
ld h, $0
ld l, a
ld d, $a
call Func_15b0
ld bc, $ff
call Func_1338
ld a, [wFontSourceBank]
ld [wc453], a
ld a, [wc441]
ld h, $0
ld l, a
ld d, $a
call Func_15b0
ld bc, $ff
call Func_1338
ld a, [wFontSourceBank]
ld [wCGBPalFadeBufferPointer], a
ld h, $0
ld a, [wc452]
ld l, a
ld d, $64
call Func_15b0
push hl
ld h, $0
ld a, [wc453]
ld l, a
ld d, $a
call Func_15b0
ld b, h
ld c, l
pop hl
add hl, bc
ld b, $0
ld a, [wCGBPalFadeBufferPointer]
ld c, a
add hl, bc
ld a, l
ld [wFontSourceBank], a
ret
Func_fa4b:
push hl
push de
push bc
xor a
ld [wc452], a
ld a, b
ld [wc442], a
ld a, c
ld [wc443], a
ld bc, $3e8
call Func_1338
ld a, [wFontSourceBank]
or a
jr nz, .asm_fa77
ld a, [wc442]
ld h, a
ld a, [wc443]
ld l, a
xor a
di
call WaitStat
ld [hl], a
ei
jr .asm_fa8e
.asm_fa77
add $bb
push af
ld a, [wc442]
ld h, a
ld a, [wc443]
ld l, a
pop af
di
call WaitStat
ld [hl], a
ei
ld a, $1
ld [wc452], a
.asm_fa8e
ld a, [wCGBFade_PalLimit]
ld h, a
ld a, [wc441]
ld l, a
ld bc, $64
call Func_1338
ld a, [wFontSourceBank]
or a
jr nz, .asm_fac0
ld a, [wc452]
or a
jr z, .asm_faab
xor a
jr .asm_fac0
.asm_faab
ld a, [wc442]
ld h, a
ld a, [wc443]
ld l, a
ld bc, $1
add hl, bc
xor a
di
call WaitStat
ld [hl], a
ei
jr .asm_fadb
.asm_fac0
add "0"
push af
ld a, [wc442]
ld h, a
ld a, [wc443]
ld l, a
ld bc, $1
add hl, bc
pop af
di
call WaitStat
ld [hl], a
ei
ld a, $1
ld [wc452], a
.asm_fadb
ld a, [wCGBFade_PalLimit]
ld h, a
ld a, [wc441]
ld l, a
ld bc, $a
call Func_1338
ld a, [wFontSourceBank]
or a
jr nz, .asm_fb0d
ld a, [wc452]
or a
jr z, .asm_faf8
xor a
jr .asm_fb0d
.asm_faf8
ld a, [wc442]
ld h, a
ld a, [wc443]
ld l, a
ld bc, $2
add hl, bc
xor a
di
call WaitStat
ld [hl], a
ei
jr .asm_fb23
.asm_fb0d
add "0"
push af
ld a, [wc442]
ld h, a
ld a, [wc443]
ld l, a
ld bc, $2
add hl, bc
pop af
di
call WaitStat
ld [hl], a
ei
.asm_fb23
ld a, [wc442]
ld h, a
ld a, [wc443]
ld l, a
ld bc, $3
add hl, bc
ld a, [wc441]
add "0"
di
call WaitStat
ld [hl], a
ei
pop bc
pop de
pop hl
ret
SaveGame: ; fb3e (3:7b3e)
enable_sram
xor a
ld [MBC3SRamBank], a
ld hl, wOverworldData
ld de, sOverworldData
ld bc, wOverworldDataEnd - wOverworldData
call CopyData
ld hl, wScriptData
ld de, sScriptData
ld bc, wScriptDataEnd - wScriptData
call CopyData
ld hl, wEventFlags
ld de, sEventFlags
IF (NUM_EVENTS & 7) > 0
ld bc, (NUM_EVENTS >> 3) + 1
ELSE
ld bc, (NUM_EVENTS >> 3)
ENDC
call CopyData
ld hl, sAddressBook
ld de, sBackupAddressBook
ld bc, $1900
ld a, BANK(sAddressBook)
ld [wFontSourceBank], a
xor a
ld [wFontSourceAddr], a
call SaveAndLoadGame_FarCopySRAMDouble
call CalculateChecksum
ld a, $1
ld [sSaveFileExists], a
xor a
ld [MBC3SRamEnable], a
ret
LoadGame: ; fb8d (3:7b8d)
enable_sram
xor a
ld [MBC3SRamBank], a
ld hl, sOverworldData
ld de, wPhoneCallSubroutine
ld bc, $80
call CopyData
ld hl, sScriptData
ld de, wcd00
ld bc, $100
call CopyData
ld hl, sEventFlags
ld de, wEventFlags
IF (NUM_EVENTS & 7) > 0
ld bc, (NUM_EVENTS >> 3) + 1
ELSE
ld bc, (NUM_EVENTS >> 3)
ENDC
call CopyData
ld hl, sBackupAddressBook
ld de, sAddressBook
ld bc, $1900
xor a
ld [wFontSourceBank], a
ld a, BANK(sAddressBook)
ld [wFontSourceAddr], a
call SaveAndLoadGame_FarCopySRAMDouble
xor a
ld [MBC3SRamEnable], a
ld a, [wc926]
ld [wMapGroup], a
ld a, [wc927]
ld [wMapNumber], a
ld a, [wc928]
ld [wc901], a
ld a, [wc929]
ld [wc902], a
ret
SaveAndLoadGame_FarCopySRAMDouble:
.loop
ld a, [wFontSourceBank]
ld [MBC3SRamBank], a
ld a, [hli]
push af
ld a, [wFontSourceAddr]
ld [MBC3SRamBank], a
pop af
ld [de], a
inc de
dec bc
ld a, c
or b
jr nz, .loop
ret
SECTION "bank 04", ROMX, BANK [$4]
INCLUDE "engine/phone_menu.asm"
SECTION "bank 05", ROMX, BANK [$5]
INCLUDE "battle/core.asm"
SECTION "bank 06", ROMX, BANK [$6]
macro_18000: MACRO
dbw \1, \2 ; bank, VRAM dest