ref: f27f79488a460f0a89670f3611e1e9e175baf5d6
parent: 8c3905c4cdb4f24810473da51d52cc3e16062173
parent: e5fa3f9a11fb6936709cd0c36e945bd6e018cb37
author: yenatch <yenatch@gmail.com>
date: Mon Jan 1 11:54:45 EST 2018
Merge pull request #455 from xCrystal/master Use more palette(s) constants, rename BG/OBP wram addresses, and rBGPI+rOBPI auto-increment constants (from Rangi)
--- a/constants/credits_constants.asm
+++ b/constants/credits_constants.asm
@@ -1,4 +1,4 @@
-; CreditsStrings indexes (see data/credits_text.asm)
+; CreditsStrings indexes (see data/credits_strings.asm)
const_def
const SATOSHI_TAJIRI
const JUNICHI_MASUDA
--- a/constants/hardware_constants.asm
+++ b/constants/hardware_constants.asm
@@ -50,7 +50,7 @@
OAM_Y_FLIP EQU 6
OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
-; BP Map attribute flags
+; BG Map attribute flags
PALETTE_MASK EQU %111
VRAM_BANK_1 EQU 1 << OAM_TILE_BANK ; $08
OBP_NUM EQU 1 << OAM_OBP_NUM ; $10
@@ -60,7 +60,7 @@
; Other useful constants
LCDC_DEFAULT EQU %11100011
-LY_VBLANK EQU 144
+LY_VBLANK EQU 144
; Hardware registers
rJOYP EQU $ff00 ; Joypad (R/W)
@@ -145,8 +145,10 @@
rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start
rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port
rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index
+rBGPI_AUTO_INCREMENT EQU 7 ; increment rBGPI after write to rBGPD
rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data
rOBPI EQU $ff6a ; CGB Mode Only - Sprite Palette Index
+rOBPI_AUTO_INCREMENT EQU 7 ; increment rOBPI after write to rOBPD
rOBPD EQU $ff6b ; CGB Mode Only - Sprite Palette Data
rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only
rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -21,7 +21,7 @@
; `mapgroup` indexes are for the sub-tables of MapGroupPointers (see maps/map_headers.asm)
const_def
- newgroup ; 1
+ newgroup ; 1
mapgroup OLIVINE_POKECENTER_1F, 4, 5 ; 1
mapgroup OLIVINE_GYM, 8, 5 ; 2
@@ -38,7 +38,7 @@
mapgroup ROUTE_39, 18, 10 ; 13
mapgroup OLIVINE_CITY, 18, 20 ; 14
- newgroup ; 2
+ newgroup ; 2
mapgroup MAHOGANY_RED_GYARADOS_SPEECH_HOUSE, 4, 4 ; 1
mapgroup MAHOGANY_GYM, 9, 5 ; 2
@@ -48,7 +48,7 @@
mapgroup ROUTE_44, 9, 30 ; 6
mapgroup MAHOGANY_TOWN, 9, 10 ; 7
- newgroup ; 3
+ newgroup ; 3
mapgroup SPROUT_TOWER_1F, 8, 10 ; 1
mapgroup SPROUT_TOWER_2F, 8, 10 ; 2
@@ -142,7 +142,7 @@
mapgroup SAFARI_ZONE_BETA, 18, 10 ; 90
mapgroup VICTORY_ROAD, 36, 10 ; 91
- newgroup ; 4
+ newgroup ; 4
mapgroup ECRUTEAK_HOUSE, 9, 10 ; 1
mapgroup WISE_TRIOS_ROOM, 4, 4 ; 2
@@ -154,7 +154,7 @@
mapgroup ECRUTEAK_ITEMFINDER_HOUSE, 4, 4 ; 8
mapgroup ECRUTEAK_CITY, 18, 20 ; 9
- newgroup ; 5
+ newgroup ; 5
mapgroup BLACKTHORN_GYM_1F, 9, 5 ; 1
mapgroup BLACKTHORN_GYM_2F, 9, 5 ; 2
@@ -167,7 +167,7 @@
mapgroup ROUTE_46, 18, 10 ; 9
mapgroup BLACKTHORN_CITY, 18, 20 ; 10
- newgroup ; 6
+ newgroup ; 6
mapgroup CINNABAR_POKECENTER_1F, 4, 5 ; 1
mapgroup CINNABAR_POKECENTER_2F_BETA, 4, 8 ; 2
@@ -178,7 +178,7 @@
mapgroup ROUTE_21, 18, 10 ; 7
mapgroup CINNABAR_ISLAND, 9, 10 ; 8
- newgroup ; 7
+ newgroup ; 7
mapgroup CERULEAN_GYM_BADGE_SPEECH_HOUSE, 4, 4 ; 1
mapgroup CERULEAN_POLICE_STATION, 4, 4 ; 2
@@ -198,7 +198,7 @@
mapgroup ROUTE_25, 9, 30 ; 16
mapgroup CERULEAN_CITY, 18, 20 ; 17
- newgroup ; 8
+ newgroup ; 8
mapgroup AZALEA_POKECENTER_1F, 4, 5 ; 1
mapgroup CHARCOAL_KILN, 4, 4 ; 2
@@ -208,7 +208,7 @@
mapgroup ROUTE_33, 9, 10 ; 6
mapgroup AZALEA_TOWN, 9, 20 ; 7
- newgroup ; 9
+ newgroup ; 9
mapgroup LAKE_OF_RAGE_HIDDEN_POWER_HOUSE, 4, 4 ; 1
mapgroup LAKE_OF_RAGE_MAGIKARP_HOUSE, 4, 4 ; 2
@@ -217,7 +217,7 @@
mapgroup ROUTE_43, 27, 10 ; 5
mapgroup LAKE_OF_RAGE, 18, 20 ; 6
- newgroup ; 10
+ newgroup ; 10
mapgroup ROUTE_32, 45, 10 ; 1
mapgroup ROUTE_35, 18, 10 ; 2
@@ -237,7 +237,7 @@
mapgroup ROUTE_36_RUINS_OF_ALPH_GATE, 4, 5 ; 16
mapgroup ROUTE_36_NATIONAL_PARK_GATE, 4, 5 ; 17
- newgroup ; 11
+ newgroup ; 11
mapgroup ROUTE_34, 27, 10 ; 1
mapgroup GOLDENROD_CITY, 18, 20 ; 2
@@ -264,7 +264,7 @@
mapgroup ROUTE_34_ILEX_FOREST_GATE, 4, 5 ; 23
mapgroup DAY_CARE, 4, 5 ; 24
- newgroup ; 12
+ newgroup ; 12
mapgroup ROUTE_6, 9, 10 ; 1
mapgroup ROUTE_11, 9, 20 ; 2
@@ -280,7 +280,7 @@
mapgroup ROUTE_6_SAFFRON_GATE, 4, 5 ; 12
mapgroup ROUTE_6_UNDERGROUND_PATH_ENTRANCE, 4, 4 ; 13
- newgroup ; 13
+ newgroup ; 13
mapgroup ROUTE_1, 18, 10 ; 1
mapgroup PALLET_TOWN, 9, 10 ; 2
@@ -289,7 +289,7 @@
mapgroup BLUES_HOUSE, 4, 4 ; 5
mapgroup OAKS_LAB, 6, 5 ; 6
- newgroup ; 14
+ newgroup ; 14
mapgroup ROUTE_3, 9, 30 ; 1
mapgroup PEWTER_CITY, 18, 20 ; 2
@@ -300,7 +300,7 @@
mapgroup PEWTER_POKECENTER_2F_BETA, 4, 8 ; 7
mapgroup PEWTER_SNOOZE_SPEECH_HOUSE, 4, 4 ; 8
- newgroup ; 15
+ newgroup ; 15
mapgroup OLIVINE_PORT, 18, 10 ; 1
mapgroup VERMILION_PORT, 18, 10 ; 2
@@ -315,7 +315,7 @@
mapgroup MOUNT_MOON_GIFT_SHOP, 4, 4 ; 11
mapgroup TIN_TOWER_ROOF, 9, 10 ; 12
- newgroup ; 16
+ newgroup ; 16
mapgroup ROUTE_23, 9, 10 ; 1
mapgroup INDIGO_PLATEAU_POKECENTER_1F, 7, 9 ; 2
@@ -326,7 +326,7 @@
mapgroup LANCES_ROOM, 12, 5 ; 7
mapgroup HALL_OF_FAME, 7, 5 ; 8
- newgroup ; 17
+ newgroup ; 17
mapgroup ROUTE_13, 9, 30 ; 1
mapgroup ROUTE_14, 18, 10 ; 2
@@ -342,7 +342,7 @@
mapgroup SAFARI_ZONE_WARDENS_HOME, 4, 5 ; 12
mapgroup ROUTE_15_FUCHSIA_GATE, 4, 5 ; 13
- newgroup ; 18
+ newgroup ; 18
mapgroup ROUTE_8, 9, 20 ; 1
mapgroup ROUTE_12, 27, 10 ; 2
@@ -359,7 +359,7 @@
mapgroup ROUTE_8_SAFFRON_GATE, 4, 5 ; 13
mapgroup ROUTE_12_SUPER_ROD_HOUSE, 4, 4 ; 14
- newgroup ; 19
+ newgroup ; 19
mapgroup ROUTE_28, 9, 20 ; 1
mapgroup SILVER_CAVE_OUTSIDE, 18, 20 ; 2
@@ -366,7 +366,7 @@
mapgroup SILVER_CAVE_POKECENTER_1F, 4, 5 ; 3
mapgroup ROUTE_28_FAMOUS_SPEECH_HOUSE, 4, 4 ; 4
- newgroup ; 20
+ newgroup ; 20
mapgroup POKECENTER_2F, 4, 8 ; 1
mapgroup TRADE_CENTER, 4, 5 ; 2
@@ -375,7 +375,7 @@
mapgroup MOBILE_TRADE_ROOM_MOBILE, 4, 5 ; 5
mapgroup MOBILE_BATTLE_ROOM, 4, 5 ; 6
- newgroup ; 21
+ newgroup ; 21
mapgroup ROUTE_7, 9, 10 ; 1
mapgroup ROUTE_16, 9, 10 ; 2
@@ -404,7 +404,7 @@
mapgroup ROUTE_7_SAFFRON_GATE, 4, 5 ; 25
mapgroup ROUTE_17_18_GATE, 4, 5 ; 26
- newgroup ; 22
+ newgroup ; 22
mapgroup ROUTE_40, 18, 10 ; 1
mapgroup ROUTE_41, 27, 25 ; 2
@@ -423,7 +423,7 @@
mapgroup ROUTE_40_BATTLE_TOWER_GATE, 4, 5 ; 15
mapgroup BATTLE_TOWER_OUTSIDE, 14, 10 ; 16
- newgroup ; 23
+ newgroup ; 23
mapgroup ROUTE_2, 27, 10 ; 1
mapgroup ROUTE_22, 9, 20 ; 2
@@ -439,7 +439,7 @@
mapgroup ROUTE_2_GATE, 4, 5 ; 12
mapgroup VICTORY_ROAD_GATE, 9, 10 ; 13
- newgroup ; 24
+ newgroup ; 24
mapgroup ROUTE_26, 54, 10 ; 1
mapgroup ROUTE_27, 9, 40 ; 2
@@ -455,7 +455,7 @@
mapgroup ROUTE_27_SANDSTORM_HOUSE, 4, 4 ; 12
mapgroup ROUTE_29_46_GATE, 4, 5 ; 13
- newgroup ; 25
+ newgroup ; 25
mapgroup ROUTE_5, 9, 10 ; 1
mapgroup SAFFRON_CITY, 18, 20 ; 2
@@ -473,7 +473,7 @@
mapgroup ROUTE_5_SAFFRON_CITY_GATE, 4, 5 ; 14
mapgroup ROUTE_5_CLEANSE_TAG_SPEECH_HOUSE, 4, 4 ; 15
- newgroup ; 26
+ newgroup ; 26
mapgroup ROUTE_30, 27, 10 ; 1
mapgroup ROUTE_31, 9, 20 ; 2
--- a/docs/battle_anim_commands.md
+++ b/docs/battle_anim_commands.md
@@ -1,6 +1,6 @@
# Battle Animation Commands
-Defined in [macros/scripts/battle_anims.asm](/macros/scripts/battle_anims.asm) and [data/moves/animations.asm:BattleAnimations](/data/moves/animations.asm).
+Defined in [macros/scripts/battle_anims.asm](/macros/scripts/battle_anims.asm) and [engine/battle_anims/anim_commands.asm:BattleAnimCommands](/engine/battle_anims/anim_commands.asm).
## `$00`−`$CF`: `anim_wait` *length*
@@ -80,7 +80,7 @@
## `$DB`: `anim_checkpokeball`
-Sets `var` to the result of [GetPokeBallWobble](/engine/battle_anims/getpokeballwobble.asm).
+Sets `BattleAnimVar` to the result of [GetPokeBallWobble](/engine/battle_anims/getpokeballwobble.asm).
## `$DC`: `anim_transform`
@@ -190,19 +190,19 @@
## `$F8`: `anim_if_param_equal` *value*, *address*
-Jumps to another script if `wKickCounter` is equal to *value*.
+Jumps to another script if `wBattleAnimParam` (aka `wKickCounter` or `wPresentPower`) is equal to *value*.
## `$F9`: `anim_setvar` *value*
-Sets `var` to *value*.
+Sets `BattleAnimVar` to *value*.
## `$FA`: `anim_incvar`
-Increments `var` by 1.
+Increments `BattleAnimVar` by 1.
## `$FB`: `anim_if_var_equal` *value*, *address*
-Jumps to another script if `var` is equal to *value*.
+Jumps to another script if `BattleAnimVar` is equal to *value*.
## `$FC`: `anim_jump` *address*
--- a/docs/map_scripts.md
+++ b/docs/map_scripts.md
@@ -65,7 +65,7 @@
## `.CoordEvents: db` *N*
-- **`coord_event` *x*, *y*, *scene id*, *script***
+- **`coord_event` *x*, *y*, *scene_id*, *script***
## `.BGEvents: db` *N*
@@ -90,7 +90,7 @@
## `.ObjectEvents: db` *N*
-- **`object_event` *x*, *y*, *sprite*, *movement*, *ry*, *rx*, *h1*, *h2*, *palette*, *type*, *range*, *script*, *event_flag***
+- **`object_event` *x*, *y*, *sprite*, *movement*, *rx*, *ry*, *h1*, *h2*, *palette*, *type*, *range*, *script*, *event_flag***
Movement types:
--- a/engine/battle/anim_hp_bar.asm
+++ b/engine/battle/anim_hp_bar.asm
@@ -45,7 +45,7 @@
and a
jr nz, .player
ld a, [wCurHPAnimMaxHP]
- cp 6 * 8
+ cp HP_BAR_LENGTH_PX
jr nc, .player
and a
ret
@@ -203,7 +203,7 @@
ShortHPBarAnim_UpdateTiles: ; d730
call HPBarAnim_UpdateHPRemaining
- ld d, $6
+ ld d, HP_BAR_LENGTH
ld a, [wWhichHPBar]
and $1
ld b, a
@@ -229,7 +229,7 @@
ld d, a
call ComputeHPBarPixels
ld c, e
- ld d, $6
+ ld d, HP_BAR_LENGTH
ld a, [wWhichHPBar]
and $1
ld b, a
@@ -377,7 +377,7 @@
ld b, 0
ld hl, 0
ld a, [wCurHPBarPixels]
- cp 6 * 8
+ cp HP_BAR_LENGTH_PX
jr nc, .return_max
and a
jr z, .return_zero
@@ -388,7 +388,7 @@
; by 48, the loop runs one extra time. To fix, uncomment the line below.
.loop
ld a, l
- sub 6 * 8
+ sub HP_BAR_LENGTH_PX
ld l, a
ld a, h
sbc $0
@@ -404,7 +404,7 @@
add hl, bc
pop bc
ld a, l
- sub 6 * 8
+ sub HP_BAR_LENGTH_PX
ld l, a
ld a, h
sbc $0
--- a/engine/battle/battle_transition.asm
+++ b/engine/battle/battle_transition.asm
@@ -26,7 +26,7 @@
ld a, $5
ld [rSVBK], a
- ld hl, UnknBGPals
+ ld hl, wBGPals1
ld bc, 8 palettes
xor a
call ByteFill
@@ -651,11 +651,11 @@
ld [rSVBK], a
call .copypals
push hl
- ld de, UnknBGPals palette PAL_BG_TEXT
+ ld de, wBGPals1 palette PAL_BG_TEXT
ld bc, 1 palettes
call CopyBytes
pop hl
- ld de, BGPals palette PAL_BG_TEXT
+ ld de, wBGPals2 palette PAL_BG_TEXT
ld bc, 1 palettes
call CopyBytes
pop af
@@ -670,17 +670,17 @@
ret
.copypals ; 8c677 (23:4677)
- ld de, UnknBGPals palette PAL_BG_TEXT
+ ld de, wBGPals1 palette PAL_BG_TEXT
call .copy
- ld de, BGPals palette PAL_BG_TEXT
+ ld de, wBGPals2 palette PAL_BG_TEXT
call .copy
- ld de, UnknOBPals palette PAL_OW_TREE
+ ld de, wOBPals1 palette PAL_OW_TREE
call .copy
- ld de, OBPals palette PAL_OW_TREE
+ ld de, wOBPals2 palette PAL_OW_TREE
call .copy
- ld de, UnknOBPals palette PAL_OW_ROCK
+ ld de, wOBPals1 palette PAL_OW_ROCK
call .copy
- ld de, OBPals palette PAL_OW_ROCK
+ ld de, wOBPals2 palette PAL_OW_ROCK
.copy ; 8c698 (23:4698)
push hl
--- a/engine/battle_anims/anim_commands.asm
+++ b/engine/battle_anims/anim_commands.asm
@@ -1433,14 +1433,14 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, BGPals
- ld de, UnknBGPals
+ ld hl, wBGPals2
+ ld de, wBGPals1
ld a, [rBGP]
ld b, a
ld c, 7
call CopyPals
- ld hl, OBPals
- ld de, UnknOBPals
+ ld hl, wOBPals2
+ ld de, wOBPals1
ld a, [rBGP]
ld b, a
ld c, 2
@@ -1461,8 +1461,8 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, OBPals palette PAL_BATTLE_OB_GRAY
- ld de, UnknOBPals palette PAL_BATTLE_OB_GRAY
+ ld hl, wOBPals2 palette PAL_BATTLE_OB_GRAY
+ ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
ld a, [rOBP0]
ld b, a
ld c, 2
--- a/engine/battle_anims/bg_effects.asm
+++ b/engine/battle_anims/bg_effects.asm
@@ -2583,13 +2583,13 @@
ld a, h
push bc
push af
- ld hl, BGPals
- ld de, UnknBGPals
+ ld hl, wBGPals2
+ ld de, wBGPals1
ld b, a
ld c, $1
call CopyPals
- ld hl, OBPals + 8
- ld de, UnknOBPals + 8
+ ld hl, wOBPals2 palette 1
+ ld de, wOBPals1 palette 1
pop af
ld b, a
ld c, $1
@@ -2610,13 +2610,13 @@
ld a, h
push bc
push af
- ld hl, BGPals + 8
- ld de, UnknBGPals + 8
+ ld hl, wBGPals2 palette 1
+ ld de, wBGPals1 palette 1
ld b, a
ld c, $1
call CopyPals
- ld hl, OBPals ; OBPals
- ld de, UnknOBPals ; wd040
+ ld hl, wOBPals2
+ ld de, wOBPals1
pop af
ld b, a
ld c, $1
--- a/engine/card_flip.asm
+++ b/engine/card_flip.asm
@@ -1652,7 +1652,7 @@
ld a, $5
ld [rSVBK], a
ld hl, .palettes
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 9 palettes
call CopyBytes
pop af
--- a/engine/cgb_layouts.asm
+++ b/engine/cgb_layouts.asm
@@ -68,21 +68,21 @@
_CGB_BattleGrayscale: ; 8db8
ld hl, PalPacket_9c66 + 1
- ld de, UnknBGPals
+ ld de, wBGPals1
ld c, 4
call CopyPalettes
ld hl, PalPacket_9c66 + 1
- ld de, UnknBGPals palette PAL_BATTLE_BG_EXP
+ ld de, wBGPals1 palette PAL_BATTLE_BG_EXP
ld c, 4
call CopyPalettes
ld hl, PalPacket_9c66 + 1
- ld de, UnknOBPals
+ ld de, wOBPals1
ld c, 2
call CopyPalettes
jr _CGB_FinishBattleScreenLayout
_CGB_BattleColors: ; 8ddb
- ld de, UnknBGPals
+ ld de, wBGPals1
call GetBattlemonBackpicPalettePointer
push hl
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_PLAYER
@@ -107,7 +107,7 @@
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_PLAYER_HP
ld hl, ExpBarPalette
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_EXP
- ld de, UnknOBPals
+ ld de, wOBPals1
pop hl
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_OB_ENEMY
pop hl
@@ -146,9 +146,9 @@
ld a, PAL_BATTLE_BG_TEXT
call ByteFill
ld hl, BattleObjectPals
- ld de, UnknOBPals palette PAL_BATTLE_OB_GRAY
+ ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
ld bc, 6 palettes
- ld a, BANK(UnknOBPals)
+ ld a, BANK(wOBPals1)
call FarCopyWRAM
call ApplyAttrMap
ret
@@ -162,9 +162,9 @@
jr nc, .not_mobile
ld hl, Palette_b309
.not_mobile
- ld de, UnknBGPals palette 7
+ ld de, wBGPals1 palette 7
ld bc, 1 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
ret
; 8e9f
@@ -175,9 +175,9 @@
jr nc, .not_mobile
ld hl, Palette_b309
.not_mobile
- ld de, UnknBGPals palette 0
+ ld de, wBGPals1 palette 0
ld bc, 1 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
ret
; 8eb9
@@ -192,9 +192,9 @@
.male
ld hl, MalePokegearPals
.got_pals
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 6 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
call ApplyPals
ld a, $1
@@ -203,7 +203,7 @@
; 8edb
_CGB_StatsScreenHPPals: ; 8edb
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, [wCurHPPal]
ld l, a
ld h, $0
@@ -219,9 +219,9 @@
ld hl, ExpBarPalette
call LoadPalette_White_Col1_Col2_Black ; exp palette
ld hl, StatsScreenPagePals
- ld de, UnknBGPals palette 3
+ ld de, wBGPals1 palette 3
ld bc, 3 palettes ; pink, green, and blue page palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
call WipeAttrMap
@@ -285,7 +285,7 @@
; 8f70
_CGB_Pokedex: ; 8f70
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, $1d
call GetPredefPal
call LoadHLPaletteIntoDE ; dex interface palette
@@ -307,9 +307,9 @@
call FillBoxCGB
call InitPartyMenuOBPals
ld hl, .PokedexCursorPalette
- ld de, UnknOBPals palette 7 ; green cursor palette
+ ld de, wOBPals1 palette 7 ; green cursor palette
ld bc, 1 palettes
- ld a, BANK(UnknOBPals)
+ ld a, BANK(wOBPals1)
call FarCopyWRAM
call ApplyAttrMap
call ApplyPals
@@ -332,7 +332,7 @@
; 8fca
_CGB_BillsPC: ; 8fca
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, $1d
call GetPredefPal
call LoadHLPaletteIntoDE
@@ -392,7 +392,7 @@
; 903e
_CGB_PokedexUnownMode: ; 903e
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, $1d
call GetPredefPal
call LoadHLPaletteIntoDE
@@ -414,9 +414,9 @@
_CGB_SlotMachine: ; 906e
ld hl, SlotMachinePals
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
call WipeAttrMap
hlcoord 0, 2, AttrMap
@@ -470,7 +470,7 @@
ld hl, PalPacket_9ca6 + 1
call CopyFourPalettes
call WipeAttrMap
- ld de, UnknOBPals
+ ld de, wOBPals1
ld a, $3c
call GetPredefPal
call LoadHLPaletteIntoDE
@@ -504,12 +504,12 @@
.Function9133: ; 9133
ld hl, .Palette_914e
- ld de, UnknBGPals
+ ld de, wBGPals1
call LoadHLPaletteIntoDE
ld hl, .Palette_9156
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 2 palettes
- ld a, BANK(UnknOBPals)
+ ld a, BANK(wOBPals1)
call FarCopyWRAM
call WipeAttrMap
ret
@@ -534,12 +534,12 @@
; 9166
.Function9166: ; 9166
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, $38
call GetPredefPal
call LoadHLPaletteIntoDE
- ld de, UnknOBPals
+ ld de, wOBPals1
ld a, $39
call GetPredefPal
call LoadHLPaletteIntoDE
@@ -550,7 +550,7 @@
.Function9180: ; 9180
ld hl, PalPacket_9c36 + 1
call CopyFourPalettes
- ld de, UnknOBPals
+ ld de, wOBPals1
ld a, $3a
call GetPredefPal
call LoadHLPaletteIntoDE
@@ -560,9 +560,9 @@
_CGB11: ; 9195
ld hl, Palettes_b789
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 5 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
call ApplyPals
call WipeAttrMap
@@ -572,9 +572,9 @@
_CGB_Diploma: ; 91ad
ld hl, DiplomaPalettes
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
ld hl, PalPacket_9cb6 + 1
@@ -602,7 +602,7 @@
; 91e4
_CGB_Evolution: ; 91e4
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, c
and a
jr z, .pokemon
@@ -622,9 +622,9 @@
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld hl, BattleObjectPals
- ld de, UnknOBPals palette PAL_BATTLE_OB_GRAY
+ ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
ld bc, 6 palettes
- ld a, BANK(UnknOBPals)
+ ld a, BANK(wOBPals1)
call FarCopyWRAM
.got_palette
@@ -638,14 +638,14 @@
_CGB0c: ; 9228
ld hl, Palettes_b6f1
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 5 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
ld hl, Palettes_b719
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 2 palettes
- ld a, BANK(UnknOBPals)
+ ld a, BANK(wOBPals1)
call FarCopyWRAM
ld a, SCGB_DIPLOMA
ld [SGBPredef], a
@@ -666,15 +666,15 @@
_CGB_UnownPuzzle: ; 925e
ld hl, PalPacket_9bc6 + 1
call CopyFourPalettes
- ld de, UnknOBPals
+ ld de, wOBPals1
ld a, $4c
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [rSVBK]
push af
- ld a, BANK(UnknOBPals)
+ ld a, BANK(wOBPals1)
ld [rSVBK], a
- ld hl, UnknOBPals
+ ld hl, wOBPals1
ld a, $1f
ld [hli], a
ld a, $0
@@ -687,7 +687,7 @@
; 9289
_CGB_TrainerCard: ; 9289
- ld de, UnknBGPals
+ ld de, wBGPals1
xor a ; CHRIS
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
@@ -793,7 +793,7 @@
; 9373
_CGB_MoveList: ; 9373
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, $10
call GetPredefPal
call LoadHLPaletteIntoDE
@@ -829,7 +829,7 @@
; 93ba
_CGB_PokedexSearchOption: ; 93ba
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, $1d
call GetPredefPal
call LoadHLPaletteIntoDE
@@ -858,9 +858,9 @@
ld hl, .ChrisPackPals
.got_gender
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 8 palettes ; 6 palettes?
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
call WipeAttrMap
hlcoord 0, 0, AttrMap
@@ -953,15 +953,15 @@
; 94fa
_CGB_GamefreakLogo: ; 94fa
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, $4e
call GetPredefPal
call LoadHLPaletteIntoDE
ld hl, .Palette
- ld de, UnknOBPals
+ ld de, wOBPals1
call LoadHLPaletteIntoDE
ld hl, .Palette
- ld de, UnknOBPals palette 1
+ ld de, wOBPals1 palette 1
call LoadHLPaletteIntoDE
call WipeAttrMap
call ApplyAttrMap
@@ -977,7 +977,7 @@
; 9529
_CGB_PlayerOrMonFrontpicPals: ; 9529
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call GetPlayerOrMonPalettePointer
@@ -989,7 +989,7 @@
; 9542
_CGB1e: ; 9542
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, [CurPartySpecies]
call GetMonPalettePointer_
call LoadPalette_White_Col1_Col2_Black
@@ -1002,11 +1002,11 @@
ld hl, PalPacket_9cc6 + 1
call CopyFourPalettes
ld hl, PartyMenuOBPals
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 1 palettes
- ld a, BANK(UnknOBPals)
+ ld a, BANK(wOBPals1)
call FarCopyWRAM
- ld de, UnknOBPals palette 7
+ ld de, wOBPals1 palette 7
ld a, $1c
call GetPredefPal
call LoadHLPaletteIntoDE
@@ -1015,7 +1015,7 @@
; 9578
_CGB_TrainerOrMonFrontpicPals: ; 9578
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call GetFrontpicPalettePointer
@@ -1028,9 +1028,9 @@
_CGB_MysteryGift: ; 9591
ld hl, .Palettes
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 2 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
call ApplyPals
call WipeAttrMap
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -142,13 +142,13 @@
ret z
; CGB only
ld hl, .BGPal
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
ld hl, .OBPal
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
@@ -191,7 +191,7 @@
jp PushSGBPals_
.cgb
- ld de, UnknOBPals
+ ld de, wOBPals1
ld a, $3b
call GetPredefPal
jp LoadHLPaletteIntoDE
@@ -207,7 +207,7 @@
jp PushSGBPals_
.cgb
- ld de, UnknOBPals
+ ld de, wOBPals1
ld a, $3c
call GetPredefPal
jp LoadHLPaletteIntoDE
@@ -239,7 +239,7 @@
jp PushSGBPals_
.cgb
- ld de, UnknOBPals
+ ld de, wOBPals1
ld a, c
call GetMonPalettePointer_
call LoadPalette_White_Col1_Col2_Black
@@ -265,7 +265,7 @@
got_palette_pointer_8bd7
push hl
- ld hl, UnknBGPals
+ ld hl, wBGPals1
ld de, 1 palettes
.loop
and a
@@ -327,7 +327,7 @@
call GetTrainerPalettePointer
.load_palettes
- ld de, UnknBGPals
+ ld de, wBGPals1
call LoadPalette_White_Col1_Col2_Black
call WipeAttrMap
call ApplyAttrMap
@@ -345,11 +345,11 @@
ret
.Enemy:
- ld de, BGPals palette PAL_BATTLE_BG_ENEMY_HP + 2
+ ld de, wBGPals2 palette PAL_BATTLE_BG_ENEMY_HP + 2
jr .okay
.Player:
- ld de, BGPals palette PAL_BATTLE_BG_PLAYER_HP + 2
+ ld de, wBGPals2 palette PAL_BATTLE_BG_PLAYER_HP + 2
.okay
ld l, c
@@ -397,11 +397,11 @@
ld a, $5
ld [rSVBK], a
ld a, [hli]
- ld [UnknBGPals palette 0], a
- ld [UnknBGPals palette 2], a
+ ld [wBGPals1 palette 0], a
+ ld [wBGPals1 palette 2], a
ld a, [hl]
- ld [UnknBGPals palette 0 + 1], a
- ld [UnknBGPals palette 2 + 1], a
+ ld [wBGPals1 palette 0 + 1], a
+ ld [wBGPals1 palette 2 + 1], a
pop af
ld [rSVBK], a
call ApplyPals
@@ -441,7 +441,7 @@
ret
.cgb
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
@@ -458,7 +458,7 @@
Function95f0:
; XXX
ld hl, .Palette
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
@@ -474,7 +474,7 @@
RGB 00, 03, 19
CopyFourPalettes:
- ld de, UnknBGPals
+ ld de, wBGPals1
ld c, $4
CopyPalettes:
@@ -575,7 +575,7 @@
ld a, $5
ld [rSVBK], a
- ld hl, UnknBGPals
+ ld hl, wBGPals1
ld c, 1 palettes
.loop
ld a, $ff
@@ -608,8 +608,8 @@
ret
ApplyPals:
- ld hl, UnknBGPals
- ld de, BGPals
+ ld hl, wBGPals1
+ ld de, wBGPals2
ld bc, 16 palettes
ld a, $5
call FarCopyWRAM
@@ -686,7 +686,7 @@
InitPartyMenuOBPals:
ld hl, PartyMenuOBPals
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 2 palettes
ld a, $5
call FarCopyWRAM
@@ -759,7 +759,7 @@
dec c
jr nz, .loop
ld hl, BattleObjectPals
- ld de, UnknOBPals palette 2
+ ld de, wOBPals1 palette 2
ld bc, 2 palettes
ld a, $5
call FarCopyWRAM
@@ -908,7 +908,7 @@
call ByteFill
ld a, $0
ld [rVBK], a
- ld a, $80
+ ld a, 1 << rBGPI_AUTO_INCREMENT
ld [rBGPI], a
ld c, 4 * 8
.bgpals_loop
@@ -918,7 +918,7 @@
ld [rBGPD], a
dec c
jr nz, .bgpals_loop
- ld a, $80
+ ld a, 1 << rOBPI_AUTO_INCREMENT
ld [rOBPI], a
ld c, 4 * 8
.obpals_loop
@@ -932,9 +932,9 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call .LoadWhitePals
- ld hl, BGPals
+ ld hl, wBGPals2
call .LoadWhitePals
pop af
ld [rSVBK], a
@@ -1253,7 +1253,7 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, UnknBGPals
+ ld hl, wBGPals1
ld b, 8
.outer_loop
ld a, [de] ; lookup index for TilesetBGPalette
@@ -1289,9 +1289,9 @@
ld bc, 8 palettes
ld hl, MapObjectPals
call AddNTimes
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 8 palettes
- ld a, BANK(UnknOBPals)
+ ld a, BANK(wOBPals1)
call FarCopyWRAM
ld a, [wEnvironment]
@@ -1316,7 +1316,7 @@
inc hl
endr
.morn_day
- ld de, UnknBGPals palette PAL_BG_ROOF + 2
+ ld de, wBGPals1 palette PAL_BG_ROOF + 2
ld bc, 4
ld a, $5
call FarCopyWRAM
--- a/engine/credits.asm
+++ b/engine/credits.asm
@@ -520,10 +520,10 @@
; Update the first three colors in both palette buffers.
push af
push hl
- add LOW(UnknBGPals)
+ add LOW(wBGPals1)
ld e, a
ld a, 0
- adc HIGH(UnknBGPals)
+ adc HIGH(wBGPals1)
ld d, a
ld bc, 24
call CopyBytes
@@ -530,10 +530,10 @@
pop hl
pop af
- add LOW(BGPals)
+ add LOW(wBGPals2)
ld e, a
ld a, 0
- adc HIGH(BGPals)
+ adc HIGH(wBGPals2)
ld d, a
ld bc, 24
call CopyBytes
--- a/engine/crystal_colors.asm
+++ b/engine/crystal_colors.asm
@@ -54,15 +54,15 @@
ret
MG_Mobile_Layout_LoadPals: ; 49351 (12:5351)
- ld de, UnknBGPals
+ ld de, wBGPals1
ld hl, Palette_493e1
ld bc, 5 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
- ld de, UnknBGPals palette PAL_BG_TEXT
+ ld de, wBGPals1 palette PAL_BG_TEXT
ld hl, Palette_TextBG7
ld bc, 1 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
ret
@@ -118,9 +118,9 @@
LoadOW_BGPal7:: ; 49409
ld hl, Palette_TextBG7
- ld de, UnknBGPals palette PAL_BG_TEXT
+ ld de, wBGPals1 palette PAL_BG_TEXT
ld bc, 1 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
ret
; 49418
@@ -131,9 +131,9 @@
Function49420:: ; 49420 (12:5420)
ld hl, MansionPalette4
- ld de, UnknBGPals palette PAL_BG_ROOF
+ ld de, wBGPals1 palette PAL_BG_ROOF
ld bc, 1 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
ret
; 4942f (12:542f)
@@ -140,10 +140,10 @@
MG_Mobile_Layout01: ; 4942f
call MG_Mobile_Layout_LoadPals
- ld de, UnknBGPals palette PAL_BG_TEXT
+ ld de, wBGPals1 palette PAL_BG_TEXT
ld hl, .Palette_49478
ld bc, 1 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
call MG_Mobile_Layout_WipeAttrMap
hlcoord 0, 0, AttrMap
@@ -208,17 +208,17 @@
MG_Mobile_Layout02: ; 49706
ld hl, .Palette_49732
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 1 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
farcall ApplyPals
call MG_Mobile_Layout_WipeAttrMap
farcall ApplyAttrMap
ld hl, .Palette_4973a
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 1 palettes
- ld a, BANK(UnknOBPals)
+ ld a, BANK(wOBPals1)
call FarCopyWRAM
ret
; 49732
@@ -239,7 +239,7 @@
Function49742: ; 49742
ld hl, .Palette_49757
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 8 palettes
ld a, $5
call FarCopyWRAM
@@ -305,9 +305,9 @@
LoadTradeRoomBGPals: ; 49811
ld hl, TradeRoomPalette
- ld de, UnknBGPals palette PAL_BG_GREEN
+ ld de, wBGPals1 palette PAL_BG_GREEN
ld bc, 6 palettes
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
call FarCopyWRAM
farcall ApplyPals
ret
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -322,9 +322,9 @@
ld a, $5
ld [rSVBK], a
ld a, [hli]
- ld [OBPals + 12], a
+ ld [wOBPals2 + 12], a
ld a, [hli]
- ld [OBPals + 13], a
+ ld [wOBPals2 + 13], a
pop af
ld [rSVBK], a
ld a, $1
@@ -483,11 +483,11 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_365ad
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, Palette_365ad
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
pop af
@@ -556,11 +556,11 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e5edd
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e5edd
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
pop af
@@ -622,11 +622,11 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_365ad
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, Palette_365ad
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
pop af
@@ -729,12 +729,12 @@
ld [rSVBK], a
ld hl, Palette_e5edd
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e5edd
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
@@ -887,11 +887,11 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_365ad
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, Palette_365ad
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
pop af
@@ -1014,11 +1014,11 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e5edd
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e5edd
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
pop af
@@ -1123,11 +1123,11 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e77dd
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e77dd
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
pop af
@@ -1197,11 +1197,11 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e6d6d
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e6d6d
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
pop af
@@ -1271,11 +1271,11 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e77dd
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e77dd
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
pop af
@@ -1441,11 +1441,11 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_e679d
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e679d
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
pop af
@@ -1516,7 +1516,7 @@
ret
Intro_Scene24_ApplyPaletteFade: ; e5172 (39:5172)
-; load the (a)th palette from .FadePals to all BGPals
+; load the (a)th palette from .FadePals to all wBGPals2
ld hl, .FadePals
add l
ld l, a
@@ -1528,11 +1528,11 @@
push af
ld a, $5
ld [rSVBK], a
- ld de, BGPals
+ ld de, wBGPals2
ld b, 8 ; number of BG pals
.loop1
push hl
- ld c, 8 ; number of bytes per pal
+ ld c, 1 palettes
.loop2
ld a, [hli]
ld [de], a
@@ -1599,7 +1599,7 @@
add a
ld e, a
ld d, $0
- ld hl, BGPals
+ ld hl, wBGPals2
add hl, de
inc hl
inc hl
@@ -1622,7 +1622,7 @@
push hl
push bc
- ld hl, BGPals
+ ld hl, wBGPals2
ld bc, 8 palettes
xor a
call ByteFill
@@ -1726,7 +1726,7 @@
ld [rSVBK], a
push bc
- ld de, BGPals
+ ld de, wBGPals2
ld a, c
add e
@@ -1735,11 +1735,11 @@
adc d
ld d, a
- ld bc, 8
+ ld bc, 1 palettes
call CopyBytes
pop bc
- ld de, UnknBGPals
+ ld de, wBGPals1
ld a, c
add e
ld e, a
@@ -1747,7 +1747,7 @@
adc d
ld d, a
- ld bc, 8
+ ld bc, 1 palettes
call CopyBytes
pop af
@@ -1779,7 +1779,7 @@
add a
ld e, a
ld d, $0
- ld hl, BGPals
+ ld hl, wBGPals2
add hl, de
rept 4
inc hl
@@ -1949,8 +1949,8 @@
ld a, $5
ld [rSVBK], a
- ld hl, BGPals
- ld bc, 16 * 8
+ ld hl, wBGPals2
+ ld bc, 16 palettes
xor a
call ByteFill
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -158,22 +158,22 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_819f4
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
- ld a, $80
+ ld a, 1 << rBGPI_AUTO_INCREMENT
ld [rBGPI], a
ld hl, Palette_819f4
- ld c, $40
+ ld c, 8 palettes
xor a
.asm_819c8
ld [rBGPD], a
dec c
jr nz, .asm_819c8
- ld a, $80
+ ld a, 1 << rOBPI_AUTO_INCREMENT
ld [rOBPI], a
ld hl, Palette_81a34
- ld c, $40
+ ld c, 8 palettes
.asm_819d6
ld a, [hli]
ld [rOBPD], a
@@ -438,7 +438,7 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, BGPals
+ ld hl, wBGPals2
ld de, wc608
ld c, $1
call Function81ee3
@@ -1153,7 +1153,7 @@
add hl, hl
add hl, hl
add hl, hl
- ld de, UnknBGPals
+ ld de, wBGPals1
add hl, de
ld de, wc608
ld bc, 8
@@ -1200,12 +1200,12 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, BGPals
+ ld hl, wBGPals2
ld a, [wcf64]
- ld bc, 8
+ ld bc, 1 palettes
call AddNTimes
ld de, wc608
- ld bc, 8
+ ld bc, 1 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -1230,14 +1230,14 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, BGPals
+ ld hl, wBGPals2
ld a, [wcf64]
- ld bc, 8
+ ld bc, 1 palettes
call AddNTimes
ld e, l
ld d, h
ld hl, wc608
- ld bc, 8
+ ld bc, 1 palettes
call CopyBytes
hlcoord 1, 0
ld de, wc608
--- a/engine/events/heal_machine_anim.asm
+++ b/engine/events/heal_machine_anim.asm
@@ -158,7 +158,7 @@
.cgb
ld hl, .palettes
- ld de, OBPals palette PAL_OW_TREE
+ ld de, wOBPals2 palette PAL_OW_TREE
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
@@ -201,7 +201,7 @@
ld a, $5
ld [rSVBK], a
- ld hl, OBPals palette PAL_OW_TREE
+ ld hl, wOBPals2 palette PAL_OW_TREE
ld a, [hli]
ld e, a
ld a, [hli]
--- a/engine/events/poisonstep_pals.asm
+++ b/engine/events/poisonstep_pals.asm
@@ -28,8 +28,8 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, BGPals
- ld c, $20
+ ld hl, wBGPals2
+ ld c, 4 palettes
.loop
; RGB 28, 21, 31
ld a, LOW(palred 28 + palgreen 21 + palblue 31)
--- a/engine/init_gender.asm
+++ b/engine/init_gender.asm
@@ -88,7 +88,7 @@
LoadGenderScreenPal: ; 48e47 (12:4e47)
ld hl, .Palette
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
--- a/engine/init_hof_credits.asm
+++ b/engine/init_hof_credits.asm
@@ -43,7 +43,7 @@
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
- ld hl, UnknBGPals
+ ld hl, wBGPals1
ld c, 4 tiles
.load_white_palettes
ld a, LOW(palred 31 + palgreen 31 + palblue 31)
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -2350,8 +2350,8 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, UnknBGPals
- ld bc, $40
+ ld hl, wBGPals1
+ ld bc, 8 palettes
xor a
call ByteFill
pop af
--- a/engine/timeofdaypals.asm
+++ b/engine/timeofdaypals.asm
@@ -42,7 +42,7 @@
ld [TimeOfDayPal], a
; save bg palette 7
- ld hl, UnknBGPals palette PAL_BG_TEXT
+ ld hl, wBGPals1 palette PAL_BG_TEXT
; save wram bank
ld a, [rSVBK]
@@ -73,7 +73,7 @@
; restore bg palette 7
- ld hl, UnknOBPals - 1 ; last byte in UnknBGPals
+ ld hl, wOBPals1 - 1 ; last byte in wBGPals1
; save wram bank
ld a, [rSVBK]
@@ -176,12 +176,12 @@
ld a, $5
ld [rSVBK], a
- ld hl, UnknBGPals
+ ld hl, wBGPals1
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
- ld hl, UnknBGPals + 1 palettes
+ ld hl, wBGPals1 + 1 palettes
ld c, 6
.loop
ld a, e
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -144,12 +144,12 @@
; Update palette colors
ld hl, TitleScreenPalettes
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
ld hl, TitleScreenPalettes
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 16 palettes
call CopyBytes
@@ -220,7 +220,7 @@
ld [hBGMapMode], a
xor a
- ld [UnknBGPals + 2], a
+ ld [wBGPals1 + 2], a
; Play starting sound effect
call SFXChannelsOff
@@ -231,7 +231,7 @@
; 10eea7
SuicuneFrameIterator: ; 10eea7
- ld hl, UnknBGPals + 2
+ ld hl, wBGPals1 + 2
ld a, [hl]
ld c, a
inc [hl]
--- a/engine/unused_title.asm
+++ b/engine/unused_title.asm
@@ -67,22 +67,22 @@
ld [rSVBK], a
ld hl, UnusedTitleBG_Palettes
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
ld hl, UnusedTitleFG_Palettes
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 8 palettes
call CopyBytes
ld hl, UnusedTitleBG_Palettes
- ld de, BGPals
+ ld de, wBGPals2
ld bc, 8 palettes
call CopyBytes
ld hl, UnusedTitleFG_Palettes
- ld de, OBPals
+ ld de, wOBPals2
ld bc, 8 palettes
call CopyBytes
--- a/home.asm
+++ b/home.asm
@@ -680,11 +680,11 @@
ld a, [rSVBK]
push af
- ld a, BANK(BGPals)
+ ld a, BANK(wBGPals2)
ld [rSVBK], a
-; Fill BGPals and OBPals with $ffff (white)
- ld hl, BGPals
+; Fill wBGPals2 and wOBPals2 with $ffff (white)
+ ld hl, wBGPals2
ld bc, 16 palettes
ld a, $ff
call ByteFill
--- a/home/palettes.asm
+++ b/home/palettes.asm
@@ -2,8 +2,8 @@
UpdatePalsIfCGB:: ; c2f
-; update bgp data from BGPals
-; update obp data from OBPals
+; update bgp data from wBGPals2
+; update obp data from wOBPals2
; return carry if successful
; check cgb
@@ -24,13 +24,13 @@
ld a, [rSVBK]
push af
- ld a, BANK(BGPals)
+ ld a, BANK(wBGPals2)
ld [rSVBK], a
- ld hl, BGPals
+ ld hl, wBGPals2
; copy 8 pals to bgpd
- ld a, %10000000 ; auto increment, index 0
+ ld a, 1 << rBGPI_AUTO_INCREMENT
ld [rBGPI], a
ld c, LOW(rBGPD)
ld b, 8 / 2
@@ -43,10 +43,10 @@
dec b
jr nz, .bgp
-; hl is now OBPals
+; hl is now wOBPals2
; copy 8 pals to obpd
- ld a, %10000000 ; auto increment, index 0
+ ld a, 1 << rOBPI_AUTO_INCREMENT
ld [rOBPI], a
ld c, LOW(rOBPD)
ld b, 8 / 2
@@ -90,12 +90,12 @@
ld a, [rSVBK]
push af
- ld a, BANK(BGPals)
+ ld a, BANK(wBGPals2)
ld [rSVBK], a
; copy & reorder bg pal buffer
- ld hl, BGPals ; to
- ld de, UnknBGPals ; from
+ ld hl, wBGPals2 ; to
+ ld de, wBGPals1 ; from
; order
ld a, [rBGP]
ld b, a
@@ -138,12 +138,12 @@
ld a, [rSVBK]
push af
- ld a, BANK(OBPals)
+ ld a, BANK(wOBPals2)
ld [rSVBK], a
; copy & reorder obj pal buffer
- ld hl, OBPals ; to
- ld de, UnknOBPals ; from
+ ld hl, wOBPals2 ; to
+ ld de, wOBPals1 ; from
; order
ld a, [rOBP0]
ld b, a
@@ -178,11 +178,11 @@
ld a, [rSVBK]
push af
- ld a, BANK(OBPals)
+ ld a, BANK(wOBPals2)
ld [rSVBK], a
- ld hl, OBPals palette 0
- ld de, UnknOBPals palette 0
+ ld hl, wOBPals2 palette 0
+ ld de, wOBPals1 palette 0
ld a, [rOBP0]
ld b, a
ld c, 1
@@ -216,11 +216,11 @@
ld a, [rSVBK]
push af
- ld a, BANK(OBPals)
+ ld a, BANK(wOBPals2)
ld [rSVBK], a
- ld hl, OBPals palette 1
- ld de, UnknOBPals palette 1
+ ld hl, wOBPals2 palette 1
+ ld de, wOBPals1 palette 1
ld a, [rOBP1]
ld b, a
ld c, 1
@@ -325,9 +325,9 @@
ret z
ld a, [rSVBK]
push af
- ld a, BANK(BGPals)
+ ld a, BANK(wBGPals2)
ld [rSVBK], a
- ld hl, BGPals
+ ld hl, wBGPals2
ld bc, (8 palettes) + (2 palettes)
xor a
call ByteFill
--- a/mobile/fixed_words.asm
+++ b/mobile/fixed_words.asm
@@ -2921,7 +2921,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_11d33a
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
pop af
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -631,7 +631,7 @@
ld a, 5
ld [rSVBK], a
ld hl, Palette_894b3
- ld de, UnknBGPals palette 7
+ ld de, wBGPals1 palette 7
ld bc, 1 palettes
call CopyBytes
pop af
@@ -682,11 +682,11 @@
ld a, [hli]
ld h, [hl]
ld l, a
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 3 palettes
call CopyBytes
ld hl, .Pals345
- ld de, UnknBGPals + 3 palettes
+ ld de, wBGPals1 + 3 palettes
ld bc, 3 palettes
call CopyBytes
@@ -2161,7 +2161,7 @@
ld [rSVBK], a
ld c, 8
- ld de, UnknBGPals
+ ld de, wBGPals1
.loop
push bc
ld hl, .Palette1
@@ -2172,7 +2172,7 @@
jr nz, .loop
ld hl, .Palette2
- ld de, UnknBGPals + 2 palettes
+ ld de, wBGPals1 + 2 palettes
ld bc, 1 palettes
call CopyBytes
@@ -2394,7 +2394,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_89eb1
- ld de, UnknBGPals palette 5
+ ld de, wBGPals1 palette 5
ld bc, 1 palettes
call CopyBytes
pop af
@@ -3399,15 +3399,15 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_8a5e5
- ld de, UnknBGPals + 4 palettes
+ ld de, wBGPals1 + 4 palettes
ld bc, 3 palettes
call CopyBytes
ld hl, Palette_8a5fd
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 1 palettes
call CopyBytes
ld hl, Palette_8a605
- ld de, UnknOBPals + 1 palettes
+ ld de, wOBPals1 + 1 palettes
ld bc, 1 palettes
call CopyBytes
pop af
@@ -3452,7 +3452,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_8a624
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 1 palettes
call CopyBytes
pop af
--- a/mobile/mobile_22_2.asm
+++ b/mobile/mobile_22_2.asm
@@ -620,8 +620,8 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_8b6d5
- ld de, UnknBGPals
- ld bc, $0018
+ ld de, wBGPals1
+ ld bc, 3 palettes
call CopyBytes
pop af
ld [rSVBK], a
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -6853,7 +6853,7 @@
Function102dec: ; 102dec
ld hl, Palettes_1032e2
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 4 palettes
ld a, $05
call FarCopyWRAM
--- a/mobile/mobile_42.asm
+++ b/mobile/mobile_42.asm
@@ -836,7 +836,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_109107
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
pop af
@@ -882,7 +882,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_109107
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
pop af
@@ -926,7 +926,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_109107
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
pop af
@@ -946,7 +946,7 @@
ld de, SFX_GIVE_TRADEMON
call PlaySFX
ld c, 40
- ld hl, BGPals palette 6
+ ld hl, wBGPals2 palette 6
call Function1082f0
call Function108af4
.loop
@@ -1010,7 +1010,7 @@
MobileTradeAnim_GiveTrademon2: ; 1087cf
ld c, 40
- ld hl, BGPals + 1 palettes
+ ld hl, wBGPals2 + 1 palettes
call Function1082f0
call Function108af4
call Function108b5a
@@ -1109,12 +1109,12 @@
MobileTradeAnim_GetTrademon2: ; 108894
ld c, 20
- ld hl, BGPals + 1 palettes
+ ld hl, wBGPals2 + 1 palettes
call Function1082fa
ld de, SFX_GIVE_TRADEMON
call PlaySFX
ld c, 20
- ld hl, BGPals + 1 palettes
+ ld hl, wBGPals2 + 1 palettes
call Function1082fa
call Function108af4
.asm_1088ad
@@ -1178,7 +1178,7 @@
MobileTradeAnim_GetTrademon3: ; 10890a
ld c, 40
- ld hl, BGPals palette 6
+ ld hl, wBGPals2 palette 6
call Function1082f0
call Function108af4
call GetMobileTradeAnimByte
@@ -1449,11 +1449,11 @@
and $1
jr z, .copy_palette_109147
ld hl, Palette_109187
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 8 palettes
call CopyBytes
ld hl, Palette_109187
- ld de, OBPals
+ ld de, wOBPals2
ld bc, 8 palettes
call CopyBytes
jr .done_copy
@@ -1460,11 +1460,11 @@
.copy_palette_109147
ld hl, Palette_109147
- ld de, UnknOBPals
+ ld de, wOBPals1
ld bc, 8 palettes
call CopyBytes
ld hl, Palette_109147
- ld de, OBPals
+ ld de, wOBPals2
ld bc, 8 palettes
call CopyBytes
@@ -1484,8 +1484,8 @@
push af
ld a, $5
ld [rSVBK], a
- ld de, (31 << 10) + (31 << 5) + 31 ; $7fff
- ld hl, UnknBGPals
+ ld de, palred 31 + palgreen 31 + palblue 31
+ ld hl, wBGPals1
ld a, e
ld [hli], a
ld d, a
@@ -1500,8 +1500,8 @@
push af
ld a, $5
ld [rSVBK], a
- ld de, (15 << 10) + (31 << 5) + 18 ; $3ff2
- ld hl, BGPals + 4 palettes
+ ld de, palred 18 + palgreen 31 + palblue 15
+ ld hl, wBGPals2 + 4 palettes
ld c, $10
.loop
ld a, e
@@ -1525,11 +1525,11 @@
ld a, c
and $2
jr z, .Orange
- ld de, (31 << 10) + (31 << 5) + 31 ; $7fff
+ ld de, palred 31 + palgreen 31 + palblue 31
jr .load_pal
.Orange:
- ld de, ( 1 << 10) + (15 << 5) + 31 ; $05ff
+ ld de, palred 31 + palgreen 15 + palblue 1
.load_pal
ld a, e
ld [hli], a
@@ -1561,7 +1561,7 @@
.asm_108bad
ld hl, Palette_108b98
.asm_108bb0
- ld de, UnknBGPals + 7 palettes
+ ld de, wBGPals1 + 7 palettes
ld bc, 8 palettes
call CopyBytes
pop af
@@ -1806,7 +1806,7 @@
ld hl, Palette_1093c7
call AddNTimes
ld a, $5
- ld de, UnknBGPals + 4 palettes
+ ld de, wBGPals1 + 4 palettes
ld bc, 1 palettes
call FarCopyWRAM
ret
--- a/mobile/mobile_45.asm
+++ b/mobile/mobile_45.asm
@@ -7607,7 +7607,7 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, UnknBGPals
+ ld hl, wBGPals1
ld de, 1 palettes
ld c, 8
.loop
--- a/mobile/mobile_45_sprite_engine.asm
+++ b/mobile/mobile_45_sprite_engine.asm
@@ -523,12 +523,12 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, UnknBGPals palette 6
+ ld hl, wBGPals1 palette 6
ld de, $c320
ld bc, 2 palettes
call CopyBytes
ld hl, Palette_11734e
- ld de, UnknBGPals palette 7
+ ld de, wBGPals1 palette 7
ld bc, 1 palettes
call CopyBytes
call SetPalettes
@@ -550,7 +550,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_11730e
- ld de, UnknOBPals + 2 palettes
+ ld de, wOBPals1 + 2 palettes
ld bc, 6 palettes
call CopyBytes
call SetPalettes
@@ -656,9 +656,9 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, BGPals
- ld de, UnknBGPals
- ld bc, $0040
+ ld hl, wBGPals2
+ ld de, wBGPals1
+ ld bc, 8 palettes
call CopyBytes
pop af
ld [rSVBK], a
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -3449,7 +3449,7 @@
ld l, a
ld a, [wcf65]
ld h, a
- ld de, BGPals
+ ld de, wBGPals2
ld a, $22
jp Function119e2b
--- a/mobile/mobile_5b.asm
+++ b/mobile/mobile_5b.asm
@@ -187,7 +187,7 @@
; 16c130
.LoadPals: ; 16c130
- ld de, UnknBGPals
+ ld de, wBGPals1
ld hl, UnknownMobilePalettes_16c903
ld bc, 8
ld a, $5
@@ -243,8 +243,8 @@
ld a, $5
ld [rSVBK], a
ld a, $ff
- ld bc, $0008
- ld hl, UnknBGPals
+ ld bc, 1 palettes
+ ld hl, wBGPals1
call ByteFill
pop af
ld [rSVBK], a
@@ -261,7 +261,7 @@
call Function16cab6
call Function16cabb
ld d, a
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cabb
cp d
@@ -275,7 +275,7 @@
jr nz, .asm_16c981
.asm_16c988
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cadc
@@ -284,7 +284,7 @@
call Function16cab6
call Function16cad8
ld d, a
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cad8
cp d
@@ -298,7 +298,7 @@
jr nz, .asm_16c9a9
.asm_16c9b0
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cb08
@@ -307,7 +307,7 @@
call Function16cab6
call Function16cac4
ld d, a
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cac4
cp d
@@ -321,7 +321,7 @@
jr nz, .asm_16c9d1
.asm_16c9d8
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cae8
@@ -371,7 +371,7 @@
ld e, $0
ld a, $0
.asm_16ca28
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cabb
cp $1f
@@ -385,12 +385,12 @@
jr nz, .asm_16ca37
.asm_16ca3f
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cadc
.asm_16ca48
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cad8
cp $1f
@@ -404,12 +404,12 @@
jr nz, .asm_16ca57
.asm_16ca5f
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cb08
.asm_16ca68
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cac4
cp $1f
@@ -423,7 +423,7 @@
jr nz, .asm_16ca77
.asm_16ca7f
- ld hl, UnknBGPals
+ ld hl, wBGPals1
call Function16cab6
call Function16cae8
@@ -682,7 +682,7 @@
ld bc, 2
ld hl, Unknown_16cfa3
call AddNTimes
- ld de, UnknBGPals + 1 palettes + 4
+ ld de, wBGPals1 + 1 palettes + 4
ld bc, 2
ld a, $5
call FarCopyWRAM
@@ -717,13 +717,13 @@
Function16cc25: ; 16cc25
ld hl, Unknown_16cfa9
- ld de, UnknBGPals + 1 palettes
+ ld de, wBGPals1 + 1 palettes
call .CopyPal
ld hl, Unknown_16cfb1
- ld de, UnknOBPals
+ ld de, wOBPals1
call .CopyPal
ld hl, Unknown_16cfb9
- ld de, UnknOBPals + 1 palettes
+ ld de, wOBPals1 + 1 palettes
call .CopyPal
ret
; 16cc41
--- a/mobile/mobile_5c.asm
+++ b/mobile/mobile_5c.asm
@@ -281,7 +281,7 @@
ld hl, LZ_1715a4
ld de, wd000
call Decompress
- ld de, UnknBGPals
+ ld de, wBGPals1
ld hl, vTiles0
lb bc, $6, $53
call Get2bpp
@@ -716,8 +716,8 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_171d71
- ld de, UnknBGPals
- ld bc, $40
+ ld de, wBGPals1
+ ld bc, 8 palettes
call CopyBytes
ld hl, EngineBuffer5
ld a, $ff
@@ -884,12 +884,12 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_172edf
- ld de, UnknBGPals
- ld bc, $40
+ ld de, wBGPals1
+ ld bc, 8 palettes
call CopyBytes
ld hl, Palette_172edf
- ld de, BGPals
- ld bc, $40
+ ld de, wBGPals2
+ ld bc, 8 palettes
call CopyBytes
call SetPalettes
pop af
--- a/mobile/mobile_5e.asm
+++ b/mobile/mobile_5e.asm
@@ -760,27 +760,27 @@
Function17abcf: ; 17abcf (5e:6bcf)
ld a, [rSVBK]
push af
- ld a, BANK(UnknBGPals)
+ ld a, BANK(wBGPals1)
ld [rSVBK], a
ld hl, Palette_17ac55
- ld de, UnknBGPals ; $d000
- ld bc, $30
+ ld de, wBGPals1 ; $d000
+ ld bc, 6 palettes
call CopyBytes
ld hl, Palette_17ac95
- ld de, UnknOBPals
- ld bc, $40
+ ld de, wOBPals1
+ ld bc, 8 palettes
call CopyBytes
ld hl, GFX_17afa5 + $510
- ld de, UnknOBPals + 2 * 4
- ld bc, $10
+ ld de, wOBPals1 palette 1
+ ld bc, 2 palettes
call CopyBytes
- ld hl, MapObjectPals + 8
- ld de, UnknOBPals + 6 * 4
- ld bc, $8
+ ld hl, MapObjectPals palette 1
+ ld de, wOBPals1 palette 3
+ ld bc, 1 palettes
ld a, BANK(MapObjectPals)
call FarCopyBytes
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -44,12 +44,12 @@
ld a, [rSVBK]
push af
- ld a, 5 ; BANK(UnknBGPals)
+ ld a, 5 ; BANK(wBGPals1)
ld [rSVBK], a
ld hl, HaveWantPals
- ld de, UnknBGPals
- ld bc, $80
+ ld de, wBGPals1
+ ld bc, 16 palettes
call CopyBytes
pop af
@@ -662,7 +662,7 @@
ld a, $6
call GetSRAMBank
ld hl, $a006
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, $1000
call CopyBytes
call CloseSRAM
@@ -703,7 +703,7 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_17eff6
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
call SetPalettes
@@ -970,7 +970,7 @@
ld a, $5
ld [rSVBK], a
ld hl, $c608
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
ld a, $4
@@ -1218,7 +1218,7 @@
call GetSRAMBank
ld hl, $a006
add hl, bc
- ld de, UnknBGPals
+ ld de, wBGPals1
ld bc, $1000
call CopyBytes
call CloseSRAM
@@ -1342,7 +1342,7 @@
ld a, [hli]
ld d, a
push hl
- ld hl, UnknBGPals
+ ld hl, wBGPals1
add hl, de
ld de, wcc60
.asm_17d86c
@@ -1411,7 +1411,7 @@
ld a, $3
ld [rSVBK], a
ld hl, $c608
- ld de, UnknBGPals
+ ld de, wBGPals1
ld b, $0
call CopyBytes
ld a, $4
@@ -1446,7 +1446,7 @@
call Function17e41e
call Function17e32b
pop de
- ld hl, UnknBGPals
+ ld hl, wBGPals1
add hl, de
ld de, wcc60
.asm_17d918
@@ -1963,9 +1963,9 @@
Function17dcaf:
ld a, $5
ld [rSVBK], a
- ld hl, UnknBGPals
- ld de, $8
- ld c, $8
+ ld hl, wBGPals1
+ ld de, 1 palettes
+ ld c, 8
.asm_17dcbb
push hl
ld a, $ff
@@ -3135,7 +3135,7 @@
; 17e40f
Function17e40f: ; 17e40f
- ld de, UnknBGPals
+ ld de, wBGPals1
add hl, de
jr Function17e41e
@@ -4377,7 +4377,7 @@
ld e, a
ld a, [hli]
ld d, a
- ld hl, UnknBGPals
+ ld hl, wBGPals1
add hl, de
ld e, l
ld d, h
--- a/tilesets/animations.asm
+++ b/tilesets/animations.asm
@@ -935,26 +935,24 @@
ret nz
; Ready for BGPD input...
- ld a, %10011000 ; auto increment, index $18 (pal 3 color 0)
+
+ ld a, (1 << rBGPI_AUTO_INCREMENT) palette PAL_BG_WATER
ld [rBGPI], a
ld a, [rSVBK]
push af
- ld a, 5 ; wra5: gfx
+ ld a, BANK(wBGPals1)
ld [rSVBK], a
; Update color 0 in order 0 1 2 1
-
ld a, l
and %110 ; frames 0 2 4 6
-
jr z, .color0
-
cp 4
jr z, .color2
.color1
- ld hl, UnknBGPals + $1a ; pal 3 color 1
+ ld hl, wBGPals1 palette PAL_BG_WATER + 2
ld a, [hli]
ld [rBGPD], a
ld a, [hli]
@@ -962,7 +960,7 @@
jr .end
.color0
- ld hl, UnknBGPals + $18 ; pal 3 color 0
+ ld hl, wBGPals1 palette PAL_BG_WATER
ld a, [hli]
ld [rBGPD], a
ld a, [hli]
@@ -970,7 +968,7 @@
jr .end
.color2
- ld hl, UnknBGPals + $1c ; pal 3 color 2
+ ld hl, wBGPals1 palette PAL_BG_WATER + 4
ld a, [hli]
ld [rBGPD], a
ld a, [hli]
@@ -999,19 +997,19 @@
ld a, [rSVBK]
push af
- ld a, 5 ; wra5: gfx
+ ld a, BANK(wBGPals1)
ld [rSVBK], a
; Ready for BGPD input...
- ld a, %10100000 ; auto-increment, index $20 (pal 4 color 0)
+ ld a, (1 << rBGPI_AUTO_INCREMENT) palette PAL_BG_YELLOW
ld [rBGPI], a
ld a, [hVBlankCounter]
- and %00000010
+ and 1 << 1
jr nz, .bit1set
- ld hl, UnknBGPals + $20 ; pal 4 color 0
+ ld hl, wBGPals1 palette PAL_BG_YELLOW
jr .okay
.bit1set
- ld hl, UnknBGPals + $22 ; pal 4 color 2
+ ld hl, wBGPals1 palette PAL_BG_YELLOW + 2
.okay
ld a, [hli]
--- a/tilesets/special_palettes.asm
+++ b/tilesets/special_palettes.asm
@@ -54,8 +54,8 @@
; 494f2
LoadPokeComPalette: ; 494f2
- ld a, BANK(UnknBGPals)
- ld de, UnknBGPals
+ ld a, BANK(wBGPals1)
+ ld de, wBGPals1
ld hl, PokeComPalette
ld bc, 8 palettes
call FarCopyWRAM
@@ -67,8 +67,8 @@
; 49541
LoadBattleTowerPalette: ; 49541
- ld a, BANK(UnknBGPals)
- ld de, UnknBGPals
+ ld a, BANK(wBGPals1)
+ ld de, wBGPals1
ld hl, BattleTowerPalette
ld bc, 8 palettes
call FarCopyWRAM
@@ -80,8 +80,8 @@
; 49590
LoadIcePathPalette: ; 49590
- ld a, BANK(UnknBGPals)
- ld de, UnknBGPals
+ ld a, BANK(wBGPals1)
+ ld de, wBGPals1
ld hl, IcePathPalette
ld bc, 8 palettes
call FarCopyWRAM
@@ -93,8 +93,8 @@
; 495df
LoadHousePalette: ; 495df
- ld a, BANK(UnknBGPals)
- ld de, UnknBGPals
+ ld a, BANK(wBGPals1)
+ ld de, wBGPals1
ld hl, HousePalette
ld bc, 8 palettes
call FarCopyWRAM
@@ -106,8 +106,8 @@
; 4962e
LoadRadioTowerPalette: ; 4962e
- ld a, BANK(UnknBGPals)
- ld de, UnknBGPals
+ ld a, BANK(wBGPals1)
+ ld de, wBGPals1
ld hl, RadioTowerPalette
ld bc, 8 palettes
call FarCopyWRAM
@@ -169,23 +169,23 @@
; 496c5
LoadMansionPalette: ; 496c5
- ld a, BANK(UnknBGPals)
- ld de, UnknBGPals
+ ld a, BANK(wBGPals1)
+ ld de, wBGPals1
ld hl, MansionPalette1
ld bc, 8 palettes
call FarCopyWRAM
- ld a, BANK(UnknBGPals)
- ld de, UnknBGPals palette PAL_BG_YELLOW
+ ld a, BANK(wBGPals1)
+ ld de, wBGPals1 palette PAL_BG_YELLOW
ld hl, MansionPalette2
ld bc, 1 palettes
call FarCopyWRAM
- ld a, BANK(UnknBGPals)
- ld de, UnknBGPals palette PAL_BG_WATER
+ ld a, BANK(wBGPals1)
+ ld de, wBGPals1 palette PAL_BG_WATER
ld hl, MansionPalette3
ld bc, 1 palettes
call FarCopyWRAM
- ld a, BANK(UnknBGPals)
- ld de, UnknBGPals palette PAL_BG_ROOF
+ ld a, BANK(wBGPals1)
+ ld de, wBGPals1 palette PAL_BG_ROOF
ld hl, MansionPalette4
ld bc, 1 palettes
call FarCopyWRAM
--- a/wram.asm
+++ b/wram.asm
@@ -2880,10 +2880,10 @@
SECTION "GBC Video", WRAMX
; eight 4-color palettes each
-UnknBGPals:: ds 8 palettes ; d000
-UnknOBPals:: ds 8 palettes ; d040
-BGPals:: ds 8 palettes ; d080
-OBPals:: ds 8 palettes ; d0c0
+wBGPals1:: ds 8 palettes ; d000
+wOBPals1:: ds 8 palettes ; d040
+wBGPals2:: ds 8 palettes ; d080
+wOBPals2:: ds 8 palettes ; d0c0
LYOverrides:: ds SCREEN_HEIGHT_PX ; d100
LYOverridesEnd:: ; d190