ref: 7b3090e22aefffa464570ac34665ee8e43df873d
parent: 812976cee6ba39d50583921273ad85195e77be37
author: PikalaxALT <PikalaxALT@gmail.com>
date: Fri Nov 20 10:15:32 EST 2015
Annotate battle tower text bug
--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -1437,13 +1437,13 @@
ld a, $5
ld [rSVBK], a
ld hl, BGPals
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, [rBGP]
ld b, a
ld c, $7
call CopyPals
ld hl, OBPals
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld a, [rBGP]
ld b, a
ld c, $2
@@ -1465,7 +1465,7 @@
ld a, $5
ld [rSVBK], a
ld hl, OBPals + $10
- ld de, Unkn2Pals + $10
+ ld de, UnknOBPals + $10
ld a, [rOBP0]
ld b, a
ld c, $2
--- a/battle/bg_effects.asm
+++ b/battle/bg_effects.asm
@@ -2571,12 +2571,12 @@
push bc
push af
ld hl, BGPals ; BGPals
- ld de, wMapPals ; wd000
+ ld de, UnknBGPals ; wd000
ld b, a
ld c, $1
call CopyPals
ld hl, OBPals + 8
- ld de, Unkn2Pals + 8
+ ld de, UnknOBPals + 8
pop af
ld b, a
ld c, $1
@@ -2598,12 +2598,12 @@
push bc
push af
ld hl, BGPals + 8
- ld de, wMapPals + 8
+ ld de, UnknBGPals + 8
ld b, a
ld c, $1
call CopyPals
ld hl, OBPals ; OBPals
- ld de, Unkn2Pals ; wd040
+ ld de, UnknOBPals ; wd040
pop af
ld b, a
ld c, $1
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -2916,7 +2916,7 @@
call ExitMenu
call LoadTileMapToTempTileMap
call WaitBGMap
- call ClearSGB
+ call GetMemSGBLayout
call SetPalettes
xor a
ld c, a
@@ -2935,7 +2935,7 @@
call DelayFrame
call _LoadHPBar
call WriteBackup
- call ClearSGB
+ call GetMemSGBLayout
call SetPalettes
call SendOutPkmnText
call NewBattleMonStatus
@@ -5372,7 +5372,7 @@
call _LoadHPBar
call WriteBackup
call LoadTileMapToTempTileMap
- call ClearSGB
+ call GetMemSGBLayout
call SetPalettes
jp BattleMenu
; 3e2f5
@@ -5454,7 +5454,7 @@
call ClearSprites
call _LoadHPBar
call WriteBackup
- call ClearSGB
+ call GetMemSGBLayout
call SetPalettes
ld a, [CurPartyMon]
ld [CurBattleMon], a
@@ -8450,7 +8450,7 @@
ld hl, EnemyMonDVs
predef GetUnownLetter
ld de, VTiles2
- predef Function5108b
+ predef FrontpicPredef
pop af
ld [CurPartySpecies], a
ret
@@ -8659,7 +8659,7 @@
ld [wdef4], a
.skip_unown
ld de, VTiles2
- predef Function5108b
+ predef FrontpicPredef
xor a
ld [TrainerClass], a
ld [hFillBox], a
--- a/constants/cgb_constants.asm
+++ b/constants/cgb_constants.asm
@@ -30,3 +30,6 @@
const SCGB_1C
const SCGB_1D
const SCGB_1E
+
+SCGB_FC EQU -4
+SCGB_RAM EQU -1
--- a/data/battle_tower.asm
+++ b/data/battle_tower.asm
@@ -208,6 +208,9 @@
; 1f814e
BattleTowerTrainers: ; 1f814e
+; The trainer class is not used in Crystal 1.0 due to a bug.
+; Instead, the sixth character in the trainer's name is used.
+; See misc/battle_tower_47.asm
db "HANSON@@@@", FISHER
db "SAWYER@@@@", POKEMANIAC
db "MASUDA@@@@", GUITARIST
--- a/engine/battle_start.asm
+++ b/engine/battle_start.asm
@@ -26,7 +26,7 @@
ld a, $5
ld [rSVBK], a
- ld hl, wMapPals
+ ld hl, UnknBGPals
ld bc, 8 palettes
xor a
call ByteFill
@@ -661,7 +661,7 @@
ld [rSVBK], a
call .copypals
push hl
- ld de, wMapPals + 8 * 7
+ ld de, UnknBGPals + 8 * 7
ld bc, $8
call CopyBytes
pop hl
@@ -680,15 +680,15 @@
ret
.copypals: ; 8c677 (23:4677)
- ld de, wMapPals + 8 * 7
+ ld de, UnknBGPals + 8 * 7
call .copy
ld de, BGPals + 8 * 7
call .copy
- ld de, Unkn2Pals + 8 * 6
+ ld de, UnknOBPals + 8 * 6
call .copy
ld de, OBPals + 8 * 6
call .copy
- ld de, Unkn2Pals + 8 * 7
+ ld de, UnknOBPals + 8 * 7
call .copy
ld de, OBPals + 8 * 7
--- a/engine/breeding/egg.asm
+++ b/engine/breeding/egg.asm
@@ -650,7 +650,7 @@
ld hl, BattleMonDVs
predef GetUnownLetter
pop de
- predef_jump Function5108b
+ predef_jump FrontpicPredef
Function17254: ; 17254 (5:7254)
push af
@@ -775,7 +775,7 @@
Function17363: ; 17363 (5:7363)
ld [PlayerHPPal], a
- ld b, $b
+ ld b, SCGB_0B
ld c, $0
jp GetSGBLayout
--- a/engine/card_flip.asm
+++ b/engine/card_flip.asm
@@ -1621,7 +1621,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e0c93
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $48
call CopyBytes
pop af
@@ -1751,7 +1751,7 @@
ld a, $93
ld [rLCDC], a
call WaitBGMap
- ld b, $18
+ ld b, SCGB_18
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -117,7 +117,7 @@
ret
; 8ade
-Function8ade: ; 8ade
+Function8ade: ; 8ade SGB layout $fc
ld hl, wcd9b
ld a, [wcda9]
ld e, a
@@ -149,7 +149,7 @@
call CheckCGB
ret z
ld hl, Palette8b2f
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0008
ld a, $5
call FarCopyWRAM
@@ -200,7 +200,7 @@
jp Function9809
.asm_8b5c
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld a, $3b
call GetAthPalletFromPalettes9df6
jp LoadHLPaletteIntoDE
@@ -216,7 +216,7 @@
jp Function9809
.asm_8b76
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld a, $3c
call GetAthPalletFromPalettes9df6
jp LoadHLPaletteIntoDE
@@ -248,7 +248,7 @@
jp Function9809
.asm_8bb2
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld a, c
call Function9775
call Function9643
@@ -275,7 +275,7 @@
asm_8bd7
push hl
- ld hl, wMapPals
+ ld hl, UnknBGPals
ld de, $0008
.asm_8bde
and a
@@ -338,7 +338,7 @@
call Function976b
.asm_8c33
- ld de, wMapPals
+ ld de, UnknBGPals
call Function9643
call Function9699
call Function96b3
@@ -412,11 +412,11 @@
ld a, $5
ld [rSVBK], a
ld a, [hli]
- ld [wMapPals], a
- ld [wMapPals + 8 * 2], a
+ ld [UnknBGPals], a
+ ld [UnknBGPals + 8 * 2], a
ld a, [hl]
- ld [wMapPals + 1], a
- ld [wMapPals + 8 * 2 + 1], a
+ ld [UnknBGPals + 1], a
+ ld [UnknBGPals + 8 * 2 + 1], a
pop af
ld [rSVBK], a
call Function96a4
@@ -458,7 +458,7 @@
ret
.asm_8cf0
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0008
ld a, $5
call FarCopyWRAM
@@ -525,7 +525,7 @@
Function95f0: ; 95f0
ld hl, Palette_9608
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, 8
ld a, $5
call FarCopyWRAM
@@ -544,7 +544,7 @@
CopyFourPalettes: ; 9610
- ld de, wMapPals
+ ld de, UnknBGPals
ld c, $4
CopyPalettes: ; 9615
@@ -644,9 +644,9 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, wMapPals
- ld c, $8
-.asm_9683
+ ld hl, UnknBGPals
+ ld c, 8
+.loop
ld a, $ff
rept 4
ld [hli], a
@@ -656,7 +656,7 @@
ld [hli], a
endr
dec c
- jr nz, .asm_9683
+ jr nz, .loop
pop af
ld [rSVBK], a
pop hl
@@ -676,7 +676,7 @@
; 96a4
Function96a4: ; 96a4
- ld hl, wMapPals
+ ld hl, UnknBGPals
ld de, BGPals
ld bc, $0080
ld a, $5
@@ -728,7 +728,7 @@
ret
; 96f3
-Function96f3: ; 96f3
+Function96f3: ; 96f3 CGB layout $fc
ld hl, wcd9b
ld a, [wcda9]
ld e, a
@@ -759,7 +759,7 @@
Function971a: ; 971a
ld hl, Palettes_b681
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $0010
ld a, $5
call FarCopyWRAM
@@ -843,7 +843,7 @@
dec c
jr nz, .asm_9787
ld hl, Palettes_979c
- ld de, Unkn2Pals + 8 * 2
+ ld de, UnknOBPals + 8 * 2
ld bc, $0010
ld a, $5
call FarCopyWRAM
@@ -1047,7 +1047,7 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function98df
ld hl, BGPals
call Function98df
@@ -1058,13 +1058,13 @@
Function98df: ; 98df
ld c, $40
-.asm_98e1
+.loop
ld a, $ff
ld [hli], a
ld a, $7f
ld [hli], a
dec c
- jr nz, .asm_98e1
+ jr nz, .loop
ret
; 98eb
@@ -1974,7 +1974,7 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, wMapPals
+ ld hl, UnknBGPals
ld b, $8
.asm_b210
ld a, [de]
@@ -2010,9 +2010,9 @@
ld bc, $40
ld hl, MapObjectPals
call AddNTimes
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $40
- ld a, $5 ; BANK(Unkn2Pals)
+ ld a, $5 ; BANK(UnknOBPals)
call FarCopyWRAM
ld a, [wPermission]
@@ -2037,7 +2037,7 @@
inc hl
endr
.asm_b26d
- ld de, wMapPals + 8 * 6 + 2
+ ld de, UnknBGPals + 8 * 6 + 2
ld bc, 4
ld a, $5
call FarCopyWRAM
--- a/engine/credits.asm
+++ b/engine/credits.asm
@@ -637,10 +637,10 @@
push af
push hl
- add wMapPals % $100
+ add UnknBGPals % $100
ld e, a
ld a, 0
- adc wMapPals / $100
+ adc UnknBGPals / $100
ld d, a
ld bc, 24
call CopyBytes
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -524,7 +524,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_365ad
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
ld hl, Palette_365ad
@@ -597,7 +597,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e5edd
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
ld hl, Palette_e5edd
@@ -662,7 +662,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_365ad
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
ld hl, Palette_365ad
@@ -759,7 +759,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e5edd
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
ld hl, Palette_e5edd
@@ -909,7 +909,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_365ad
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
ld hl, Palette_365ad
@@ -1034,7 +1034,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e5edd
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
ld hl, Palette_e5edd
@@ -1143,7 +1143,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e77dd
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
ld hl, Palette_e77dd
@@ -1217,7 +1217,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e6d6d
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
ld hl, Palette_e6d6d
@@ -1291,7 +1291,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e77dd
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
ld hl, Palette_e77dd
@@ -1459,7 +1459,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e679d
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
ld hl, Palette_e679d
@@ -1785,7 +1785,7 @@
ld bc, $8
call CopyBytes
pop bc
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, c
add e
ld e, a
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -1244,7 +1244,7 @@
rept 3
add hl, hl
endr
- ld de, wMapPals
+ ld de, UnknBGPals
add hl, de
ld de, wc608
ld bc, 8
--- a/engine/diploma.asm
+++ b/engine/diploma.asm
@@ -31,7 +31,7 @@
call PlaceString
call EnableLCD
call WaitBGMap
- ld b, $8
+ ld b, SCGB_08
call GetSGBLayout
call SetPalettes
call DelayFrame
--- a/engine/dummy_game.asm
+++ b/engine/dummy_game.asm
@@ -8,7 +8,7 @@
Functione1e67: ; e1e67 (38:5e67)
call DisableLCD
- ld b, $8
+ ld b, SCGB_08
call GetSGBLayout
callab Function8cf53
ld hl, LZ_e2221
--- a/engine/evolution_animation.asm
+++ b/engine/evolution_animation.asm
@@ -52,11 +52,11 @@
ld [PlayerHPPal], a
ld c, $0
- call Function4e703
+ call .GetSGBLayout
ld a, [Buffer1]
ld [CurPartySpecies], a
ld [CurSpecies], a
- call Function4e708
+ call .PlaceFrontpic
ld de, VTiles2
ld hl, VTiles2 tile $31
@@ -65,11 +65,11 @@
ld a, $31
ld [wd1ec], a
- call Evolution_FlashFrontpics
+ call .ReplaceFrontpic
ld a, [Buffer2]
ld [CurPartySpecies], a
ld [CurSpecies], a
- call Function4e711
+ call .LoadFrontpic
ld a, [Buffer1]
ld [CurPartySpecies], a
ld [CurSpecies], a
@@ -90,14 +90,14 @@
call DelayFrames
ld c, $1
- call Function4e703
- call Function4e726
- jr c, .pressed_b
+ call .GetSGBLayout
+ call .AnimationSequence
+ jr c, .cancel_evo
- ld a, $cf
+ ld a, -7 * 7
ld [wd1ec], a
- call Evolution_FlashFrontpics
+ call .ReplaceFrontpic
xor a
ld [wd1ed], a
@@ -105,7 +105,7 @@
ld [PlayerHPPal], a
ld c, $0
- call Function4e703
+ call .GetSGBLayout
call Function4e7a6
callba Function8cf53
call Function4e794
@@ -134,7 +134,7 @@
.asm_4e6de
ret
-.pressed_b
+.cancel_evo
ld a, $1
ld [wd1ed], a
@@ -142,7 +142,7 @@
ld [PlayerHPPal], a
ld c, $0
- call Function4e703
+ call .GetSGBLayout
call Function4e7a6
callba Function8cf53
call Function4e794
@@ -153,38 +153,38 @@
ret
; 4e703
-Function4e703: ; 4e703
- ld b, $b
+.GetSGBLayout: ; 4e703
+ ld b, SCGB_0B
jp GetSGBLayout
; 4e708
-Function4e708: ; 4e708
+.PlaceFrontpic: ; 4e708
call GetBaseData
hlcoord 7, 2
jp PrepMonFrontpic
; 4e711
-Function4e711: ; 4e711
+.LoadFrontpic: ; 4e711
call GetBaseData
ld a, $1
ld [wc2c6], a
ld de, VTiles2
- predef Function5108b
+ predef FrontpicPredef
xor a
ld [wc2c6], a
ret
; 4e726
-Function4e726: ; 4e726
+.AnimationSequence: ; 4e726
call ClearJoypad
- lb bc, 1, 14
+ lb bc, 1, 2 * 7 ; flash b times, wait c frames in between
.loop
push bc
- call Evolution_CheckPressedB
+ call .WaitFrames_CheckPressedB
pop bc
- jr c, .pressed_b
+ jr c, .exit_sequence
push bc
- call Evolution_NextFrame
+ call .Flash
pop bc
inc b
rept 2
@@ -194,31 +194,30 @@
and a
ret
-.pressed_b
+.exit_sequence
scf
ret
; 4e741
-Evolution_NextFrame: ; 4e741
-.loop
- ld a, -49
+.Flash: ; 4e741
+ ld a, -7 * 7 ; new stage
ld [wd1ec], a
- call Evolution_FlashFrontpics
- ld a, 49
+ call .ReplaceFrontpic
+ ld a, 7 * 7 ; previous stage
ld [wd1ec], a
- call Evolution_FlashFrontpics
+ call .ReplaceFrontpic
dec b
- jr nz, .loop
+ jr nz, .Flash
ret
; 4e755
-Evolution_FlashFrontpics: ; 4e755
+.ReplaceFrontpic: ; 4e755
push bc
xor a
ld [hBGMapMode], a
hlcoord 7, 2
lb bc, 7, 7
- ld de, $d
+ ld de, SCREEN_WIDTH - 7
.loop1
push bc
.loop2
@@ -238,8 +237,7 @@
ret
; 4e779
-Evolution_CheckPressedB: ; 4e779
-.loop
+.WaitFrames_CheckPressedB: ; 4e779
call DelayFrame
push bc
call JoyTextDelay
@@ -247,9 +245,9 @@
pop bc
and B_BUTTON
jr nz, .pressed_b
-.loop2
+.loop3
dec c
- jr nz, .loop
+ jr nz, .WaitFrames_CheckPressedB
and a
ret
@@ -256,7 +254,7 @@
.pressed_b
ld a, [wd1e9]
and a
- jr nz, .loop2
+ jr nz, .loop3
scf
ret
; 4e794
@@ -281,18 +279,18 @@
ld a, [hl]
push af
ld [hl], $0
-.asm_4e7b8
+.loop
call Function4e7cf
- jr nc, .asm_4e7c2
+ jr nc, .done
call Function4e80c
- jr .asm_4e7b8
+ jr .loop
-.asm_4e7c2
+.done
ld c, $20
-.asm_4e7c4
+.loop2
call Function4e80c
dec c
- jr nz, .asm_4e7c4
+ jr nz, .loop2
pop af
ld [wJumptableIndex], a
ret
@@ -319,7 +317,7 @@
Function4e7e8: ; 4e7e8
push de
- ld de, $4858
+ lb de, $48, $58
ld a, $13
call _InitSpriteAnimStruct
ld hl, $b
@@ -342,6 +340,7 @@
Function4e80c: ; 4e80c
push bc
callab Function8cf69
+ ; a = (([hVBlankCounter] + 4) / 2) % NUM_PALETTES
ld a, [hVBlankCounter]
and $e
srl a
@@ -350,9 +349,9 @@
endr
and $7
ld b, a
- ld hl, Sprites + 3
- ld c, $28
-.asm_4e823
+ ld hl, Sprites + 3 ; attributes
+ ld c, 40
+.loop
ld a, [hl]
or b
ld [hli], a
@@ -360,7 +359,7 @@
inc hl
endr
dec c
- jr nz, .asm_4e823
+ jr nz, .loop
pop bc
call DelayFrame
ret
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -495,7 +495,7 @@
call PlaceWholeStringInBoxAtOnce
call RotateThreePalettesRight
call ClearScreen
- ld b, $8
+ ld b, SCGB_08
call GetSGBLayout
call Function3200
ret
@@ -1585,7 +1585,7 @@
Function28b22: ; 28b22
call RotateThreePalettesRight
call ClearScreen
- ld b, $8
+ ld b, SCGB_08
call GetSGBLayout
call Function3200
xor a
@@ -1889,7 +1889,7 @@
call DelayFrames
call ClearTileMap
call LoadFontsBattleExtra
- ld b, $8
+ ld b, SCGB_08
call GetSGBLayout
ld a, [hLinkPlayerNumber]
cp $1
@@ -2401,7 +2401,7 @@
pop bc
ld [hl], b
call WaitBGMap
- ld b, $1b
+ ld b, SCGB_1B
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
@@ -2672,7 +2672,7 @@
lb bc, 3, 12
call Function297db
call WaitBGMap
- ld b, $1b
+ ld b, SCGB_1B
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
@@ -2812,7 +2812,7 @@
ld [TempMonDVs], a
ld a, [wPlayerMinimized]
ld [TempMonDVs + 1], a
- ld b, $1a
+ ld b, SCGB_1A
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
@@ -2838,7 +2838,7 @@
ld [TempMonDVs], a
ld a, [wPlayerWrapCount]
ld [TempMonDVs + 1], a
- ld b, $1a
+ ld b, SCGB_1A
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -41,7 +41,7 @@
Function116f8: ; 116f8
call ClearBGPalettes
- ld b, $8
+ ld b, SCGB_08
call GetSGBLayout
call DisableLCD
call Function11c51
--- a/engine/party_menu.asm
+++ b/engine/party_menu.asm
@@ -20,7 +20,7 @@
call ClearBGPalettes
call Function5003f
call WaitBGMap
- ld b, $a
+ ld b, SCGB_0A
call GetSGBLayout
call SetPalettes
call DelayFrame
@@ -149,7 +149,7 @@
ld b, $0
add hl, bc
call SetHPPal
- ld b, $fc
+ ld b, SCGB_FC
call GetSGBLayout
.skip
@@ -162,7 +162,7 @@
inc b
dec c
jr nz, .loop
- ld b, $a
+ ld b, SCGB_0A
call GetSGBLayout
ret
; 50117
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -2363,7 +2363,7 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, wMapPals
+ ld hl, UnknBGPals
ld bc, $40
xor a
call ByteFill
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -1952,7 +1952,7 @@
call Request1bpp
call FlyMap
call Function91c8f
- ld b, $2
+ ld b, SCGB_02
call GetSGBLayout
call SetPalettes
.loop
@@ -2378,7 +2378,7 @@
call TownMapPals
hlbgcoord 0, 0
call TownMapBGUpdate
- ld b, $2
+ ld b, SCGB_02
call GetSGBLayout
call SetPalettes
xor a
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -92,7 +92,7 @@
add_predef PartyMonItemName
add_predef GetFrontpic
add_predef GetBackpic
- add_predef Function5108b
+ add_predef FrontpicPredef
add_predef GetTrainerPic
add_predef DecompressPredef ; $40
add_predef CheckTypeMatchup
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -28,9 +28,9 @@
call DisableLCD
hlbgcoord 0, 0
lb bc, 4, 0
- ld a, $7f
+ ld a, " "
call ByteFill
- ld b, $5
+ ld b, SCGB_05
call GetSGBLayout
callab Function8cf53
ld hl, wc6d0
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -1795,7 +1795,7 @@
call PrintLevel
ld hl, PlayerHPPal
call SetHPPal
- ld b, $e
+ ld b, SCGB_0E
call GetSGBLayout
hlcoord 16, 0
lb bc, 1, 3
--- a/engine/stats_screen.asm
+++ b/engine/stats_screen.asm
@@ -848,7 +848,7 @@
ret c
call Function4e307
ld de, VTiles2 tile $00
- predef Function5108b
+ predef FrontpicPredef
hlcoord 0, 0
ld d, $0
ld e, $2
@@ -1051,7 +1051,7 @@
ld [wc2c6], a
call Function4e307
ld de, VTiles2 tile $00
- predef Function5108b
+ predef FrontpicPredef
pop de
hlcoord 0, 0
ld d, $0
--- a/engine/timeofdaypals.asm
+++ b/engine/timeofdaypals.asm
@@ -39,7 +39,7 @@
; save bg palette 8
- ld hl, wMapPals + 8 * 7 ; wMapPals + 7 pals
+ ld hl, UnknBGPals + 8 * 7 ; UnknBGPals + 7 pals
; save wram bank
ld a, [rSVBK]
@@ -65,12 +65,12 @@
; update sgb pals
- ld b, $9
+ ld b, SCGB_09
call GetSGBLayout
; restore bg palette 8
- ld hl, Unkn2Pals - 1 ; last byte in wMapPals
+ ld hl, UnknOBPals - 1 ; last byte in UnknBGPals
; save wram bank
ld a, [rSVBK]
@@ -172,12 +172,12 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, wMapPals
+ ld hl, UnknBGPals
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
- ld hl, wMapPals + 8
+ ld hl, UnknBGPals + 8
ld c, $6
.asm_8c0d4
ld a, e
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -144,7 +144,7 @@
; Update palette colors
ld hl, TitleScreenPalettes
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, 4 * 32
call CopyBytes
@@ -220,7 +220,7 @@
ld [hBGMapMode], a
xor a
- ld [wMapPals + 2], a
+ ld [UnknBGPals + 2], a
; Play starting sound effect
call SFXChannelsOff
@@ -231,7 +231,7 @@
; 10eea7
SuicuneFrameIterator: ; 10eea7
- ld hl, wMapPals + 2
+ ld hl, UnknBGPals + 2
ld a, [hl]
ld c, a
inc [hl]
--- a/event/whiteout.asm
+++ b/event/whiteout.asm
@@ -42,7 +42,7 @@
; 1250a
BattleBGMap: ; 1250a
- ld b, $0
+ ld b, SCGB_00
call GetSGBLayout
call SetPalettes
ret
--- a/gfx/pics/animation.asm
+++ b/gfx/pics/animation.asm
@@ -1113,7 +1113,7 @@
push bc
push hl
ld de, VTiles2
- predef Function5108b
+ predef FrontpicPredef
pop hl
pop bc
ld d, 0
--- a/home.asm
+++ b/home.asm
@@ -748,9 +748,8 @@
; 333e
-ClearSGB:: ; 333e
- ld b, $ff
-
+GetMemSGBLayout:: ; 333e
+ ld b, SCGB_RAM
GetSGBLayout:: ; 3340
; load sgb packets unless dmg
--- a/home/map.asm
+++ b/home/map.asm
@@ -2029,10 +2029,8 @@
call Function2bae
call UpdateSprites
call Functiond90
-; 2b5c
-
Function2b5c:: ; 2b5c
- ld b, $9
+ ld b, SCGB_09
call GetSGBLayout
callba Function49409
call Function3200
@@ -2056,7 +2054,7 @@
set 0, [hl]
call UpdateSprites
call Function3200
- ld b, $9
+ ld b, SCGB_09
call GetSGBLayout
callba Function49409
call UpdateTimePals
--- a/home/palettes.asm
+++ b/home/palettes.asm
@@ -95,7 +95,7 @@
; copy & reorder bg pal buffer
ld hl, BGPals ; to
- ld de, wMapPals ; from
+ ld de, UnknBGPals ; from
; order
ld a, [rBGP]
ld b, a
@@ -143,7 +143,7 @@
; copy & reorder obj pal buffer
ld hl, OBPals ; to
- ld de, Unkn2Pals ; from
+ ld de, UnknOBPals ; from
; order
ld a, [rOBP0]
ld b, a
@@ -182,7 +182,7 @@
ld [rSVBK], a
ld hl, OBPals
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld a, [rOBP0]
ld b, a
ld c, $1
@@ -216,7 +216,7 @@
ld a, $5
ld [rSVBK], a
ld hl, OBPals + 8
- ld de, Unkn2Pals + 8
+ ld de, UnknOBPals + 8
ld a, [rOBP1]
ld b, a
ld c, $1
--- a/main.asm
+++ b/main.asm
@@ -9925,7 +9925,7 @@
call CopyMenuDataHeader
call ClearMenuBoxInterior
call WaitBGMap
- call ClearSGB
+ call GetMemSGBLayout
xor a
ld [hBGMapMode], a
call OverworldTextModeSwitch
@@ -12161,7 +12161,7 @@
.continue
callba GetMonFrontpic
callba _LoadBattleFontsHPBar
- call ClearSGB
+ call GetMemSGBLayout
call WriteBackup
call LoadStandardMenuDataHeader
call WaitBGMap
@@ -15449,7 +15449,7 @@
Function48e47: ; 48e47 (12:4e47)
ld hl, Palette_48e5c
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $8
ld a, $5
call FarCopyWRAM
@@ -15613,10 +15613,10 @@
Function4930f: ; 4930f (mobile)
ld a, b
- cp $ff
- jr nz, .asm_49317
+ cp SCGB_RAM
+ jr nz, .not_ram
ld a, [SGBPredef]
-.asm_49317
+.not_ram
push af
callba Function9673
pop af
@@ -15623,7 +15623,7 @@
ld l, a
ld h, 0
add hl, hl
- ld de, Jumptable_49330
+ ld de, .jumptable
add hl, de
ld a, [hli]
ld h, [hl]
@@ -15635,7 +15635,7 @@
ret
; 49330 (12:5330)
-Jumptable_49330: ; 49330
+.jumptable: ; 49330
dw Function4936e
dw Function4942f
dw Function49706
@@ -15667,15 +15667,15 @@
ret
Function49351: ; 49351 (12:5351)
- ld de, wMapPals
+ ld de, UnknBGPals
ld hl, Palette_493e1
ld bc, $28
- ld a, $5 ; BANK(wMapPals)
+ ld a, $5 ; BANK(UnknBGPals)
call FarCopyWRAM
- ld de, wMapPals + $38
+ ld de, UnknBGPals + $38
ld hl, Palette_49418
ld bc, $8
- ld a, $5 ; BANK(wMapPals)
+ ld a, $5 ; BANK(UnknBGPals)
call FarCopyWRAM
ret
@@ -15755,7 +15755,7 @@
Function49409:: ; 49409
ld hl, Palette_49418
- ld de, wMapPals + 8 * 7
+ ld de, UnknBGPals + 8 * 7
ld bc, 8
ld a, $5
call FarCopyWRAM
@@ -15771,9 +15771,9 @@
Function49420:: ; 49420 (12:5420)
ld hl, MansionPalette4
- ld de, wMapPals + $30
+ ld de, UnknBGPals + $30
ld bc, $8
- ld a, $5 ; BANK(wMapPals)
+ ld a, $5 ; BANK(UnknBGPals)
call FarCopyWRAM
ret
; 4942f (12:542f)
@@ -15780,10 +15780,10 @@
Function4942f: ; 4942f
call Function49351
- ld de, wMapPals + $38
+ ld de, UnknBGPals + $38
ld hl, Palette_49478
ld bc, $8
- ld a, $5 ; BANK(wMapPals)
+ ld a, $5 ; BANK(UnknBGPals)
call FarCopyWRAM
call Function49346
hlcoord 0, 0, AttrMap
@@ -15901,7 +15901,7 @@
LoadPokeComPalette: ; 494f2
ld a, $5
- ld de, wMapPals
+ ld de, UnknBGPals
ld hl, PokeComPalette
ld bc, 8 palettes
call FarCopyWRAM
@@ -15914,7 +15914,7 @@
LoadBattleTowerPalette: ; 49541
ld a, $5
- ld de, wMapPals
+ ld de, UnknBGPals
ld hl, BattleTowerPalette
ld bc, 8 palettes
call FarCopyWRAM
@@ -15927,7 +15927,7 @@
LoadIcePathPalette: ; 49590
ld a, $5
- ld de, wMapPals
+ ld de, UnknBGPals
ld hl, IcePathPalette
ld bc, 8 palettes
call FarCopyWRAM
@@ -15940,7 +15940,7 @@
LoadHousePalette: ; 495df
ld a, $5
- ld de, wMapPals
+ ld de, UnknBGPals
ld hl, HousePalette
ld bc, 8 palettes
call FarCopyWRAM
@@ -15953,7 +15953,7 @@
LoadRadioTowerPalette: ; 4962e
ld a, $5
- ld de, wMapPals
+ ld de, UnknBGPals
ld hl, RadioTowerPalette
ld bc, 8 palettes
call FarCopyWRAM
@@ -16016,22 +16016,22 @@
LoadMansionPalette: ; 496c5
ld a, $5
- ld de, wMapPals
+ ld de, UnknBGPals
ld hl, MansionPalette1
ld bc, 8 palettes
call FarCopyWRAM
ld a, $5
- ld de, wMapPals + 4 palettes
+ ld de, UnknBGPals + 4 palettes
ld hl, MansionPalette2
ld bc, 1 palettes
call FarCopyWRAM
ld a, $5
- ld de, wMapPals + 3 palettes
+ ld de, UnknBGPals + 3 palettes
ld hl, MansionPalette3
ld bc, 1 palettes
call FarCopyWRAM
ld a, $5
- ld de, wMapPals + 6 palettes
+ ld de, UnknBGPals + 6 palettes
ld hl, MansionPalette4
ld bc, 1 palettes
call FarCopyWRAM
@@ -16047,7 +16047,7 @@
Function49706: ; 49706
ld hl, Palette_49732
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
@@ -16055,7 +16055,7 @@
call Function49346
callba Function96b3
ld hl, Palette_4973a
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
@@ -16078,7 +16078,7 @@
Function49742: ; 49742
ld hl, Palette_49757
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $40
ld a, $5
call FarCopyWRAM
@@ -16182,7 +16182,7 @@
Function49811: ; 49811
ld hl, Palette_49826
- ld de, wMapPals + $10
+ ld de, UnknBGPals + $10
ld bc, $30
ld a, $5
call FarCopyWRAM
@@ -18422,7 +18422,7 @@
ld [CurSpecies], a
call GetBaseData
pop de
- predef Function5108b
+ predef FrontpicPredef
ret
; 4d81e
@@ -20604,7 +20604,7 @@
ret
; 5108b
-Function5108b: ; 5108b
+FrontpicPredef: ; 5108b
ld a, [CurPartySpecies]
ld [CurSpecies], a
call IsAPokemon
@@ -24146,7 +24146,7 @@
ret
LoadMapPalettes: ; 1047eb
- ld b, $9
+ ld b, SCGB_09
jp GetSGBLayout
; 1047f0
--- a/maps/AzaleaTown.asm
+++ b/maps/AzaleaTown.asm
@@ -367,11 +367,11 @@
UnknownText_0x1985b0:
text "SLOWPOKE: …"
- para $56, " ", $56, " ", $56
+ para "<......> <......> <......>"
done
UnknownText_0x1985c3:
- text $56, " ", $56, "Yawn?"
+ text "<......> <......>Yawn?"
done
WoosterText:
--- a/maps/BurnedTower1F.asm
+++ b/maps/BurnedTower1F.asm
@@ -160,7 +160,7 @@
step_end
UnknownText_0x185cd9:
- text $56, " ", $56, " ", $56
+ text "<......> <......> <......>"
para "…Oh, it's you."
--- a/misc/battle_tower_47.asm
+++ b/misc/battle_tower_47.asm
@@ -11,6 +11,12 @@
ld hl, BT_OTTrainerClass
ELSE
ld hl, BT_OTName + 5
+; BUG ALERT
+; Instead of loading the Trainer Class, this routine
+; loads the 6th character in the Trainer's name, then
+; uses it to get the gender of the trainer.
+; As a consequence, the enemy trainer's dialog will
+; always be sampled from the female array.
ENDC
ld a, [hl]
dec a
@@ -2888,7 +2894,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_11d33a
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, 16 * 8
call CopyBytes
pop af
@@ -3015,7 +3021,7 @@
ld a, [hli]
ld b, a
push hl
- ld hl, wMapPals
+ ld hl, UnknBGPals
add hl, de
ld a, [wcd2d]
ld e, a
@@ -4174,7 +4180,7 @@
db $ac, $05, $15, $00
db $00, $00, $09, $00
-BTTrainerClassGenders:
+BTTrainerClassGenders: ; 11f2f0
db MALE ; FALKNER
db FEMALE ; WHITNEY
db FEMALE ; BUGSY
--- a/misc/crystal_misc.asm
+++ b/misc/crystal_misc.asm
@@ -768,26 +768,26 @@
Function17abcf: ; 17abcf (5e:6bcf)
ld a, [rSVBK]
push af
- ld a, BANK(wMapPals)
+ ld a, BANK(UnknBGPals)
ld [rSVBK], a
ld hl, Palette_17ac55
- ld de, wMapPals ; $d000
+ ld de, UnknBGPals ; $d000
ld bc, $30
call CopyBytes
ld hl, Palette_17ac95
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $40
call CopyBytes
ld hl, GFX_17afa5 + $510
- ld de, Unkn2Pals + 2 * 4
+ ld de, UnknOBPals + 2 * 4
ld bc, $10
call CopyBytes
ld hl, MapObjectPals + 8
- ld de, Unkn2Pals + 6 * 4
+ ld de, UnknOBPals + 6 * 4
ld bc, $8
ld a, BANK(MapObjectPals)
call FarCopyBytes
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -623,7 +623,7 @@
ld a, 5
ld [rSVBK], a
ld hl, Palette_894b3
- ld de, wMapPals + 8 * 7
+ ld de, UnknBGPals + 8 * 7
ld bc, 8
call CopyBytes
pop af
@@ -675,11 +675,11 @@
ld a, [hli]
ld h, [hl]
ld l, a
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, 3 palettes
call CopyBytes
ld hl, .Pals345
- ld de, wMapPals + 3 palettes
+ ld de, UnknBGPals + 3 palettes
ld bc, 3 palettes
call CopyBytes
@@ -2154,7 +2154,7 @@
ld a, $5
ld [rSVBK], a
ld c, $8
- ld de, wMapPals
+ ld de, UnknBGPals
.asm_89d1c
push bc
ld hl, Palette_89d4e
@@ -3394,7 +3394,7 @@
ld bc, $18
call CopyBytes
ld hl, Palette_8a5fd
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $8
call CopyBytes
ld hl, Palette_8a605
@@ -3441,7 +3441,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_8a624
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $0008
call CopyBytes
pop af
--- a/misc/mobile_22_2.asm
+++ b/misc/mobile_22_2.asm
@@ -610,7 +610,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_8b6d5
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0018
call CopyBytes
pop af
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -6825,7 +6825,7 @@
Function102dec: ; 102dec
ld hl, Unknown_1032e2
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $0020
ld a, $5
call FarCopyWRAM
--- a/misc/mobile_42.asm
+++ b/misc/mobile_42.asm
@@ -276,7 +276,7 @@
ld [CurSpecies], a
call GetBaseData
pop de
- predef Function5108b
+ predef FrontpicPredef
ret
; 108219
@@ -459,7 +459,7 @@
ld [TempMonDVs], a
ld a, [$c6fe]
ld [TempMonDVs + 1], a
- ld b, $1a
+ ld b, SCGB_1A
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
@@ -552,7 +552,7 @@
ld [TempMonDVs], a
ld a, [wPlayerWrapCount]
ld [TempMonDVs + 1], a
- ld b, $1a
+ ld b, SCGB_1A
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
@@ -594,7 +594,7 @@
ld [TempMonDVs], a
ld a, [$c6fe]
ld [TempMonDVs + 1], a
- ld b, $1a
+ ld b, SCGB_1A
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
@@ -696,7 +696,7 @@
ld [TempMonDVs], a
ld a, [wPlayerWrapCount]
ld [TempMonDVs + 1], a
- ld b, $1a
+ ld b, SCGB_1A
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
@@ -765,7 +765,7 @@
ld [TempMonDVs], a
ld a, [wPlayerWrapCount]
ld [TempMonDVs + 1], a
- ld b, $1a
+ ld b, SCGB_1A
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
@@ -804,7 +804,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_109107
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0040
call CopyBytes
pop af
@@ -850,7 +850,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_109107
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0040
call CopyBytes
pop af
@@ -894,7 +894,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_109107
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0040
call CopyBytes
pop af
@@ -1423,7 +1423,7 @@
and $1
jr z, .asm_108b1c
ld hl, Palette_109187
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $0040
call CopyBytes
ld hl, Palette_109187
@@ -1434,7 +1434,7 @@
.asm_108b1c
ld hl, Palette_109147
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $0040
call CopyBytes
ld hl, Palette_109147
@@ -1459,7 +1459,7 @@
ld a, $5
ld [rSVBK], a
ld de, $7fff
- ld hl, wMapPals
+ ld hl, UnknBGPals
ld a, e
ld [hli], a
ld d, a
@@ -1537,7 +1537,7 @@
ld hl, Palette_108b98
.asm_108bb0
- ld de, wMapPals + 8 * 7
+ ld de, UnknBGPals + 8 * 7
ld bc, $0040
call CopyBytes
pop af
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -5786,7 +5786,7 @@
ld bc, $0010
call CopyBytes
ld hl, Palette_11734e
- ld de, wMapPals + 8 * 7
+ ld de, UnknBGPals + 8 * 7
ld bc, $0008
call CopyBytes
call SetPalettes
@@ -5912,7 +5912,7 @@
ld a, $5
ld [rSVBK], a
ld hl, BGPals
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0040
call CopyBytes
pop af
@@ -5955,7 +5955,7 @@
call ByteFill
call DelayFrame
callba Function14146
- ld b, $9
+ ld b, SCGB_09
call GetSGBLayout
ld a, [rSVBK]
push af
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -175,7 +175,7 @@
cp [hl]
jr nz, .asm_11813e
xor a
- ld [wMapPals], a
+ ld [UnknBGPals], a
pop af
ld [rSVBK], a
call Function118452
@@ -1067,7 +1067,7 @@
set 0, [hl]
ld a, $6
ld [rSVBK], a
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
ld a, [hl]
sla a
@@ -1462,7 +1462,7 @@
ld de, wcc60
ld bc, $80
call CopyBytes
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
jp Function118b10
; 118a7a
@@ -1472,7 +1472,7 @@
ld de, wcc60
ld bc, $80
call CopyBytes
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
jp Function118b10
; 118a8f
@@ -1482,7 +1482,7 @@
ld de, wcc60
ld bc, $80
call CopyBytes
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
jp Function118b10
; 118aa4
@@ -1504,7 +1504,7 @@
ld de, wcc60
ld bc, $80
call CopyBytes
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
jr Function118b10
; 118ad0 (46:4ad0)
@@ -1514,7 +1514,7 @@
ld de, wcc60
ld bc, $80
call CopyBytes
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
jr Function118b10
@@ -2101,7 +2101,7 @@
ld a, $40
ld [wcd89], a
ld hl, wc314 + 48 + 2
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
ld a, $2c
jp Function119e2b
@@ -2115,7 +2115,7 @@
ld e, a
ld a, [wcd50]
ld d, a
- ld a, [wMapPals]
+ ld a, [UnknBGPals]
ld c, a
ld a, [wd001]
ld b, a
@@ -2127,7 +2127,7 @@
ld a, $6
ld [rSVBK], a
ld hl, wd002
- ld a, [wMapPals]
+ ld a, [UnknBGPals]
ld c, a
ld a, [wd001]
ld b, a
@@ -2174,7 +2174,7 @@
ld de, wcc60
call Function1191ad
ret c
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
jp Function118b10
; 1190ec
@@ -2194,7 +2194,7 @@
call CloseSRAM
ld a, $6
call GetSRAMBank
- ld a, [wMapPals]
+ ld a, [UnknBGPals]
ld c, a
ld a, [wd001]
ld b, a
@@ -2207,7 +2207,7 @@
jr z, .asm_11913e
ld a, $6
ld [rSVBK], a
- ld a, [wMapPals]
+ ld a, [UnknBGPals]
ld c, a
ld a, [wd001]
ld b, a
@@ -2674,7 +2674,7 @@
ld a, $8
ld [wcd3c], a
call Function119ed8
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
jp Function118b10
; 119413
@@ -2682,7 +2682,7 @@
Function119413: ; 119413
ld a, $6
call GetSRAMBank
- ld a, [wMapPals]
+ ld a, [UnknBGPals]
ld c, a
ld a, [wd001]
ld b, a
@@ -3039,7 +3039,7 @@
ld [wcd3c], a
call Function119ed8
call Function118b24
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
ld a, $2a
jp Function119e2b
@@ -3334,7 +3334,7 @@
xor a
ld [de], a
call Function118b24
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
ld a, $2a
jp Function119e2b
@@ -3533,7 +3533,7 @@
xor a
ld [wcf65], a
ld [StringBuffer2 + 10], a
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, $20
jp Function119e2b
; 119987
@@ -3540,7 +3540,7 @@
Function119987: ; 119987
ld hl, wd001
- ld a, [wMapPals]
+ ld a, [UnknBGPals]
or [hl]
jr z, .asm_1199a0
ld a, [wcf64]
@@ -3702,13 +3702,13 @@
ld [StringBuffer2 + 12], a
Function119ac9:
- ld a, [wMapPals]
+ ld a, [UnknBGPals]
ld l, a
ld a, [wd001]
ld h, a
dec hl
ld a, l
- ld [wMapPals], a
+ ld [UnknBGPals], a
ld a, h
ld [wd001], a
ld a, [wcf64]
--- a/misc/mobile_5b.asm
+++ b/misc/mobile_5b.asm
@@ -179,7 +179,7 @@
; 16c130
Function16c130: ; 16c130
- ld de, wMapPals
+ ld de, UnknBGPals
ld hl, Unknown_16c903
ld bc, 8
ld a, $5
@@ -274,7 +274,7 @@
ld [rSVBK], a
ld a, $ff
ld bc, $0008
- ld hl, wMapPals
+ ld hl, UnknBGPals
call ByteFill
pop af
ld [rSVBK], a
@@ -291,7 +291,7 @@
call Function16cab6
call Function16cabb
ld d, a
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cabb
cp d
@@ -305,7 +305,7 @@
jr nz, .asm_16c981
.asm_16c988
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cadc
@@ -314,7 +314,7 @@
call Function16cab6
call Function16cad8
ld d, a
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cad8
cp d
@@ -328,7 +328,7 @@
jr nz, .asm_16c9a9
.asm_16c9b0
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cb08
@@ -337,7 +337,7 @@
call Function16cab6
call Function16cac4
ld d, a
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cac4
cp d
@@ -351,7 +351,7 @@
jr nz, .asm_16c9d1
.asm_16c9d8
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cae8
@@ -402,7 +402,7 @@
ld e, $0
ld a, $0
.asm_16ca28
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cabb
cp $1f
@@ -416,12 +416,12 @@
jr nz, .asm_16ca37
.asm_16ca3f
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cadc
.asm_16ca48
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cad8
cp $1f
@@ -435,12 +435,12 @@
jr nz, .asm_16ca57
.asm_16ca5f
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cb08
.asm_16ca68
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cac4
cp $1f
@@ -454,7 +454,7 @@
jr nz, .asm_16ca77
.asm_16ca7f
- ld hl, wMapPals
+ ld hl, UnknBGPals
call Function16cab6
call Function16cae8
@@ -752,7 +752,7 @@
ld de, wd008
call Function16cc41
ld hl, Unknown_16cfb1
- ld de, Unkn2Pals
+ ld de, UnknOBPals
call Function16cc41
ld hl, Unknown_16cfb9
ld de, wd048
@@ -890,7 +890,7 @@
call ClearSprites
callba Function16d421
callba Function16d42e
- ld b, $8
+ ld b, SCGB_08
call GetSGBLayout
call SetPalettes
call WaitBGMap
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -1631,7 +1631,7 @@
ld hl, LZ_1715a4
ld de, wd000
call Decompress
- ld de, wMapPals
+ ld de, UnknBGPals
ld hl, VTiles0
lb bc, $6, $53
call Get2bpp
@@ -2056,7 +2056,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_171d71
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $40
call CopyBytes
ld hl, EngineBuffer5
@@ -2219,7 +2219,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_172edf
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $40
call CopyBytes
ld hl, Palette_172edf
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -48,11 +48,11 @@
ld a, [rSVBK]
push af
- ld a, 5 ; BANK(wMapPals)
+ ld a, 5 ; BANK(UnknBGPals)
ld [rSVBK], a
ld hl, HaveWantPals
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $80
call CopyBytes
@@ -664,7 +664,7 @@
ld a, $6
call GetSRAMBank
ld hl, $a006
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
call CopyBytes
call CloseSRAM
@@ -705,7 +705,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_17eff6
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0040
call CopyBytes
call SetPalettes
@@ -985,7 +985,7 @@
ld a, $5
ld [rSVBK], a
ld hl, $c608
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0040
call CopyBytes
ld a, $4
@@ -1239,7 +1239,7 @@
call GetSRAMBank
ld hl, $a006
add hl, bc
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $1000
call CopyBytes
call CloseSRAM
@@ -1363,7 +1363,7 @@
ld a, [hli]
ld d, a
push hl
- ld hl, wMapPals
+ ld hl, UnknBGPals
add hl, de
ld de, wcc60
.asm_17d86c
@@ -1432,7 +1432,7 @@
ld a, $3
ld [rSVBK], a
ld hl, $c608
- ld de, wMapPals
+ ld de, UnknBGPals
ld b, $0
call CopyBytes
ld a, $4
@@ -1467,7 +1467,7 @@
call Function17e41e
call Function17e32b
pop de
- ld hl, wMapPals
+ ld hl, UnknBGPals
add hl, de
ld de, wcc60
.asm_17d918
@@ -1984,7 +1984,7 @@
Function17dcaf:
ld a, $5
ld [rSVBK], a
- ld hl, wMapPals
+ ld hl, UnknBGPals
ld de, $0008
ld c, $8
.asm_17dcbb
@@ -3165,7 +3165,7 @@
; 17e40f
Function17e40f: ; 17e40f
- ld de, wMapPals
+ ld de, UnknBGPals
add hl, de
jr Function17e41e
@@ -4419,7 +4419,7 @@
ld e, a
ld a, [hli]
ld d, a
- ld hl, wMapPals
+ ld hl, UnknBGPals
add hl, de
ld e, l
ld d, h
--- a/misc/unused_title.asm
+++ b/misc/unused_title.asm
@@ -67,12 +67,12 @@
ld [rSVBK], a
ld hl, UnusedTitleBG_Palettes
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $40
call CopyBytes
ld hl, UnusedTitleFG_Palettes
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $40
call CopyBytes
--- a/predef/cgb.asm
+++ b/predef/cgb.asm
@@ -8,12 +8,12 @@
Predef_LoadSGBLayoutCGB: ; 8d59
ld a, b
- cp $ff
- jr nz, .asm_8d61
+ cp SCGB_RAM
+ jr nz, .not_ram
ld a, [SGBPredef]
-.asm_8d61
- cp -4
+.not_ram
+ cp SCGB_FC
jp z, Function96f3
call Function9673
ld l, a
@@ -69,21 +69,21 @@
_CGB00: ; 8db8
ld hl, PalPacket_9c66 + 1
- ld de, wMapPals
+ ld de, UnknBGPals
ld c, $4
call CopyPalettes
ld hl, PalPacket_9c66 + 1
- ld de, wMapPals + $20
+ ld de, UnknBGPals + $20
ld c, $4
call CopyPalettes
ld hl, PalPacket_9c66 + 1
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld c, $2
call CopyPalettes
jr Function8e23
_CGB01: ; 8ddb
- ld de, wMapPals
+ ld de, UnknBGPals
call Function9729
push hl
call Function9643
@@ -110,12 +110,12 @@
call Function9643
ld hl, Palettes_a8ca
call Function9643
- ld de, Unkn2Pals
+ ld de, UnknOBPals
pop hl
call Function9643
pop hl
call Function9643
- ld a, $1
+ ld a, SCGB_01
ld [SGBPredef], a
call Function96a4
@@ -150,7 +150,7 @@
ld a, $7
call ByteFill
ld hl, Palettes_979c
- ld de, Unkn2Pals + $10
+ ld de, UnknOBPals + $10
ld bc, $0030
ld a, $5
call FarCopyWRAM
@@ -168,7 +168,7 @@
ld hl, Palette_b309
.asm_8e93
- ld de, wMapPals + 8 * 7
+ ld de, UnknBGPals + 8 * 7
ld bc, $0008
ld a, $5
call FarCopyWRAM
@@ -182,7 +182,7 @@
ld hl, Palette_b309
.asm_8ead
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0008
ld a, $5
call FarCopyWRAM
@@ -200,7 +200,7 @@
ld hl, Palettes_b729
.asm_8ec8
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0030
ld a, $5
call FarCopyWRAM
@@ -211,7 +211,7 @@
; 8edb
_CGB03: ; 8edb
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, [wcda1]
ld l, a
ld h, $0
@@ -228,7 +228,7 @@
ld hl, Palettes_a8ca
call Function9643
ld hl, Palette8f52
- ld de, wMapPals + 8 * 3
+ ld de, UnknBGPals + 8 * 3
ld bc, $0018
ld a, $5
call FarCopyWRAM
@@ -286,7 +286,7 @@
; 8f70
_CGB04: ; 8f70
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, $1d
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
@@ -309,7 +309,7 @@
call FillBoxCGB
call Function971a
ld hl, Palette8fc2
- ld de, Unkn2Pals + $38
+ ld de, UnknOBPals + $38
ld bc, $0008
ld a, $5
call FarCopyWRAM
@@ -334,7 +334,7 @@
; 8fca
_CGB17: ; 8fca
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, $1d
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
@@ -395,7 +395,7 @@
; 903e
_CGB16: ; 903e
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, $1d
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
@@ -417,7 +417,7 @@
_CGB05: ; 906e
ld hl, Palettes_b7a9
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0080
ld a, $5
call FarCopyWRAM
@@ -473,7 +473,7 @@
ld hl, PalPacket_9ca6 + 1
call CopyFourPalettes
call Function9699
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld a, $3c
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
@@ -508,10 +508,10 @@
Function9133: ; 9133
ld hl, Palette_914e
- ld de, wMapPals
+ ld de, UnknBGPals
call LoadHLPaletteIntoDE
ld hl, Palette_9156
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $0010
ld a, $5
call FarCopyWRAM
@@ -538,11 +538,11 @@
; 9166
Function9166: ; 9166
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, $38
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld a, $39
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
@@ -553,7 +553,7 @@
Function9180: ; 9180
ld hl, PalPacket_9c36 + 1
call CopyFourPalettes
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld a, $3a
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
@@ -563,7 +563,7 @@
_CGB11: ; 9195
ld hl, Palettes_b789
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0028
ld a, $5
call FarCopyWRAM
@@ -575,7 +575,7 @@
_CGB08: ; 91ad
ld hl, Palettes_b641
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0080
ld a, $5
call FarCopyWRAM
@@ -588,7 +588,7 @@
_CGB09: ; 91c8
call Functionb1de
- ld a, $9
+ ld a, SCGB_09
ld [SGBPredef], a
ret
; 91d1
@@ -604,7 +604,7 @@
; 91e4
_CGB0b: ; 91e4
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, c
and a
jr z, .asm_91f5
@@ -624,7 +624,7 @@
call Function974b
call Function9643
ld hl, Palettes_979c
- ld de, Unkn2Pals + $10
+ ld de, UnknOBPals + $10
ld bc, $0030
ld a, $5
call FarCopyWRAM
@@ -640,16 +640,16 @@
_CGB0c: ; 9228
ld hl, Palettes_b6f1
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0028
ld a, $5
call FarCopyWRAM
ld hl, Palettes_b719
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $0010
ld a, $5
call FarCopyWRAM
- ld a, $8
+ ld a, SCGB_08
ld [SGBPredef], a
call Function96a4
ld a, $1
@@ -668,7 +668,7 @@
_CGB18: ; 925e
ld hl, PalPacket_9bc6 + 1
call CopyFourPalettes
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld a, $4c
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
@@ -676,7 +676,7 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, Unkn2Pals
+ ld hl, UnknOBPals
ld a, $1f
ld [hli], a
ld a, $0
@@ -689,7 +689,7 @@
; 9289
_CGB15: ; 9289
- ld de, wMapPals
+ ld de, UnknBGPals
xor a
call Function976b
call Function9643
@@ -794,7 +794,7 @@
; 9373
_CGB0e: ; 9373
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, $10
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
@@ -831,7 +831,7 @@
; 93ba
_CGB10: ; 93ba
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, $1d
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
@@ -859,7 +859,7 @@
ld hl, Palettes_9439
.asm_93e9
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0040
ld a, $5
call FarCopyWRAM
@@ -1000,15 +1000,15 @@
; 94fa
_CGB19: ; 94fa
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, $4e
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
ld hl, Palette_9521
- ld de, Unkn2Pals
+ ld de, UnknOBPals
call LoadHLPaletteIntoDE
ld hl, Palette_9521
- ld de, Unkn2Pals + 8
+ ld de, UnknOBPals + 8
call LoadHLPaletteIntoDE
call Function9699
call Function96b3
@@ -1024,7 +1024,7 @@
; 9529
_CGB1a: ; 9529
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call Function974b
@@ -1036,7 +1036,7 @@
; 9542
_CGB1e: ; 9542
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, [CurPartySpecies]
call Function9775
call Function9643
@@ -1049,11 +1049,11 @@
ld hl, PalPacket_9cc6 + 1
call CopyFourPalettes
ld hl, Palettes_b681
- ld de, Unkn2Pals
+ ld de, UnknOBPals
ld bc, $0008
ld a, $5
call FarCopyWRAM
- ld de, Unkn2Pals + $38
+ ld de, UnknOBPals + $38
ld a, $1c
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
@@ -1062,7 +1062,7 @@
; 9578
_CGB1c: ; 9578
- ld de, wMapPals
+ ld de, UnknBGPals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call Function9764
@@ -1075,7 +1075,7 @@
_CGB1d: ; 9591
ld hl, Palette95e0
- ld de, wMapPals
+ ld de, UnknBGPals
ld bc, $0010
ld a, $5
call FarCopyWRAM
--- a/predef/sgb.asm
+++ b/predef/sgb.asm
@@ -4,12 +4,12 @@
jp nz, Predef_LoadSGBLayoutCGB
ld a, b
- cp $ff
- jr nz, .asm_865a
+ cp SCGB_RAM
+ jr nz, .not_ram
ld a, [SGBPredef]
-.asm_865a
- cp $fc
+.not_ram
+ cp SCGB_FC
jp z, Function8ade
ld l, a
ld h, 0
@@ -136,7 +136,7 @@
ld hl, wcda9
ld de, wcda9 + $10
- ld a, $1
+ ld a, SCGB_01
ld [SGBPredef], a
ret
; 873c
@@ -341,7 +341,7 @@
.SGB0c: ; 8884
ld hl, PalPacket_9b96
ld de, BlkPacket_9b56
- ld a, $8
+ ld a, SCGB_08
ld [SGBPredef], a
ret
; 8890
@@ -377,7 +377,7 @@
ld hl, wcda9 + 1
ld [hld], a
ld de, BlkPacket_9a86
- ld a, $9
+ ld a, SCGB_09
ld [SGBPredef], a
ret
; 88cd
--- a/text/battle_tower.asm
+++ b/text/battle_tower.asm
@@ -186,20 +186,20 @@
; 0x1ec402
UnknownText_0x1ec402: ; 0x1ec402
- text $56, $56, $56
- line $56, $56, "Battle?"
+ text "<......><......><......>"
+ line "<......><......>Battle?"
done
; 0x1ec411
UnknownText_0x1ec411: ; 0x1ec411
- text $56, $56, $56
- line $56, $56, "I won?"
+ text "<......><......><......>"
+ line "<......><......>I won?"
done
; 0x1ec41f
UnknownText_0x1ec41f: ; 0x1ec41f
- text $56, $56, $56
- line $56, $56, "I lost?"
+ text "<......><......><......>"
+ line "<......><......>I lost?"
done
; 0x1ec42e
--- a/tilesets/animations.asm
+++ b/tilesets/animations.asm
@@ -958,7 +958,7 @@
jr z, .color2
.color1
- ld hl, wMapPals + $1a ; pal 3 color 1
+ ld hl, UnknBGPals + $1a ; pal 3 color 1
ld a, [hli]
ld [rBGPD], a
ld a, [hli]
@@ -966,7 +966,7 @@
jr .end
.color0
- ld hl, wMapPals + $18 ; pal 3 color 0
+ ld hl, UnknBGPals + $18 ; pal 3 color 0
ld a, [hli]
ld [rBGPD], a
ld a, [hli]
@@ -974,7 +974,7 @@
jr .end
.color2
- ld hl, wMapPals + $1c ; pal 3 color 2
+ ld hl, UnknBGPals + $1c ; pal 3 color 2
ld a, [hli]
ld [rBGPD], a
ld a, [hli]
@@ -1011,11 +1011,11 @@
ld a, [hVBlankCounter]
and %00000010
jr nz, .bit1set
- ld hl, wMapPals + $20 ; pal 4 color 0
+ ld hl, UnknBGPals + $20 ; pal 4 color 0
jr .okay
.bit1set
- ld hl, wMapPals + $22 ; pal 4 color 2
+ ld hl, UnknBGPals + $22 ; pal 4 color 2
.okay
ld a, [hli]
--- a/wram.asm
+++ b/wram.asm
@@ -2896,7 +2896,7 @@
wPokeAnimStructEnd::
-SECTION "WRAM 3", WRAMX, BANK [3]
+SECTION "Battle Tower", WRAMX, BANK [3]
w3_d000:: ; d000
ds $80
@@ -2912,9 +2912,9 @@
; d200
BT_TrainerTextIndex::
ds $be
-w3_d2be::
- ds $542
+w3_d2be:: ds 1
+SECTION "WRAM 3 part 2", WRAMX [$d800], BANK [3]
wBTChoiceOfLvlGroup::
w3_d800:: ds $400
w3_dc00:: ds $168
@@ -2924,10 +2924,10 @@
SECTION "GBC Video", WRAMX, BANK [5]
; 8 4-color palettes
-wMapPals:: ds 8 * 8 ; d000
-Unkn2Pals:: ds 8 * 8 ; d040
-BGPals:: ds 8 * 8 ; d080
-OBPals:: ds 8 * 8 ; d0c0
+UnknBGPals:: ds 8 palettes ; d000
+UnknOBPals:: ds 8 palettes ; d040
+BGPals:: ds 8 palettes ; d080
+OBPals:: ds 8 palettes ; d0c0
LYOverrides:: ; d100
ds SCREEN_HEIGHT_PX