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 1 commit
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
2 changes: 1 addition & 1 deletion engine/battle/checkbattlescene.asm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CheckBattleScene: ; 4ea44
and a
jr nz, .from_wram

ld a, $4
ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call GetSRAMBank
ld a, [$a60c]
ld c, a
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ BattleTurn: ; 3c12f
; 3c1bf

MobileFn_3c1bf: mobile
ld a, $5
ld a, 5 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call GetSRAMBank
ld hl, $a89b ; s5_a89b
inc [hl]
Expand Down
2 changes: 1 addition & 1 deletion engine/billspc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2104,7 +2104,7 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
ld hl, wBillsPC_BackupScrollPosition
add [hl]
ld [CurPartyMon], a
ld a, $1
ld a, BANK(sBox)
call GetSRAMBank
ld hl, sBoxSpecies
call CopySpeciesToTemp
Expand Down
2 changes: 1 addition & 1 deletion engine/mail_2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ReadAnyMail: ; b9237
ld h, d
ld l, e
push hl
ld a, $0
ld a, BANK(sPartyMail)
call GetSRAMBank
ld de, sPartyMon1MailAuthorID - sPartyMon1Mail
add hl, de
Expand Down
4 changes: 2 additions & 2 deletions engine/menu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -730,15 +730,15 @@ Function24423: ; 24423
ld a, [VramState]
bit 0, a
ret z
xor a
xor a ; effectively ld a, BANK(sScratch)
Copy link
Contributor

Choose a reason for hiding this comment

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

Other parts of the code just comment the implied zero value: xor a ; PARTYMON, xor a ; OAKS_POKEMON_TALK, xor a ; LOW(vBGMap0), etc.

call GetSRAMBank
hlcoord 0, 0
ld de, sScratch
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
call CloseSRAM
call OverworldTextModeSwitch
xor a
xor a ; effectively ld a, BANK(sScratch)
call GetSRAMBank
ld hl, sScratch
decoord 0, 0
Expand Down
2 changes: 1 addition & 1 deletion engine/mon_stats.asm
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ GetGender: ; 50bdd
; sBoxMon data is read directly from SRAM.
ld a, [MonType]
cp BOXMON
ld a, 1
ld a, BANK(sBox)
call z, GetSRAMBank

; Attack DV
Expand Down
2 changes: 1 addition & 1 deletion engine/mystery_gift.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ Function10578c: ; 10578c (41:578c)
ld a, [sCrystalData + 0]
ld [de], a
inc de
ld a, $4
ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call GetSRAMBank
ld hl, $a603
ld bc, $8
Expand Down
8 changes: 4 additions & 4 deletions engine/routines/emptyallsrambanks.asm
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
EmptyAllSRAMBanks: ; 4cf1f
ld a, $0
ld a, 0
call .EmptyBank
ld a, $1
ld a, 1
call .EmptyBank
ld a, $2
ld a, 2
call .EmptyBank
ld a, $3
ld a, 3
call .EmptyBank
ret

Expand Down
2 changes: 1 addition & 1 deletion engine/rtc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Function140ae: ; 140ae
farcall ClearDailyTimers
farcall Function170923
; mobile
ld a, $5
ld a, 5 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call GetSRAMBank
ld a, [$aa8c]
inc a
Expand Down
8 changes: 4 additions & 4 deletions engine/save.asm
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ EraseHallOfFame: ; 14d06
Function14d18: ; 14d18
; XXX
; copy .Data to SRA4:a007
ld a, $4
ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call GetSRAMBank
ld hl, .Data
ld de, $a007
Expand Down Expand Up @@ -454,7 +454,7 @@ SaveData: ; 14d68

Function14d6c: ; 14d6c
; XXX
ld a, $4
ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call GetSRAMBank
ld a, [$a60b]
ld b, $0
Expand All @@ -471,7 +471,7 @@ Function14d6c: ; 14d6c

Function14d83: ; 14d83
; XXX
ld a, $4
ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call GetSRAMBank
xor a
ld [$a60c], a
Expand All @@ -482,7 +482,7 @@ Function14d83: ; 14d83

Function14d93: ; 14d93
; XXX
ld a, $7
ld a, 7 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call GetSRAMBank
xor a
ld [$a000], a
Expand Down