shithub: pokecrystal

Download patch

ref: c5a4c0bd2e75be4808aa4e4b88887135b38cb715
parent: 2184b60a0cb5e3d1c2b64f7787f3fc0da5efbcab
author: mid-kid <esteve.varela@gmail.com>
date: Wed Apr 10 16:46:16 EDT 2019

Create some battle tower SRAM labels

--- a/data/text/common_3.asm
+++ b/data/text/common_3.asm
@@ -1133,7 +1133,7 @@
 	line "you're ready."
 	done
 
-UnknownText_0x1c5983::
+_NeedAtLeastThreeMonText::
 	text "You need at least"
 	line "three #MON."
 
@@ -1140,7 +1140,7 @@
 	para ""
 	done
 
-UnknownText_0x1c59a3::
+_EggDoesNotQualifyText::
 	text "Sorry, an EGG"
 	line "doesn't qualify."
 
@@ -1147,7 +1147,7 @@
 	para ""
 	done
 
-Text_OnlyThreeMonMayBeEntered::
+_OnlyThreeMonMayBeEnteredText::
 	text "Only three #MON"
 	line "may be entered."
 
@@ -1154,7 +1154,7 @@
 	para ""
 	done
 
-Text_TheMonMustAllBeDifferentKinds::
+_TheMonMustAllBeDifferentKindsText::
 	text "The @"
 	text_ram wStringBuffer2
 	text " #MON"
@@ -1164,7 +1164,7 @@
 	para ""
 	done
 
-Text_TheMonMustNotHoldTheSameItems::
+_TheMonMustNotHoldTheSameItemsText::
 	text "The @"
 	text_ram wStringBuffer2
 	text " #MON"
@@ -1174,7 +1174,7 @@
 	para ""
 	done
 
-Text_YouCantTakeAnEgg::
+_YouCantTakeAnEggText::
 	text "You can't take an"
 	line "EGG!"
 
--- a/engine/battle_anims/anim_commands.asm
+++ b/engine/battle_anims/anim_commands.asm
@@ -152,7 +152,7 @@
 
 	ldh a, [rSVBK]
 	push af
-	ld a, BANK(wCurBattleMon) ; alternatively: BANK(wTempMon), BANK(wPartyMon1), several others
+	ld a, BANK(wCurBattleMon) ; aka BANK(wTempMon) and BANK(wPartyMon1) and several others
 	ldh [rSVBK], a
 
 	ld hl, UpdateBattleHuds
--- a/engine/events/battle_tower/battle_tower.asm
+++ b/engine/events/battle_tower/battle_tower.asm
@@ -12,26 +12,26 @@
 Function1700c4:
 	ldh a, [rSVBK]
 	push af
-	ld a, $3
+	ld a, BANK(w3_d202TrainerData) ; aka BANK(w3_dffc) and BANK(w3_d202Name)
 	ldh [rSVBK], a
 
 	call Function17042c
 
-	ld a, $5
+	ld a, BANK(s5_be45) ; aka BANK(s5_be46) and BANK(s5_aa41) and BANK(s5_aa5d)
 	call GetSRAMBank
-	ld a, $1
-	ld [$be45], a
+	ld a, 1
+	ld [s5_be45], a
 	xor a
-	ld [$be46], a
+	ld [s5_be46], a
 	ld hl, w3_dffc
-	ld de, $aa41
+	ld de, s5_aa41
 	ld bc, 4
 	call CopyBytes
 	ld hl, w3_d202Name
-	ld de, $aa8e
+	ld de, s5_aa8e
 	ld bc, 7 * $cc ; length of battle tower struct from japanese games?
 	call CopyBytes
-	ld hl, $aa5d ; some sort of count
+	ld hl, s5_aa5d ; some sort of count
 	ld a, [hl]
 	inc [hl]
 	inc hl
@@ -38,7 +38,7 @@
 	sla a
 	sla a
 	ld e, a
-	ld d, $0
+	ld d, 0
 	add hl, de
 	ld e, l
 	ld d, h
@@ -57,11 +57,11 @@
 	ret
 
 .Function170121:
-	ld a, $5
+	ld a, BANK(s5_a948)
 	call GetSRAMBank
-	ld hl, $a948
+	ld hl, s5_a948
 	ld de, wc608
-	ld bc, $f6 ; 246
+	ld bc, 246
 	call CopyBytes
 	call CloseSRAM
 	call Function170c8b
@@ -69,10 +69,10 @@
 
 Function170139:
 ; Convert the 4-digit decimal number at 5:aa41 into binary
-	ld a, $5
+	ld a, BANK(s5_aa41)
 	call GetSRAMBank
-	ld de, $aa41
-	ld h, $0
+	ld de, s5_aa41
+	ld h, 0
 	ld l, h
 	ld bc, 1000
 	call .DecToBin
@@ -82,7 +82,7 @@
 	call .DecToBin
 	ld a, [de]
 	ld c, a
-	ld b, $0
+	ld b, 0
 	add hl, bc
 	call CloseSRAM
 ; Store that number in wc608
@@ -145,20 +145,22 @@
 	pop af
 	dec a
 	jr nz, .CopyLoop
-	ld a, $4
+
+	ld a, BANK(s4_a013)
 	call GetSRAMBank
-	ld hl, $a013
-	ld bc, $24
+	ld hl, s4_a013
+	ld bc, 36
 	call CopyBytes
 	call CloseSRAM
-	ld a, $5
+
+	ld a, BANK(s5_a894) ; aka BANK(s5_a948)
 	call GetSRAMBank
-	ld hl, $a894
+	ld hl, s5_a894
 	ld bc, NAME_LENGTH_JAPANESE
 	call CopyBytes
 	ld hl, wc608
-	ld de, $a948
-	ld bc, $f6
+	ld de, s5_a948
+	ld bc, 246
 	call CopyBytes
 	call CloseSRAM
 	ret
@@ -176,7 +178,7 @@
 	ret
 
 BattleTowerBattle:
-	xor a
+	xor a ; FALSE
 	ld [wBattleTowerBattleEnded], a
 	call _BattleTowerBattle
 	ret
@@ -197,7 +199,7 @@
 	call .do_dw
 	call DelayFrame
 	ld a, [wBattleTowerBattleEnded]
-	cp $1
+	cp TRUE
 	jr nz, .loop
 	ret
 
@@ -225,7 +227,7 @@
 
 	ld a, [wInBattleTowerBattle]
 	push af
-	or $1
+	or 1
 	ld [wInBattleTowerBattle], a
 
 	xor a
@@ -260,7 +262,7 @@
 	ld [wInBattleTowerBattle], a
 	pop af
 	ld [wOptions], a
-	ld a, $1
+	ld a, TRUE
 	ld [wBattleTowerBattleEnded], a
 	ret
 
@@ -407,9 +409,9 @@
 .valid
 	ld [wCurSpecies], a
 	call GetBaseData
-	ld a, $5
+	ld a, BANK(s5_b2fb)
 	call GetSRAMBank
-	ld a, [$b2fb] ; s5_b2fb ; max level?
+	ld a, [s5_b2fb] ; s5_b2fb ; max level?
 	call CloseSRAM
 	ld e, a
 	ld hl, MON_LEVEL
@@ -640,17 +642,17 @@
 	dw .Jumptable_2
 
 .Jumptable_0:
-	ld a, $5
+	ld a, BANK(s5_a89c)
 	call GetSRAMBank
 
-	ld hl, $a89c
+	ld hl, s5_a89c
 	ld de, wStringBuffer3
-	ld bc, $16
+	ld bc, 22
 	call CopyBytes
 
-	ld hl, $a8b2
+	ld hl, s5_a8b2
 	ld de, wc608
-	ld bc, $0096
+	ld bc, 150
 	call CopyBytes
 
 	call CloseSRAM
@@ -879,41 +881,41 @@
 	jp hl
 
 .dw
-	dw BattleTowerAction_CheckExplanationRead ; 0x00
-	dw BattleTowerAction_SetExplanationRead ; 0x01
-	dw BattleTowerAction_GetChallengeState ; 0x02
-	dw BattleTowerAction_SetByteToQuickSaveChallenge ; 0x03
-	dw BattleTowerAction_SetByteToCancelChallenge ; 0x04
-	dw Function1707ac ; 0x05
-	dw Function1707f4 ; 0x06
-	dw SaveBattleTowerLevelGroup ; 0x07
-	dw LoadBattleTowerLevelGroup ; 0x08
-	dw BattleTower_CheckSaveFileExistsAndIsYours ; 0x09
-	dw Function1708b1 ; 0x0a
-	dw CheckMobileEventIndex ; 0x0b
-	dw Function1708c8 ; 0x0c
-	dw Function1708f0 ; 0x0d
-	dw BattleTowerAction_EggTicket ; 0x0e
-	dw Function1709aa ; 0x0f
-	dw Function1709bb ; 0x10
-	dw Function170a9c ; 0x11
-	dw Function170aa0 ; 0x12
-	dw Function170aaf ; 0x13
-	dw Function170abe ; 0x14
-	dw Function170ad7 ; 0x15
-	dw Function170807 ; 0x16
-	dw Function17081d ; 0x17
-	dw BattleTowerAction_LevelCheck ; 0x18
-	dw BattleTowerAction_UbersCheck ; 0x19
-	dw ResetBattleTowerTrainersSRAM ; 0x1a
-	dw BattleTower_GiveReward ; 0x1b
-	dw Function17071b ; 0x1c
-	dw Function170729 ; 0x1d
-	dw BattleTower_RandomlyChooseReward ; 0x1e
-	dw BattleTower_SaveOptions ; 0x1f
+	dw BattleTowerAction_CheckExplanationRead
+	dw BattleTowerAction_SetExplanationRead
+	dw BattleTowerAction_GetChallengeState
+	dw BattleTowerAction_SetByteToQuickSaveChallenge
+	dw BattleTowerAction_SetByteToCancelChallenge
+	dw Function1707ac
+	dw Function1707f4
+	dw SaveBattleTowerLevelGroup
+	dw LoadBattleTowerLevelGroup
+	dw BattleTower_CheckSaveFileExistsAndIsYours
+	dw Function1708b1
+	dw CheckMobileEventIndex
+	dw Function1708c8
+	dw Function1708f0
+	dw BattleTowerAction_EggTicket
+	dw Function1709aa
+	dw Function1709bb
+	dw Function170a9c
+	dw Function170aa0
+	dw Function170aaf
+	dw Function170abe
+	dw Function170ad7
+	dw Function170807
+	dw Function17081d
+	dw BattleTowerAction_LevelCheck
+	dw BattleTowerAction_UbersCheck
+	dw ResetBattleTowerTrainersSRAM
+	dw BattleTower_GiveReward
+	dw Function17071b
+	dw Function170729
+	dw BattleTower_RandomlyChooseReward
+	dw BattleTower_SaveOptions
 
 ; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes)
-ResetBattleTowerTrainersSRAM: ; BattleTowerAction $1a
+ResetBattleTowerTrainersSRAM:
 	ld a, BANK(sBTTrainers)
 	call GetSRAMBank
 
@@ -929,7 +931,7 @@
 
 	ret
 
-BattleTower_GiveReward: ; BattleTowerAction $1b
+BattleTower_GiveReward:
 	ld a, BANK(sBattleTowerReward)
 	call GetSRAMBank
 
@@ -958,7 +960,7 @@
 	ld [wScriptVar], a
 	ret
 
-Function17071b: ; BattleTowerAction $1c
+Function17071b:
 	ld a, BANK(sBattleTowerChallengeState)
 	call GetSRAMBank
 	ld a, BATTLETOWER_WON_CHALLENGE
@@ -966,7 +968,7 @@
 	call CloseSRAM
 	ret
 
-Function170729: ; BattleTowerAction $1d
+Function170729:
 	ld a, BANK(sBattleTowerChallengeState)
 	call GetSRAMBank
 	ld a, BATTLETOWER_RECEIVED_REWARD
@@ -974,11 +976,11 @@
 	call CloseSRAM
 	ret
 
-BattleTower_SaveOptions: ; BattleTowerAction $1f
+BattleTower_SaveOptions:
 	farcall SaveOptions
 	ret
 
-BattleTower_RandomlyChooseReward: ; BattleTowerAction $1e
+BattleTower_RandomlyChooseReward:
 ; Generate a random stat boosting item.
 .loop
 	call Random
@@ -999,7 +1001,7 @@
 	call CloseSRAM
 	ret
 
-BattleTowerAction_CheckExplanationRead: ; BattleTowerAction $00
+BattleTowerAction_CheckExplanationRead:
 	call BattleTower_CheckSaveFileExistsAndIsYours
 	ld a, [wScriptVar]
 	and a
@@ -1008,12 +1010,12 @@
 	ld a, BANK(sBattleTowerSaveFileFlags)
 	call GetSRAMBank
 	ld a, [sBattleTowerSaveFileFlags]
-	and $2
+	and 2
 	ld [wScriptVar], a
 	call CloseSRAM
 	ret
 
-BattleTowerAction_GetChallengeState: ; BattleTowerAction $02
+BattleTowerAction_GetChallengeState:
 	ld hl, sBattleTowerChallengeState
 	ld a, BANK(sBattleTowerChallengeState)
 	call GetSRAMBank
@@ -1022,20 +1024,20 @@
 	call CloseSRAM
 	ret
 
-BattleTowerAction_SetExplanationRead: ; BattleTowerAction $01
+BattleTowerAction_SetExplanationRead:
 	ld a, BANK(sBattleTowerSaveFileFlags)
 	call GetSRAMBank
 	ld a, [sBattleTowerSaveFileFlags]
-	or $2
+	or 2
 	ld [sBattleTowerSaveFileFlags], a
 	call CloseSRAM
 	ret
 
-BattleTowerAction_SetByteToQuickSaveChallenge: ; BattleTowerAction $03
+BattleTowerAction_SetByteToQuickSaveChallenge:
 	ld c, BATTLETOWER_SAVED_AND_LEFT
 	jr asm_17079f
 
-BattleTowerAction_SetByteToCancelChallenge: ; BattleTowerAction $04
+BattleTowerAction_SetByteToCancelChallenge:
 	ld c, BATTLETOWER_NO_CHALLENGE
 asm_17079f:
 	ld a, BANK(sBattleTowerChallengeState)
@@ -1045,31 +1047,31 @@
 	call CloseSRAM
 	ret
 
-Function1707ac: ; BattleTowerAction $05
-	ld a, $5
+Function1707ac:
+	ld a, BANK(s5_aa8c) ; aka BANK(s5_be46)
 	call GetSRAMBank
-	ld a, [$aa8c]
+	ld a, [s5_aa8c]
 	ld b, a
-	ld a, [$be46]
+	ld a, [s5_be46]
 	ld [wScriptVar], a
 	call CloseSRAM
 	and a
 	ret z
 	ld a, b
-	cp $2
+	cp 2
 	jr nc, .asm_1707ef
 	push bc
 	call UpdateTime
 	pop bc
-	ld a, $5
+	ld a, BANK(s5_aa8c)
 	call GetSRAMBank
-	ld a, [$aa8b]
+	ld a, [s5_aa8b]
 	call CloseSRAM
 	ld c, a
 	ld a, [wCurDay]
 	sub c
 	jr c, .asm_1707e5
-	cp $8
+	cp 8
 	jr nc, .asm_1707ef
 	ld a, b
 	and a
@@ -1080,44 +1082,44 @@
 	ld a, $8c
 	sub c
 	add [hl]
-	cp $8
+	cp 8
 	ret c
 .asm_1707ef
-	ld a, $8
+	ld a, 8
 	ld [wScriptVar], a
 
-Function1707f4: ; BattleTowerAction $06
-	ld a, $5
+Function1707f4:
+	ld a, BANK(s5_be46) ; aka BANK(s5_aa8b) and BANK(s5_aa8c)
 	call GetSRAMBank
 	xor a
-	ld [$be46], a
-	ld [$aa8b], a
-	ld [$aa8c], a
+	ld [s5_be46], a
+	ld [s5_aa8b], a
+	ld [s5_aa8c], a
 	call CloseSRAM
 	ret
 
-Function170807: ; BattleTowerAction $16
+Function170807:
 	call UpdateTime
-	ld a, $5
+	ld a, BANK(s5_b2f9) ; aka BANK(s5_b2fa)
 	call GetSRAMBank
 	ld a, [wCurDay]
-	ld [$b2f9], a
+	ld [s5_b2f9], a
 	xor a
-	ld [$b2fa], a
+	ld [s5_b2fa], a
 	call CloseSRAM
 	ret
 
-Function17081d: ; BattleTowerAction $17
+Function17081d:
 	xor a
 	ld [wScriptVar], a
-	ld a, $5
+	ld a, BANK(s5_b2f9) ; aka BANK(s5_b2fa)
 	call GetSRAMBank
-	ld a, [$b2f9]
+	ld a, [s5_b2f9]
 	ld c, a
-	ld a, [$b2fa]
+	ld a, [s5_b2fa]
 	ld b, a
 	call CloseSRAM
-	cp $2
+	cp 2
 	jr nc, .asm_170853
 	push bc
 	call UpdateTime
@@ -1125,7 +1127,7 @@
 	ld a, [wCurDay]
 	sub c
 	jr c, .asm_170849
-	cp $b
+	cp 11
 	jr nc, .asm_170853
 	ld a, b
 	and a
@@ -1137,25 +1139,25 @@
 	ld a, 140
 	sub c
 	add [hl]
-	cp $b
+	cp 11
 	ret c
 .asm_170853
-	ld a, $1
+	ld a, 1
 	ld [wScriptVar], a
-	ld a, $5
+	ld a, BANK(s5_b2f9) ; aka BANK(s5_b2fa)
 	call GetSRAMBank
 	xor a
-	ld [$b2f9], a
-	ld [$b2fa], a
+	ld [s5_b2f9], a
+	ld [s5_b2fa], a
 	call CloseSRAM
 	ret
 
-SaveBattleTowerLevelGroup: ; BattleTowerAction $07
+SaveBattleTowerLevelGroup:
 	ld a, BANK(sBTChoiceOfLevelGroup)
 	call GetSRAMBank
 	ldh a, [rSVBK]
 	push af
-	ld a, $3
+	ld a, BANK(wBTChoiceOfLvlGroup)
 	ldh [rSVBK], a
 	ld a, [wBTChoiceOfLvlGroup]
 	ld [sBTChoiceOfLevelGroup], a
@@ -1164,12 +1166,12 @@
 	call CloseSRAM
 	ret
 
-LoadBattleTowerLevelGroup: ; BattleTowerAction $08 ; Load level group choice
+LoadBattleTowerLevelGroup: ; Load level group choice
 	ld a, BANK(sBTChoiceOfLevelGroup)
 	call GetSRAMBank
 	ldh a, [rSVBK]
 	push af
-	ld a, $3
+	ld a, BANK(wBTChoiceOfLvlGroup)
 	ldh [rSVBK], a
 	ld a, [sBTChoiceOfLevelGroup]
 	ld [wBTChoiceOfLvlGroup], a
@@ -1178,17 +1180,17 @@
 	call CloseSRAM
 	ret
 
-BattleTower_CheckSaveFileExistsAndIsYours: ; BattleTowerAction $09
+BattleTower_CheckSaveFileExistsAndIsYours:
 	ld a, [wSaveFileExists]
 	and a
 	jr z, .nope
 	farcall CompareLoadedAndSavedPlayerID
 	jr z, .yes
-	xor a
+	xor a ; FALSE
 	jr .nope
 
 .yes
-	ld a, $1
+	ld a, TRUE
 
 .nope
 	ld [wScriptVar], a
@@ -1210,32 +1212,32 @@
 
 Function1708c8: ; BattleTowerAction $0c
 	call UpdateTime
-	ld a, $5
+	ld a, BANK(s5_aa8b) ; aka BANK(s5_aa8c) and BANK(s5_aa5d) and BANK(s5_aa48) and BANK(s5_aa47)
 	call GetSRAMBank
 	ld a, [wCurDay]
-	ld [$aa8b], a
+	ld [s5_aa8b], a
 	xor a
-	ld [$aa8c], a
-	ld a, [$aa5d]
-	cp $2
+	ld [s5_aa8c], a
+	ld a, [s5_aa5d]
+	cp 2
 	jr nc, .asm_1708ec
 	ld a, [wCurDay]
-	ld [$aa48], a
-	ld a, $1
-	ld [$aa47], a
+	ld [s5_aa48], a
+	ld a, 1
+	ld [s5_aa47], a
 .asm_1708ec
 	call CloseSRAM
 	ret
 
 Function1708f0: ; BattleTowerAction $0d
-	xor a
+	xor a ; FALSE
 	ld [wScriptVar], a
 	call UpdateTime
-	ld a, $5
+	ld a, BANK(s5_aa48) ; aka BANK(s5_aa47)
 	call GetSRAMBank
-	ld a, [$aa48]
+	ld a, [s5_aa48]
 	ld c, a
-	ld a, [$aa47]
+	ld a, [s5_aa47]
 	call CloseSRAM
 	and a
 	ret z
@@ -1243,30 +1245,30 @@
 	ld a, c
 	cp [hl]
 	jr nz, Function170923
-	ld a, $5
+	ld a, BANK(s5_aa5d)
 	call GetSRAMBank
-	ld a, [$aa5d]
+	ld a, [s5_aa5d]
 	call CloseSRAM
-	cp $5
+	cp 5
 	ret c
-	ld a, $1
+	ld a, TRUE
 	ld [wScriptVar], a
 	ret
 
 Function170923:
-	ld a, $5
+	ld a, BANK(s5_aa48) ; aka BANK(s5_aa47) and BANK(s5_aa5d)
 	call GetSRAMBank
 	xor a
-	ld [$aa48], a
-	ld [$aa47], a
-	ld hl, $aa5d
-	ld bc, $0011
+	ld [s5_aa48], a
+	ld [s5_aa47], a
+	ld hl, s5_aa5d
+	ld bc, MOBILE_LOGIN_PASSWORD_LENGTH
 	call ByteFill
 	call CloseSRAM
 	ret
 
 BattleTowerAction_EggTicket: ; BattleTowerAction $0e
-	xor a
+	xor a ; FALSE
 	ld [wScriptVar], a
 	ld a, EGG_TICKET
 	ld [wCurItem], a
@@ -1319,7 +1321,7 @@
 	ld [wCurItemQuantity], a
 	ld hl, wNumItems
 	call TossItem
-	ld a, $1
+	ld a, TRUE
 	ld [wScriptVar], a
 	ret
 
@@ -1347,11 +1349,11 @@
 	ret
 
 Function1709bb: ; BattleTowerAction $10
-	xor a
+	xor a ; FALSE
 	ld [wScriptVar], a
-	ld a, $5
+	ld a, BANK(s5_a800)
 	call GetSRAMBank
-	ld a, [$a800]
+	ld a, [s5_a800]
 	call CloseSRAM
 	cp 6
 	jr nc, .invalid
@@ -1366,10 +1368,10 @@
 	jp hl
 
 .invalid
-	ld a, $5
+	ld a, BANK(s5_a800)
 	call GetSRAMBank
 	xor a
-	ld [$a800], a
+	ld [s5_a800], a
 	call CloseSRAM
 	ret
 
@@ -1382,10 +1384,10 @@
 	dw .Action5
 
 .DoAction1:
-	ld a, $5
+	ld a, BANK(s5_a800)
 	call GetSRAMBank
-	ld a, $1
-	ld [$a800], a
+	ld a, 1
+	ld [s5_a800], a
 	call CloseSRAM
 
 .NoAction:
@@ -1392,36 +1394,36 @@
 	ret
 
 .Action4:
-	ld a, $5
+	ld a, BANK(s5_b023) ; aka BANK(s5_a825) and BANK(s5_a826)
 	call GetSRAMBank
-	ld hl, $b023
+	ld hl, s5_b023
 	ld de, wc608
-	ld bc, $0069
+	ld bc, 105
 	call CopyBytes
-	ld a, [$a825]
+	ld a, [s5_a825]
 	ld [wcd30], a
-	ld a, [$a826]
+	ld a, [s5_a826]
 	ld [wcd31], a
 	call CloseSRAM
 	farcall Function11b6b4
 	farcall Function17d0f3
-	ld a, $1
+	ld a, TRUE
 	ld [wScriptVar], a
 	ret
 
 .Action5:
-	ld a, $0
+	ld a, 0 ; ???
 	call GetSRAMBank
 	ld hl, wRTC
 	ld de, wc608
-	ld bc, $0004
+	ld bc, 4
 	call CopyBytes
 	call CloseSRAM
-	ld a, $5
+	ld a, BANK(s5_b08c)
 	call GetSRAMBank
-	ld hl, $b08c
+	ld hl, s5_b08c
 	ld de, wc608
-	ld c, $4
+	ld c, 4
 .compare_loop
 	ld a, [de]
 	inc de
@@ -1444,16 +1446,16 @@
 	ret nz
 
 .no_scene
-	ld a, $1
+	ld a, TRUE
 	ld [wScriptVar], a
 	ret
 
 .different
 	call CloseSRAM
-	ld a, $5
+	ld a, BANK(s5_a800)
 	call GetSRAMBank
 	xor a
-	ld [$a800], a
+	ld [s5_a800], a
 	call CloseSRAM
 	ld [wScriptVar], a
 	ld a, [wMapGroup]
@@ -1470,29 +1472,29 @@
 .no_scene_2
 	ret
 
-Function170a9c: ; BattleTowerAction $11
+Function170a9c:
 	ld c, FALSE
 	jr asm_170aa2
 
-Function170aa0: ; BattleTowerAction $12
+Function170aa0:
 	ld c, TRUE
 asm_170aa2:
-	ld a, $5
+	ld a, BANK(s5_aa8d)
 	call GetSRAMBank
 	ld a, c
-	ld [$aa8d], a
+	ld [s5_aa8d], a
 	call CloseSRAM
 	ret
 
-Function170aaf: ; BattleTowerAction $13
-	ld a, $5
+Function170aaf:
+	ld a, BANK(s5_aa8d)
 	call GetSRAMBank
-	ld a, [$aa8d]
+	ld a, [s5_aa8d]
 	ld [wScriptVar], a
 	call CloseSRAM
 	ret
 
-Function170abe: ; BattleTowerAction $14
+Function170abe:
 	call BattleTower_CheckSaveFileExistsAndIsYours
 	ld a, [wScriptVar]
 	and a
@@ -1501,24 +1503,24 @@
 	ld a, BANK(sBattleTowerSaveFileFlags)
 	call GetSRAMBank
 	ld a, [sBattleTowerSaveFileFlags]
-	and $1
+	and 1
 	ld [wScriptVar], a
 	call CloseSRAM
 	ret
 
-Function170ad7: ; BattleTowerAction $15
+Function170ad7:
 	ld a, BANK(sBattleTowerSaveFileFlags)
 	call GetSRAMBank
 	ld a, [sBattleTowerSaveFileFlags]
-	or $1
+	or 1
 	ld [sBattleTowerSaveFileFlags], a
 	call CloseSRAM
 	ret
 
-BattleTowerAction_LevelCheck: ; BattleTowerAction $18
-	ld a, $5
+BattleTowerAction_LevelCheck:
+	ld a, BANK(s5_b2fb)
 	call GetSRAMBank
-	ld a, [$b2fb]
+	ld a, [s5_b2fb]
 	call CloseSRAM
 	ld c, 10
 	call SimpleDivide
@@ -1526,19 +1528,19 @@
 	ld [wcd4f], a
 	xor a
 	ld [wScriptVar], a
-	farcall BattleTower_LevelCheck ; level check
+	farcall BattleTower_LevelCheck
 	ret nc
-	ld a, $5
+	ld a, BANK(s5_b2fb)
 	call GetSRAMBank
-	ld a, [$b2fb]
+	ld a, [s5_b2fb]
 	call CloseSRAM
 	ld [wScriptVar], a
 	ret
 
-BattleTowerAction_UbersCheck: ; BattleTowerAction $19
-	ld a, $5
+BattleTowerAction_UbersCheck:
+	ld a, BANK(s5_b2fb)
 	call GetSRAMBank
-	ld a, [$b2fb]
+	ld a, [s5_b2fb]
 	call CloseSRAM
 	ld c, 10
 	call SimpleDivide
@@ -1548,9 +1550,9 @@
 	ld [wScriptVar], a
 	farcall BattleTower_UbersCheck
 	ret nc
-	ld a, $5
+	ld a, BANK(s5_b2fb)
 	call GetSRAMBank
-	ld a, [$b2fb]
+	ld a, [s5_b2fb]
 	call CloseSRAM
 	ld [wScriptVar], a
 	ret
@@ -1559,13 +1561,13 @@
 	farcall Function_LoadOpponentTrainerAndPokemons
 	ldh a, [rSVBK]
 	push af
-	ld a, $3
+	ld a, BANK(wBT_OTTrainerClass)
 	ldh [rSVBK], a
 	ld hl, wBT_OTTrainerClass
 	ld a, [hl]
 	dec a
 	ld c, a
-	ld b, $0
+	ld b, 0
 	pop af
 	ldh [rSVBK], a
 	ld hl, BTTrainerClassSprites
@@ -1606,13 +1608,13 @@
 
 CheckForBattleTowerRules:
 	farcall _CheckForBattleTowerRules
-	jr c, .asm_170bde
+	jr c, .ready
 	xor a ; FALSE
-	jr .asm_170be0
+	jr .end
 
-.asm_170bde
+.ready
 	ld a, TRUE
 
-.asm_170be0
+.end
 	ld [wScriptVar], a
 	ret
--- a/engine/events/battle_tower/rules.asm
+++ b/engine/events/battle_tower/rules.asm
@@ -17,8 +17,8 @@
 
 .TextPointers:
 	dw .ExcuseMeText
-	dw JumpText_NeedAtLeastThreeMon
-	dw JumpText_EggDoesNotQualify
+	dw NeedAtLeastThreeMonText
+	dw EggDoesNotQualifyText
 
 .ExcuseMeText:
 	; Excuse me!
@@ -50,10 +50,10 @@
 
 .TextPointers:
 	dw JumpText_ExcuseMeYoureNotReady
-	dw JumpText_OnlyThreeMonMayBeEntered
-	dw JumpText_TheMonMustAllBeDifferentKinds
-	dw JumpText_TheMonMustNotHoldTheSameItems
-	dw JumpText_YouCantTakeAnEgg
+	dw OnlyThreeMonMayBeEnteredText
+	dw TheMonMustAllBeDifferentKindsText
+	dw TheMonMustNotHoldTheSameItemsText
+	dw YouCantTakeAnEggText
 
 JumpText_ExcuseMeYoureNotReady:
 	; Excuse me. You're not ready.
@@ -70,34 +70,34 @@
 	text_far UnknownText_0x1c5962
 	text_end
 
-JumpText_NeedAtLeastThreeMon:
+NeedAtLeastThreeMonText:
 	; You need at least three #MON.
-	text_far UnknownText_0x1c5983
+	text_far _NeedAtLeastThreeMonText
 	text_end
 
-JumpText_EggDoesNotQualify:
+EggDoesNotQualifyText:
 	; Sorry, an EGG doesn't qualify.
-	text_far UnknownText_0x1c59a3
+	text_far _EggDoesNotQualifyText
 	text_end
 
-JumpText_OnlyThreeMonMayBeEntered:
+OnlyThreeMonMayBeEnteredText:
 	; Only three #MON may be entered.
-	text_far Text_OnlyThreeMonMayBeEntered
+	text_far _OnlyThreeMonMayBeEnteredText
 	text_end
 
-JumpText_TheMonMustAllBeDifferentKinds:
+TheMonMustAllBeDifferentKindsText:
 	; The @  #MON must all be different kinds.
-	text_far Text_TheMonMustAllBeDifferentKinds
+	text_far _TheMonMustAllBeDifferentKindsText
 	text_end
 
-JumpText_TheMonMustNotHoldTheSameItems:
+TheMonMustNotHoldTheSameItemsText:
 	; The @  #MON must not hold the same items.
-	text_far Text_TheMonMustNotHoldTheSameItems
+	text_far _TheMonMustNotHoldTheSameItemsText
 	text_end
 
-JumpText_YouCantTakeAnEgg:
+YouCantTakeAnEggText:
 	; You can't take an EGG!
-	text_far Text_YouCantTakeAnEgg
+	text_far _YouCantTakeAnEggText
 	text_end
 
 BattleTower_ExecuteJumptable:
@@ -161,7 +161,7 @@
 	call z, .PrintFirstText
 	pop bc
 	call .PrintNthText
-	ld b, $1
+	ld b, 1
 	pop de
 	ret
 
@@ -178,7 +178,7 @@
 	call .GetTextPointers
 	inc hl
 	inc hl
-	ld b, $0
+	ld b, 0
 	add hl, bc
 	add hl, bc
 	call .LoadTextPointer
@@ -194,7 +194,7 @@
 BattleTower_CheckPartyHasThreeMonsThatAreNotEggs:
 	ld hl, wPartyCount
 	ld a, [hli]
-	ld b, $0
+	ld b, 0
 	ld c, a
 .loop
 	ld a, [hli]
--- a/pokecrystal.link
+++ b/pokecrystal.link
@@ -361,7 +361,9 @@
 	"Boxes 1-7"
 SRAM $03
 	"Boxes 8-14"
+SRAM $04
+	"SRAM Mobile 1"
 SRAM $05
-	"SRAM Mobile"
+	"SRAM Mobile 2"
 HRAM
 	"HRAM"
--- a/sram.asm
+++ b/sram.asm
@@ -239,9 +239,14 @@
 sBox13:: box sBox13
 sBox14:: box sBox14
 
+SECTION "SRAM Mobile 1", SRAM
 
-SECTION "SRAM Mobile", SRAM, BANK [5]
+	ds $13
 
+s4_a013:: ds 36 ; a013
+
+SECTION "SRAM Mobile 2", SRAM
+
 	ds 1 ; former location for sMobileEventIndex, moved to 1:BE3C in English
 
 sTrainerRankings:: ; a001
@@ -292,9 +297,64 @@
 
 	ds 1 ; Former location for sMobileEventIndexBackup, moved to 1:BE44 in English
 
-sTrainerRankingsBackup:: ds sTrainerRankingsEnd - sTrainerRankings
+sTrainerRankingsBackup:: ds sTrainerRankingsEnd - sTrainerRankings ; a084
 
-	ds $945
-; aa4b
+	ds $6fa
 
-sMobileLoginPassword:: ds MOBILE_LOGIN_PASSWORD_LENGTH
+s5_a800:: db ; a800
+
+	ds $24
+
+s5_a825:: db ; a825
+s5_a826:: db ; a826
+
+	ds $6d
+
+s5_a894:: ds NAME_LENGTH_JAPANESE ; a894
+
+	ds $2
+
+s5_a89c:: ds 22 ; a89c
+s5_a8b2:: ds 150 ; a8b2
+
+s5_a948:: ds 246 ; a948
+
+	ds $3
+
+s5_aa41:: ds 4 ; aa41
+
+	ds $2
+
+s5_aa47:: db ; aa47
+s5_aa48:: db ; aa48
+
+	ds $2
+
+sMobileLoginPassword:: ds MOBILE_LOGIN_PASSWORD_LENGTH ; aa4b
+
+	ds $1
+
+s5_aa5d:: ds MOBILE_LOGIN_PASSWORD_LENGTH ; aa5d
+
+	ds $1d
+
+s5_aa8b:: db ; aa8b
+s5_aa8c:: db ; aa8c
+s5_aa8d:: db ; aa8d
+s5_aa8e:: ds 7 * $cc ; aa8e
+
+	ds $1
+
+s5_b023:: ds 105 ; b023
+s5_b08c:: ds 4 ; b08c
+
+	ds $269
+
+s5_b2f9:: db ; b2f9
+s5_b2fa:: db ; b2fa
+s5_b2fb:: db ; b2fb
+
+	ds $b49
+
+s5_be45:: db ; be45
+s5_be46:: db ; be46
--- a/wram.asm
+++ b/wram.asm
@@ -2409,7 +2409,10 @@
 wStartMinute:: db ; d4b8
 wStartSecond:: db ; d4b9
 
-wRTC:: ds 8 ; d4ba
+wRTC:: ds 4 ; d4ba
+	
+	ds 4
+
 wDST:: ; d4c2
 ; bit 7: dst
 	db