-
Notifications
You must be signed in to change notification settings - Fork 806
/
color.asm
1340 lines (1201 loc) · 18.9 KB
/
color.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 "engine/gfx/sgb_layouts.asm"
DEF SHINY_ATK_MASK EQU %0010
DEF SHINY_DEF_DV EQU 10
DEF SHINY_SPD_DV EQU 10
DEF SHINY_SPC_DV EQU 10
CheckShininess:
; Check if a mon is shiny by DVs at bc.
; Return carry if shiny.
ld l, c
ld h, b
; Attack
ld a, [hl]
and SHINY_ATK_MASK << 4
jr z, .not_shiny
; Defense
ld a, [hli]
and %1111
cp SHINY_DEF_DV
jr nz, .not_shiny
; Speed
ld a, [hl]
and %1111 << 4
cp SHINY_SPD_DV << 4
jr nz, .not_shiny
; Special
ld a, [hl]
and %1111
cp SHINY_SPC_DV
jr nz, .not_shiny
; shiny
scf
ret
.not_shiny
and a
ret
Unused_CheckShininess:
; Return carry if the DVs at hl are all 10 or higher.
; Attack
ld a, [hl]
cp 10 << 4
jr c, .not_shiny
; Defense
ld a, [hli]
and %1111
cp 10
jr c, .not_shiny
; Speed
ld a, [hl]
cp 10 << 4
jr c, .not_shiny
; Special
ld a, [hl]
and %1111
cp 10
jr c, .not_shiny
; shiny
scf
ret
.not_shiny
and a
ret
SGB_ApplyCreditsPals: ; unreferenced
push de
push bc
ld hl, PalPacket_Pal01
ld de, wSGBPals
ld bc, PALPACKET_LENGTH
call CopyBytes
pop bc
pop de
ld a, c
ld [wSGBPals + 3], a
ld a, b
ld [wSGBPals + 4], a
ld a, e
ld [wSGBPals + 5], a
ld a, d
ld [wSGBPals + 6], a
ld hl, wSGBPals
call PushSGBPals
ld hl, BlkPacket_AllPal0
call PushSGBPals
ret
InitPartyMenuPalettes:
ld hl, PalPacket_PartyMenu + 1
call CopyFourPalettes
call InitPartyMenuOBPals
call WipeAttrmap
ret
; SGB layout for SCGB_PARTY_MENU_HP_BARS
SGB_ApplyPartyMenuHPPals:
ld hl, wHPPals
ld a, [wSGBPals]
ld e, a
ld d, 0
add hl, de
ld e, l
ld d, h
ld a, [de]
and a
ld e, $5
jr z, .okay
dec a
ld e, $a
jr z, .okay
ld e, $f
.okay
push de
ld hl, wSGBPals + 10
ld bc, $6
ld a, [wSGBPals]
call AddNTimes
pop de
ld [hl], e
ret
Intro_LoadMagikarpPalettes: ; unreferenced
call CheckCGB
ret z
; CGB only
ld hl, .MagikarpBGPal
ld de, wBGPals1
ld bc, 1 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
ld hl, .MagikarpOBPal
ld de, wOBPals1
ld bc, 1 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
.MagikarpBGPal:
INCLUDE "gfx/intro/gs_magikarp_bg.pal"
.MagikarpOBPal:
INCLUDE "gfx/intro/gs_magikarp_ob.pal"
Intro_LoadAllPal0: ; unreferenced
call CheckCGB
ret nz
ldh a, [hSGB]
and a
ret z
ld hl, BlkPacket_AllPal0
jp PushSGBPals
Intro_LoadBetaIntroVenusaurPalettes: ; unreferenced
call CheckCGB
jr nz, .cgb
ldh a, [hSGB]
and a
ret z
ld hl, PalPacket_BetaIntroVenusaur
jp PushSGBPals
.cgb
ld de, wOBPals1
ld a, PREDEFPAL_BETA_INTRO_VENUSAUR
call GetPredefPal
jp LoadHLPaletteIntoDE
Intro_LoadPackPalettes: ; unreferenced
call CheckCGB
jr nz, .cgb
ldh a, [hSGB]
and a
ret z
ld hl, PalPacket_Pack
jp PushSGBPals
.cgb
ld de, wOBPals1
ld a, PREDEFPAL_PACK
call GetPredefPal
jp LoadHLPaletteIntoDE
GSIntro_LoadMonPalette: ; unreferenced
call CheckCGB
jr nz, .cgb
ldh a, [hSGB]
and a
ret z
ld a, c
push af
ld hl, PalPacket_Pal01
ld de, wSGBPals
ld bc, PALPACKET_LENGTH
call CopyBytes
pop af
call GetMonPalettePointer
ld a, [hli]
ld [wSGBPals + 3], a
ld a, [hli]
ld [wSGBPals + 4], a
ld a, [hli]
ld [wSGBPals + 5], a
ld a, [hl]
ld [wSGBPals + 6], a
ld hl, wSGBPals
jp PushSGBPals
.cgb
ld de, wOBPals1
ld a, c
call GetMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
ret
LoadTrainerClassPaletteAsNthBGPal:
ld a, [wTrainerClass]
call GetTrainerPalettePointer
ld a, e
jr LoadNthMiddleBGPal
LoadMonPaletteAsNthBGPal:
ld a, [wCurPartySpecies]
call _GetMonPalettePointer
ld a, e
bit 7, a
jr z, LoadNthMiddleBGPal
and $7f
inc hl
inc hl
inc hl
inc hl
LoadNthMiddleBGPal:
push hl
ld hl, wBGPals1
ld de, 1 palettes
.loop
and a
jr z, .got_addr
add hl, de
dec a
jr .loop
.got_addr
ld e, l
ld d, h
pop hl
call LoadPalette_White_Col1_Col2_Black
ret
LoadBetaPokerPalettes: ; unreferenced
ldh a, [hCGB]
and a
jr nz, .cgb
ld hl, wBetaPokerSGBPals
jp PushSGBPals
.cgb
ld a, [wBetaPokerSGBCol]
ld c, a
ld a, [wBetaPokerSGBRow]
hlcoord 0, 0, wAttrmap
ld de, SCREEN_WIDTH
.loop
and a
jr z, .done
add hl, de
dec a
jr .loop
.done
ld b, 0
add hl, bc
lb bc, 6, 4
ld a, [wBetaPokerSGBAttr]
and $3
call FillBoxCGB
call CopyTilemapAtOnce
ret
ApplyMonOrTrainerPals:
call CheckCGB
ret z
ld a, e
and a
jr z, .get_trainer
ld a, [wCurPartySpecies]
call GetMonPalettePointer
jr .load_palettes
.get_trainer
ld a, [wTrainerClass]
call GetTrainerPalettePointer
.load_palettes
ld de, wBGPals1
call LoadPalette_White_Col1_Col2_Black
call WipeAttrmap
call ApplyAttrmap
call ApplyPals
ret
ApplyHPBarPals:
ld a, [wWhichHPBar]
and a
jr z, .Enemy
cp $1
jr z, .Player
cp $2
jr z, .PartyMenu
ret
.Enemy:
ld de, wBGPals2 palette PAL_BATTLE_BG_ENEMY_HP color 1
jr .okay
.Player:
ld de, wBGPals2 palette PAL_BATTLE_BG_PLAYER_HP color 1
.okay
ld l, c
ld h, $0
add hl, hl
add hl, hl
ld bc, HPBarPals
add hl, bc
ld bc, 4
ld a, BANK(wBGPals2)
call FarCopyWRAM
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
.PartyMenu:
ld e, c
inc e
hlcoord 11, 1, wAttrmap
ld bc, 2 * SCREEN_WIDTH
ld a, [wCurPartyMon]
.loop
and a
jr z, .done
add hl, bc
dec a
jr .loop
.done
lb bc, 2, 8
ld a, e
call FillBoxCGB
ret
LoadStatsScreenPals:
call CheckCGB
ret z
ld hl, StatsScreenPals
ld b, 0
dec c
add hl, bc
add hl, bc
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ldh [rSVBK], a
ld a, [hli]
ld [wBGPals1 palette 0], a
ld [wBGPals1 palette 2], a
ld a, [hl]
ld [wBGPals1 palette 0 + 1], a
ld [wBGPals1 palette 2 + 1], a
pop af
ldh [rSVBK], a
call ApplyPals
ld a, $1
ret
LoadMailPalettes:
ld l, e
ld h, 0
add hl, hl
add hl, hl
add hl, hl
ld de, .MailPals
add hl, de
call CheckCGB
jr nz, .cgb
push hl
ld hl, PalPacket_Pal01
ld de, wSGBPals
ld bc, PALPACKET_LENGTH
call CopyBytes
pop hl
inc hl
inc hl
ld a, [hli]
ld [wSGBPals + 3], a
ld a, [hli]
ld [wSGBPals + 4], a
ld a, [hli]
ld [wSGBPals + 5], a
ld a, [hli]
ld [wSGBPals + 6], a
ld hl, wSGBPals
call PushSGBPals
ld hl, BlkPacket_AllPal0
call PushSGBPals
ret
.cgb
ld de, wBGPals1
ld bc, 1 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
call ApplyPals
call WipeAttrmap
call ApplyAttrmap
ret
.MailPals:
INCLUDE "gfx/mail/mail.pal"
INCLUDE "engine/gfx/cgb_layouts.asm"
CopyFourPalettes:
ld de, wBGPals1
ld c, 4
CopyPalettes:
.loop
push bc
ld a, [hli]
push hl
call GetPredefPal
call LoadHLPaletteIntoDE
pop hl
inc hl
pop bc
dec c
jr nz, .loop
ret
GetPredefPal:
ld l, a
ld h, 0
add hl, hl
add hl, hl
add hl, hl
ld bc, PredefPals
add hl, bc
ret
LoadHLPaletteIntoDE:
ldh a, [rSVBK]
push af
ld a, BANK(wOBPals1)
ldh [rSVBK], a
ld c, 1 palettes
.loop
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .loop
pop af
ldh [rSVBK], a
ret
LoadPalette_White_Col1_Col2_Black:
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ldh [rSVBK], a
ld a, LOW(PALRGB_WHITE)
ld [de], a
inc de
ld a, HIGH(PALRGB_WHITE)
ld [de], a
inc de
ld c, 2 * PAL_COLOR_SIZE
.loop
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .loop
xor a
ld [de], a
inc de
ld [de], a
inc de
pop af
ldh [rSVBK], a
ret
FillBoxCGB:
.row
push bc
push hl
.col
ld [hli], a
dec c
jr nz, .col
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
jr nz, .row
ret
ResetBGPals:
push af
push bc
push de
push hl
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ldh [rSVBK], a
ld hl, wBGPals1
ld c, 1 palettes
.loop
ld a, $ff
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
dec c
jr nz, .loop
pop af
ldh [rSVBK], a
pop hl
pop de
pop bc
pop af
ret
WipeAttrmap:
hlcoord 0, 0, wAttrmap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
ret
ApplyPals:
ld hl, wBGPals1
ld de, wBGPals2
ld bc, 16 palettes
ld a, BANK(wGBCPalettes)
call FarCopyWRAM
ret
ApplyAttrmap:
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
jr z, .UpdateVBank1
ldh a, [hBGMapMode]
push af
ld a, $2
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
call DelayFrame
call DelayFrame
pop af
ldh [hBGMapMode], a
ret
.UpdateVBank1:
hlcoord 0, 0, wAttrmap
debgcoord 0, 0
ld b, SCREEN_HEIGHT
ld a, $1
ldh [rVBK], a
.row
ld c, SCREEN_WIDTH
.col
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .col
ld a, BG_MAP_WIDTH - SCREEN_WIDTH
add e
jr nc, .okay
inc d
.okay
ld e, a
dec b
jr nz, .row
ld a, $0
ldh [rVBK], a
ret
; CGB layout for SCGB_PARTY_MENU_HP_BARS
CGB_ApplyPartyMenuHPPals:
ld hl, wHPPals
ld a, [wSGBPals]
ld e, a
ld d, 0
add hl, de
ld e, l
ld d, h
ld a, [de]
inc a
ld e, a
hlcoord 11, 2, wAttrmap
ld bc, 2 * SCREEN_WIDTH
ld a, [wSGBPals]
.loop
and a
jr z, .done
add hl, bc
dec a
jr .loop
.done
lb bc, 2, 8
ld a, e
call FillBoxCGB
ret
InitPartyMenuOBPals:
ld hl, PartyMenuOBPals
ld de, wOBPals1
ld bc, 2 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
ret
GetBattlemonBackpicPalettePointer:
push de
farcall GetPartyMonDVs
ld c, l
ld b, h
ld a, [wTempBattleMonSpecies]
call GetPlayerOrMonPalettePointer
pop de
ret
GetEnemyFrontpicPalettePointer:
push de
farcall GetEnemyMonDVs
ld c, l
ld b, h
ld a, [wTempEnemyMonSpecies]
call GetFrontpicPalettePointer
pop de
ret
GetPlayerOrMonPalettePointer:
and a
jp nz, GetMonNormalOrShinyPalettePointer
ld a, [wPlayerSpriteSetupFlags]
bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
jr nz, .male
ld a, [wPlayerGender]
and a
jr z, .male
ld hl, KrisPalette
ret
.male
ld hl, PlayerPalette
ret
GetFrontpicPalettePointer:
and a
jp nz, GetMonNormalOrShinyPalettePointer
ld a, [wTrainerClass]
GetTrainerPalettePointer:
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld bc, TrainerPalettes
add hl, bc
ret
GetMonPalettePointer:
call _GetMonPalettePointer
ret
CGBCopyBattleObjectPals: ; unreferenced
; dummied out
ret
call CheckCGB
ret z
ld hl, BattleObjectPals
ld a, (1 << rOBPI_AUTO_INCREMENT) | $10
ldh [rOBPI], a
ld c, 6 palettes
.loop
ld a, [hli]
ldh [rOBPD], a
dec c
jr nz, .loop
ld hl, BattleObjectPals
ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
ld bc, 2 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
ret
BattleObjectPals:
INCLUDE "gfx/battle_anims/battle_anims.pal"
CGBCopyTwoPredefObjectPals: ; unreferenced
call CheckCGB
ret z
ld a, (1 << rOBPI_AUTO_INCREMENT) | $10
ldh [rOBPI], a
ld a, PREDEFPAL_TRADE_TUBE
call GetPredefPal
call .PushPalette
ld a, PREDEFPAL_RB_GREENMON
call GetPredefPal
call .PushPalette
ret
.PushPalette:
ld c, 1 palettes
.loop
ld a, [hli]
ldh [rOBPD], a
dec c
jr nz, .loop
ret
_GetMonPalettePointer:
ld l, a
ld h, 0
add hl, hl
add hl, hl
add hl, hl
ld bc, PokemonPalettes
add hl, bc
ret
GetMonNormalOrShinyPalettePointer:
push bc
call _GetMonPalettePointer
pop bc
push hl
call CheckShininess
pop hl
ret nc
rept 4
inc hl
endr
ret
PushSGBPals:
ld a, [wJoypadDisable]
push af
set JOYPAD_DISABLE_SGB_TRANSFER_F, a
ld [wJoypadDisable], a
call _PushSGBPals
pop af
ld [wJoypadDisable], a
ret
_PushSGBPals:
ld a, [hl]
and $7
ret z
ld b, a
.loop
push bc
xor a
ldh [rJOYP], a
ld a, $30
ldh [rJOYP], a
ld b, $10
.loop2
ld e, $8
ld a, [hli]
ld d, a
.loop3
bit 0, d
ld a, $10
jr nz, .okay
ld a, $20
.okay
ldh [rJOYP], a
ld a, $30
ldh [rJOYP], a
rr d
dec e
jr nz, .loop3
dec b
jr nz, .loop2
ld a, $20
ldh [rJOYP], a
ld a, $30
ldh [rJOYP], a
call SGBDelayCycles
pop bc
dec b
jr nz, .loop
ret
InitSGBBorder:
call CheckCGB
ret nz
; SGB/DMG only
di
ld a, [wJoypadDisable]
push af
set JOYPAD_DISABLE_SGB_TRANSFER_F, a
ld [wJoypadDisable], a
xor a
ldh [rJOYP], a
ldh [hSGB], a
call PushSGBBorderPalsAndWait
jr nc, .skip
ld a, $1
ldh [hSGB], a
call _InitSGBBorderPals
call SGBBorder_PushBGPals
call SGBDelayCycles
call SGB_ClearVRAM
call PushSGBBorder
call SGBDelayCycles
call SGB_ClearVRAM
ld hl, MaskEnCancelPacket
call _PushSGBPals
.skip
pop af
ld [wJoypadDisable], a
ei
ret
InitCGBPals::
call CheckCGB
ret z
; CGB only
ld a, BANK(vTiles3)
ldh [rVBK], a
ld hl, vTiles3
ld bc, $200 tiles
xor a
call ByteFill
ld a, BANK(vTiles0)
ldh [rVBK], a
ld a, 1 << rBGPI_AUTO_INCREMENT
ldh [rBGPI], a
ld c, 4 * TILE_WIDTH
.bgpals_loop
ld a, LOW(PALRGB_WHITE)
ldh [rBGPD], a
ld a, HIGH(PALRGB_WHITE)
ldh [rBGPD], a
dec c
jr nz, .bgpals_loop
ld a, 1 << rOBPI_AUTO_INCREMENT
ldh [rOBPI], a
ld c, 4 * TILE_WIDTH
.obpals_loop
ld a, LOW(PALRGB_WHITE)
ldh [rOBPD], a
ld a, HIGH(PALRGB_WHITE)
ldh [rOBPD], a
dec c
jr nz, .obpals_loop
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ldh [rSVBK], a
ld hl, wBGPals1
call .LoadWhitePals
ld hl, wBGPals2
call .LoadWhitePals
pop af
ldh [rSVBK], a
ret
.LoadWhitePals:
ld c, 4 * 16
.loop
ld a, LOW(PALRGB_WHITE)
ld [hli], a
ld a, HIGH(PALRGB_WHITE)
ld [hli], a
dec c
jr nz, .loop
ret
_InitSGBBorderPals:
ld hl, .PacketPointerTable
ld c, 9
.loop
push bc
ld a, [hli]
push hl
ld h, [hl]
ld l, a
call _PushSGBPals
pop hl
inc hl
pop bc
dec c
jr nz, .loop
ret
.PacketPointerTable:
dw MaskEnFreezePacket
dw DataSndPacket1
dw DataSndPacket2
dw DataSndPacket3
dw DataSndPacket4
dw DataSndPacket5
dw DataSndPacket6
dw DataSndPacket7
dw DataSndPacket8
UpdateSGBBorder: ; unreferenced
di
xor a
ldh [rJOYP], a
ld hl, MaskEnFreezePacket
call _PushSGBPals
call PushSGBBorder
call SGBDelayCycles
call SGB_ClearVRAM
ld hl, MaskEnCancelPacket
call _PushSGBPals
ei
ret
PushSGBBorder:
call .LoadSGBBorderPointers
push de
call SGBBorder_YetMorePalPushing
pop hl
call SGBBorder_MorePalPushing
ret
.LoadSGBBorderPointers:
ld hl, SGBBorderGFX
ld de, SGBBorderMapAndPalettes
ret
SGB_ClearVRAM:
ld hl, STARTOF(VRAM)
ld bc, SIZEOF(VRAM)
xor a
call ByteFill
ret
PushSGBBorderPalsAndWait:
ld hl, MltReq2Packet
call _PushSGBPals
call SGBDelayCycles
ldh a, [rJOYP]
and $3
cp $3
jr nz, .carry
ld a, $20
ldh [rJOYP], a
ldh a, [rJOYP]
ldh a, [rJOYP]
call SGBDelayCycles