Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace hardcoded banks & addresses in non-mobile code #460

Merged
merged 15 commits into from
Jan 22, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions audio/engine.asm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ _MapSetup_Sound_Off:: ; e8000

ld hl, Channels ; start of channel data
ld de, ChannelsEnd - Channels ; length of area to clear (entire sound wram area)
.clearchannels ; clear Channel1-$c2bf
.clearchannels
xor a
ld [hli], a
dec de
Expand Down Expand Up @@ -2749,7 +2749,7 @@ PlayStereoSFX:: ; e8ca6
add hl, bc
ld [hl], a

ld hl, Channel1Field30 - Channel1 ; $c131 - Channel1
ld hl, Channel1Field30 - Channel1
add hl, bc
ld [hl], a

Expand All @@ -2760,11 +2760,11 @@ PlayStereoSFX:: ; e8ca6
; ch3-4
ld a, [wSFXDuration]

ld hl, Channel1Field2e - Channel1 ; $c12f - Channel1
ld hl, Channel1Field2e - Channel1
add hl, bc
ld [hl], a

ld hl, Channel1Field2f - Channel1 ; $c130 - Channel1
ld hl, Channel1Field2f - Channel1
add hl, bc
ld [hl], a

Expand Down
3 changes: 1 addition & 2 deletions data/default_options.asm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ DefaultOptions: ; 14f7c
db GBPRINTER_NORMAL
; Options2: menu account on
db 1 << MENU_ACCOUNT
; $cfd2: ??
db $00
; $cfd3: ??
db $00
; 14f84
16 changes: 8 additions & 8 deletions engine/battle/battle_transition.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -298,7 +298,7 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab)

StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8)
farcall Function5602
ld a, $5 ; BANK(LYOverrides)
ld a, BANK(LYOverrides)
ld [rSVBK], a

call StartTrainerBattle_NextScene
Expand Down Expand Up @@ -356,7 +356,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408)

StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d)
farcall Function5602
ld a, $5 ; BANK(LYOverrides)
ld a, BANK(LYOverrides)
ld [rSVBK], a
call StartTrainerBattle_NextScene
xor a
Expand Down Expand Up @@ -498,7 +498,7 @@ ENDM

StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578)
farcall Function5602
ld a, $5 ; BANK(LYOverrides)
ld a, BANK(LYOverrides)
ld [rSVBK], a
call StartTrainerBattle_NextScene
ld a, $10
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8440,7 +8440,7 @@ InitEnemy: ; 3f55e
BackUpBGMap2: ; 3f568
ld a, [rSVBK]
push af
ld a, $6 ; BANK(wDecompressScratch)
ld a, BANK(wDecompressScratch)
ld [rSVBK], a
ld hl, wDecompressScratch
ld bc, $40 tiles ; vBGMap3 - vBGMap2
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/sliding_intro.asm
Original file line number Diff line number Diff line change
@@ -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
Expand Down
30 changes: 15 additions & 15 deletions engine/battle_anims/anim_commands.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PlayBattleAnim: ; cc0d6
ld a, [rSVBK]
push af

ld a, 5
ld a, BANK(ActiveAnimObjects)
ld [rSVBK], a

call _PlayBattleAnim
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -1254,22 +1254,22 @@ 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]
and a
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions engine/battle_anims/bg_effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions engine/battle_anims/functions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/battle_anims/getpokeballwobble.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GetPokeBallWobble: ; f971 (3:7971)
ld d, a
push de

ld a, 1 ; BANK(Buffer2)
ld a, BANK(Buffer2)
ld [rSVBK], a

ld a, [Buffer2]
Expand Down
2 changes: 1 addition & 1 deletion engine/card_flip.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions engine/color.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -572,7 +572,7 @@ ResetBGPals:

ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a

ld hl, wBGPals1
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/credits.asm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Credits:: ; 109847

ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wPals)
ld [rSVBK], a

call ClearBGPalettes
Expand Down
Loading