shithub: pokecrystal

Download patch

ref: da7849d800d37156360845fa17e361d2521dce29
parent: 4fa6c6daa46935c7580a60a22bd9216414246dc0
author: PikalaxALT <PikalaxALT@gmail.com>
date: Sat Oct 17 08:58:26 EDT 2015

Restructured functions in main.asm to resemble the home functions they clone

--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
 [submodule "extras"]
 	path = extras
-	url = git://github.com/kanzure/pokemon-reverse-engineering-tools.git
+	url = git://github.com/pret/pokemon-reverse-engineering-tools.git
--- a/constants.asm
+++ b/constants.asm
@@ -26,3 +26,5 @@
 INCLUDE "constants/std_constants.asm"
 INCLUDE "constants/deco_constants.asm"
 INCLUDE "constants/radio_constants.asm"
+INCLUDE "constants/sprite_constants.asm"
+INCLUDE "constants/tilemap_constants.asm"
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -474,188 +474,6 @@
 	shift_const SOUTH
 	shift_const NORTH
 
-; sprites
-	const_def
-	const SPRITE_NONE ; 00
-	const SPRITE_CHRIS ; 01
-	const SPRITE_CHRIS_BIKE ; 02
-	const SPRITE_GAMEBOY_KID ; 03
-	const SPRITE_SILVER ; 04
-	const SPRITE_OAK ; 05
-	const SPRITE_RED ; 06
-	const SPRITE_BLUE ; 07
-	const SPRITE_BILL ; 08
-	const SPRITE_ELDER ; 09
-	const SPRITE_JANINE ; 0a
-	const SPRITE_KURT ; 0b
-	const SPRITE_MOM ; 0c
-	const SPRITE_BLAINE ; 0d
-	const SPRITE_REDS_MOM ; 0e
-	const SPRITE_DAISY ; 0f
-	const SPRITE_ELM ; 10
-	const SPRITE_WILL ; 11
-	const SPRITE_FALKNER ; 12
-	const SPRITE_WHITNEY ; 13
-	const SPRITE_BUGSY ; 14
-	const SPRITE_MORTY ; 15
-	const SPRITE_CHUCK ; 16
-	const SPRITE_JASMINE ; 17
-	const SPRITE_PRYCE ; 18
-	const SPRITE_CLAIR ; 19
-	const SPRITE_BROCK ; 1a
-	const SPRITE_KAREN ; 1b
-	const SPRITE_BRUNO ; 1c
-	const SPRITE_MISTY ; 1d
-	const SPRITE_LANCE ; 1e
-	const SPRITE_SURGE ; 1f
-	const SPRITE_ERIKA ; 20
-	const SPRITE_KOGA ; 21
-	const SPRITE_SABRINA ; 22
-	const SPRITE_COOLTRAINER_M ; 23
-	const SPRITE_COOLTRAINER_F ; 24
-	const SPRITE_BUG_CATCHER ; 25
-	const SPRITE_TWIN ; 26
-	const SPRITE_YOUNGSTER ; 27
-	const SPRITE_LASS ; 28
-	const SPRITE_TEACHER ; 29
-	const SPRITE_BUENA ; 2a
-	const SPRITE_SUPER_NERD ; 2b
-	const SPRITE_ROCKER ; 2c
-	const SPRITE_POKEFAN_M ; 2d
-	const SPRITE_POKEFAN_F ; 2e
-	const SPRITE_GRAMPS ; 2f
-	const SPRITE_GRANNY ; 30
-	const SPRITE_SWIMMER_GUY ; 31
-	const SPRITE_SWIMMER_GIRL ; 32
-	const SPRITE_BIG_SNORLAX ; 33
-	const SPRITE_SURFING_PIKACHU ; 34
-	const SPRITE_ROCKET ; 35
-	const SPRITE_ROCKET_GIRL ; 36
-	const SPRITE_NURSE ; 37
-	const SPRITE_LINK_RECEPTIONIST ; 38
-	const SPRITE_CLERK ; 39
-	const SPRITE_FISHER ; 3a
-	const SPRITE_FISHING_GURU ; 3b
-	const SPRITE_SCIENTIST ; 3c
-	const SPRITE_KIMONO_GIRL ; 3d
-	const SPRITE_SAGE ; 3e
-	const SPRITE_UNUSED_GUY ; 3f
-	const SPRITE_GENTLEMAN ; 40
-	const SPRITE_BLACK_BELT ; 41
-	const SPRITE_RECEPTIONIST ; 42
-	const SPRITE_OFFICER ; 43
-	const SPRITE_CAL ; 44
-	const SPRITE_SLOWPOKE ; 45
-	const SPRITE_CAPTAIN ; 46
-	const SPRITE_BIG_LAPRAS ; 47
-	const SPRITE_GYM_GUY ; 48
-	const SPRITE_SAILOR ; 49
-	const SPRITE_BIKER ; 4a
-	const SPRITE_PHARMACIST ; 4b
-	const SPRITE_MONSTER ; 4c
-	const SPRITE_FAIRY ; 4d
-	const SPRITE_BIRD ; 4e
-	const SPRITE_DRAGON ; 4f
-	const SPRITE_BIG_ONIX ; 50
-	const SPRITE_N64 ; 51
-	const SPRITE_SUDOWOODO ; 52
-	const SPRITE_SURF ; 53
-	const SPRITE_POKE_BALL ; 54
-	const SPRITE_POKEDEX ; 55
-	const SPRITE_PAPER ; 56
-	const SPRITE_VIRTUAL_BOY ; 57
-	const SPRITE_OLD_LINK_RECEPTIONIST ; 58
-	const SPRITE_ROCK ; 59
-	const SPRITE_BOULDER ; 5a
-	const SPRITE_SNES ; 5b
-	const SPRITE_FAMICOM ; 5c
-	const SPRITE_FRUIT_TREE ; 5d
-	const SPRITE_GOLD_TROPHY ; 5e
-	const SPRITE_SILVER_TROPHY ; 5f
-	const SPRITE_KRIS ; 60
-	const SPRITE_KRIS_BIKE ; 61
-	const SPRITE_KURT_OUTSIDE ; 62
-	const SPRITE_SUICUNE ; 63
-	const SPRITE_ENTEI ; 64
-	const SPRITE_RAIKOU ; 65
-	const SPRITE_STANDING_YOUNGSTER ; 66
-
-const_value SET $80
-
-SPRITE_POKEMON EQU const_value
-	const SPRITE_UNOWN ; 80
-	const SPRITE_GEODUDE ; 81
-	const SPRITE_GROWLITHE ; 82
-	const SPRITE_WEEDLE ; 83
-	const SPRITE_SHELLDER ; 84
-	const SPRITE_ODDISH ; 85
-	const SPRITE_GENGAR ; 86
-	const SPRITE_ZUBAT ; 87
-	const SPRITE_MAGIKARP ; 88
-	const SPRITE_SQUIRTLE ; 89
-	const SPRITE_TOGEPI ; 8a
-	const SPRITE_BUTTERFREE ; 8b
-	const SPRITE_DIGLETT ; 8c
-	const SPRITE_POLIWAG ; 8d
-	const SPRITE_PIKACHU ; 8e
-	const SPRITE_CLEFAIRY ; 8f
-	const SPRITE_CHARMANDER ; 90
-	const SPRITE_JYNX ; 91
-	const SPRITE_STARMIE ; 92
-	const SPRITE_BULBASAUR ; 93
-	const SPRITE_JIGGLYPUFF ; 94
-	const SPRITE_GRIMER ; 95
-	const SPRITE_EKANS ; 96
-	const SPRITE_PARAS ; 97
-	const SPRITE_TENTACOOL ; 98
-	const SPRITE_TAUROS ; 99
-	const SPRITE_MACHOP ; 9a
-	const SPRITE_VOLTORB ; 9b
-	const SPRITE_LAPRAS ; 9c
-	const SPRITE_RHYDON ; 9d
-	const SPRITE_MOLTRES ; 9e
-	const SPRITE_SNORLAX ; 9f
-	const SPRITE_GYARADOS ; a0
-	const SPRITE_LUGIA ; a1
-	const SPRITE_HO_OH ; a2
-
-const_value SET $e0
-	const SPRITE_DAYCARE_MON_1 ; e0
-	const SPRITE_DAYCARE_MON_2 ; e1
-
-const_value SET $f0
-SPRITE_VARS EQU const_value
-	const SPRITE_CONSOLE ; f0
-	const SPRITE_DOLL_1 ; f1
-	const SPRITE_DOLL_2 ; f2
-	const SPRITE_BIG_DOLL ; f3
-	const SPRITE_WEIRD_TREE ; f4
-	const SPRITE_OLIVINE_RIVAL ; f5
-	const SPRITE_AZALEA_ROCKET ; f6
-	const SPRITE_FUCHSIA_GYM_1 ; f7
-	const SPRITE_FUCHSIA_GYM_2 ; f8
-	const SPRITE_FUCHSIA_GYM_3 ; f9
-	const SPRITE_FUCHSIA_GYM_4 ; fa
-	const SPRITE_COPYCAT ; fb
-	const SPRITE_JANINE_IMPERSONATOR ; fc
-
-; sprite types
-const_value SET 1
-	const WALKING_SPRITE
-	const STANDING_SPRITE
-	const STILL_SPRITE
-
-; sprite palettes
-	const_def
-	const PAL_OW_RED
-	const PAL_OW_BLUE
-	const PAL_OW_GREEN
-	const PAL_OW_BROWN
-	const PAL_OW_PINK
-	const PAL_OW_SILVER
-	const PAL_OW_TREE
-	const PAL_OW_ROCK
-
 ; permissions
 const_value SET 1
 	const TOWN
@@ -794,42 +612,6 @@
 	const SPAWN_MT_SILVER
 	const SPAWN_FAST_SHIP
 NUM_SPAWNS EQU const_value
-
-	const_def
-	const SPRITEMOVEFN_00
-	const SPRITEMOVEFN_01
-	const SPRITEMOVEFN_02
-	const SPRITEMOVEFN_03
-	const SPRITEMOVEFN_04
-	const SPRITEMOVEFN_05
-	const SPRITEMOVEFN_06
-	const SPRITEMOVEFN_07
-	const SPRITEMOVEFN_08
-	const SPRITEMOVEFN_09
-	const SPRITEMOVEFN_0A
-	const SPRITEMOVEFN_0B
-	const SPRITEMOVEFN_0C
-	const SPRITEMOVEFN_0D
-	const SPRITEMOVEFN_0E
-	const SPRITEMOVEFN_0F
-	const SPRITEMOVEFN_10
-	const SPRITEMOVEFN_11
-	const SPRITEMOVEFN_12
-	const SPRITEMOVEFN_13
-	const SPRITEMOVEFN_14
-	const SPRITEMOVEFN_15
-	const SPRITEMOVEFN_16
-	const SPRITEMOVEFN_17
-	const SPRITEMOVEFN_18
-	const SPRITEMOVEFN_19
-	const SPRITEMOVEFN_1A
-	const SPRITEMOVEFN_1B
-	const SPRITEMOVEFN_1C
-	const SPRITEMOVEFN_1D
-	const SPRITEMOVEFN_1E
-	const SPRITEMOVEFN_1F
-	const SPRITEMOVEFN_20
-	const SPRITEMOVEFN_21
 
 	const_def
 	const PALETTE_AUTO
--- /dev/null
+++ b/constants/sprite_constants.asm
@@ -1,0 +1,219 @@
+
+; sprites
+	const_def
+	const SPRITE_NONE ; 00
+	const SPRITE_CHRIS ; 01
+	const SPRITE_CHRIS_BIKE ; 02
+	const SPRITE_GAMEBOY_KID ; 03
+	const SPRITE_SILVER ; 04
+	const SPRITE_OAK ; 05
+	const SPRITE_RED ; 06
+	const SPRITE_BLUE ; 07
+	const SPRITE_BILL ; 08
+	const SPRITE_ELDER ; 09
+	const SPRITE_JANINE ; 0a
+	const SPRITE_KURT ; 0b
+	const SPRITE_MOM ; 0c
+	const SPRITE_BLAINE ; 0d
+	const SPRITE_REDS_MOM ; 0e
+	const SPRITE_DAISY ; 0f
+	const SPRITE_ELM ; 10
+	const SPRITE_WILL ; 11
+	const SPRITE_FALKNER ; 12
+	const SPRITE_WHITNEY ; 13
+	const SPRITE_BUGSY ; 14
+	const SPRITE_MORTY ; 15
+	const SPRITE_CHUCK ; 16
+	const SPRITE_JASMINE ; 17
+	const SPRITE_PRYCE ; 18
+	const SPRITE_CLAIR ; 19
+	const SPRITE_BROCK ; 1a
+	const SPRITE_KAREN ; 1b
+	const SPRITE_BRUNO ; 1c
+	const SPRITE_MISTY ; 1d
+	const SPRITE_LANCE ; 1e
+	const SPRITE_SURGE ; 1f
+	const SPRITE_ERIKA ; 20
+	const SPRITE_KOGA ; 21
+	const SPRITE_SABRINA ; 22
+	const SPRITE_COOLTRAINER_M ; 23
+	const SPRITE_COOLTRAINER_F ; 24
+	const SPRITE_BUG_CATCHER ; 25
+	const SPRITE_TWIN ; 26
+	const SPRITE_YOUNGSTER ; 27
+	const SPRITE_LASS ; 28
+	const SPRITE_TEACHER ; 29
+	const SPRITE_BUENA ; 2a
+	const SPRITE_SUPER_NERD ; 2b
+	const SPRITE_ROCKER ; 2c
+	const SPRITE_POKEFAN_M ; 2d
+	const SPRITE_POKEFAN_F ; 2e
+	const SPRITE_GRAMPS ; 2f
+	const SPRITE_GRANNY ; 30
+	const SPRITE_SWIMMER_GUY ; 31
+	const SPRITE_SWIMMER_GIRL ; 32
+	const SPRITE_BIG_SNORLAX ; 33
+	const SPRITE_SURFING_PIKACHU ; 34
+	const SPRITE_ROCKET ; 35
+	const SPRITE_ROCKET_GIRL ; 36
+	const SPRITE_NURSE ; 37
+	const SPRITE_LINK_RECEPTIONIST ; 38
+	const SPRITE_CLERK ; 39
+	const SPRITE_FISHER ; 3a
+	const SPRITE_FISHING_GURU ; 3b
+	const SPRITE_SCIENTIST ; 3c
+	const SPRITE_KIMONO_GIRL ; 3d
+	const SPRITE_SAGE ; 3e
+	const SPRITE_UNUSED_GUY ; 3f
+	const SPRITE_GENTLEMAN ; 40
+	const SPRITE_BLACK_BELT ; 41
+	const SPRITE_RECEPTIONIST ; 42
+	const SPRITE_OFFICER ; 43
+	const SPRITE_CAL ; 44
+	const SPRITE_SLOWPOKE ; 45
+	const SPRITE_CAPTAIN ; 46
+	const SPRITE_BIG_LAPRAS ; 47
+	const SPRITE_GYM_GUY ; 48
+	const SPRITE_SAILOR ; 49
+	const SPRITE_BIKER ; 4a
+	const SPRITE_PHARMACIST ; 4b
+	const SPRITE_MONSTER ; 4c
+	const SPRITE_FAIRY ; 4d
+	const SPRITE_BIRD ; 4e
+	const SPRITE_DRAGON ; 4f
+	const SPRITE_BIG_ONIX ; 50
+	const SPRITE_N64 ; 51
+	const SPRITE_SUDOWOODO ; 52
+	const SPRITE_SURF ; 53
+	const SPRITE_POKE_BALL ; 54
+	const SPRITE_POKEDEX ; 55
+	const SPRITE_PAPER ; 56
+	const SPRITE_VIRTUAL_BOY ; 57
+	const SPRITE_OLD_LINK_RECEPTIONIST ; 58
+	const SPRITE_ROCK ; 59
+	const SPRITE_BOULDER ; 5a
+	const SPRITE_SNES ; 5b
+	const SPRITE_FAMICOM ; 5c
+	const SPRITE_FRUIT_TREE ; 5d
+	const SPRITE_GOLD_TROPHY ; 5e
+	const SPRITE_SILVER_TROPHY ; 5f
+	const SPRITE_KRIS ; 60
+	const SPRITE_KRIS_BIKE ; 61
+	const SPRITE_KURT_OUTSIDE ; 62
+	const SPRITE_SUICUNE ; 63
+	const SPRITE_ENTEI ; 64
+	const SPRITE_RAIKOU ; 65
+	const SPRITE_STANDING_YOUNGSTER ; 66
+
+const_value SET $80
+
+SPRITE_POKEMON EQU const_value
+	const SPRITE_UNOWN ; 80
+	const SPRITE_GEODUDE ; 81
+	const SPRITE_GROWLITHE ; 82
+	const SPRITE_WEEDLE ; 83
+	const SPRITE_SHELLDER ; 84
+	const SPRITE_ODDISH ; 85
+	const SPRITE_GENGAR ; 86
+	const SPRITE_ZUBAT ; 87
+	const SPRITE_MAGIKARP ; 88
+	const SPRITE_SQUIRTLE ; 89
+	const SPRITE_TOGEPI ; 8a
+	const SPRITE_BUTTERFREE ; 8b
+	const SPRITE_DIGLETT ; 8c
+	const SPRITE_POLIWAG ; 8d
+	const SPRITE_PIKACHU ; 8e
+	const SPRITE_CLEFAIRY ; 8f
+	const SPRITE_CHARMANDER ; 90
+	const SPRITE_JYNX ; 91
+	const SPRITE_STARMIE ; 92
+	const SPRITE_BULBASAUR ; 93
+	const SPRITE_JIGGLYPUFF ; 94
+	const SPRITE_GRIMER ; 95
+	const SPRITE_EKANS ; 96
+	const SPRITE_PARAS ; 97
+	const SPRITE_TENTACOOL ; 98
+	const SPRITE_TAUROS ; 99
+	const SPRITE_MACHOP ; 9a
+	const SPRITE_VOLTORB ; 9b
+	const SPRITE_LAPRAS ; 9c
+	const SPRITE_RHYDON ; 9d
+	const SPRITE_MOLTRES ; 9e
+	const SPRITE_SNORLAX ; 9f
+	const SPRITE_GYARADOS ; a0
+	const SPRITE_LUGIA ; a1
+	const SPRITE_HO_OH ; a2
+
+const_value SET $e0
+	const SPRITE_DAYCARE_MON_1 ; e0
+	const SPRITE_DAYCARE_MON_2 ; e1
+
+const_value SET $f0
+SPRITE_VARS EQU const_value
+	const SPRITE_CONSOLE ; f0
+	const SPRITE_DOLL_1 ; f1
+	const SPRITE_DOLL_2 ; f2
+	const SPRITE_BIG_DOLL ; f3
+	const SPRITE_WEIRD_TREE ; f4
+	const SPRITE_OLIVINE_RIVAL ; f5
+	const SPRITE_AZALEA_ROCKET ; f6
+	const SPRITE_FUCHSIA_GYM_1 ; f7
+	const SPRITE_FUCHSIA_GYM_2 ; f8
+	const SPRITE_FUCHSIA_GYM_3 ; f9
+	const SPRITE_FUCHSIA_GYM_4 ; fa
+	const SPRITE_COPYCAT ; fb
+	const SPRITE_JANINE_IMPERSONATOR ; fc
+
+; sprite types
+const_value SET 1
+	const WALKING_SPRITE
+	const STANDING_SPRITE
+	const STILL_SPRITE
+
+; sprite palettes
+	const_def
+	const PAL_OW_RED
+	const PAL_OW_BLUE
+	const PAL_OW_GREEN
+	const PAL_OW_BROWN
+	const PAL_OW_PINK
+	const PAL_OW_SILVER
+	const PAL_OW_TREE
+	const PAL_OW_ROCK
+
+; sprite movements
+	const_def
+	const SPRITEMOVEFN_00
+	const SPRITEMOVEFN_01
+	const SPRITEMOVEFN_02
+	const SPRITEMOVEFN_03
+	const SPRITEMOVEFN_04
+	const SPRITEMOVEFN_05
+	const SPRITEMOVEFN_06
+	const SPRITEMOVEFN_07
+	const SPRITEMOVEFN_08
+	const SPRITEMOVEFN_09
+	const SPRITEMOVEFN_0A
+	const SPRITEMOVEFN_0B
+	const SPRITEMOVEFN_0C
+	const SPRITEMOVEFN_0D
+	const SPRITEMOVEFN_0E
+	const SPRITEMOVEFN_0F
+	const SPRITEMOVEFN_10
+	const SPRITEMOVEFN_11
+	const SPRITEMOVEFN_12
+	const SPRITEMOVEFN_13
+	const SPRITEMOVEFN_14
+	const SPRITEMOVEFN_15
+	const SPRITEMOVEFN_16
+	const SPRITEMOVEFN_17
+	const SPRITEMOVEFN_18
+	const SPRITEMOVEFN_19
+	const SPRITEMOVEFN_1A
+	const SPRITEMOVEFN_1B
+	const SPRITEMOVEFN_1C
+	const SPRITEMOVEFN_1D
+	const SPRITEMOVEFN_1E
+	const SPRITEMOVEFN_1F
+	const SPRITEMOVEFN_20
+	const SPRITEMOVEFN_21
--- /dev/null
+++ b/constants/tilemap_constants.asm
@@ -1,0 +1,5 @@
+LANDTILE EQU  0
+WALLTILE EQU  1
+WATRTILE EQU 15
+
+TALK     EQU  1 << 4
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -4,7 +4,7 @@
 	set 4, [hl]
 	call Function1068a
 .loop
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .done
@@ -651,7 +651,7 @@
 	set 4, [hl]
 	call Function1068a
 .asm_1049b
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_104ad
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -27,7 +27,7 @@
 	call DelayFrame
 
 .main
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .exit
--- a/event/buena.asm
+++ b/event/buena.asm
@@ -141,7 +141,7 @@
 	call WriteBackup
 	ld hl, UnknownText_0x8b08b
 	call PrintText
-	call Functiona36
+	call JoyWaitAorB
 	call PlayClickSFX
 	ret
 ; 8b072
--- a/event/mom.asm
+++ b/event/mom.asm
@@ -491,7 +491,7 @@
 
 Function16571: ; 16571
 .loop
-	call Functiona57
+	call JoyTextDelay
 	ld hl, hJoyPressed
 	ld a, [hl]
 	and B_BUTTON
--- a/event/poke_seer.asm
+++ b/event/poke_seer.asm
@@ -11,7 +11,7 @@
 SpecialPokeSeer: ; 4f0bc
 	ld a, SEER_INTRO
 	call PrintSeerText
-	call Functiona36
+	call JoyWaitAorB
 
 	ld b, $6
 	callba SelectMonFromParty
--- a/event/unown.asm
+++ b/event/unown.asm
@@ -151,7 +151,7 @@
 	add hl, bc
 	call Function8aee9
 	call Function3200
-	call Functiona36
+	call JoyWaitAorB
 	call PlayClickSFX
 	call WriteBackup
 	ret
--- a/home.asm
+++ b/home.asm
@@ -615,11 +615,11 @@
 	jr c, .wait
 
 	di
-	ld a, $1
+	ld a, 1 ; BANK(VTiles3)
 	ld [rVBK], a
 	hlcoord 0, 0, AttrMap
 	call Function327b
-	ld a, $0
+	ld a, 0 ; BANK(VTiles0)
 	ld [rVBK], a
 	hlcoord 0, 0
 	call Function327b
@@ -639,7 +639,7 @@
 Function327b:: ; 327b
 	ld [hSPBuffer], sp
 	ld sp, hl
-	ld a, [$ffd7]
+	ld a, [hBGMapAddress + 1]
 	ld h, a
 	ld l, 0
 	ld a, 18
@@ -1188,7 +1188,7 @@
 	push af
 	ld a, $1
 	ld [hInMenu], a
-	call Functiona57
+	call JoyTextDelay
 	pop af
 	ld [hInMenu], a
 
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -211,6 +211,7 @@
 
 
 Request2bpp:: ; eba
+; Load 2bpp at b:de to occupy c tiles of hl.
 	ld a, [hBGMapMode]
 	push af
 	xor a
@@ -228,14 +229,14 @@
 	ld [$ffd3], a
 	ld a, [InLinkBattle]
 	cp $4
-	jr nz, .asm_edc
+	jr nz, .okay
 	ld a, [$ffe9]
 	and a
-	jr nz, .asm_edc
+	jr nz, .okay
 	ld a, $6
 	ld [$ffd3], a
 
-.asm_edc
+.okay
 	ld a, e
 	ld [Requested2bppSource], a
 	ld a, d
@@ -245,11 +246,11 @@
 	ld a, h
 	ld [Requested2bppDest + 1], a
 
-.asm_eec
+.loop
 	ld a, c
 	ld hl, $ffd3
 	cp [hl]
-	jr nc, .asm_f08
+	jr nc, .iterate
 
 	ld [Requested2bpp], a
 .wait
@@ -268,19 +269,19 @@
 	ld [hBGMapMode], a
 	ret
 
-.asm_f08
+.iterate
 	ld a, [$ffd3]
 	ld [Requested2bpp], a
-.asm_f0d
+.wait2
 	call DelayFrame
 	ld a, [Requested2bpp]
 	and a
-	jr nz, .asm_f0d
+	jr nz, .wait2
 	ld a, c
 	ld hl, $ffd3
 	sub [hl]
 	ld c, a
-	jr .asm_eec
+	jr .loop
 ; f1e
 
 
@@ -302,14 +303,14 @@
 	ld [$ffd3], a
 	ld a, [InLinkBattle]
 	cp $4
-	jr nz, .asm_f40
+	jr nz, .NotMobile
 	ld a, [$ffe9]
 	and a
-	jr nz, .asm_f40
+	jr nz, .NotMobile
 	ld a, $6
 	ld [$ffd3], a
 
-.asm_f40
+.NotMobile
 	ld a, e
 	ld [Requested1bppSource], a
 	ld a, d
@@ -318,11 +319,11 @@
 	ld [Requested1bppDest], a
 	ld a, h
 	ld [Requested1bppDest + 1], a
-.asm_f50
+.loop
 	ld a, c
 	ld hl, $ffd3
 	cp [hl]
-	jr nc, .asm_f6c
+	jr nc, .iterate
 
 	ld [Requested1bpp], a
 .wait
@@ -341,19 +342,21 @@
 	ld [hBGMapMode], a
 	ret
 
-.asm_f6c
+.iterate
 	ld a, [$ffd3]
 	ld [Requested1bpp], a
-.asm_f71
+
+.wait2
 	call DelayFrame
 	ld a, [Requested1bpp]
 	and a
-	jr nz, .asm_f71
+	jr nz, .wait2
+
 	ld a, c
 	ld hl, $ffd3
 	sub [hl]
 	ld c, a
-	jr .asm_f50
+	jr .loop
 ; f82
 
 
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -273,35 +273,37 @@
 ; a1b
 
 
-Functiona1b:: ; a1b
+JoyTitleScreenInput:: ; a1b
+.loop
 
 	call DelayFrame
 
 	push bc
-	call Functiona57
+	call JoyTextDelay
 	pop bc
 
 	ld a, [hJoyDown]
 	cp D_UP | SELECT | B_BUTTON
-	jr z, .asm_a34
+	jr z, .keycombo
 
 	ld a, [hJoyLast]
 	and START | A_BUTTON
-	jr nz, .asm_a34
+	jr nz, .keycombo
 
 	dec c
-	jr nz, Functiona1b
+	jr nz, .loop
 
 	and a
 	ret
 
-.asm_a34
+.keycombo
 	scf
 	ret
 ; a36
 
 
-Functiona36:: ; a36
+JoyWaitAorB:: ; a36
+.loop
 	call DelayFrame
 	call GetJoypad
 	ld a, [hJoyPressed]
@@ -308,7 +310,7 @@
 	and A_BUTTON | B_BUTTON
 	ret nz
 	call RTC
-	jr Functiona36
+	jr .loop
 ; a46
 
 CloseText:: ; a46
@@ -317,13 +319,13 @@
 	ld a, 1
 	ld [hOAMUpdate], a
 	call WaitBGMap
-	call Functiona36
+	call JoyWaitAorB
 	pop af
 	ld [hOAMUpdate], a
 	ret
 ; a57
 
-Functiona57:: ; a57
+JoyTextDelay:: ; a57
 	call GetJoypad
 	ld a, [hInMenu]
 	and a
@@ -367,7 +369,7 @@
 	hlcoord 18, 17
 	call Functionb06
 	pop hl
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyLast]
 	and $3
 	jr z, .asm_a8d
@@ -379,7 +381,7 @@
 ; aa5
 
 Functionaa5:: ; aa5
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyLast]
 	and A_BUTTON | B_BUTTON
 	jr z, Functionaa5
@@ -413,7 +415,7 @@
 	callba Function1de28a
 .asm_ad9
 	call Functionaf5
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyPressed]
 	and $3
 	jr nz, .asm_af1
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -2181,7 +2181,7 @@
 	call Functionf1db
 	ld a, $f5
 	call Functionf24a
-	call Functiona36
+	call JoyWaitAorB
 .asm_f413
 	ld a, b
 	inc a
--- a/main.asm
+++ b/main.asm
@@ -947,7 +947,7 @@
 	ld c, 3
 	call DelayFrames
 
-	call Function61cd
+	call Intro_PlacePlayerSprite
 	call Functione5f
 
 	ld c, 50
@@ -1020,7 +1020,7 @@
 	ret
 ; 61cd
 
-Function61cd: ; 61cd
+Intro_PlacePlayerSprite: ; 61cd
 
 	callba GetPlayerIcon
 	ld c, $c
@@ -1028,7 +1028,7 @@
 	call Request2bpp
 
 	ld hl, Sprites
-	ld de, .data_61fe
+	ld de, .sprites
 	ld a, [de]
 	inc de
 
@@ -1058,12 +1058,12 @@
 	ret
 ; 61fe
 
-.data_61fe ; 61fe
+.sprites ; 61fe
 	db 4
-	db $4c, $48, $00
-	db $4c, $50, $01
-	db $54, $48, $02
-	db $54, $50, $03
+	db $4c, $48, 0
+	db $4c, $50, 1
+	db $54, $48, 2
+	db $54, $50, 3
 ; 620b
 
 
@@ -1123,7 +1123,7 @@
 	dw Function6389
 	dw Function620b
 	dw Function620b
-	dw Function6392
+	dw ResetClock
 ; 6274
 
 
@@ -1378,18 +1378,19 @@
 	jp Init
 ; 6392
 
-Function6392: ; 6392
-	callba Function4d3b1
+ResetClock: ; 6392
+	callba _ResetClock
 	jp Init
 ; 639b
 
 Function639b: ; 639b
+	; If bit 0 or 1 of [wcf65] is set, we don't need to be here.
 	ld a, [wcf65]
 	and $3
 	ret nz
 	ld bc, wc3a4
 	ld hl, $000a
-	add hl, bc
+	add hl, bc ; over-the-top compicated way to load wc3ae into hl
 	ld l, [hl]
 	ld h, 0
 rept 2
@@ -1397,8 +1398,9 @@
 endr
 	ld de, Data63ca
 	add hl, de
+	; If bit 2 of [wcf65] is set, get the second dw; else, get the first dw
 	ld a, [wcf65]
-	and $4
+	and %00000100
 	srl a
 	srl a
 	ld e, a
@@ -1417,12 +1419,12 @@
 ; 63ca
 
 Data63ca: ; 63ca
-	db $5c, $50, $00, $00
-	db $5c, $68, $5c, $58
-	db $5c, $68, $5c, $78
-	db $5c, $88, $5c, $78
-	db $00, $00, $5c, $78
-	db $00, $00, $5c, $58
+	dw $505c, $0000
+	dw $685c, $585c
+	dw $685c, $785c
+	dw $885c, $785c
+	dw $0000, $785c
+	dw $0000, $585c
 ; 63e2
 
 Copyright: ; 63e2
@@ -10752,7 +10754,7 @@
 ; 11915
 
 Function11915: ; 11915
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_11930
@@ -11492,7 +11494,7 @@
 	ret
 
 Function11fc0: ; 11fc0 (4:5fc0)
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_11fdb
@@ -18956,7 +18958,7 @@
 	call TakeMoney
 	ld a, $4
 	call Function15c7d
-	call Functiona36
+	call JoyWaitAorB
 
 .asm_15d68
 	call SpeechTextBox
@@ -18970,7 +18972,7 @@
 .asm_15d6f
 	ld a, $3
 	call Function15c7d
-	call Functiona36
+	call JoyWaitAorB
 	and a
 	ret
 
@@ -18977,7 +18979,7 @@
 .asm_15d79
 	ld a, $2
 	call Function15c7d
-	call Functiona36
+	call JoyWaitAorB
 	and a
 	ret
 ; 15d83
@@ -19036,7 +19038,7 @@
 .asm_15dd8
 	ld a, $5
 	call Function15c7d
-	call Functiona36
+	call JoyWaitAorB
 	scf
 	ret
 ; 15de2
@@ -19341,7 +19343,7 @@
 	call PrintTextBoxText
 	call Function15fc3
 	callba Function24af0
-	call Functiona36
+	call JoyWaitAorB
 
 .asm_15f6e
 	call ExitMenu
@@ -19435,7 +19437,7 @@
 
 Function15fcd: ; 15fcd
 	call MenuTextBox
-	call Functiona36
+	call JoyWaitAorB
 	call ExitMenu
 	ret
 ; 15fd7
@@ -20490,7 +20492,7 @@
 	call Function32f9
 
 .asm_16c6b
-	call Functiona57
+	call JoyTextDelay
 
 	ld a, [hJoyPressed]
 	and B_BUTTON
@@ -22364,7 +22366,7 @@
 	callab Function8cf62
 
 .asm_24266
-	call Functiona57
+	call JoyTextDelay
 	call Function1bdd
 	and a
 	ret z
@@ -24765,7 +24767,7 @@
 	call Function2513b
 .asm_25117
 	call UpdateTime
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_25132
@@ -25367,7 +25369,7 @@
 .shutdown
 	ld hl, OakPCText4
 	call PrintText
-	call Functiona36
+	call JoyWaitAorB
 	call ExitMenu
 	ret
 ; 0x265ee
@@ -25377,7 +25379,7 @@
 	call PrintText
 	call Rate
 	call PlaySFX ; sfx loaded by previous Rate function call
-	call Functiona36
+	call JoyWaitAorB
 	call WaitSFX
 	ret
 ; 0x26601
@@ -25389,7 +25391,7 @@
 	call PlayMusic
 	pop de
 	call PlaySFX
-	call Functiona36
+	call JoyWaitAorB
 	call WaitSFX
 	ret
 ; 0x26616
@@ -25409,7 +25411,7 @@
 	call ClearOakRatingBuffers
 	ld hl, OakPCText3
 	call PrintText
-	call Functiona36
+	call JoyWaitAorB
 	ld a, [wd003]
 	ld hl, OakRatings
 	call FindOakRating
@@ -28742,7 +28744,7 @@
 	ld a, $ed
 	ldcoord 9, 17
 .asm_28ae3
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyLast]
 	and a
 	jr z, .asm_28ae3
@@ -37593,7 +37595,7 @@
 	ld a, [wd473]
 	push af
 .asm_487c6
-	call Functiona57
+	call JoyTextDelay
 	call Function4880e
 	jr nc, .asm_487c6
 	ld a, $1
@@ -37791,7 +37793,7 @@
 
 asm_48922: ; 48922 (12:4922)
 	push bc
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyDown] ; $ff00+$a8
 	and a
 	jp z, Function4896e
@@ -40596,7 +40598,7 @@
 	call CloseSRAM
 	ld hl, UnknownText_0x4a35d
 	call PrintText
-	call Functiona36
+	call JoyWaitAorB
 .asm_4a338
 	call ExitMenu
 .asm_4a33b
@@ -42407,59 +42409,59 @@
 ; 11 talkable water
 ; 1f talkable wall
 
-	db $00, $00, $00, $00, $00, $00, $00, $0f
-	db $00, $00, $00, $00, $00, $00, $00, $0f
-	db $00, $00, $1f, $00, $00, $1f, $00, $00
-	db $00, $00, $1f, $00, $00, $1f, $00, $00
-	db $01, $01, $11, $00, $11, $01, $01, $0f
-	db $01, $01, $11, $00, $11, $01, $01, $0f
-	db $01, $01, $01, $01, $01, $01, $01, $01
-	db $01, $01, $01, $01, $01, $01, $01, $01
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + WATRTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + WATRTILE
+	db NULL + LANDTILE, NULL + LANDTILE, TALK + WATRTILE, NULL + LANDTILE, NULL + LANDTILE, TALK + WATRTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, TALK + WATRTILE, NULL + LANDTILE, NULL + LANDTILE, TALK + WATRTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + WALLTILE, NULL + WALLTILE, TALK + WALLTILE, NULL + LANDTILE, TALK + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WATRTILE
+	db NULL + WALLTILE, NULL + WALLTILE, TALK + WALLTILE, NULL + LANDTILE, TALK + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WATRTILE
+	db NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE
+	db NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE
 
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $0f, $00, $00, $00, $00, $00
-	db $00, $00, $0f, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + WATRTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + WATRTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
 
-	db $0f, $0f, $0f, $0f, $0f, $00, $00, $00
-	db $0f, $0f, $0f, $0f, $0f, $00, $00, $00
-	db $0f, $0f, $0f, $0f, $0f, $0f, $0f, $0f
-	db $0f, $0f, $0f, $0f, $0f, $0f, $0f, $0f
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
+	db NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE
+	db NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE, NULL + WATRTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
 
-	db $01, $01, $01, $01, $01, $01, $01, $01
-	db $01, $01, $01, $01, $01, $01, $01, $01
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $00
-	db $00, $00, $00, $00, $00, $00, $00, $0f
+	db NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE
+	db NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE, NULL + WALLTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE
+	db NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + LANDTILE, NULL + WATRTILE
 ; 4cf1f
 
-Function4cf1f: ; 4cf1f
+EmptyAllSRAMBanks: ; 4cf1f
 	ld a, $0
-	call Function4cf34
+	call .EmptyBank
 	ld a, $1
-	call Function4cf34
+	call .EmptyBank
 	ld a, $2
-	call Function4cf34
+	call .EmptyBank
 	ld a, $3
-	call Function4cf34
+	call .EmptyBank
 	ret
 ; 4cf34
 
-Function4cf34: ; 4cf34
+.EmptyBank: ; 4cf34
 	call GetSRAMBank
-	ld hl, sScratch
-	ld bc, StackBottom - sScratch
+	ld hl, SRAM_Begin
+	ld bc, SRAM_End - SRAM_Begin
 	xor a
 	call ByteFill
 	call CloseSRAM
@@ -42471,6 +42473,8 @@
 	ld a, [hCGB] ; $ff00+$e6
 	and a
 	jp z, WaitBGMap
+
+; The following is a modified version of Function3246.
 	ld a, [hBGMapMode] ; $ff00+$d4
 	push af
 	xor a
@@ -42479,24 +42483,26 @@
 	push af
 	xor a
 	ld [$ffde], a
-.asm_4cf57
+.WaitLY
 	ld a, [rLY] ; $ff00+$44
 	cp $60
-	jr c, .asm_4cf57
+	jr c, .WaitLY
+
 	di
-	ld a, $1
+	ld a, 1 ; BANK(VBGMap2)
 	ld [rVBK], a ; $ff00+$4f
 	hlcoord 0, 0, AttrMap
 	call Function4cf80
-	ld a, $0
+	ld a, 0 ; BANK(VBGMap0)
 	ld [rVBK], a ; $ff00+$4f
 	hlcoord 0, 0
 	call Function4cf80
-.asm_4cf72
+.WaitLY2
 	ld a, [rLY] ; $ff00+$44
 	cp $60
-	jr c, .asm_4cf72
+	jr c, .WaitLY2
 	ei
+
 	pop af
 	ld [$ffde], a
 	pop af
@@ -42508,111 +42514,35 @@
 	ld sp, hl
 	ld a, [hBGMapAddress + 1]
 	ld h, a
-	ld l, $0
-	ld a, $12
+	ld l, 0
+	ld a, 18
 	ld [$ffd3], a
-	ld b, $2
-	ld c, $41
-.asm_4cf91
+	ld b, 1 << 1
+	ld c, rSTAT % $100
+
+.loop
+rept 20 / 2
 	pop de
-.asm_4cf92
+.loop\@
 	ld a, [$ff00+c]
 	and b
-	jr nz, .asm_4cf92
+	jr nz, .loop\@
 	ld [hl], e
 	inc l
 	ld [hl], d
 	inc l
-	pop de
-.asm_4cf9b
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4cf9b
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4cfa4
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4cfa4
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4cfad
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4cfad
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4cfb6
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4cfb6
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4cfbf
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4cfbf
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4cfc8
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4cfc8
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4cfd1
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4cfd1
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4cfda
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4cfda
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4cfe3
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4cfe3
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	ld de, $c
+endr
+
+	ld de, 32 - 20
 	add hl, de
 	ld a, [$ffd3]
 	dec a
 	ld [$ffd3], a
-	jr nz, .asm_4cf91
+	jr nz, .loop
+
 	ld a, [hSPBuffer] ; $ff00+$d9
 	ld l, a
-	ld a, [$ffda]
+	ld a, [hSPBuffer + 1]
 	ld h, a
 	ld sp, hl
 	ret
@@ -42627,15 +42557,15 @@
 	ld c, a
 	call CloseSRAM
 	ld a, b
-	cp $63
-	jr nz, .asm_4d01b
+	cp 99
+	jr nz, .ok
 	ld a, c
-	cp $7f
-	jr nz, .asm_4d01b
+	cp " "
+	jr nz, .ok
 	ld c, $1
 	ret
 
-.asm_4d01b
+.ok
 	ld c, $0
 	ret
 ; 4d01e
@@ -42690,6 +42620,8 @@
 	ld a, [wc2ce]
 	cp $0
 	jp z, WaitBGMap
+
+; What follows is a modified version of Function3246.
 	ld a, [hBGMapMode]
 	push af
 	xor a
@@ -42698,24 +42630,26 @@
 	push af
 	xor a
 	ld [$ffde], a
-.asm_4d1a2
+.wait
 	ld a, [rLY]
 	cp $8f
-	jr c, .asm_4d1a2
+	jr c, .wait
+
 	di
-	ld a, $1
+	ld a, 1 ; BANK(VBGMap2)
 	ld [rVBK], a
 	hlcoord 0, 0, AttrMap
 	call Function4d1cb
-	ld a, $0
+	ld a, 0 ; BANK(VBGMap0)
 	ld [rVBK], a
 	hlcoord 0, 0
 	call Function4d1cb
-.asm_4d1bd
+.wait2
 	ld a, [rLY]
 	cp $8f
-	jr c, .asm_4d1bd
+	jr c, .wait2
 	ei
+
 	pop af
 	ld [$ffde], a
 	pop af
@@ -42728,111 +42662,35 @@
 	ld sp, hl
 	ld a, [hBGMapAddress + 1]
 	ld h, a
-	ld l, $0
-	ld a, $12
+	ld l, 0
+	ld a, 18
 	ld [$ffd3], a
-	ld b, $2
-	ld c, $41
-.asm_4d1dc
+	ld b, 1 << 1 ; not in v/hblank
+	ld c, rSTAT % $100
+
+.loop
+rept 20 / 2
 	pop de
-.asm_4d1dd
+.loop\@
 	ld a, [$ff00+c]
 	and b
-	jr nz, .asm_4d1dd
+	jr nz, .loop\@
 	ld [hl], e
 	inc l
 	ld [hl], d
 	inc l
-	pop de
-.asm_4d1e6
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4d1e6
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4d1ef
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4d1ef
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4d1f8
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4d1f8
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4d201
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4d201
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4d20a
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4d20a
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4d213
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4d213
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4d21c
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4d21c
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4d225
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4d225
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	pop de
-.asm_4d22e
-	ld a, [$ff00+c]
-	and b
-	jr nz, .asm_4d22e
-	ld [hl], e
-	inc l
-	ld [hl], d
-	inc l
-	ld de, $000c
+endr
+
+	ld de, 32 - 20
 	add hl, de
 	ld a, [$ffd3]
 	dec a
 	ld [$ffd3], a
-	jr nz, .asm_4d1dc
+	jr nz, .loop
+
 	ld a, [hSPBuffer]
 	ld l, a
-	ld a, [$ffda]
+	ld a, [hSPBuffer + 1]
 	ld h, a
 	ld sp, hl
 	ret
@@ -42889,19 +42747,19 @@
 	inc c
 endr
 	ld a, $7
-.asm_4d36e
+.row
 	push bc
 	push hl
-.asm_4d370
+.col
 	ld [hli], a
 	dec c
-	jr nz, .asm_4d370
+	jr nz, .col
 	pop hl
 	ld de, SCREEN_WIDTH
 	add hl, de
 	pop bc
 	dec b
-	jr nz, .asm_4d36e
+	jr nz, .row
 	ret
 ; 4d37e
 
@@ -42916,36 +42774,36 @@
 	pop hl
 	ld de, SCREEN_WIDTH
 	add hl, de
-.asm_4d38d
+.loop
 	push hl
-	ld a, $79
+	ld a, "┌"
 	ld [hli], a
-	ld a, $7f
+	ld a, " "
 	call Function4d3ab
-	ld [hl], $7a
+	ld [hl], "─"
 	pop hl
 	ld de, SCREEN_WIDTH
 	add hl, de
 	dec b
-	jr nz, .asm_4d38d
-	ld a, $7b
+	jr nz, .loop
+	ld a, "┐"
 	ld [hli], a
-	ld a, $7c
+	ld a, "│"
 	call Function4d3ab
-	ld [hl], $7d
+	ld [hl], "└"
 	ret
 ; 4d3ab
 
 Function4d3ab: ; 4d3ab
 	ld d, c
-.asm_4d3ac
+.loop
 	ld [hli], a
 	dec d
-	jr nz, .asm_4d3ac
+	jr nz, .loop
 	ret
 ; 4d3b1
 
-Function4d3b1: ; 4d3b1
+_ResetClock: ; 4d3b1
 	callba Function8000
 	ld b, $8
 	call GetSGBLayout
@@ -42953,9 +42811,9 @@
 	call Functione5f
 	ld de, MUSIC_MAIN_MENU
 	call PlayMusic
-	ld hl, UnknownText_0x4d408
+	ld hl, .text_askreset
 	call PrintText
-	ld hl, MenuDataHeader_0x4d40d
+	ld hl, .NoYes_MenuDataHeader
 	call CopyMenuDataHeader
 	call InterpretMenu2
 	ret c
@@ -42962,50 +42820,50 @@
 	ld a, [wcfa9]
 	cp $1
 	ret z
-	call Function4d41e
-	jr c, .asm_4d3f7
+	call ClockResetPassword
+	jr c, .wrongpassword
 	ld a, BANK(s0_ac60)
 	call GetSRAMBank
 	ld a, $80
 	ld [s0_ac60], a
 	call CloseSRAM
-	ld hl, UnknownText_0x4d3fe
+	ld hl, .text_okay
 	call PrintText
 	ret
 
-.asm_4d3f7
-	ld hl, UnknownText_0x4d403
+.wrongpassword
+	ld hl, .text_wrong
 	call PrintText
 	ret
 ; 4d3fe
 
-UnknownText_0x4d3fe: ; 0x4d3fe
+.text_okay: ; 0x4d3fe
 	; Password OK. Select CONTINUE & reset settings.
 	text_jump UnknownText_0x1c55db
 	db "@"
 ; 0x4d403
 
-UnknownText_0x4d403: ; 0x4d403
+.text_wrong: ; 0x4d403
 	; Wrong password!
 	text_jump UnknownText_0x1c560b
 	db "@"
 ; 0x4d408
 
-UnknownText_0x4d408: ; 0x4d408
+.text_askreset: ; 0x4d408
 	; Reset the clock?
 	text_jump UnknownText_0x1c561c
 	db "@"
 ; 0x4d40d
 
-MenuDataHeader_0x4d40d: ; 0x4d40d
+.NoYes_MenuDataHeader: ; 0x4d40d
 	db $00 ; flags
 	db 07, 14 ; start coords
 	db 11, 19 ; end coords
-	dw MenuData2_0x4d415
+	dw .NoYes_MenuData2
 	db 1 ; default option
 ; 0x4d415
 
-MenuData2_0x4d415: ; 0x4d415
+.NoYes_MenuData2: ; 0x4d415
 	db $c0 ; flags
 	db 2 ; items
 	db "NO@"
@@ -43012,8 +42870,8 @@
 	db "YES@"
 ; 0x4d41e
 
-Function4d41e: ; 4d41e
-	call Function4d50f
+ClockResetPassword: ; 4d41e
+	call .CalculatePassword
 	push de
 	ld hl, StringBuffer2
 	ld bc, 5
@@ -43021,58 +42879,58 @@
 	call ByteFill
 	ld a, $4
 	ld [StringBuffer2 + 5], a
-	ld hl, UnknownText_0x4d463
+	ld hl, .pleaseenterpasswordtext
 	call PrintText
-.asm_4d437
-	call Function4d468
-.asm_4d43a
-	call Functiona57
+.loop
+	call .updateIDdisplay
+.loop2
+	call JoyTextDelay
 	ld a, [hJoyLast]
 	ld b, a
 	and A_BUTTON
-	jr nz, .asm_4d453
+	jr nz, .confirm
 	ld a, b
 	and D_PAD
-	jr z, .asm_4d43a
-	call Function4d490
+	jr z, .loop2
+	call .dpadinput
 	ld c, $3
 	call DelayFrames
-	jr .asm_4d437
+	jr .loop
 
-.asm_4d453
-	call Function4d4e0
+.confirm
+	call .ConvertDecIDToBytes
 	pop de
 	ld a, e
 	cp l
-	jr nz, .asm_4d461
+	jr nz, .nope
 	ld a, d
 	cp h
-	jr nz, .asm_4d461
+	jr nz, .nope
 	and a
 	ret
 
-.asm_4d461
+.nope
 	scf
 	ret
 ; 4d463
 
-UnknownText_0x4d463: ; 0x4d463
+.pleaseenterpasswordtext: ; 0x4d463
 	; Please enter the password.
 	text_jump UnknownText_0x1c562e
 	db "@"
 ; 0x4d468
 
-Function4d468: ; 4d468
+.updateIDdisplay: ; 4d468
 	hlcoord 14, 15
 	ld de, StringBuffer2
-	ld c, $5
-.asm_4d470
+	ld c, 5
+.loop3
 	ld a, [de]
-	add $f6
+	add "0"
 	ld [hli], a
 	inc de
 	dec c
-	jr nz, .asm_4d470
+	jr nz, .loop3
 	hlcoord 14, 16
 	ld bc, 5
 	ld a, " "
@@ -43086,22 +42944,22 @@
 	ret
 ; 4d490
 
-Function4d490: ; 4d490
+.dpadinput: ; 4d490
 	ld a, b
-	and $20
-	jr nz, .asm_4d4a5
+	and D_LEFT
+	jr nz, .left
 	ld a, b
-	and $10
-	jr nz, .asm_4d4af
+	and D_RIGHT
+	jr nz, .right
 	ld a, b
-	and $40
-	jr nz, .asm_4d4ba
+	and D_UP
+	jr nz, .up
 	ld a, b
-	and $80
-	jr nz, .asm_4d4c8
+	and D_DOWN
+	jr nz, .down
 	ret
 
-.asm_4d4a5
+.left
 	ld a, [StringBuffer2 + 5]
 	and a
 	ret z
@@ -43109,7 +42967,7 @@
 	ld [StringBuffer2 + 5], a
 	ret
 
-.asm_4d4af
+.right
 	ld a, [StringBuffer2 + 5]
 	cp $4
 	ret z
@@ -43117,34 +42975,34 @@
 	ld [StringBuffer2 + 5], a
 	ret
 
-.asm_4d4ba
-	call Function4d4d5
+.up
+	call .getcurrentdigit
 	ld a, [hl]
-	cp $9
-	jr z, .asm_4d4c5
+	cp 9
+	jr z, .wraparound_up
 	inc a
 	ld [hl], a
 	ret
 
-.asm_4d4c5
+.wraparound_up
 	ld [hl], $0
 	ret
 
-.asm_4d4c8
-	call Function4d4d5
+.down
+	call .getcurrentdigit
 	ld a, [hl]
 	and a
-	jr z, .asm_4d4d2
+	jr z, .wraparound_down
 	dec a
 	ld [hl], a
 	ret
 
-.asm_4d4d2
-	ld [hl], $9
+.wraparound_down
+	ld [hl], 9
 	ret
 ; 4d4d5
 
-Function4d4d5: ; 4d4d5
+.getcurrentdigit: ; 4d4d5
 	ld a, [StringBuffer2 + 5]
 	ld e, a
 	ld d, $0
@@ -43153,19 +43011,19 @@
 	ret
 ; 4d4e0
 
-Function4d4e0: ; 4d4e0
+.ConvertDecIDToBytes: ; 4d4e0
 	ld hl, 0
 	ld de, StringBuffer2 + 4
 	ld bc, 1
-	call Function4d501
+	call .ConvertToBytes
 	ld bc, 10
-	call Function4d501
+	call .ConvertToBytes
 	ld bc, 100
-	call Function4d501
+	call .ConvertToBytes
 	ld bc, 1000
-	call Function4d501
+	call .ConvertToBytes
 	ld bc, 10000
-Function4d501: ; 4d501
+.ConvertToBytes: ; 4d501
 	ld a, [de]
 	dec de
 	push hl
@@ -43178,25 +43036,24 @@
 	ret
 ; 4d50f
 
-Function4d50f: ; 4d50f
+.CalculatePassword: ; 4d50f
 	ld a, BANK(sPlayerData)
 	call GetSRAMBank
 	ld de, $0000
-	ld hl, sPlayerData + PlayerID - wPlayerData
+	ld hl, sPlayerData + (PlayerID - wPlayerData)
 	ld c, $2
-	call Function4d533
-	ld hl, sPlayerData + PlayerName - wPlayerData
+	call .ComponentFromNumber
+	ld hl, sPlayerData + (PlayerName - wPlayerData)
 	ld c, $5
-	call Function4d53e
-	ld hl, sPlayerData + Money - wPlayerData
+	call .ComponentFromString
+	ld hl, sPlayerData + (Money - wPlayerData)
 	ld c, $3
-	call Function4d533
+	call .ComponentFromNumber
 	call CloseSRAM
 	ret
 ; 4d533
 
-Function4d533: ; 4d533
-.asm_4d533
+.ComponentFromNumber: ; 4d533
 	ld a, [hli]
 	add e
 	ld e, a
@@ -43204,12 +43061,11 @@
 	adc d
 	ld d, a
 	dec c
-	jr nz, .asm_4d533
+	jr nz, .ComponentFromNumber
 	ret
 ; 4d53e
 
-Function4d53e: ; 4d53e
-.asm_4d53e
+.ComponentFromString: ; 4d53e
 	ld a, [hli]
 	cp "@"
 	ret z
@@ -43219,7 +43075,7 @@
 	adc d
 	ld d, a
 	dec c
-	jr nz, .asm_4d53e
+	jr nz, .ComponentFromString
 	ret
 ; 4d54c
 
@@ -43240,7 +43096,7 @@
 	ld a, [wcfa9]
 	cp $1
 	ret z
-	callba Function4cf1f
+	callba EmptyAllSRAMBanks
 	ret
 ; 4d580
 
@@ -45520,7 +45376,7 @@
 .asm_4e779
 	call DelayFrame
 	push bc
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyDown]
 	pop bc
 	and B_BUTTON
@@ -50592,7 +50448,7 @@
 ; 81a74
 
 Function81a74: ; 81a74
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	cp $4
 	jr nc, .asm_81a8b
@@ -52438,7 +52294,7 @@
 
 Function843f0: ; 843f0
 .asm_843f0
-	call Functiona57
+	call JoyTextDelay
 	call Function846f6
 	jr c, .asm_8440f
 	ld a, [wcf63]
@@ -52656,7 +52512,7 @@
 	ld a, $9
 	ld [wcf65], a
 .asm_84597
-	call Functiona57
+	call JoyTextDelay
 	call Function846f6
 	jr c, .asm_845c0
 	ld a, [wcf63]
@@ -53652,7 +53508,7 @@
 	call Function86692
 	jr c, .asm_86690
 .asm_8666e
-	call Functiona57
+	call JoyTextDelay
 	ld hl, hJoyLast
 	ld a, [hl]
 	and B_BUTTON
@@ -56601,6 +56457,7 @@
 	add hl, bc
 	ld a, [wc3b4]
 	ld [hli], a
+; read from the table
 	ld a, [de]
 	ld [hli], a
 	inc de
@@ -56611,6 +56468,7 @@
 	call Function8d109
 	ld [hli], a
 	pop de
+
 	ld hl, $0004
 	add hl, bc
 	ld a, e
@@ -56908,6 +56766,8 @@
 ; 8d189
 
 Function8d189: ; 8d189
+	; Get the [bc+10]th entry in the data table
+	; indexed at [bc+1] in Unknown_8d6e6
 	ld hl, $0001
 	add hl, bc
 	ld e, [hl]
@@ -56962,51 +56822,51 @@
 ; 8d1c4
 
 Unknown_8d1c4: ; 8d1c4
-	db $01, $01, $00
-	db $07, $04, $00
-	db $08, $05, $05
-	db $0a, $06, $00
-	db $0b, $07, $06
-	db $0c, $08, $06
-	db $0d, $09, $07
-	db $0e, $0a, $07
-	db $10, $0b, $07
-	db $08, $0c, $05
-	db $11, $00, $00
-	db $12, $0d, $08
-	db $12, $0e, $08
-	db $12, $0f, $08
-	db $13, $10, $00
-	db $15, $00, $00
-	db $16, $11, $00
-	db $17, $12, $00
-	db $18, $12, $00
-	db $19, $13, $00
-	db $1a, $14, $00
-	db $1b, $00, $00
-	db $1d, $15, $00
-	db $1e, $00, $00
-	db $1d, $17, $00
-	db $1f, $00, $00
-	db $24, $19, $00
-	db $25, $00, $00
-	db $20, $13, $00
-	db $26, $1a, $00
-	db $2d, $00, $00
-	db $2e, $00, $00
-	db $2f, $00, $00
-	db $30, $00, $00
-	db $31, $00, $00
-	db $32, $1b, $00
-	db $33, $1c, $00
-	db $34, $00, $00
-	db $35, $1d, $00
-	db $37, $1e, $00
-	db $38, $1e, $00
-	db $39, $20, $00
-	db $3f, $21, $00
-	db $3e, $22, $00
-	db $40, $00, $00
+	db $01, $01, $00 ; 00
+	db $07, $04, $00 ; 01
+	db $08, $05, $05 ; 02
+	db $0a, $06, $00 ; 03
+	db $0b, $07, $06 ; 04
+	db $0c, $08, $06 ; 05
+	db $0d, $09, $07 ; 06
+	db $0e, $0a, $07 ; 07
+	db $10, $0b, $07 ; 08
+	db $08, $0c, $05 ; 09
+	db $11, $00, $00 ; 0a
+	db $12, $0d, $08 ; 0b
+	db $12, $0e, $08 ; 0c
+	db $12, $0f, $08 ; 0d
+	db $13, $10, $00 ; 0e
+	db $15, $00, $00 ; 0f
+	db $16, $11, $00 ; 10
+	db $17, $12, $00 ; 11
+	db $18, $12, $00 ; 12
+	db $19, $13, $00 ; 13
+	db $1a, $14, $00 ; 14
+	db $1b, $00, $00 ; 15
+	db $1d, $15, $00 ; 16
+	db $1e, $00, $00 ; 17
+	db $1d, $17, $00 ; 18
+	db $1f, $00, $00 ; 19
+	db $24, $19, $00 ; 1a
+	db $25, $00, $00 ; 1b
+	db $20, $13, $00 ; 1c
+	db $26, $1a, $00 ; 1d
+	db $2d, $00, $00 ; 1e
+	db $2e, $00, $00 ; 1f
+	db $2f, $00, $00 ; 20
+	db $30, $00, $00 ; 21
+	db $31, $00, $00 ; 22
+	db $32, $1b, $00 ; 23
+	db $33, $1c, $00 ; 24
+	db $34, $00, $00 ; 25
+	db $35, $1d, $00 ; 26
+	db $37, $1e, $00 ; 27
+	db $38, $1e, $00 ; 28
+	db $39, $20, $00 ; 29
+	db $3f, $21, $00 ; 2a
+	db $3e, $22, $00 ; 2b
+	db $40, $00, $00 ; 2c
 ; 8d24b
 
 
@@ -59253,20 +59113,17 @@
 ; 8e706
 
 
-Unknown_8e706: ; 8e706
-	dbbw $80, $01, Unknown_8e72a
-	dbbw $80, $01, Unknown_8e72a
-	dbbw $80, $01, Unknown_8e72a
-	dbbw $80, $01, Unknown_8e72a
-	dbbw $10, $37, Unknown_8e72a
-	dbbw $10, $11, Unknown_8e72a
-	dbbw $10, $39, Unknown_8e72a
-	dbbw $10, $24, Unknown_8e72a
-	dbbw $10, $21, Unknown_8e72a
+Unknown_8e706: ; Broken 2bpp pointers
+	dbbw $80, $01, $672a ; 128-tile 2bpp at 1:672a (inside Multiply)
+	dbbw $80, $01, $672a
+	dbbw $80, $01, $672a
+	dbbw $80, $01, $672a
+	dbbw $10, $37, $672a ; 16-tile 2bpp at 37:672a (within Tileset11GFX)
+	dbbw $10, $11, $672a ; 16-tile 2bpp at 11:672a (empty data)
+	dbbw $10, $39, $672a ; 16-tile 2bpp at 39:672a (empty data)
+	dbbw $10, $24, $672a ; 16-tile 2bpp at 24:672a (inside Function926f7)
+	dbbw $10, $21, $672a ; 16-tile 2bpp at 21:672a (inside Function8671c)
 
-Unknown_8e72a:
-	; nothing to see here
-
 Function8e72a: ; 8e72a
 	add $10
 Function8e72c: ; 8e72c
@@ -59281,7 +59138,7 @@
 	and $1f
 	call Function8e741
 	ld a, h
-	xor $ff
+	xor $ff ; cpl
 	inc a
 	ret
 ; 8e741
@@ -60780,7 +60637,7 @@
 	ld c, $a
 	call DelayFrames
 .asm_9070d
-	call Functiona57
+	call JoyTextDelay
 	call Function90795
 	jr nc, .asm_9070d
 	ld a, [wc608 + 20]
@@ -60807,7 +60664,7 @@
 	ld c, 10
 	call DelayFrames
 .asm_90752
-	call Functiona57
+	call JoyTextDelay
 	call Function90810
 	jr nc, .asm_90752
 	ld a, [BattleMonNick + 5]
@@ -61151,7 +61008,7 @@
 	ld c, $a
 	call DelayFrames
 .asm_9096a
-	call Functiona57
+	call JoyTextDelay
 	call Function90993
 	jr nc, .asm_9096a
 	call ExitMenu
@@ -61498,7 +61355,7 @@
 
 .loop
 	call UpdateTime
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .done
@@ -62654,7 +62511,7 @@
 
 .asm_91398
 	push de
-	call Functiona57
+	call JoyTextDelay
 	pop de
 	ld hl, hJoyPressed
 	ld a, [hl]
@@ -62978,7 +62835,7 @@
 
 Function919b0: ; 919b0
 .asm_919b0
-	call Functiona57
+	call JoyTextDelay
 	ld hl, hJoyPressed
 	ld a, [hl]
 	and B_BUTTON
@@ -63081,7 +62938,7 @@
 	ld c, 100
 	call DelayFrames
 .loop
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyPressed]
 	and A_BUTTON | B_BUTTON
 	jr nz, .stop
@@ -63200,7 +63057,7 @@
 	call GetSGBLayout
 	call Function32f9
 .loop
-	call Functiona57
+	call JoyTextDelay
 	ld hl, hJoyPressed
 	ld a, [hl]
 	and B_BUTTON
@@ -63626,7 +63483,7 @@
 	xor a
 	call Function91e1e
 .asm_91d6e
-	call Functiona57
+	call JoyTextDelay
 	ld hl, hJoyPressed
 	ld a, [hl]
 	and A_BUTTON | B_BUTTON
@@ -64132,7 +63989,7 @@
 	call GetSGBLayout
 	call Function32f9
 .loop
-	call Functiona57
+	call JoyTextDelay
 	ld hl, hJoyPressed
 	ld a, [hl]
 	and B_BUTTON
@@ -68894,7 +68751,7 @@
 	xor a
 	ld [wcf66], a
 .loop
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyLast]
 	and A_BUTTON
 	jr nz, .next
@@ -68948,7 +68805,7 @@
 	ld hl, .PlaceYourBetText
 	call Functione0489
 .betloop
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyLast]
 	and A_BUTTON
 	jr nz, .betdone
@@ -70472,7 +70329,7 @@
 	ld [wd0ec], a
 	call DelayFrame
 .asm_e1217
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_e123d
@@ -71793,7 +71650,7 @@
 	ld a, [wcf63]
 	cp $7
 	jr nc, .asm_e21c8
-	call Functiona57
+	call JoyTextDelay
 	ld hl, hJoypadPressed ; $ffa3
 	ld a, [hl]
 	and A_BUTTON
@@ -71900,7 +71757,7 @@
 	ld [wcb2e], a
 	call DelayFrame
 .asm_e23b4
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_e23c6
@@ -72162,7 +72019,7 @@
 	ld [wcb2e], a
 	call DelayFrame
 .asm_e25a7
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_e25b9
@@ -72411,7 +72268,7 @@
 	ld [wcb2e], a
 	call DelayFrame
 .asm_e2781
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_e2793
@@ -74578,7 +74435,7 @@
 	call GetSGBLayout
 	call Function32f9
 .asm_e4217
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyPressed]
 	and START | B_BUTTON
 	jr nz, .ExitOptions
@@ -75154,7 +75011,7 @@
 	callba GBCOnlyScreen
 	call Functione45e8
 .asm_e45c0
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyLast]
 	and BUTTONS
 	jr nz, .asm_e45de
@@ -75502,7 +75359,7 @@
 	push af
 	call Functione4901
 .loop: ; e48bc
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyLast]
 	and BUTTONS
 	jr nz, .ShutOffMusic
@@ -75596,7 +75453,7 @@
 
 
 NextIntroScene: ; e4956 (39:4956)
-	ld hl, wcf63
+	ld hl, wIntroSceneIndex
 	inc [hl]
 	ret
 
@@ -75647,7 +75504,7 @@
 	callba Function8cf53
 	call Functione549e
 	xor a
-	ld [wcf64], a
+	ld [wIntroSceneFrameCounter], a
 	ld [wcf65], a
 	call NextIntroScene
 	ret
@@ -75654,13 +75511,13 @@
 
 IntroScene2: ; e49d6 (39:49d6)
 ; First Unown (A) fades in, pulses, then fades out.
-	ld hl, wcf64
+	ld hl, wIntroSceneFrameCounter
 	ld a, [hl]
 	inc [hl]
 	cp $80
-	jr nc, .asm_e49f9
+	jr nc, .endscene
 	cp $60
-	jr nz, .asm_e49f1
+	jr nz, .DontPlaySound
 	push af
 	ld de, $5858
 	call Functione51dc
@@ -75667,12 +75524,12 @@
 	ld de, SFX_INTRO_UNOWN_1
 	call PlaySFX
 	pop af
-.asm_e49f1
+.DontPlaySound
 	ld [wcf65], a
 	xor a
 	call Functione5223
 	ret
-.asm_e49f9
+.endscene
 	call NextIntroScene
 	ret
 
@@ -75720,7 +75577,7 @@
 	call Functione5516
 	call Functione549e
 	xor a
-	ld [wcf64], a
+	ld [wIntroSceneFrameCounter], a
 	call NextIntroScene
 	ret
 
@@ -75727,13 +75584,13 @@
 IntroScene4: ; e4a69 (39:4a69)
 ; Scroll the outdoor panorama for a bit.
 	call Functione552f
-	ld hl, wcf64
+	ld hl, wIntroSceneFrameCounter
 	ld a, [hl]
 	cp $80
-	jr z, .asm_e4a76
+	jr z, .endscene
 	inc [hl]
 	ret
-.asm_e4a76
+.endscene
 	call NextIntroScene
 	ret
 
@@ -75796,15 +75653,15 @@
 	ld a, [hl]
 	inc [hl]
 	cp $80
-	jr nc, .asm_e4b3b
+	jr nc, .endscene
 	cp $60
-	jr z, .asm_e4b24
+	jr z, .SecondUnown
 	cp $40
-	jr nc, .asm_e4b32
+	jr nc, .StopUnown
 	cp $20
-	jr z, .asm_e4b0e
-	jr .asm_e4b1c
-.asm_e4b0e
+	jr z, .FirstUnown
+	jr .NoUnown
+.FirstUnown
 	push af
 	ld de, $3878
 	call Functione51dc
@@ -75811,12 +75668,12 @@
 	ld de, SFX_INTRO_UNOWN_2
 	call PlaySFX
 	pop af
-.asm_e4b1c
+.NoUnown
 	ld [wcf65], a
 	xor a
 	call Functione5223
 	ret
-.asm_e4b24
+.SecondUnown
 	push af
 	ld de, $7030
 	call Functione51dc
@@ -75823,12 +75680,12 @@
 	ld de, SFX_INTRO_UNOWN_1
 	call PlaySFX
 	pop af
-.asm_e4b32
+.StopUnown
 	ld [wcf65], a
 	ld a, $1
 	call Functione5223
 	ret
-.asm_e4b3b
+.endscene
 	call NextIntroScene
 	ret
 
@@ -75888,7 +75745,7 @@
 	ld [wc3c0], a
 	call Functione549e
 	xor a
-	ld [wcf64], a
+	ld [wIntroSceneFrameCounter], a
 	ld [wcf65], a
 	call NextIntroScene
 	ret
@@ -75895,7 +75752,7 @@
 
 IntroScene8: ; e4bd3 (39:4bd3)
 ; Scroll the scene, then show Suicune running across the screen.
-	ld hl, wcf64
+	ld hl, wIntroSceneFrameCounter
 	ld a, [hl]
 	inc [hl]
 	cp $40
@@ -76032,7 +75889,7 @@
 	callba Function8cf53
 	call Functione549e
 	xor a
-	ld [wcf64], a
+	ld [wIntroSceneFrameCounter], a
 	ld [wcf65], a
 	call NextIntroScene
 	ret
@@ -76040,7 +75897,7 @@
 IntroScene12: ; e4cfa (39:4cfa)
 ; Even more Unown.
 	call Functione4d36
-	ld hl, wcf64
+	ld hl, wIntroSceneFrameCounter
 	ld a, [hl]
 	inc [hl]
 	cp $c0
@@ -76074,20 +75931,20 @@
 	ret
 
 Functione4d36: ; e4d36 (39:4d36)
-	ld a, [wcf64]
+	ld a, [wIntroSceneFrameCounter]
 	ld c, a
-	ld hl, Unknown_e4d54
-.asm_e4d3d
+	ld hl, .UnownSounds
+.loop
 	ld a, [hli]
-	cp $ff
+	cp -1
 	ret z
 	cp c
-	jr z, .asm_e4d48
+	jr z, .playsound
 rept 2
 	inc hl
 endr
-	jr .asm_e4d3d
-.asm_e4d48
+	jr .loop
+.playsound
 	ld a, [hli]
 	ld d, [hl]
 	ld e, a
@@ -76098,7 +75955,7 @@
 	ret
 ; e4d54 (39:4d54)
 
-Unknown_e4d54: ; e4d54
+.UnownSounds: ; e4d54
 	dbw $00, SFX_INTRO_UNOWN_3
 	dbw $20, SFX_INTRO_UNOWN_2
 	dbw $40, SFX_INTRO_UNOWN_1
@@ -76633,7 +76490,7 @@
 	ret
 
 .done
-	ld hl, wcf63
+	ld hl, wIntroSceneIndex
 	set 7, [hl]
 	ret
 
@@ -80056,16 +79913,16 @@
 ; 1042b2
 
 Function1042b2:: ; 1042b2
-.asm_1042b2
+.loop
 	ld a, c
 	cp $10
-	jp c, Function1042d6
-	jp z, Function1042d6
+	jp c, .asm_1042d6
+	jp z, .asm_1042d6
 	push bc
 	push hl
 	push de
 	ld c, $10
-	call Function1042d6
+	call .asm_1042d6
 	pop de
 	ld hl, $0080
 	add hl, de
@@ -80078,10 +79935,10 @@
 	ld a, c
 	sub $10
 	ld c, a
-	jr .asm_1042b2
+	jr .loop
 ; 1042d6
 
-Function1042d6: ; 1042d6
+.asm_1042d6: ; 1042d6
 	ld a, [rSVBK]
 	push af
 	ld a, $6
--- a/misc/crystal_misc.asm
+++ b/misc/crystal_misc.asm
@@ -155,7 +155,7 @@
 	push af
 	ld a, $1
 	ld [hInMenu], a
-	call Functiona57
+	call JoyTextDelay
 	pop af
 	ld [hInMenu], a
 	ret
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -194,7 +194,7 @@
 	ret
 
 Function89235: ; 89235 (22:5235)
-	call Functiona36
+	call JoyWaitAorB
 	call PlayClickSFX
 	ret
 
@@ -3655,7 +3655,7 @@
 	call InitName
 	call CloseSRAM
 	call DelayFrame
-	call Functiona57
+	call JoyTextDelay
 	call Function891de
 	call WhiteBGMap
 	call Function893cc
@@ -3731,7 +3731,7 @@
 	ld de, .string_8a868
 	call PlaceString
 	call WaitBGMap
-	call Functiona36
+	call JoyWaitAorB
 .asm_8a863
 	call CloseSRAM
 	scf
@@ -3750,7 +3750,7 @@
 	hlcoord 1, 13
 	call PlaceString
 	call WaitBGMap
-	call Functiona36
+	call JoyWaitAorB
 	and a
 	ret
 ; 8a88b (22:688b)
@@ -3805,7 +3805,7 @@
 	ld de, String_8a926
 	call PlaceString
 	call WaitBGMap
-	call Functiona36
+	call JoyWaitAorB
 .asm_8a90f
 	call Function89448
 	call Function891fe
@@ -4057,7 +4057,7 @@
 	ld de, String_8aaf0
 	call PlaceString
 	call WaitBGMap
-	call Functiona36
+	call JoyWaitAorB
 .asm_8aaeb
 	call CloseSRAM
 	scf
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -332,7 +332,7 @@
 	pop de
 	call PlaceString
 	call Function100320
-	call Functiona36
+	call JoyWaitAorB
 	ret
 ; 10024d
 
@@ -432,7 +432,7 @@
 	callba Function10202c
 	callba Function115dd3
 	call Function100320
-	call Functiona36
+	call JoyWaitAorB
 	ret
 ; 100320
 
@@ -4979,7 +4979,7 @@
 	call MenuTextBox
 	ld de, SFX_LEVEL_UP
 	call PlaySFX
-	call Functiona36
+	call JoyWaitAorB
 	call ExitMenu
 	call Function10219f
 	ld hl, UnknownText_0x1021d6
@@ -5022,7 +5022,7 @@
 	call Function10218d
 	ld de, $c608 + 1
 	callba Function8ac4e
-	call Functiona36
+	call JoyWaitAorB
 	call PlayClickSFX
 	call Function1013aa
 	ret
@@ -5056,7 +5056,7 @@
 
 Function1021e0: ; 1021e0
 	call MenuTextBox
-	call Functiona36
+	call JoyWaitAorB
 	call ExitMenu
 	ret
 ; 1021ea
@@ -7749,7 +7749,7 @@
 	jr c, .asm_103696
 	callba Function8b1e1
 	jr nc, .asm_103690
-	call Functiona36
+	call JoyWaitAorB
 	jr .asm_103696
 
 .asm_103690
@@ -7772,7 +7772,7 @@
 	call YesNoBox
 	jr c, .asm_1036b5
 	call Function1036f9
-	call Functiona36
+	call JoyWaitAorB
 
 .asm_1036b5
 	call Function103700
@@ -7794,7 +7794,7 @@
 .asm_1036d9
 	callba Function8b1e1
 	jr nc, .asm_1036e6
-	call Functiona36
+	call JoyWaitAorB
 	jr .asm_1036f4
 
 .asm_1036e6
@@ -7804,7 +7804,7 @@
 
 .asm_1036ec
 	call Function1036f9
-	call Functiona36
+	call JoyWaitAorB
 	jr .asm_1036b5
 
 .asm_1036f4
@@ -7859,7 +7859,7 @@
 .asm_10373c
 	ld hl, UnknownText_0x10377b
 	call PrintText
-	call Functiona36
+	call JoyWaitAorB
 	scf
 	ret
 ; 103747
@@ -7981,10 +7981,10 @@
 	jr nc, .asm_103807
 	ld hl, UnknownText_0x103819
 	call PrintText
-	call Functiona36
+	call JoyWaitAorB
 	ld hl, UnknownText_0x10381e
 	call PrintText
-	call Functiona36
+	call JoyWaitAorB
 	xor a
 	ld [ScriptVar], a
 	ret
@@ -8042,7 +8042,7 @@
 	ld [hl], a
 	ld hl, UnknownText_0x103876
 	call PrintText
-	call Functiona36
+	call JoyWaitAorB
 	callba Script_reloadmappart
 	callba Function4a94e
 	jr c, .asm_103870
@@ -8074,7 +8074,7 @@
 	ld [StringBuffer2], a
 	ld hl, UnknownText_0x103898
 	call PrintText
-	call Functiona36
+	call JoyWaitAorB
 	ret
 ; 103898
 
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -7716,7 +7716,7 @@
 	ret
 
 Function1176ee: ; 1176ee (45:76ee)
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcd49]
 	bit 7, a
 	jr nz, .asm_117709
@@ -8189,7 +8189,7 @@
 ; 0x117acd
 
 Function117acd: ; 0x117acd
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_117ae2 ; 0x117ad5 $b
@@ -8493,7 +8493,7 @@
 	ld a, $3
 	ld [rSVBK], a
 .asm_118024
-	call Functiona57
+	call JoyTextDelay
 	call Function118473
 	ld a, [wcf66]
 	cp $1b
@@ -8534,7 +8534,7 @@
 	ld a, $3
 	ld [rSVBK], a
 .asm_11807d
-	call Functiona57
+	call JoyTextDelay
 	call Function118473
 	ld a, [wcf66]
 	cp $1b
@@ -8572,7 +8572,7 @@
 	ld a, $3
 	ld [rSVBK], a
 .asm_1180d1
-	call Functiona57
+	call JoyTextDelay
 	call Function118473
 	ld a, [wcf66]
 	cp $28
@@ -8627,7 +8627,7 @@
 	ld a, $3
 	ld [rSVBK], a
 .asm_11813e
-	call Functiona57
+	call JoyTextDelay
 	call Function118473
 	ld a, [wcf66]
 	cp $f
@@ -8712,7 +8712,7 @@
 	ld a, $3
 	ld [rSVBK], a
 .asm_1181f8
-	call Functiona57
+	call JoyTextDelay
 	call Function118473
 	ld a, [wcf66]
 	cp $28
@@ -8750,7 +8750,7 @@
 	ld a, $3
 	ld [rSVBK], a
 .asm_11824c
-	call Functiona57
+	call JoyTextDelay
 	call Function118473
 	ld a, [wcf66]
 	cp $1e
@@ -8787,7 +8787,7 @@
 	ld a, $3
 	ld [rSVBK], a ; $ff00+$70
 .asm_11829d
-	call Functiona57
+	call JoyTextDelay
 	call Function118473
 	ld a, [wcf66]
 	cp $20
@@ -8824,7 +8824,7 @@
 	ld a, $3
 	ld [rSVBK], a
 .asm_1182ee
-	call Functiona57
+	call JoyTextDelay
 	call Function118473
 	ld a, [wcf66]
 	cp $1b
@@ -8862,7 +8862,7 @@
 	ld a, $3
 	ld [rSVBK], a
 .asm_118342
-	call Functiona57
+	call JoyTextDelay
 	call Function118473
 	ld a, [wcf66]
 	cp $18
@@ -8899,7 +8899,7 @@
 	ld a, $3
 	ld [rSVBK], a
 .asm_118393
-	call Functiona57
+	call JoyTextDelay
 	call Function118473
 	ld a, [wcf66]
 	cp $19
@@ -14342,7 +14342,7 @@
 	call Function11ad1b
 	call DelayFrame
 .asm_11ac82
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_11aca8
@@ -16935,7 +16935,7 @@
 
 Function11c283: ; 11c283
 .asm_11c283
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyPressed]
 	ld [hJoypadPressed], a
 	ld a, [wcf63]
@@ -22187,7 +22187,7 @@
 	call GetSGBLayout
 	call Function32f9
 	call WaitBGMap
-	call Functiona36
+	call JoyWaitAorB
 	call Function1d7d
 	ret
 ; 16d465
@@ -22518,7 +22518,7 @@
 	callba Function8cf62
 
 .asm_16d7f4
-	call Functiona57
+	call JoyTextDelay
 	call Function16d713
 	and a
 	ret z
@@ -23228,7 +23228,7 @@
 	call ClearSprites
 	call ClearScreen
 .asm_1704fa
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcf63]
 	bit 7, a
 	jr nz, .asm_17050f
@@ -24539,7 +24539,7 @@
 	ret
 
 Function171a11: ; 171a11 (5c:5a11)
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcd49]
 	bit 7, a
 	jr nz, .asm_171a2c
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -714,7 +714,7 @@
 
 Function17d45a: ; 17d45a
 .asm_17d45a
-	call Functiona57
+	call JoyTextDelay
 	ld a, [wcd77]
 	bit 7, a
 	jr nz, .asm_17d46f
@@ -3144,7 +3144,7 @@
 	call Function17e415
 	call Function17e41e
 .asm_17e3f6
-	call Functiona57
+	call JoyTextDelay
 	ld hl, hJoyPressed
 	ld a, [hl]
 	and $1
@@ -4678,7 +4678,7 @@
 
 Function17f555: ; 17f555
 .asm_17f555
-	call Functiona57
+	call JoyTextDelay
 	call Function17f5ae
 	ld a, [wc303]
 	bit 7, a
--- a/misc/unused_title.asm
+++ b/misc/unused_title.asm
@@ -546,7 +546,7 @@
 Function10ed51: ; 10ed51
 	call _TitleScreen
 .loop
-	call Functiona57
+	call JoyTextDelay
 	ld a, [hJoyLast]
 	ld b, a
 	and 1
--- a/sram.asm
+++ b/sram.asm
@@ -1,5 +1,5 @@
 SECTION "Scratch", SRAM, BANK [0]
-
+SRAM_Begin::
 sScratch::
 
 
@@ -49,6 +49,8 @@
 sBackupChecksum:: ds 2
 s0_bf0f:: ds 1
 sStackTop:: ds 2
+	ds $ee
+SRAM_End::
 
 
 SECTION "SRAM Bank 1", SRAM, BANK [1]
--- /dev/null
+++ b/vram.asm
@@ -1,0 +1,13 @@
+SECTION "VRAM0", VRAM, BANK [0]
+VTiles0:: ds $800
+VTiles1:: ds $800
+VTiles2:: ds $800
+VBGMap0:: ds $400
+VBGMap1:: ds $400
+
+SECTION "VRAM1", VRAM, BANK [1]
+VTiles3:: ds $800
+VTiles4:: ds $800
+VTiles5:: ds $800
+VBGMap2:: ds $400
+VBGMap3:: ds $400
--- a/wram.asm
+++ b/wram.asm
@@ -130,19 +130,8 @@
                       ds 1 ; c132
 ENDM
 
-SECTION "CHR0", VRAM [$8000], BANK [0]
-VTiles0::
-SECTION "CHR1", VRAM [$8800], BANK [0]
-VTiles1::
-SECTION "CHR2", VRAM [$9000], BANK [0]
-VTiles2::
-SECTION "BG0",  VRAM [$9800], BANK [0]
-VBGMap0::
-SECTION "BG1",  VRAM [$9C00], BANK [0]
-VBGMap1::
+INCLUDE "vram.asm"
 
-
-
 SECTION "Stack", WRAM0
 wc000::
 StackBottom::
@@ -1191,14 +1180,18 @@
 	ds 1
 
 wcf61:: ds 2
+wIntroSceneIndex::
 wcf63:: ds 1
 wNrOfBeatenBattleTowerTrainers::
 wMomBankDigitCursorPosition::
+wIntroSceneFrameCounter::
 wcf64:: ds 1
 IF !DEF(CRYSTAL11)
 wPokedexStatus::
 ENDC
+wTitleScreenTimerLo::
 wcf65:: ds 1
+wTitleScreenTimerHi::
 wcf66:: ds 1
 
 Requested2bpp:: ; cf67
--