Move all of constants/sram_constants.asm into sram

This way we can easily use `BANK()` where appropriate, and it is more
tidy.
This commit is contained in:
mid-kid 2017-11-20 19:50:54 +01:00
parent 617ba8be3d
commit df118afbca
10 changed files with 75 additions and 72 deletions

View File

@ -4,7 +4,6 @@ INCLUDE "gbhw.asm"
INCLUDE "hram.asm"
INCLUDE "constants/wram_constants.asm"
INCLUDE "constants/sram_constants.asm"
INCLUDE "constants/pokemon_constants.asm"
INCLUDE "constants/type_constants.asm"
INCLUDE "constants/move_constants.asm"

View File

@ -142,6 +142,7 @@ NUM_WILDMONS_PER_AREA_TIME_OF_DAY EQU 7
WILDMON_GRASS_STRUCTURE_LENGTH EQU 2 + 3 * (1 + 2 * NUM_WILDMONS_PER_AREA_TIME_OF_DAY)
MOBILE_EVENT_OBJECT_GS_BALL EQU $b
MOBILE_LOGIN_PASSWORD_LENGTH EQU 17
MALE EQU 0
FEMALE EQU 1

View File

@ -1,53 +0,0 @@
; Mobile bank 5
; sMobileEventIndex EQU $a000 ; moved to 1:BE3C in English
sTrainerRankings EQU $a001
sTrainerRankingGameTimeHOF EQU $a001
sTrainerRankingStepCountHOF EQU $a005
sTrainerRankingHealingsHOF EQU $a009
sTrainerRankingBattlesHOF EQU $a00d
sTrainerRankingStepCount EQU $a010
sTrainerRankingBattleTowerWins EQU $a014
sTrainerRankingTMsHMsTaught EQU $a018
sTrainerRankingBattles EQU $a01b
sTrainerRankingWildBattles EQU $a01e
sTrainerRankingTrainerBattles EQU $a021
sTrainerRankingUnused1 EQU $a024
sTrainerRankingHOFEntries EQU $a027
sTrainerRankingWildMonsCaught EQU $a02a
sTrainerRankingHookedEncounters EQU $a02d
sTrainerRankingEggsHatched EQU $a030
sTrainerRankingMonsEvolved EQU $a033
sTrainerRankingFruitPicked EQU $a036
sTrainerRankingHealings EQU $a039
sTrainerRankingMysteryGift EQU $a03c
sTrainerRankingTrades EQU $a03f
sTrainerRankingFly EQU $a042
sTrainerRankingSurf EQU $a045
sTrainerRankingWaterfall EQU $a048
sTrainerRankingWhiteOuts EQU $a04b
sTrainerRankingLuckyNumberShow EQU $a04e
sTrainerRankingPhoneCalls EQU $a051
sTrainerRankingUnused2 EQU $a054
sTrainerRankingLinkBattles EQU $a057
sTrainerRankingSplash EQU $a05a
sTrainerRankingTreeEncounters EQU $a05d
sTrainerRankingUnused3 EQU $a060
sTrainerRankingColosseumWins EQU $a063
sTrainerRankingColosseumLosses EQU $a066
sTrainerRankingColosseumDraws EQU $a069
sTrainerRankingSelfdestruct EQU $a06c
sTrainerRankingCurrentSlotsStreak EQU $a06f
sTrainerRankingLongestSlotsStreak EQU $a071
sTrainerRankingTotalSlotsPayouts EQU $a073
sTrainerRankingTotalBattlePayouts EQU $a077
sTrainerRankingLongestMagikarp EQU $a07b
sTrainerRankingShortestMagikarp EQU $a07d
sTrainerRankingBugContestScore EQU $a07f
sTrainerRankingsChecksum EQU $a081
sTrainerRankingsEnd EQU $a083
; sMobileEventIndexBackup EQU $a083 ; moved to 1:BE44 in English
sTrainerRankingsBackup EQU $a084
sMobileLoginPassword EQU $aa4b
LOGIN_PASSWORD_LENGTH EQU 17

View File

@ -5,7 +5,7 @@ SECTION "bank41_2", ROMX
; Copies certain values at the time the player enters the Hall of Fame.
TrainerRankings_HallOfFame2:: mobile ; 0x105ef6
ld a, $5
ld a, BANK(sTrainerRankingGameTimeHOF)
call GetSRAMBank
ld hl, GameTimeHours
@ -36,7 +36,7 @@ TrainerRankings_HallOfFame2:: mobile ; 0x105ef6
; 105f33
TrainerRankings_MagikarpLength: mobile ; 105f33
ld a, $5
ld a, BANK(sTrainerRankingLongestMagikarp)
call GetSRAMBank
ld de, Buffer1
ld hl, sTrainerRankingLongestMagikarp
@ -104,7 +104,7 @@ TrainerRankings_MagikarpLength: mobile ; 105f33
; 105f79
TrainerRankings_BugContestScore: mobile ; 105f79
ld a, $5
ld a, BANK(sTrainerRankingBugContestScore)
call GetSRAMBank
ld a, [hProduct]
ld hl, sTrainerRankingBugContestScore
@ -133,7 +133,7 @@ TrainerRankings_BugContestScore: mobile ; 105f79
; 105f9f
TrainerRankings_AddToSlotsWinStreak: mobile ; 105f9f
ld a, $5
ld a, BANK(sTrainerRankingCurrentSlotsStreak)
call GetSRAMBank
; Increment the current streak
@ -173,7 +173,7 @@ TrainerRankings_AddToSlotsWinStreak: mobile ; 105f9f
; 105fd0
TrainerRankings_EndSlotsWinStreak: mobile ; 105fd0
ld a, $5
ld a, BANK(sTrainerRankingCurrentSlotsStreak)
call GetSRAMBank
ld hl, sTrainerRankingCurrentSlotsStreak
xor a
@ -185,7 +185,7 @@ TrainerRankings_EndSlotsWinStreak: mobile ; 105fd0
; 105fe3
TrainerRankings_AddToSlotsPayouts: mobile ; 105fe3
ld a, $5
ld a, BANK(sTrainerRankingTotalSlotsPayouts)
call GetSRAMBank
ld hl, sTrainerRankingTotalSlotsPayouts + 3
ld a, e
@ -213,7 +213,7 @@ TrainerRankings_AddToSlotsPayouts: mobile ; 105fe3
; 106008
TrainerRankings_AddToBattlePayouts: mobile ; 106008
ld a, $5
ld a, BANK(sTrainerRankingTotalBattlePayouts)
call GetSRAMBank
ld hl, sTrainerRankingTotalBattlePayouts + 3
ld a, [bc]
@ -416,7 +416,7 @@ TrainerRankings_Increment1Byte: ; 106129
; Increments a big-endian value of bc + 1 bytes at hl
TrainerRankings_Increment: ; 10612d
ld a, $5
ld a, BANK(sTrainerRankings)
call GetSRAMBank
push hl
push de
@ -453,7 +453,7 @@ TrainerRankings_Increment: ; 10612d
; Used when SRAM bank 5 isnt already loaded — whats the point of this?
UpdateTrainerRankingsChecksum2: mobile ; 106155
ld a, $5
ld a, BANK(sTrainerRankings)
call GetSRAMBank
call UpdateTrainerRankingsChecksum
call CloseSRAM

View File

@ -7249,13 +7249,13 @@ Function117942: ; 117942 (45:7942)
call PlaceString
ld a, $1e
ld [wcd4e], a
ld a, $5
ld a, BANK(sMobileLoginPassword)
call GetSRAMBank
ld a, [wcd4f]
ld [sMobileLoginPassword], a
ld hl, $c708
ld de, sMobileLoginPassword + 1
ld bc, LOGIN_PASSWORD_LENGTH
ld bc, MOBILE_LOGIN_PASSWORD_LENGTH
call CopyBytes
call CloseSRAM
ld a, [wcd4f]

View File

@ -4224,10 +4224,10 @@ Function119eb4: ; 119eb4 (46:5eb4)
ret
Function119ec2: ; 119ec2 (46:5ec2)
ld a, $5
ld a, BANK(sMobileLoginPassword)
call GetSRAMBank
xor a
ld [sMobileLoginPassword + LOGIN_PASSWORD_LENGTH], a
ld [sMobileLoginPassword + MOBILE_LOGIN_PASSWORD_LENGTH], a
ld de, sMobileLoginPassword + 1
.loop
ld a, [de]
@ -4395,7 +4395,7 @@ Function119f98: ; 119f98
; 11a00e
Function11a00e: ; 11a00e
ld a, $5
ld a, BANK(sMobileLoginPassword)
call GetSRAMBank
ld a, [sMobileLoginPassword]
and a
@ -4404,7 +4404,7 @@ Function11a00e: ; 11a00e
call CloseSRAM
and a
ret nz
ld a, $5
ld a, BANK(sMobileLoginPassword)
call GetSRAMBank
xor a
ld [sMobileLoginPassword], a

View File

@ -4688,7 +4688,7 @@ Function17f555: ; 17f555
ret nz
.asm_17f5a1
ld a, $5
ld a, BANK(sMobileLoginPassword)
call GetSRAMBank
xor a
ld [sMobileLoginPassword], a

View File

@ -441,11 +441,11 @@ Function4a28a: ; 4a28a (12:628a)
ld a, [wMenuCursorY]
cp $2
jr z, .dont_delete_password
ld a, $5
ld a, BANK(sMobileLoginPassword)
call GetSRAMBank
ld hl, sMobileLoginPassword
xor a
ld bc, LOGIN_PASSWORD_LENGTH
ld bc, MOBILE_LOGIN_PASSWORD_LENGTH
call ByteFill
call CloseSRAM
ld hl, UnknownText_0x4a35d

View File

@ -356,3 +356,5 @@ SRAM $02
"Boxes 1-7"
SRAM $03
"Boxes 8-14"
SRAM $05
"SRAM Mobile"

View File

@ -243,3 +243,57 @@ SECTION "Boxes 8-14", SRAM
box sBox12
box sBox13
box sBox14
SECTION "SRAM Mobile", SRAM, BANK [5]
ds 1 ; Former location for sMobileEventIndex, moved to 1:BE3C in English
sTrainerRankings:: ; a001
sTrainerRankingGameTimeHOF:: ds 4
sTrainerRankingStepCountHOF:: ds 4
sTrainerRankingHealingsHOF:: ds 4
sTrainerRankingBattlesHOF:: ds 3
sTrainerRankingStepCount:: ds 4
sTrainerRankingBattleTowerWins:: ds 4
sTrainerRankingTMsHMsTaught:: ds 3
sTrainerRankingBattles:: ds 3
sTrainerRankingWildBattles:: ds 3
sTrainerRankingTrainerBattles:: ds 3
sTrainerRankingUnused1:: ds 3
sTrainerRankingHOFEntries:: ds 3
sTrainerRankingWildMonsCaught:: ds 3
sTrainerRankingHookedEncounters:: ds 3
sTrainerRankingEggsHatched:: ds 3
sTrainerRankingMonsEvolved:: ds 3
sTrainerRankingFruitPicked:: ds 3
sTrainerRankingHealings:: ds 3
sTrainerRankingMysteryGift:: ds 3
sTrainerRankingTrades:: ds 3
sTrainerRankingFly:: ds 3
sTrainerRankingSurf:: ds 3
sTrainerRankingWaterfall:: ds 3
sTrainerRankingWhiteOuts:: ds 3
sTrainerRankingLuckyNumberShow:: ds 3
sTrainerRankingPhoneCalls:: ds 3
sTrainerRankingUnused2:: ds 3
sTrainerRankingLinkBattles:: ds 3
sTrainerRankingSplash:: ds 3
sTrainerRankingTreeEncounters:: ds 3
sTrainerRankingUnused3:: ds 3
sTrainerRankingColosseumWins:: ds 3
sTrainerRankingColosseumLosses:: ds 3
sTrainerRankingColosseumDraws:: ds 3
sTrainerRankingSelfdestruct:: ds 3
sTrainerRankingCurrentSlotsStreak:: ds 2
sTrainerRankingLongestSlotsStreak:: ds 2
sTrainerRankingTotalSlotsPayouts:: ds 4
sTrainerRankingTotalBattlePayouts:: ds 4
sTrainerRankingLongestMagikarp:: ds 2
sTrainerRankingShortestMagikarp:: ds 2
sTrainerRankingBugContestScore:: ds 2
sTrainerRankingsChecksum:: ds 2
sTrainerRankingsEnd:: ; a083
ds 1 ; Former location for sMobileEventIndexBackup, moved to 1:BE44 in English
sTrainerRankingsBackup:: ds sTrainerRankingsEnd - sTrainerRankings
ds $945
; aa4b
sMobileLoginPassword:: ds MOBILE_LOGIN_PASSWORD_LENGTH