From 9d0ba6bfd3b2f10fae9969a784aa7b2b573e8411 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Wed, 3 Jan 2018 19:12:45 -0500 Subject: [PATCH] Use BANK for hardcoded WRAM banks (except where bankswitches appear unnecessary). --- engine/battle/battle_transition.asm | 10 +++--- engine/battle/core.asm | 4 +-- engine/battle/sliding_intro.asm | 2 +- engine/battle_anims/anim_commands.asm | 30 ++++++++--------- engine/battle_anims/bg_effects.asm | 4 +-- engine/battle_anims/functions.asm | 4 +-- engine/card_flip.asm | 2 +- engine/color.asm | 12 +++---- engine/credits.asm | 2 +- engine/crystal_intro.asm | 48 +++++++++++++-------------- engine/debug.asm | 10 +++--- engine/dma_transfer.asm | 8 ++--- engine/events/heal_machine_anim.asm | 2 +- engine/events/magnet_train.asm | 8 ++--- engine/events/poisonstep_pals.asm | 2 +- engine/events/print_unown.asm | 2 +- engine/gbc_only.asm | 2 +- engine/init_hof_credits.asm | 2 +- engine/init_map.asm | 2 +- engine/intro_menu.asm | 2 +- engine/menu.asm | 4 +-- engine/pic_animation.asm | 4 +-- engine/pokedex.asm | 2 +- engine/timeofdaypals.asm | 10 +++--- engine/title.asm | 2 +- engine/unused_title.asm | 2 +- gfx/load_pics.asm | 6 ++-- home/game_time.asm | 2 +- home/init.asm | 2 +- home/map.asm | 2 +- home/menu.asm | 2 +- home/video.asm | 2 +- wram.asm | 3 ++ 33 files changed, 102 insertions(+), 99 deletions(-) diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 2b9ebe091..73f7eaef4 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -23,7 +23,7 @@ Predef_StartBattle: ; 8c20f .done ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 @@ -44,7 +44,7 @@ Predef_StartBattle: ; 8c20f ld [hLYOverrideEnd], a ld [hSCY], a - ld a, $1 + ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a pop af ld [hVBlank], a @@ -116,7 +116,7 @@ LoadTrainerBattlePokeballTiles: ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push hl ld hl, wDecompressScratch @@ -647,7 +647,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) .daytime ld a, [rSVBK] push af - ld a, $5 ; WRAM5 = palettes + ld a, BANK(wBGPals1) ld [rSVBK], a call .copypals push hl @@ -729,7 +729,7 @@ PokeBallTransition: WipeLYOverrides: ; 8c6d8 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(LYOverrides) ld [rSVBK], a ld hl, LYOverrides diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 48be08bf0..bac39e76f 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -9320,7 +9320,7 @@ InitBattleDisplay: ; 3fb6c .BlankBGMap: ; 3fbd6 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, wDecompressScratch @@ -9381,7 +9381,7 @@ GetTrainerBackpic: ; 3fbff CopyBackpic: ; 3fc30 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, vTiles0 ld de, vTiles2 tile $31 diff --git a/engine/battle/sliding_intro.asm b/engine/battle/sliding_intro.asm index ed78add8e..2cd242c84 100755 --- a/engine/battle/sliding_intro.asm +++ b/engine/battle/sliding_intro.asm @@ -1,7 +1,7 @@ BattleIntroSlidingPics: ; 4e980 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(LYOverrides) ld [rSVBK], a call .subfunction1 ld a, rSCX - $ff00 diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 27d57e68f..b91aa8c6c 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -5,7 +5,7 @@ PlayBattleAnim: ; cc0d6 ld a, [rSVBK] push af - ld a, 5 + ld a, BANK(ActiveAnimObjects) ld [rSVBK], a call _PlayBattleAnim @@ -163,7 +163,7 @@ BattleAnimRestoreHuds: ; cc1bb ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(CurBattleMon) ; alternatively: BANK(TempMon), BANK(PartyMon1), several others ld [rSVBK], a ld hl, UpdateBattleHuds @@ -917,7 +917,7 @@ BattleAnimCmd_E7: ; cc5db (33:45db) BattleAnimCmd_Transform: ; cc5dc (33:45dc) ld a, [rSVBK] push af - ld a, 1 + ld a, BANK(CurPartySpecies) ld [rSVBK], a ld a, [CurPartySpecies] ; CurPartySpecies push af @@ -973,7 +973,7 @@ BattleAnimCmd_RaiseSub: ; cc640 (33:4640) ld a, [rSVBK] push af - ld a, 1 + ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a xor a call GetSRAMBank @@ -1047,7 +1047,7 @@ GetSubstitutePic: ; cc64c BattleAnimCmd_MinimizeOpp: ; cc6cf (33:46cf) ld a, [rSVBK] push af - ld a, $1 + ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a xor a call GetSRAMBank @@ -1103,7 +1103,7 @@ INCBIN "gfx/battle/minimize.2bpp" BattleAnimCmd_Minimize: ; cc735 (33:4735) ld a, [rSVBK] push af - ld a, $1 + ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a xor a call GetSRAMBank @@ -1118,7 +1118,7 @@ BattleAnimCmd_Minimize: ; cc735 (33:4735) BattleAnimCmd_DropSub: ; cc750 (33:4750) ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(CurPartySpecies) ld [rSVBK], a ld a, [CurPartySpecies] ; CurPartySpecies @@ -1143,7 +1143,7 @@ BattleAnimCmd_DropSub: ; cc750 (33:4750) BattleAnimCmd_BeatUp: ; cc776 (33:4776) ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(CurPartySpecies) ld [rSVBK], a ld a, [CurPartySpecies] ; CurPartySpecies push af @@ -1254,7 +1254,7 @@ endr ld a, [rSVBK] push af - ld a, 1 + ld a, BANK(EnemyMon) ; BattleMon is in WRAM0, but EnemyMon is in WRAMX ld [rSVBK], a ld a, [hBattleTurn] @@ -1262,14 +1262,14 @@ endr jr nz, .enemy ld a, $f0 - ld [CryTracks], a ; CryTracks - ld a, [BattleMonSpecies] ; BattleMonSpecies + ld [CryTracks], a + ld a, [BattleMonSpecies] jr .done_cry_tracks .enemy ld a, $0f - ld [CryTracks], a ; CryTracks - ld a, [EnemyMonSpecies] ; EnemyMon + ld [CryTracks], a + ld a, [EnemyMonSpecies] .done_cry_tracks push hl @@ -1431,7 +1431,7 @@ BattleAnim_SetBGPals: ; cc91a ret z ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals2 ld de, wBGPals1 @@ -1459,7 +1459,7 @@ BattleAnim_SetOBPals: ; cc94b ret z ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wOBPals1) ld [rSVBK], a ld hl, wOBPals2 palette PAL_BATTLE_OB_GRAY ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index bb8feb1f9..3dd6e7785 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -2578,7 +2578,7 @@ BGEffects_LoadBGPal0_OBPal1: ; c8e52 (32:4e52) ld h, a ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld a, h push bc @@ -2605,7 +2605,7 @@ BGEffects_LoadBGPal1_OBPal0: ; c8e7f (32:4e7f) ld h, a ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld a, h push bc diff --git a/engine/battle_anims/functions.asm b/engine/battle_anims/functions.asm index ea9fb70b3..1a66ed51d 100755 --- a/engine/battle_anims/functions.asm +++ b/engine/battle_anims/functions.asm @@ -428,9 +428,9 @@ GetBallAnimPal: ; cd249 (33:5249) ld hl, BallColors ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(CurItem) ld [rSVBK], a - ld a, [CurItem] ; CurItem + ld a, [CurItem] ld e, a pop af ld [rSVBK], a diff --git a/engine/card_flip.asm b/engine/card_flip.asm index 158f3fa05..78a734514 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -1649,7 +1649,7 @@ CardFlip_InitAttrPals: ; e0c37 (38:4c37) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, .palettes ld de, wBGPals1 diff --git a/engine/color.asm b/engine/color.asm index 04b24fde9..054d74654 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -394,7 +394,7 @@ LoadStatsScreenPals: add hl, bc ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld a, [hli] ld [wBGPals1 palette 0], a @@ -504,7 +504,7 @@ GetPredefPal: LoadHLPaletteIntoDE: ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wOBPals1) ld [rSVBK], a ld c, $8 .loop @@ -520,7 +520,7 @@ LoadHLPaletteIntoDE: LoadPalette_White_Col1_Col2_Black: ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld a, LOW(palred 31 + palgreen 31 + palblue 31) @@ -572,7 +572,7 @@ ResetBGPals: ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 @@ -930,7 +930,7 @@ InitCGBPals:: jr nz, .obpals_loop ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 call .LoadWhitePals @@ -1251,7 +1251,7 @@ LoadMapPals: ; Switch to palettes WRAM bank ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 ld b, 8 diff --git a/engine/credits.asm b/engine/credits.asm index 3dddb4126..8a5cd2c75 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -13,7 +13,7 @@ Credits:: ; 109847 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wPals) ld [rSVBK], a call ClearBGPalettes diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 302490a3b..2c4a31af5 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -57,7 +57,7 @@ Copyright_GFPresents: ; e4579 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, IntroLogoGFX @@ -319,7 +319,7 @@ GameFreakLogoScene4: ; e4776 (39:4776) add hl, de ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wOBPals2) ld [rSVBK], a ld a, [hli] ld [wOBPals2 + 12], a @@ -352,7 +352,7 @@ INCBIN "gfx/splash/logo2.1bpp" CrystalIntro: ; e48ac ld a, [rSVBK] push af - ld a, 5 + ld a, BANK(wPals) ld [rSVBK], a ld a, [hInMenu] push af @@ -480,7 +480,7 @@ IntroScene1: ; e495b (39:495b) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_365ad ld de, wBGPals1 @@ -553,7 +553,7 @@ IntroScene3: ; e49fd (39:49fd) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e5edd ld de, wBGPals1 @@ -619,7 +619,7 @@ IntroScene5: ; e4a7a (39:4a7a) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_365ad ld de, wBGPals1 @@ -725,7 +725,7 @@ IntroScene7: ; e4b3f (39:4b3f) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e5edd @@ -884,7 +884,7 @@ IntroScene11: ; e4c86 (39:4c86) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_365ad ld de, wBGPals1 @@ -1011,7 +1011,7 @@ IntroScene13: ; e4d6d (39:4d6d) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e5edd ld de, wBGPals1 @@ -1120,7 +1120,7 @@ IntroScene15: ; e4e40 (39:4e40) call Intro_LoadTilemap ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e77dd ld de, wBGPals1 @@ -1194,7 +1194,7 @@ IntroScene17: ; e4ef5 (39:4ef5) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e6d6d ld de, wBGPals1 @@ -1268,7 +1268,7 @@ IntroScene19: ; e4f7e (39:4f7e) call Intro_LoadTilemap ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e77dd ld de, wBGPals1 @@ -1438,7 +1438,7 @@ IntroScene26: ; e50bb (39:50bb) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e679d ld de, wBGPals1 @@ -1526,7 +1526,7 @@ Intro_Scene24_ApplyPaletteFade: ; e5172 (39:5172) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld de, wBGPals2 ld b, 8 ; number of BG pals @@ -1617,7 +1617,7 @@ CrystalIntro_UnownFade: ; e5223 (39:5223) ld b, $0 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a push hl @@ -1722,7 +1722,7 @@ Intro_Scene20_AppearUnown: ; e5348 (39:5348) ld c, a ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a push bc @@ -1791,7 +1791,7 @@ endr ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a push hl @@ -1846,7 +1846,7 @@ endr Intro_LoadTilemap: ; e541b (39:541b) ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, wDecompressScratch @@ -1946,7 +1946,7 @@ Intro_SetCGBPalUpdate: ; e549e (39:549e) Intro_ClearBGPals: ; e54a3 (39:54a3) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, wBGPals2 @@ -1965,7 +1965,7 @@ Intro_ClearBGPals: ; e54a3 (39:54a3) Intro_DecompressRequest2bpp_128Tiles: ; e54c2 (39:54c2) ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push de @@ -1984,7 +1984,7 @@ Intro_DecompressRequest2bpp_128Tiles: ; e54c2 (39:54c2) Intro_DecompressRequest2bpp_255Tiles: ; e54de (39:54de) ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push de @@ -2003,7 +2003,7 @@ Intro_DecompressRequest2bpp_255Tiles: ; e54de (39:54de) Intro_DecompressRequest2bpp_64Tiles: ; e54fa (39:54fa) ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push de @@ -2022,7 +2022,7 @@ Intro_DecompressRequest2bpp_64Tiles: ; e54fa (39:54fa) Intro_ResetLYOverrides: ; e5516 (39:5516) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(LYOverrides) ld [rSVBK], a ld hl, LYOverrides @@ -2039,7 +2039,7 @@ Intro_ResetLYOverrides: ; e5516 (39:5516) Intro_PerspectiveScrollBG: ; e552f (39:552f) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(LYOverrides) ld [rSVBK], a ; Scroll the grass every frame. ; Scroll the trees every other frame and at half speed. diff --git a/engine/debug.asm b/engine/debug.asm index 1e0d042e0..8cc4809e8 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -155,7 +155,7 @@ Function819a7: ; 819a7 ret z ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, Palette_819f4 ld de, wBGPals2 @@ -436,7 +436,7 @@ Function81c33: ; 81c33 jr z, .asm_81c69 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, wBGPals2 ld de, wc608 @@ -1145,7 +1145,7 @@ Function82203: ; 82203 Function8220f: ; 8220f ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld a, [wcf64] ld l, a @@ -1198,7 +1198,7 @@ Function82236: ; 82236 call Function821d8 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, wBGPals2 ld a, [wcf64] @@ -1228,7 +1228,7 @@ Function82236: ; 82236 Function822a3: ; 822a3 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, wBGPals2 ld a, [wcf64] diff --git a/engine/dma_transfer.asm b/engine/dma_transfer.asm index 56e7d56da..eef2b936d 100755 --- a/engine/dma_transfer.asm +++ b/engine/dma_transfer.asm @@ -143,7 +143,7 @@ Mobile_ReloadMapPart: ; 104099 .unreferenced_104101 ld a, $1 ld [rVBK], a - ld a, $3 + ld a, BANK(w3_d800) ld [rSVBK], a ld hl, w3_d800 call HDMATransferToWRAMBank3 @@ -221,7 +221,7 @@ CallInSafeGFXMode: ; 104177 ld [hMapAnims], a ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wScratchTileMap) ld [rSVBK], a ld a, [rVBK] push af @@ -472,7 +472,7 @@ _Get2bpp:: ; 104284 ; switch to WRAM bank 6 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wScratchTileMap) ld [rSVBK], a push bc @@ -542,7 +542,7 @@ _Get1bpp:: ; 1042b2 .bankswitch ; 1042d6 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wScratchTileMap) ld [rSVBK], a push bc diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 493330e58..d60acb5b6 100755 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -198,7 +198,7 @@ INCBIN "gfx/overworld/heal_machine.2bpp" .go ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wOBPals2) ld [rSVBK], a ld hl, wOBPals2 palette PAL_OW_TREE diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index c85642ab8..510af938a 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -16,7 +16,7 @@ Special_MagnetTrain: ; 8cc04 ld h, a ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wMagnetTrain) ld [rSVBK], a ld a, h @@ -129,7 +129,7 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 ld [hSCY], a ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(wPlayerGender) ld [rSVBK], a farcall GetPlayerIcon pop af @@ -325,7 +325,7 @@ MagnetTrain_Jumptable: ; 8cdf7 ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_RED ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(wPlayerGender) ld [rSVBK], a ld a, [wPlayerGender] bit 0, a @@ -429,7 +429,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae call DelayFrame ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(wEnvironment) ld [rSVBK], a ld a, [TimeOfDayPal] push af diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index 498ae8f18..b132b178f 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -26,7 +26,7 @@ LoadPoisonBGPals: ; cbcdd .cgb ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, wBGPals2 ld c, 4 palettes diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index 72248a67b..4a4367e13 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -154,7 +154,7 @@ UnownPrinter: ; 16be4 .Load2bppToSRAM: ; 16cff ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld a, BANK(sScratch) diff --git a/engine/gbc_only.asm b/engine/gbc_only.asm index 6e26fad39..a36efe04c 100644 --- a/engine/gbc_only.asm +++ b/engine/gbc_only.asm @@ -13,7 +13,7 @@ GBCOnlyScreen: ; 4ea82 ld de, wd000 ld a, [rSVBK] push af - ld a, 0 + ld a, 0 ; this is tantamount to selecting Bank 1 ld [rSVBK], a call Decompress pop af diff --git a/engine/init_hof_credits.asm b/engine/init_hof_credits.asm index 8e3db75eb..e72ae011c 100644 --- a/engine/init_hof_credits.asm +++ b/engine/init_hof_credits.asm @@ -63,7 +63,7 @@ InitDisplayForRedCredits: ; 4e8c2 ResetDisplayBetweenHallOfFameMons: ; 4e906 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, wDecompressScratch ld bc, wScratchAttrMap - wDecompressScratch diff --git a/engine/init_map.asm b/engine/init_map.asm index e5bee971d..e1b6b9ab9 100644 --- a/engine/init_map.asm +++ b/engine/init_map.asm @@ -79,7 +79,7 @@ LoadFonts_NoOAMUpdate:: ; 64bf HDMATransfer_FillBGMap0WithBlack: ; 64db ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld a, "" ; $60 diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 7d17b62e5..441119342 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -1019,7 +1019,7 @@ CrystalIntroSequence: ; 620b StartTitleScreen: ; 6219 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a call .TitleScreen diff --git a/engine/menu.asm b/engine/menu.asm index 6fbed2848..e5a5ed6c9 100755 --- a/engine/menu.asm +++ b/engine/menu.asm @@ -586,7 +586,7 @@ Place2DMenuCursor: ; 24329 _PushWindow:: ; 24374 ld a, [rSVBK] push af - ld a, $7 + ld a, BANK(wWindowStack) ld [rSVBK], a ld hl, wWindowStackPointer @@ -691,7 +691,7 @@ _ExitMenu:: ; 243e8 ld a, [rSVBK] push af - ld a, $7 + ld a, BANK(wWindowStack) ld [rSVBK], a call GetWindowStackTop diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 33b770b14..e10dcc360 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -279,7 +279,7 @@ PokeAnim_StereoCry: ; d0196 PokeAnim_DeinitFrames: ; d01a9 ld a, [rSVBK] push af - ld a, $2 + ld a, BANK(wPokeAnimCoord) ld [rSVBK], a call PokeAnim_PlaceGraphic farcall HDMATransferTileMapToWRAMBank3 @@ -876,7 +876,7 @@ PokeAnim_PlaceGraphic: ; d04bd PokeAnim_SetVBank1: ; d0504 ld a, [rSVBK] push af - ld a, $2 + ld a, BANK(wPokeAnimCoord) ld [rSVBK], a xor a ld [hBGMapMode], a diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 5dc3dc2a7..5030fe5f1 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -2348,7 +2348,7 @@ Pokedex_BlackOutBG: ; 41401 (10:5401) ; Make BG palettes black so that the BG becomes all black. ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 ld bc, 8 palettes diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm index 0b1ea71a2..defa9e96d 100644 --- a/engine/timeofdaypals.asm +++ b/engine/timeofdaypals.asm @@ -47,8 +47,8 @@ _TimeOfDayPals:: ; 8c011 ; save wram bank ld a, [rSVBK] ld b, a -; wram bank 5 - ld a, $5 + + ld a, BANK(wBGPals1) ld [rSVBK], a ; push palette @@ -78,8 +78,8 @@ _TimeOfDayPals:: ; 8c011 ; save wram bank ld a, [rSVBK] ld d, a -; wram bank 5 - ld a, 5 + + ld a, BANK(wOBPals1) ld [rSVBK], a ; pop palette @@ -173,7 +173,7 @@ Special_FadeBlackQuickly: ; 8c0b6 FillWhiteBGColor: ; 8c0c1 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 diff --git a/engine/title.asm b/engine/title.asm index 2b43c811a..1b7ae66e0 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -139,7 +139,7 @@ _TitleScreen: ; 10ed67 ld a, [rSVBK] push af ; WRAM bank 5 - ld a, 5 + ld a, BANK(wBGPals1) ld [rSVBK], a ; Update palette colors diff --git a/engine/unused_title.asm b/engine/unused_title.asm index f0b59b527..5af468e2a 100644 --- a/engine/unused_title.asm +++ b/engine/unused_title.asm @@ -63,7 +63,7 @@ UnusedTitleScreen: ; 10c000 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, UnusedTitleBG_Palettes diff --git a/gfx/load_pics.asm b/gfx/load_pics.asm index 1d685f1dd..2cd169508 100755 --- a/gfx/load_pics.asm +++ b/gfx/load_pics.asm @@ -206,7 +206,7 @@ GetMonBackpic: ; 5116c ld c, a ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push de @@ -327,7 +327,7 @@ GetTrainerPic: ; 5120d call AddNTimes ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push de ld a, BANK(TrainerPicPointers) @@ -358,7 +358,7 @@ DecompressPredef: ; 5125d ld a, [rSVBK] push af - ld a, 6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push de diff --git a/home/game_time.asm b/home/game_time.asm index 69ea0099e..36dcaa282 100644 --- a/home/game_time.asm +++ b/home/game_time.asm @@ -16,7 +16,7 @@ GameTimer:: ; 209e ld a, [rSVBK] push af - ld a, 1 + ld a, BANK(GameTime) ld [rSVBK], a call UpdateGameTimer diff --git a/home/init.asm b/home/init.asm index a65f75332..dbdbccf3d 100644 --- a/home/init.asm +++ b/home/init.asm @@ -96,7 +96,7 @@ Init:: ; 17d ld [hCGB], a call ClearWRAM - ld a, 1 + ld a, BANK(wd000) ld [rSVBK], a call ClearVRAM call ClearSprites diff --git a/home/map.asm b/home/map.asm index 1e409f0fc..b48f01ce1 100644 --- a/home/map.asm +++ b/home/map.asm @@ -1401,7 +1401,7 @@ LoadTilesetGFX:: ; 2821 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld a, e diff --git a/home/menu.asm b/home/menu.asm index 03cec64df..2be46120d 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -499,7 +499,7 @@ ClearWindowData:: ; 1fbf ld a, [rSVBK] push af - ld a, $7 + ld a, BANK(wWindowStack) ld [rSVBK], a xor a diff --git a/home/video.asm b/home/video.asm index 8f14dfeee..a533a4b77 100644 --- a/home/video.asm +++ b/home/video.asm @@ -466,7 +466,7 @@ AnimateTileset:: ; 17d3 ld a, [rSVBK] push af - ld a, 1 + ld a, BANK(TilesetAnim) ld [rSVBK], a ld a, [rVBK] diff --git a/wram.asm b/wram.asm index ccd9f8f19..91a452506 100644 --- a/wram.asm +++ b/wram.asm @@ -2278,6 +2278,7 @@ StartSecond:: db ; d4b9 wRTC:: ds 8 ; d4ba wDST:: db ; d4c2 +GameTime:: GameTimeCap:: db ; d4c3 GameTimeHours:: dw ; d4c4 GameTimeMinutes:: db ; d4c6 @@ -2879,6 +2880,7 @@ w3_dffc:: ds 4 SECTION "GBC Video", WRAMX ; eight 4-color palettes each +wPals:: wBGPals1:: ds 8 palettes ; d000 wOBPals1:: ds 8 palettes ; d040 wBGPals2:: ds 8 palettes ; d080 @@ -2889,6 +2891,7 @@ LYOverridesEnd:: ; d190 ds 1 +wMagnetTrain:: wMagnetTrainDirection:: db wMagnetTrainInitPosition:: db wMagnetTrainHoldPosition:: db