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 5 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
6 changes: 3 additions & 3 deletions engine/battle/battle_transition.asm
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion 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
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/events/battle_tower.asm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
.FindARandomBattleTowerPkmn:
; From Which LevelGroup are the Pkmn loaded
; a = 1..10
ld a, [wBTChoiceOfLvlGroup] ; [$d800]
ld a, [wBTChoiceOfLvlGroup]
dec a
ld hl, BattleTowerMons
ld bc, BattleTowerMons2 - BattleTowerMons1
Expand Down
4 changes: 2 additions & 2 deletions engine/gbc_only.asm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GBCOnlyScreen: ; 4ea82
call ClearTileMap

ld hl, GBCOnlyGFX
ld de, $d000
ld de, wd000
ld a, [rSVBK]
push af
ld a, 0
Expand All @@ -19,7 +19,7 @@ GBCOnlyScreen: ; 4ea82
pop af
ld [rSVBK], a

ld de, $d000
ld de, wd000
ld hl, vTiles2
lb bc, BANK(GBCOnlyGFX), $54
call Get2bpp
Expand Down
7 changes: 0 additions & 7 deletions engine/link.asm
Original file line number Diff line number Diff line change
Expand Up @@ -811,31 +811,24 @@ Link_PrepPartyData_Gen2: ; 28595
inc de
dec b
jr nz, .loop1
; de = $c806
ld hl, PlayerName
ld bc, NAME_LENGTH
call CopyBytes
; de = $c811
ld hl, PartyCount
ld bc, 1 + PARTY_LENGTH + 1
call CopyBytes
; de = $c819
ld hl, PlayerID
ld bc, 2
call CopyBytes
; de = $c81b
ld hl, PartyMon1Species
ld bc, PARTY_LENGTH * PARTYMON_STRUCT_LENGTH
call CopyBytes
; de = $c93b
ld hl, PartyMonOT
ld bc, PARTY_LENGTH * NAME_LENGTH
call CopyBytes
; de = $c97d
ld hl, PartyMonNicknames
ld bc, PARTY_LENGTH * PKMN_NAME_LENGTH
call CopyBytes
; de = $c9bf

; Okay, we did all that. Now, are we in the trade center?
ld a, [wLinkMode]
Expand Down
2 changes: 1 addition & 1 deletion engine/pack.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ TextJump_YouCantUseItInABattle: ; 0x10b11
db "@"
; 0x10b16

PackMenuGFX:
PackMenuGFX::
INCBIN "gfx/pack/pack_menu.2bpp"
PackGFX:
INCBIN "gfx/pack/pack.2bpp"
2 changes: 1 addition & 1 deletion engine/title.asm
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ _TitleScreen: ; 10ed67

ld a, [rSVBK]
push af
ld a, 5 ; BANK(LYOverrides)
ld a, BANK(LYOverrides)
ld [rSVBK], a

; Make alternating lines come in from opposite sides
Expand Down
2 changes: 1 addition & 1 deletion home/init.asm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Init:: ; 17d
ld [rOBP1], a
ld [rTMA], a
ld [rTAC], a
ld [$d000], a
ld [WRAM1_Begin], a

ld a, %100 ; Start timer at 4096Hz
ld [rTAC], a
Expand Down
2 changes: 1 addition & 1 deletion home/names.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ NamesPointers:: ; 33ab
dbw 0, PartyMonOT
dbw 0, OTPartyMonOT
dba TrainerClassNames
dbw $4, $4b52 ; within PackMenuGFX
dbw $4, PackMenuGFX + 60
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make that dba PackMenuGFX + 60 since $4 is BANK(PackMenuGFX + 60).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BANK() can't evaluate arithmetic (at least I think that's the problem). dbw BANK(PackMenuGFX), PackMenuGFX + 60 is the best that can be done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh well, dbw BANK(PackMenuGFX), PackMenuGFX + 60 is good enough.

; 33c3

GetName:: ; 33c3
Expand Down
2 changes: 1 addition & 1 deletion mobile/mobile_46.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7223,7 +7223,7 @@ Function11b483: ; 11b483
jr .loop8

.okay4
ld a, $0 ; BANK(sPartyMail)
ld a, BANK(sPartyMail)
call GetSRAMBank
ld a, MAIL_STRUCT_LENGTH
.loop9
Expand Down
Loading