shithub: pokecrystal

Download patch

ref: 7a42f1790ae1e9e357593879bd38c6596dcb03da
parent: a2b6befd7d12b2ad8bb97979a10519500dcdd870
parent: 1092983bde65bbf1a27eeabbfbceec1f278a4831
author: Rangi <35663410+Rangi42@users.noreply.github.com>
date: Fri Oct 30 08:26:03 EDT 2020

Merge pull request #776 from Rangi42/unreferenced

Comment, remove, or revise many unreferenced labels

diff: cannot open b/data/collision//null: file does not exist: 'b/data/collision//null'
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -9,6 +9,12 @@
 
 Download and install [**Windows Subsystem for Linux**](https://docs.microsoft.com/en-us/windows/wsl/install-win10). Then open the **WSL terminal**.
 
+Update WSL's software before continuing. If you chose Debian, Ubuntu, or another distribution that uses `apt-get`, then enter this command:
+
+```bash
+apt-get update && apt-get upgrade
+```
+
 WSL has its own file system that's not accessible from Windows, but Windows files *are* accessible from WSL. So you're going to want to install pokecrystal within Windows. You'll have to change the **current working directory** every time you open WSL.
 
 For example, if you want to store pokecrystal in **C:\Users\\*\<user>*\Desktop**, enter this command:
@@ -19,9 +25,9 @@
 
 (The Windows `C:\` drive is called `/mnt/c/` in WSL. Replace *\<user>* in the example path with your username.)
 
-Then follow [the instructions for **Linux**](#linux).
+If this works, then follow [the instructions for **Linux**](#linux) below for whatever distribution you installed for WSL.
 
-If this doesn't work, try following [the regular Windows instructions](#windows) below.
+Otherwise, continue reading below for [the older Windows instructions](#windows).
 
 
 ## Windows
@@ -36,9 +42,9 @@
 
 Double click on the text that says "**Skip**" next to each package to select the most recent version to install.
 
-Then download [**rgbds**](https://github.com/gbdev/rgbds/releases/): the latest **win64.zip** or **win32.zip** release. Extract it and put all the `exe` and `dll` files individually in **C:\cygwin64\usr\local\bin**.
+Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/windows) for Windows with Cygwin to install **rgbds 0.4.1**.
 
-**Note: If you already have an older rgbds, you will need to update to 0.4.1.** Ignore this if you have never installed rgbds before. If a version newer than 0.4.1 does not work, try downloading 0.4.1.
+**Note:** If you already have an older rgbds, you will need to update to 0.4.1. Ignore this if you have never installed rgbds before. If a version newer than 0.4.1 does not work, try downloading 0.4.1.
 
 Now open the **Cygwin terminal** and enter the following commands.
 
@@ -55,18 +61,14 @@
 Now you're ready to [build **pokecrystal**](#build-pokecrystal).
 
 
-## Mac OS X
+## macOS
 
 Install [**Homebrew**](https://brew.sh/). Follow the official instructions.
 
-Open **Terminal** and enter the following commands.
+Open **Terminal** and prepare to enter commands.
 
-To install **rgbds**:
+Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/macos) for macOS to install **rgbds 0.4.1**.
 
-```bash
-brew install rgbds
-```
-
 Now you're ready to [build **pokecrystal**](#build-pokecrystal).
 
 
@@ -82,14 +84,8 @@
 sudo apt-get install make gcc git
 ```
 
-To install **rgbds**:
+Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.4.1** from source.
 
-```bash
-sudo apt-get install pkg-config flex bison libpng-dev
-git clone -b v0.4.1 --depth=1 https://github.com/gbdev/rgbds
-sudo make -C rgbds install
-```
-
 ### OpenSUSE
 
 To install the software required for **pokecrystal**:
@@ -98,14 +94,8 @@
 sudo zypper install make gcc git
 ```
 
-To install **rgbds**:
+Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.4.1** from source.
 
-```bash
-sudo zypper install pkg-config flex bison libpng16-devel
-git clone -b v0.4.1 --depth=1 https://github.com/gbdev/rgbds
-sudo make -C rgbds install
-```
-
 ### Arch Linux
 
 To install the software required for **pokecrystal**:
@@ -114,13 +104,9 @@
 sudo pacman -S make gcc git rgbds
 ```
 
-If you want to compile and install **rgbds** manually instead of using the Arch package:
+Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/arch) for Arch Linux to install **rgbds 0.4.1**.
 
-```bash
-sudo pacman -S pkg-config flex bison libpng
-git clone -b v0.4.1 --depth=1 https://github.com/gbdev/rgbds
-sudo make -C rgbds install
-```
+If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.4.1** from source.
 
 ### Termux
 
@@ -136,6 +122,8 @@
 sudo apt install rgbds
 ```
 
+If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.4.1** from source.
+
 ### Other distros
 
 If your distro is not listed here, try to find the required software in its repositories:
@@ -145,19 +133,7 @@
 - `git`
 - `rgbds`
 
-If `rgbds` is not available, you'll also need these:
-
-- `pkg-config`
-- `flex`
-- `bison`
-- `libpng` (and the development headers)
-
-To install **rgbds**:
-
-```bash
-git clone -b v0.4.1 --depth=1 https://github.com/gbdev/rgbds
-sudo make -C rgbds install
-```
+If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.4.1** from source.
 
 Now you're ready to [build **pokecrystal**](#build-pokecrystal).
 
--- a/STYLE.md
+++ b/STYLE.md
@@ -69,6 +69,7 @@
 PascalCase:: ; global label
 .snake_case ; local jump
 .PascalCase: ; an atomic chunk of code or data that's local
+; don't define unused labels when a comment would do
 
 ; Labels are prefixed with lower case letters depending on location
 wPascalCase: ; wram
@@ -151,9 +152,7 @@
 
 	; do
 	db \1, \2, \3, \4, \5
-rept 5
-	shift
-endr
+	shift 5
 	db \1, \2, \3, \4, \5
 
 ENDM
@@ -161,7 +160,7 @@
 
 UPPER_CASE_IS_OK_SOMETIMES: MACRO
 
-; but i can't think of any examples
+; but I can't think of any examples besides ACRONYMS
 
 ENDM
 
--- a/audio/cries.asm
+++ b/audio/cries.asm
@@ -464,7 +464,7 @@
 	square_note 8, 15, 1, 1824
 	sound_ret
 
-Cry_Sentret_Ch8:
+Cry_Sentret_Ch8: ; unreferenced
 	noise_note 8, 3, -3, 0
 	noise_note 8, 9, 2, 0
 	sound_ret
@@ -1082,7 +1082,7 @@
 	channel 6, Cry_Weepinbell_Ch6
 	channel 8, Cry_Weepinbell_Ch8
 
-Cry_Unused_Ch5:
+Cry_Unused_Ch5: ; unreferenced
 	duty_cycle_pattern 3, 3, 0, 0
 	square_note 15, 14, 0, 1920
 	square_note 15, 15, 0, 1924
@@ -1092,7 +1092,7 @@
 	square_note 8, 7, 1, 1924
 	sound_ret
 
-Cry_Unused_Ch6:
+Cry_Unused_Ch6: ; unreferenced
 	duty_cycle_pattern 0, 0, 1, 1
 	square_note 15, 10, 0, 1857
 	square_note 15, 11, 0, 1859
@@ -1102,7 +1102,7 @@
 	square_note 8, 3, 1, 1862
 	sound_ret
 
-Cry_Unused_Ch8:
+Cry_Unused_Ch8: ; unreferenced
 	noise_note 2, 15, 2, 76
 	noise_note 6, 14, 0, 58
 	noise_note 15, 13, 0, 58
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -38,15 +38,16 @@
 	dec e
 	jr nz, .clearsound
 
-	ld hl, wChannels ; start of channel data
-	ld de, wChannelsEnd - wChannels ; length of area to clear (entire sound wram area)
-.clearchannels
+	ld hl, wAudio
+	ld de, wAudioEnd - wAudio
+.clearaudio
 	xor a
 	ld [hli], a
 	dec de
 	ld a, e
 	or d
-	jr nz, .clearchannels
+	jr nz, .clearaudio
+
 	ld a, MAX_VOLUME
 	ld [wVolume], a
 	call MusicOn
@@ -1614,9 +1615,9 @@
 	ret
 
 MusicEE:
+; unused
 ; conditional jump
 ; checks a byte in ram corresponding to the current channel
-; doesn't seem to be set by any commands
 ; params: 2
 ;		ll hh ; pointer
 
@@ -1666,8 +1667,8 @@
 	ret
 
 MusicF9:
+; unused
 ; sets some flag
-; seems to be unused
 ; params: 0
 	ld a, TRUE
 	ld [wUnusedMusicF9Flag], a
@@ -1674,7 +1675,7 @@
 	ret
 
 MusicE2:
-; seems to have been dummied out
+; unused
 ; params: 1
 	call GetMusicByte
 	ld hl, CHANNEL_FIELD2C
--- a/audio/music/magnettrain.asm
+++ b/audio/music/magnettrain.asm
@@ -246,7 +246,7 @@
 	drum_note 12, 16
 	sound_ret
 
-.sub1: ; unused
+.sub1: ; unreferenced
 	drum_note 9, 1
 	drum_note 8, 1
 	drum_note 8, 1
--- a/audio/sfx.asm
+++ b/audio/sfx.asm
@@ -21,7 +21,8 @@
 Sfx_ReadText:
 Sfx_ReadText2:
 	channel_count 1
-	channel 5, Sfx_ReadText2_Ch5
+	channel 5, Sfx_ReadText_Ch5
+	assert Sfx_ReadText_Ch5 == Sfx_ReadText2_Ch5
 
 Sfx_Poison:
 	channel_count 1
@@ -467,6 +468,7 @@
 	channel 6, Sfx_Unknown5F_Ch6
 Sfx_Sandstorm:
 	channel 8, Sfx_Sandstorm_Ch8
+	assert Sfx_Sandstorm_Ch8 == Sfx_Unknown5F_Ch8
 
 Sfx_HangUp:
 	channel_count 1
@@ -490,6 +492,10 @@
 	channel 6, Sfx_LevelUp_Ch6
 	channel 7, Sfx_LevelUp_Ch7
 	channel 8, Sfx_LevelUp_Ch8
+	assert Sfx_LevelUp_Ch5 == Sfx_DexFanfare5079_Ch5
+	assert Sfx_LevelUp_Ch6 == Sfx_DexFanfare5079_Ch6
+	assert Sfx_LevelUp_Ch7 == Sfx_DexFanfare5079_Ch7
+	assert Sfx_LevelUp_Ch8 == Sfx_DexFanfare5079_Ch8
 
 Sfx_LevelUp_Ch5:
 Sfx_DexFanfare5079_Ch5:
@@ -942,7 +948,7 @@
 	channel 6, Sfx_Fanfare2_Ch6
 	channel 8, Sfx_Fanfare2_Ch8
 
-Sfx_Unused:
+Sfx_Unused: ; unreferenced
 	channel_count 4
 	channel 5, Sfx_Unused_Ch5
 	channel 6, Sfx_Unused_Ch6
--- a/audio/sfx_crystal.asm
+++ b/audio/sfx_crystal.asm
@@ -184,7 +184,7 @@
 	duty_cycle 1
 	transpose 0, 11
 	note_type 1, 11, 1
-Sfx_Tingle_branch_17996c:
+.loop1:
 	octave 5
 	note C_, 3
 	octave 6
@@ -192,7 +192,7 @@
 	octave 5
 	note C_, 3
 	rest 2
-	sound_loop 2, Sfx_Tingle_branch_17996c
+	sound_loop 2, .loop1
 	note C_, 2
 	volume_envelope 10, 1
 	note G_, 13
--- a/constants/collision_constants.asm
+++ b/constants/collision_constants.asm
@@ -1,4 +1,4 @@
-; collision permissions (see data/collision_permissions.asm)
+; collision permissions (see data/collision/collision_permissions.asm)
 LAND_TILE  EQU $00
 WATER_TILE EQU $01
 WALL_TILE  EQU $0f
@@ -5,7 +5,7 @@
 TALK       EQU $10
 
 ; collision data types (see data/tilesets/*_collision.asm)
-; TileCollisionTable indexes (see data/collision_permissions.asm)
+; TileCollisionTable indexes (see data/collision/collision_permissions.asm)
 COLL_FLOOR             EQU $00
 COLL_01                EQU $01 ; garbage
 COLL_03                EQU $03 ; garbage
--- a/constants/engine_flags.asm
+++ b/constants/engine_flags.asm
@@ -15,7 +15,7 @@
 	const ENGINE_MOM_SAVING_MONEY
 	const ENGINE_MOM_ACTIVE
 ; wUnusedTwoDayTimerOn
-	const ENGINE_0A
+	const ENGINE_UNUSED_TWO_DAY_TIMER_ON
 ; wStatusFlags
 	const ENGINE_POKEDEX
 	const ENGINE_UNOWN_DEX
@@ -115,7 +115,7 @@
 ; wSwarmFlags
 	const ENGINE_BUENAS_PASSWORD_2
 	const ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON
-; wGameTimerPause
+; wGameTimerPaused
 	const ENGINE_62
 ; wPlayerGender
 	const ENGINE_PLAYER_IS_FEMALE
--- a/constants/event_flags.asm
+++ b/constants/event_flags.asm
@@ -136,9 +136,9 @@
 	const EVENT_TIN_TOWER_5F_HIDDEN_FULL_RESTORE
 	const EVENT_TIN_TOWER_5F_HIDDEN_CARBOS
 	const EVENT_BURNED_TOWER_1F_HIDDEN_ETHER
-	const_skip ; unused
-	const_skip ; unused
-	const_skip ; unused
+	const_skip ; unused in Crystal
+	const_skip ; unused in Crystal
+	const_skip ; unused in Crystal
 	const EVENT_NATIONAL_PARK_HIDDEN_FULL_HEAL
 	const EVENT_OLIVINE_LIGHTHOUSE_5F_HIDDEN_HYPER_POTION
 	const EVENT_TEAM_ROCKET_BASE_B1F_HIDDEN_REVIVE
@@ -281,11 +281,11 @@
 	const EVENT_GAVE_KURT_PNK_APRICORN
 ; Phone events
 	const EVENT_JACK_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_BEVERLY_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_HUEY_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_GOT_PROTEIN_FROM_HUEY
 	const EVENT_GOT_HP_UP_FROM_JOEY
 	const EVENT_GOT_CARBOS_FROM_VANCE
@@ -293,55 +293,55 @@
 	const EVENT_GOT_CALCIUM_FROM_ERIN
 	const EVENT_KENJI_ON_BREAK
 	const EVENT_GAVEN_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_BETH_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_JOSE_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_REENA_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_JOEY_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_WADE_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_RALPH_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_LIZ_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_ANTHONY_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_TODD_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_GINA_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_IRWIN_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_ARNIE_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_ALAN_ASKED_FOR_PHONE_NUMBER
+	const_skip ; unused in Crystal
 	const_skip ; unused
 	const_skip ; unused
-	const_skip ; unused
 	const EVENT_DANA_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_CHAD_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_DEREK_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_TULLY_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_BRENT_ASKED_FOR_PHONE_NUMBER
 	const_skip ; unused
 	const EVENT_TIFFANY_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_VANCE_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_WILTON_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_KENJI_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_PARRY_ASKED_FOR_PHONE_NUMBER
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_ERIN_ASKED_FOR_PHONE_NUMBER
 	const EVENT_BUENA_OFFERED_HER_PHONE_NUMBER_NO_BLUE_CARD
 	const_skip ; unused
@@ -1229,7 +1229,7 @@
 	const EVENT_COPYCAT_2
 	const EVENT_GOLDENROD_SALE_OFF
 	const EVENT_GOLDENROD_SALE_ON
-	const_skip ; unused
+	const_skip ; unused in Crystal
 	const EVENT_ILEX_FOREST_APPRENTICE
 	const EVENT_ILEX_FOREST_CHARCOAL_MASTER
 	const EVENT_CHARCOAL_KILN_FARFETCH_D
--- a/constants/gfx_constants.asm
+++ b/constants/gfx_constants.asm
@@ -21,6 +21,7 @@
 SCREEN_META_HEIGHT EQU 5 ; metatiles
 SURROUNDING_WIDTH  EQU SCREEN_META_WIDTH * METATILE_WIDTH ; tiles
 SURROUNDING_HEIGHT EQU SCREEN_META_HEIGHT * METATILE_WIDTH ; tiles
+MAP_CONNECTION_PADDING_WIDTH EQU 3 ; metatiles
 
 HP_BAR_LENGTH  EQU 6 ; tiles
 EXP_BAR_LENGTH EQU 8 ; tiles
--- a/constants/hardware_constants.asm
+++ b/constants/hardware_constants.asm
@@ -71,10 +71,10 @@
 rTMA        EQU $ff06 ; Timer Modulo (R/W)
 rTAC        EQU $ff07 ; Timer Control (R/W)
 rTAC_ON        EQU 2
-rTAC_4096_HZ   EQU 0
-rTAC_262144_HZ EQU 1
-rTAC_65536_HZ  EQU 2
-rTAC_16384_HZ  EQU 3
+rTAC_4096_HZ   EQU %00
+rTAC_262144_HZ EQU %01
+rTAC_65536_HZ  EQU %10
+rTAC_16384_HZ  EQU %11
 rIF         EQU $ff0f ; Interrupt Flag (R/W)
 rNR10       EQU $ff10 ; Channel 1 Sweep register (R/W)
 rNR11       EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W)
@@ -147,6 +147,9 @@
 rHDMA4      EQU $ff54 ; CGB Mode Only - New DMA Destination, Low
 rHDMA5      EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start
 rRP         EQU $ff56 ; CGB Mode Only - Infrared Communications Port
+rRP_LED_ON EQU 0
+rRP_RECEIVING EQU 1
+rRP_ENABLE_READ_MASK EQU %11000000
 rBGPI       EQU $ff68 ; CGB Mode Only - Background Palette Index
 rBGPI_AUTO_INCREMENT EQU 7 ; increment rBGPI after write to rBGPD
 rBGPD       EQU $ff69 ; CGB Mode Only - Background Palette Data
--- a/constants/landmark_constants.asm
+++ b/constants/landmark_constants.asm
@@ -102,8 +102,9 @@
 	const LANDMARK_FAST_SHIP         ; 5f
 
 ; used in CaughtData
-LANDMARK_GIFT  EQU $7e
-LANDMARK_EVENT EQU $7f
+	const_def $7f, -1
+	const LANDMARK_EVENT             ; $7f
+	const LANDMARK_GIFT              ; $7e
 
 ; Regions
 	const_def
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -1,5 +1,5 @@
 newgroup: MACRO
-const_value = const_value + 1
+	const_skip
 __map_value__ = 1
 ENDM
 
--- a/constants/map_data_constants.asm
+++ b/constants/map_data_constants.asm
@@ -66,7 +66,7 @@
 	shift_const NORTH
 
 ; SpawnPoints indexes (see data/maps/spawn_points.asm)
-const_value = -1
+	const_def -1
 	const SPAWN_N_A
 	const SPAWN_HOME
 	const SPAWN_DEBUG
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -14,6 +14,8 @@
 
 ; G/S version ID: 0 = Gold, 1 = Silver (used by checkver)
 GS_VERSION EQU 0
+; Pokémon Pikachu 2, a step counter / virtual pet device (used by Mystery Gift)
+POKEMON_PIKACHU_2_VERSION EQU 3
 
 ; save file corruption check values
 SAVE_CHECK_VALUE_1 EQU 99
--- a/constants/pokemon_constants.asm
+++ b/constants/pokemon_constants.asm
@@ -10,14 +10,14 @@
 ; - PokemonPalettes (see data/pokemon/palettes.asm)
 ; - PokedexDataPointerTable (see data/pokemon/dex_entry_pointers.asm)
 ; - AlphabeticalPokedexOrder (see data/pokemon/dex_order_alpha.asm)
-; - EZChat_SortedPokemon (see data/pokemon/ezchat_order.asm)
 ; - NewPokedexOrder (see data/pokemon/dex_order_new.asm)
 ; - Pokered_MonIndices (see data/pokemon/gen1_order.asm)
+; - Footprints (see gfx/footprints.asm)
 ; - AnimationPointers (see gfx/pokemon/anim_pointers.asm)
 ; - AnimationIdlePointers (see gfx/pokemon/idle_pointers.asm)
 ; - BitmasksPointers (see gfx/pokemon/bitmask_pointers.asm)
 ; - FramesPointers (see gfx/pokemon/frame_pointers.asm)
-; - Footprints (see gfx/footprints.asm)
+; - EZChat_SortedPokemon (see data/pokemon/ezchat_order.asm)
 	const_def 1
 	const BULBASAUR  ; 01
 	const IVYSAUR    ; 02
--- a/constants/pokemon_data_constants.asm
+++ b/constants/pokemon_data_constants.asm
@@ -179,7 +179,7 @@
 	const TREEMON_SCORE_RARE ; 2
 
 ; ChangeHappiness arguments (see data/happiness_changes.asm)
-const_value = 1
+	const_def 1
 	const HAPPINESS_GAINLEVEL         ; 01
 	const HAPPINESS_USEDITEM          ; 02
 	const HAPPINESS_USEDXITEM         ; 03
--- a/constants/scgb_constants.asm
+++ b/constants/scgb_constants.asm
@@ -35,6 +35,12 @@
 SCGB_PARTY_MENU_HP_BARS EQU $fc
 SCGB_DEFAULT EQU $ff
 
+; GetCrystalCGBLayout arguments (see engine/gfx/crystal_layouts.asm)
+	const_def
+	const CRYSTAL_CGB_MOBILE_0
+	const CRYSTAL_CGB_MOBILE_1
+	const CRYSTAL_CGB_NAME_CARD
+
 ; PredefPals indexes (see gfx/sgb/predef.pal)
 ; GetPredefPal arguments (see engine/gfx/color.asm)
 	const_def
--- a/constants/serial_constants.asm
+++ b/constants/serial_constants.asm
@@ -30,3 +30,8 @@
 SERIAL_PATCH_LIST_PART_TERMINATOR EQU $ff
 
 SERIAL_PREAMBLE_LENGTH EQU 6
+
+; timeout duration after exchanging a byte
+SERIAL_LINK_BYTE_TIMEOUT EQU $5000
+
+MAX_MYSTERY_GIFT_PARTNERS EQU 5
--- a/constants/trainer_constants.asm
+++ b/constants/trainer_constants.asm
@@ -3,7 +3,7 @@
 trainerclass: MACRO
 \1 EQU __trainer_class__
 __trainer_class__ = __trainer_class__ + 1
-const_value = 1
+	const_def 1
 ENDM
 
 ; trainer class ids
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -21,10 +21,14 @@
 	const TEMPMON    ; 3
 	const WILDMON    ; 4
 
-; wGameTimerPause::
-GAMETIMERPAUSE_TIMER_PAUSED_F EQU 0
-GAMETIMERPAUSE_MOBILE_7_F     EQU 7
+; wGameTimerPaused::
+GAME_TIMER_PAUSED_F EQU 0
+GAME_TIMER_MOBILE_F EQU 7
 
+; wJoypadDisable::
+JOYPAD_DISABLE_MON_FAINT_F    EQU 6
+JOYPAD_DISABLE_SGB_TRANSFER_F EQU 7
+
 ; wOptions::
 TEXT_DELAY_MASK EQU %111
 	const_def 4
@@ -80,11 +84,12 @@
 RIGHT_MASK EQU 1 << RIGHT
 
 ; wFacingDirection::
+	const_def NUM_DIRECTIONS - 1, -1
+	shift_const FACE_DOWN  ; 8
+	shift_const FACE_UP    ; 4
+	shift_const FACE_LEFT  ; 2
+	shift_const FACE_RIGHT ; 1
 FACE_CURRENT EQU 0
-FACE_DOWN    EQU 8
-FACE_UP      EQU 4
-FACE_LEFT    EQU 2
-FACE_RIGHT   EQU 1
 
 ; wPokemonWithdrawDepositParameter::
 PC_WITHDRAW       EQU 0
--- a/data/battle/effect_command_pointers.asm
+++ b/data/battle/effect_command_pointers.asm
@@ -63,7 +63,7 @@
 	dw BattleCommand_Charge
 	dw BattleCommand_CheckCharge
 	dw BattleCommand_TrapTarget
-	dw BattleCommand3c
+	dw BattleCommand_Unused3C
 	dw BattleCommand_Rampage
 	dw BattleCommand_CheckRampage
 	dw BattleCommand_ConstantDamage
@@ -96,7 +96,7 @@
 	dw BattleCommand_Endure
 	dw BattleCommand_CheckCurl
 	dw BattleCommand_RolloutPower
-	dw BattleCommand5d
+	dw BattleCommand_Unused5D
 	dw BattleCommand_FuryCutter
 	dw BattleCommand_Attract
 	dw BattleCommand_HappinessPower
--- a/data/battle_tower/parties.asm
+++ b/data/battle_tower/parties.asm
@@ -1,7 +1,7 @@
 BattleTowerMons:
-; 10 groups of 21 mons.
+; 10 groups (one per floor level) of 21 mons (BATTLETOWER_NUM_UNIQUE_MON).
 
-BattleTowerMons1:
+; BattleTowerMons group 1
 
 	db JOLTEON
 	db MIRACLEBERRY
@@ -550,7 +550,7 @@
 	db "BARIYA-DO@@"
 
 
-BattleTowerMons2:
+; BattleTowerMons group 2
 
 	db UMBREON
 	db LEFTOVERS
@@ -1099,7 +1099,7 @@
 	db "NUO-@@@@@@@"
 
 
-BattleTowerMons3:
+; BattleTowerMons group 3
 
 	db JOLTEON
 	db MIRACLEBERRY
@@ -1648,7 +1648,7 @@
 	db "OKORIZARU@@"
 
 
-BattleTowerMons4:
+; BattleTowerMons group 4
 
 	db TAUROS
 	db GOLD_BERRY
@@ -2197,7 +2197,7 @@
 	db "EREBU-@@@@@"
 
 
-BattleTowerMons5:
+; BattleTowerMons group 5
 
 	db KINGDRA
 	db GOLD_BERRY
@@ -2746,7 +2746,7 @@
 	db "HURI-ZA-@@@"
 
 
-BattleTowerMons6:
+; BattleTowerMons group 6
 
 	db KINGDRA
 	db LEFTOVERS
@@ -3295,7 +3295,7 @@
 	db "GORO-NIya@@"
 
 
-BattleTowerMons7:
+; BattleTowerMons group 7
 
 	db JOLTEON
 	db MIRACLEBERRY
@@ -3844,7 +3844,7 @@
 	db "KAMEtuKUSU@"
 
 
-BattleTowerMons8:
+; BattleTowerMons group 8
 
 	db JOLTEON
 	db MIRACLEBERRY
@@ -4393,7 +4393,7 @@
 	db "GURANBURU@@"
 
 
-BattleTowerMons9:
+; BattleTowerMons group 9
 
 	db UMBREON
 	db KINGS_ROCK
@@ -4942,7 +4942,7 @@
 	db "BETOBETON@@"
 
 
-BattleTowerMons10:
+; BattleTowerMons group 10
 
 	db HOUNDOOM
 	db MINT_BERRY
--- a/data/battle_tower/unknown.asm
+++ b/data/battle_tower/unknown.asm
@@ -1,8 +1,8 @@
-BattleTowerTrainerData:: ; What exactly it is, I don't know
-; Size is 70 (Nr of Trainers in BattleTower) * 0x24 (Nr of Bytes that are copied)
+BattleTowerTrainerData:: ; ???
+; 70 tables (BATTLETOWER_NUM_UNIQUE_TRAINERS) of 18 two-argument entries (total size BATTLETOWER_TRAINERDATALENGTH).
 ; Second argument points to an entry in Unknown_170470, to which the first argument is compared.
 
-BattleTowerTrainer1DataTable:
+; BattleTowerTrainerData table 1:
 	db $37,  3
 	db $0e,  9
 	db $25, 11
@@ -22,7 +22,7 @@
 	db $34,  3
 	db $06,  5
 
-BattleTowerTrainer2DataTable:
+; BattleTowerTrainerData table 2:
 	db $36,  3
 	db $ca,  0
 	db $22,  8
@@ -42,7 +42,7 @@
 	db $28, 11
 	db $0c, 13
 
-BattleTowerTrainer3DataTable:
+; BattleTowerTrainerData table 3:
 	db $32,  6
 	db $31,  4
 	db $02,  2
@@ -62,7 +62,7 @@
 	db $22,  2
 	db $13, 13
 
-BattleTowerTrainer4DataTable:
+; BattleTowerTrainerData table 4:
 	db $22, 12
 	db $22, 12
 	db $0a,  9
@@ -82,7 +82,7 @@
 	db $1c, 11
 	db $41, 11
 
-BattleTowerTrainer5DataTable:
+; BattleTowerTrainerData table 5:
 	db $a3,  0
 	db $41,  3
 	db $1f,  4
@@ -102,7 +102,7 @@
 	db $d1,  0
 	db $0a,  6
 
-BattleTowerTrainer6DataTable:
+; BattleTowerTrainerData table 6:
 	db $13,  2
 	db $31,  6
 	db $04,  2
@@ -122,7 +122,7 @@
 	db $08,  5
 	db $1a, 13
 
-BattleTowerTrainer7DataTable:
+; BattleTowerTrainerData table 7:
 	db $0d,  2
 	db $07,  2
 	db $00,  5
@@ -142,7 +142,7 @@
 	db $20,  4
 	db $23, 13
 
-BattleTowerTrainer8DataTable:
+; BattleTowerTrainerData table 8:
 	db $1e,  2
 	db $22,  2
 	db $00,  5
@@ -162,7 +162,7 @@
 	db $14,  8
 	db $00,  5
 
-BattleTowerTrainer9DataTable:
+; BattleTowerTrainerData table 9:
 	db $06, 12
 	db $09,  6
 	db $00,  0
@@ -182,7 +182,7 @@
 	db $31, 13
 	db $01,  5
 
-BattleTowerTrainer10DataTable:
+; BattleTowerTrainerData table 10:
 	db $22, 12
 	db $30,  4
 	db $01,  5
@@ -202,7 +202,7 @@
 	db $30, 13
 	db $06,  5
 
-BattleTowerTrainer11DataTable:
+; BattleTowerTrainerData table 11:
 	db $0e,  6
 	db $04,  5
 	db $2c,  4
@@ -222,7 +222,7 @@
 	db $26, 13
 	db $04,  5
 
-BattleTowerTrainer12DataTable:
+; BattleTowerTrainerData table 12:
 	db $18,  2
 	db $33,  3
 	db $28,  4
@@ -242,7 +242,7 @@
 	db $0f,  2
 	db $00,  5
 
-BattleTowerTrainer13DataTable:
+; BattleTowerTrainerData table 13:
 	db $3a, 11
 	db $3a, 11
 	db $00,  5
@@ -262,7 +262,7 @@
 	db $3a,  8
 	db $2a, 13
 
-BattleTowerTrainer14DataTable:
+; BattleTowerTrainerData table 14:
 	db $31,  5
 	db $11, 14
 	db $30,  4
@@ -282,7 +282,7 @@
 	db $3b,  7
 	db $0e, 13
 
-BattleTowerTrainer15DataTable:
+; BattleTowerTrainerData table 15:
 	db $1b,  2
 	db $2c,  4
 	db $0d, 13
@@ -302,7 +302,7 @@
 	db $06,  5
 	db $00,  0
 
-BattleTowerTrainer16DataTable:
+; BattleTowerTrainerData table 16:
 	db $42,  3
 	db $30,  4
 	db $1f, 11
@@ -322,7 +322,7 @@
 	db $36,  8
 	db $41, 13
 
-BattleTowerTrainer17DataTable:
+; BattleTowerTrainerData table 17:
 	db $18,  3
 	db $42,  3
 	db $43,  4
@@ -342,7 +342,7 @@
 	db $3f,  4
 	db $20, 14
 
-BattleTowerTrainer18DataTable:
+; BattleTowerTrainerData table 18:
 	db $0c,  5
 	db $36,  7
 	db $30,  4
@@ -362,7 +362,7 @@
 	db $30,  7
 	db $06,  5
 
-BattleTowerTrainer19DataTable:
+; BattleTowerTrainerData table 19:
 	db $36,  3
 	db $06,  6
 	db $44,  4
@@ -382,7 +382,7 @@
 	db $05, 13
 	db $00,  0
 
-BattleTowerTrainer20DataTable:
+; BattleTowerTrainerData table 20:
 	db $3f,  6
 	db $2c,  4
 	db $34, 13
@@ -402,7 +402,7 @@
 	db $34,  7
 	db $04, 13
 
-BattleTowerTrainer21DataTable:
+; BattleTowerTrainerData table 21:
 	db $12,  3
 	db $02,  4
 	db $07,  7
@@ -422,7 +422,7 @@
 	db $28, 11
 	db $02,  5
 
-BattleTowerTrainer22DataTable:
+; BattleTowerTrainerData table 22:
 	db $41,  4
 	db $3c, 11
 	db $34, 13
@@ -442,7 +442,7 @@
 	db $0c,  4
 	db $3b, 13
 
-BattleTowerTrainer23DataTable:
+; BattleTowerTrainerData table 23:
 	db $03, 10
 	db $3a, 13
 	db $2c,  4
@@ -462,7 +462,7 @@
 	db $13,  4
 	db $04,  5
 
-BattleTowerTrainer24DataTable:
+; BattleTowerTrainerData table 24:
 	db $06,  5
 	db $06,  5
 	db $06,  5
@@ -482,7 +482,7 @@
 	db $33,  4
 	db $03,  5
 
-BattleTowerTrainer25DataTable:
+; BattleTowerTrainerData table 25:
 	db $27,  5
 	db $01,  5
 	db $00,  0
@@ -502,7 +502,7 @@
 	db $0c,  4
 	db $19, 13
 
-BattleTowerTrainer26DataTable:
+; BattleTowerTrainerData table 26:
 	db $03,  2
 	db $43,  3
 	db $27,  4
@@ -522,7 +522,7 @@
 	db $20,  4
 	db $41, 13
 
-BattleTowerTrainer27DataTable:
+; BattleTowerTrainerData table 27:
 	db $34,  3
 	db $00,  3
 	db $11, 13
@@ -542,7 +542,7 @@
 	db $0d,  6
 	db $20,  6
 
-BattleTowerTrainer28DataTable:
+; BattleTowerTrainerData table 28:
 	db $19,  3
 	db $17, 11
 	db $20,  6
@@ -562,7 +562,7 @@
 	db $06, 12
 	db $1a, 11
 
-BattleTowerTrainer29DataTable:
+; BattleTowerTrainerData table 29:
 	db $0a,  3
 	db $0c, 12
 	db $25, 10
@@ -582,7 +582,7 @@
 	db $0a,  9
 	db $2f, 13
 
-BattleTowerTrainer30DataTable:
+; BattleTowerTrainerData table 30:
 	db $15,  2
 	db $2c,  4
 	db $03,  2
@@ -602,7 +602,7 @@
 	db $0c,  4
 	db $3b, 13
 
-BattleTowerTrainer31DataTable:
+; BattleTowerTrainerData table 31:
 	db $10, 11
 	db $04,  4
 	db $00,  5
@@ -622,7 +622,7 @@
 	db $13,  7
 	db $16, 13
 
-BattleTowerTrainer32DataTable:
+; BattleTowerTrainerData table 32:
 	db $0f, 14
 	db $19, 13
 	db $00,  5
@@ -642,7 +642,7 @@
 	db $19, 13
 	db $01,  5
 
-BattleTowerTrainer33DataTable:
+; BattleTowerTrainerData table 33:
 	db $35,  3
 	db $06,  4
 	db $0d,  6
@@ -662,7 +662,7 @@
 	db $29,  8
 	db $03,  5
 
-BattleTowerTrainer34DataTable:
+; BattleTowerTrainerData table 34:
 	db $18,  4
 	db $03,  5
 	db $0b, 13
@@ -682,7 +682,7 @@
 	db $0c,  6
 	db $1a, 13
 
-BattleTowerTrainer35DataTable:
+; BattleTowerTrainerData table 35:
 	db $0c, 12
 	db $37,  3
 	db $1a,  3
@@ -702,7 +702,7 @@
 	db $3b,  8
 	db $1b,  7
 
-BattleTowerTrainer36DataTable:
+; BattleTowerTrainerData table 36:
 	db $18,  3
 	db $1b,  8
 	db $29, 11
@@ -722,7 +722,7 @@
 	db $2f,  8
 	db $27,  6
 
-BattleTowerTrainer37DataTable:
+; BattleTowerTrainerData table 37:
 	db $1c,  3
 	db $02, 14
 	db $31,  3
@@ -742,7 +742,7 @@
 	db $27,  4
 	db $34, 13
 
-BattleTowerTrainer38DataTable:
+; BattleTowerTrainerData table 38:
 	db $33,  3
 	db $30,  4
 	db $2c,  4
@@ -762,7 +762,7 @@
 	db $40,  6
 	db $22,  7
 
-BattleTowerTrainer39DataTable:
+; BattleTowerTrainerData table 39:
 	db $22, 12
 	db $22, 12
 	db $16, 10
@@ -782,7 +782,7 @@
 	db $2c,  4
 	db $26,  7
 
-BattleTowerTrainer40DataTable:
+; BattleTowerTrainerData table 40:
 	db $0e,  6
 	db $05,  8
 	db $04, 13
@@ -802,7 +802,7 @@
 	db $00,  0
 	db $00,  0
 
-BattleTowerTrainer41DataTable:
+; BattleTowerTrainerData table 41:
 	db $18,  3
 	db $27,  3
 	db $03,  5
@@ -822,7 +822,7 @@
 	db $2f,  8
 	db $06,  5
 
-BattleTowerTrainer42DataTable:
+; BattleTowerTrainerData table 42:
 	db $36,  3
 	db $30,  4
 	db $17,  4
@@ -842,7 +842,7 @@
 	db $07, 13
 	db $3b, 13
 
-BattleTowerTrainer43DataTable:
+; BattleTowerTrainerData table 43:
 	db $0b,  5
 	db $14,  6
 	db $24,  4
@@ -862,7 +862,7 @@
 	db $00,  2
 	db $07,  5
 
-BattleTowerTrainer44DataTable:
+; BattleTowerTrainerData table 44:
 	db $0a,  3
 	db $32,  7
 	db $0b, 14
@@ -882,7 +882,7 @@
 	db $1e,  6
 	db $14,  7
 
-BattleTowerTrainer45DataTable:
+; BattleTowerTrainerData table 45:
 	db $0e,  6
 	db $2c,  4
 	db $00, 13
@@ -902,7 +902,7 @@
 	db $31,  4
 	db $21, 13
 
-BattleTowerTrainer46DataTable:
+; BattleTowerTrainerData table 46:
 	db $22,  5
 	db $07, 14
 	db $30,  4
@@ -922,7 +922,7 @@
 	db $3f,  4
 	db $06,  5
 
-BattleTowerTrainer47DataTable:
+; BattleTowerTrainerData table 47:
 	db $3a,  7
 	db $3b,  7
 	db $36,  3
@@ -942,7 +942,7 @@
 	db $3f,  4
 	db $0c, 13
 
-BattleTowerTrainer48DataTable:
+; BattleTowerTrainerData table 48:
 	db $43,  3
 	db $20,  4
 	db $41, 13
@@ -962,7 +962,7 @@
 	db $39,  4
 	db $41, 13
 
-BattleTowerTrainer49DataTable:
+; BattleTowerTrainerData table 49:
 	db $36,  3
 	db $16,  4
 	db $08,  6
@@ -982,7 +982,7 @@
 	db $2c, 13
 	db $00,  5
 
-BattleTowerTrainer50DataTable:
+; BattleTowerTrainerData table 50:
 	db $11,  5
 	db $25,  3
 	db $33,  4
@@ -1002,7 +1002,7 @@
 	db $19, 13
 	db $06,  5
 
-BattleTowerTrainer51DataTable:
+; BattleTowerTrainerData table 51:
 	db $2c,  4
 	db $0a, 13
 	db $04,  5
@@ -1022,7 +1022,7 @@
 	db $29,  8
 	db $05, 13
 
-BattleTowerTrainer52DataTable:
+; BattleTowerTrainerData table 52:
 	db $05,  3
 	db $1b,  4
 	db $41,  3
@@ -1042,7 +1042,7 @@
 	db $1d, 11
 	db $03,  5
 
-BattleTowerTrainer53DataTable:
+; BattleTowerTrainerData table 53:
 	db $1c, 12
 	db $20,  6
 	db $05,  8
@@ -1062,7 +1062,7 @@
 	db $06,  5
 	db $1f,  8
 
-BattleTowerTrainer54DataTable:
+; BattleTowerTrainerData table 54:
 	db $37,  3
 	db $0e,  1
 	db $08,  1
@@ -1082,7 +1082,7 @@
 	db $41,  8
 	db $3b, 13
 
-BattleTowerTrainer55DataTable:
+; BattleTowerTrainerData table 55:
 	db $06,  2
 	db $00,  5
 	db $34,  3
@@ -1102,7 +1102,7 @@
 	db $1b,  4
 	db $0c, 13
 
-BattleTowerTrainer56DataTable:
+; BattleTowerTrainerData table 56:
 	db $2c,  4
 	db $13,  9
 	db $20,  6
@@ -1122,7 +1122,7 @@
 	db $06, 13
 	db $3b, 13
 
-BattleTowerTrainer57DataTable:
+; BattleTowerTrainerData table 57:
 	db $06,  3
 	db $20,  4
 	db $24, 13
@@ -1142,7 +1142,7 @@
 	db $09,  6
 	db $06,  5
 
-BattleTowerTrainer58DataTable:
+; BattleTowerTrainerData table 58:
 	db $44,  7
 	db $23, 11
 	db $33, 13
@@ -1162,7 +1162,7 @@
 	db $11,  8
 	db $41, 13
 
-BattleTowerTrainer59DataTable:
+; BattleTowerTrainerData table 59:
 	db $36,  3
 	db $06,  6
 	db $30,  4
@@ -1182,7 +1182,7 @@
 	db $0b,  6
 	db $27,  6
 
-BattleTowerTrainer60DataTable:
+; BattleTowerTrainerData table 60:
 	db $14,  5
 	db $04,  2
 	db $09, 14
@@ -1202,7 +1202,7 @@
 	db $39,  4
 	db $00,  5
 
-BattleTowerTrainer61DataTable:
+; BattleTowerTrainerData table 61:
 	db $34,  3
 	db $00,  3
 	db $11, 13
@@ -1222,7 +1222,7 @@
 	db $1e,  6
 	db $14, 13
 
-BattleTowerTrainer62DataTable:
+; BattleTowerTrainerData table 62:
 	db $37,  5
 	db $37,  5
 	db $00,  5
@@ -1242,7 +1242,7 @@
 	db $16,  5
 	db $01,  5
 
-BattleTowerTrainer63DataTable:
+; BattleTowerTrainerData table 63:
 	db $1f, 14
 	db $36,  4
 	db $40, 13
@@ -1262,7 +1262,7 @@
 	db $27, 13
 	db $00,  0
 
-BattleTowerTrainer64DataTable:
+; BattleTowerTrainerData table 64:
 	db $41,  8
 	db $0b,  6
 	db $37,  3
@@ -1282,7 +1282,7 @@
 	db $28,  6
 	db $06,  5
 
-BattleTowerTrainer65DataTable:
+; BattleTowerTrainerData table 65:
 	db $0c,  8
 	db $2c,  4
 	db $1c, 11
@@ -1302,7 +1302,7 @@
 	db $20,  6
 	db $22,  7
 
-BattleTowerTrainer66DataTable:
+; BattleTowerTrainerData table 66:
 	db $22, 12
 	db $22, 12
 	db $0a,  9
@@ -1322,7 +1322,7 @@
 	db $02,  7
 	db $04,  5
 
-BattleTowerTrainer67DataTable:
+; BattleTowerTrainerData table 67:
 	db $2d, 11
 	db $02,  8
 	db $37, 13
@@ -1342,7 +1342,7 @@
 	db $10,  5
 	db $04,  5
 
-BattleTowerTrainer68DataTable:
+; BattleTowerTrainerData table 68:
 	db $3f,  3
 	db $16, 14
 	db $3f,  8
@@ -1362,7 +1362,7 @@
 	db $26,  7
 	db $03,  5
 
-BattleTowerTrainer69DataTable:
+; BattleTowerTrainerData table 69:
 	db $3a,  6
 	db $2c,  3
 	db $12,  3
@@ -1382,7 +1382,7 @@
 	db $1b,  7
 	db $00,  5
 
-BattleTowerTrainer70DataTable:
+; BattleTowerTrainerData table 70:
 	db $1b,  2
 	db $00,  5
 	db $0c,  8
@@ -1401,4 +1401,3 @@
 	db $22,  7
 	db $d1,  0
 	db $32, 13
-BattleTowerTrainerDataEnd:
--- /dev/null
+++ b/data/collision/collision_permissions.asm
@@ -1,0 +1,258 @@
+TileCollisionTable::
+; entries correspond to COLL_* constants
+	db LAND_TILE         ; COLL_FLOOR
+	db LAND_TILE         ; COLL_01
+	db LAND_TILE         ; 02
+	db LAND_TILE         ; COLL_03
+	db LAND_TILE         ; COLL_04
+	db LAND_TILE         ; 05
+	db LAND_TILE         ; 06
+	db WALL_TILE         ; COLL_WALL
+	db LAND_TILE         ; COLL_CUT_08
+	db LAND_TILE         ; 09
+	db LAND_TILE         ; 0a
+	db LAND_TILE         ; 0b
+	db LAND_TILE         ; 0c
+	db LAND_TILE         ; 0d
+	db LAND_TILE         ; 0e
+	db WALL_TILE         ; 0f
+	db LAND_TILE         ; COLL_TALL_GRASS_10
+	db LAND_TILE         ; 11
+	db WALL_TILE | TALK  ; COLL_CUT_TREE
+	db LAND_TILE         ; 13
+	db LAND_TILE         ; COLL_LONG_GRASS
+	db WALL_TILE | TALK  ; COLL_HEADBUTT_TREE
+	db LAND_TILE         ; 16
+	db LAND_TILE         ; 17
+	db LAND_TILE         ; COLL_TALL_GRASS
+	db LAND_TILE         ; 19
+	db WALL_TILE | TALK  ; COLL_CUT_TREE_1A
+	db LAND_TILE         ; 1b
+	db LAND_TILE         ; COLL_LONG_GRASS_1C
+	db WALL_TILE | TALK  ; COLL_HEADBUTT_TREE_1D
+	db LAND_TILE         ; 1e
+	db LAND_TILE         ; 1f
+	db WATER_TILE        ; 20
+	db WATER_TILE        ; COLL_WATER_21
+	db WATER_TILE | TALK ; 22
+	db LAND_TILE         ; COLL_ICE
+	db WATER_TILE | TALK ; COLL_WHIRLPOOL
+	db WATER_TILE        ; 25
+	db WATER_TILE        ; 26
+	db WALL_TILE         ; COLL_BUOY
+	db WATER_TILE        ; COLL_CUT_28
+	db WATER_TILE        ; COLL_WATER
+	db WATER_TILE | TALK ; 2a
+	db LAND_TILE         ; COLL_ICE_2B
+	db WATER_TILE | TALK ; COLL_WHIRLPOOL_2C
+	db WATER_TILE        ; 2d
+	db WATER_TILE        ; 2e
+	db WALL_TILE         ; 2f
+	db WATER_TILE        ; COLL_WATERFALL_RIGHT
+	db WATER_TILE        ; COLL_WATERFALL_LEFT
+	db WATER_TILE        ; COLL_WATERFALL_UP
+	db WATER_TILE        ; COLL_WATERFALL
+	db WATER_TILE        ; 34
+	db WATER_TILE        ; 35
+	db WATER_TILE        ; 36
+	db WATER_TILE        ; 37
+	db WATER_TILE        ; COLL_CURRENT_RIGHT
+	db WATER_TILE        ; COLL_CURRENT_LEFT
+	db WATER_TILE        ; COLL_CURRENT_UP
+	db WATER_TILE        ; COLL_CURRENT_DOWN
+	db WATER_TILE        ; 3c
+	db WATER_TILE        ; 3d
+	db WATER_TILE        ; 3e
+	db WATER_TILE        ; 3f
+	db LAND_TILE         ; COLL_BRAKE
+	db LAND_TILE         ; COLL_WALK_RIGHT
+	db LAND_TILE         ; COLL_WALK_LEFT
+	db LAND_TILE         ; COLL_WALK_UP
+	db LAND_TILE         ; COLL_WALK_DOWN
+	db LAND_TILE         ; COLL_BRAKE_45
+	db LAND_TILE         ; COLL_BRAKE_46
+	db LAND_TILE         ; COLL_BRAKE_47
+	db LAND_TILE         ; COLL_GRASS_48
+	db LAND_TILE         ; COLL_GRASS_49
+	db LAND_TILE         ; COLL_GRASS_4A
+	db LAND_TILE         ; COLL_GRASS_4B
+	db LAND_TILE         ; COLL_GRASS_4C
+	db LAND_TILE         ; 4d
+	db LAND_TILE         ; 4e
+	db LAND_TILE         ; 4f
+	db LAND_TILE         ; COLL_WALK_RIGHT_ALT
+	db LAND_TILE         ; COLL_WALK_LEFT_ALT
+	db LAND_TILE         ; COLL_WALK_UP_ALT
+	db LAND_TILE         ; COLL_WALK_DOWN_ALT
+	db LAND_TILE         ; COLL_BRAKE_ALT
+	db LAND_TILE         ; COLL_BRAKE_55
+	db LAND_TILE         ; COLL_BRAKE_56
+	db LAND_TILE         ; COLL_BRAKE_57
+	db LAND_TILE         ; 58
+	db LAND_TILE         ; 59
+	db LAND_TILE         ; 5a
+	db LAND_TILE         ; COLL_5B
+	db LAND_TILE         ; 5c
+	db LAND_TILE         ; 5d
+	db LAND_TILE         ; 5e
+	db LAND_TILE         ; 5f
+	db LAND_TILE         ; COLL_PIT
+	db LAND_TILE         ; COLL_VIRTUAL_BOY
+	db WALL_TILE         ; 62
+	db LAND_TILE         ; 63
+	db LAND_TILE         ; COLL_64
+	db LAND_TILE         ; COLL_65
+	db LAND_TILE         ; 66
+	db LAND_TILE         ; 67
+	db LAND_TILE         ; COLL_PIT_68
+	db LAND_TILE         ; 69
+	db WALL_TILE         ; 6a
+	db LAND_TILE         ; 6b
+	db LAND_TILE         ; 6c
+	db LAND_TILE         ; 6d
+	db LAND_TILE         ; 6e
+	db LAND_TILE         ; 6f
+	db LAND_TILE         ; COLL_WARP_CARPET_DOWN
+	db LAND_TILE         ; COLL_DOOR
+	db LAND_TILE         ; COLL_LADDER
+	db LAND_TILE         ; COLL_STAIRCASE_73
+	db LAND_TILE         ; COLL_CAVE_74
+	db LAND_TILE         ; COLL_DOOR_75
+	db LAND_TILE         ; COLL_WARP_CARPET_LEFT
+	db LAND_TILE         ; COLL_WARP_77
+	db LAND_TILE         ; COLL_WARP_CARPET_UP
+	db LAND_TILE         ; COLL_DOOR_79
+	db LAND_TILE         ; COLL_STAIRCASE
+	db LAND_TILE         ; COLL_CAVE
+	db LAND_TILE         ; COLL_WARP_PANEL
+	db LAND_TILE         ; COLL_DOOR_7D
+	db LAND_TILE         ; COLL_WARP_CARPET_RIGHT
+	db LAND_TILE         ; COLL_WARP_7F
+	db WALL_TILE         ; 80
+	db WALL_TILE         ; 81
+	db WALL_TILE         ; 82
+	db WALL_TILE         ; 83
+	db WALL_TILE         ; 84
+	db LAND_TILE         ; 85
+	db LAND_TILE         ; 86
+	db LAND_TILE         ; 87
+	db WALL_TILE         ; 88
+	db WALL_TILE         ; 89
+	db WALL_TILE         ; 8a
+	db WALL_TILE         ; 8b
+	db WALL_TILE         ; 8c
+	db LAND_TILE         ; 8d
+	db LAND_TILE         ; 8e
+	db LAND_TILE         ; 8f
+	db WALL_TILE         ; COLL_COUNTER
+	db WALL_TILE         ; COLL_BOOKSHELF
+	db WALL_TILE         ; 92
+	db WALL_TILE         ; COLL_PC
+	db WALL_TILE         ; COLL_RADIO
+	db WALL_TILE         ; COLL_TOWN_MAP
+	db WALL_TILE         ; COLL_MART_SHELF
+	db WALL_TILE         ; COLL_TV
+	db WALL_TILE         ; COLL_COUNTER_98
+	db WALL_TILE         ; 99
+	db WALL_TILE         ; 9a
+	db WALL_TILE         ; 9b
+	db WALL_TILE         ; COLL_9C
+	db WALL_TILE         ; COLL_WINDOW
+	db WALL_TILE         ; 9e
+	db WALL_TILE         ; COLL_INCENSE_BURNER
+	db LAND_TILE         ; COLL_HOP_RIGHT
+	db LAND_TILE         ; COLL_HOP_LEFT
+	db LAND_TILE         ; COLL_HOP_UP
+	db LAND_TILE         ; COLL_HOP_DOWN
+	db LAND_TILE         ; COLL_HOP_DOWN_RIGHT
+	db LAND_TILE         ; COLL_HOP_DOWN_LEFT
+	db LAND_TILE         ; COLL_HOP_UP_RIGHT
+	db LAND_TILE         ; COLL_HOP_UP_LEFT
+	db LAND_TILE         ; a8
+	db LAND_TILE         ; a9
+	db LAND_TILE         ; aa
+	db LAND_TILE         ; ab
+	db LAND_TILE         ; ac
+	db LAND_TILE         ; ad
+	db LAND_TILE         ; ae
+	db LAND_TILE         ; af
+	db LAND_TILE         ; COLL_RIGHT_WALL
+	db LAND_TILE         ; COLL_LEFT_WALL
+	db LAND_TILE         ; COLL_UP_WALL
+	db LAND_TILE         ; COLL_DOWN_WALL
+	db LAND_TILE         ; COLL_DOWN_RIGHT_WALL
+	db LAND_TILE         ; COLL_DOWN_LEFT_WALL
+	db LAND_TILE         ; COLL_UP_RIGHT_WALL
+	db LAND_TILE         ; COLL_UP_LEFT_WALL
+	db LAND_TILE         ; b8
+	db LAND_TILE         ; b9
+	db LAND_TILE         ; ba
+	db LAND_TILE         ; bb
+	db LAND_TILE         ; bc
+	db LAND_TILE         ; bd
+	db LAND_TILE         ; be
+	db LAND_TILE         ; bf
+	db WATER_TILE        ; COLL_RIGHT_BUOY
+	db WATER_TILE        ; COLL_LEFT_BUOY
+	db WATER_TILE        ; COLL_UP_BUOY
+	db WATER_TILE        ; COLL_DOWN_BUOY
+	db WATER_TILE        ; COLL_DOWN_RIGHT_BUOY
+	db WATER_TILE        ; COLL_DOWN_LEFT_BUOY
+	db WATER_TILE        ; COLL_UP_RIGHT_BUOY
+	db WATER_TILE        ; COLL_UP_LEFT_BUOY
+	db WATER_TILE        ; c8
+	db WATER_TILE        ; c9
+	db WATER_TILE        ; ca
+	db WATER_TILE        ; cb
+	db WATER_TILE        ; cc
+	db WATER_TILE        ; cd
+	db WATER_TILE        ; ce
+	db WATER_TILE        ; cf
+	db LAND_TILE         ; d0
+	db LAND_TILE         ; d1
+	db LAND_TILE         ; d2
+	db LAND_TILE         ; d3
+	db LAND_TILE         ; d4
+	db LAND_TILE         ; d5
+	db LAND_TILE         ; d6
+	db LAND_TILE         ; d7
+	db LAND_TILE         ; d8
+	db LAND_TILE         ; d9
+	db LAND_TILE         ; da
+	db LAND_TILE         ; db
+	db LAND_TILE         ; dc
+	db LAND_TILE         ; dd
+	db LAND_TILE         ; de
+	db LAND_TILE         ; df
+	db LAND_TILE         ; e0
+	db LAND_TILE         ; e1
+	db LAND_TILE         ; e2
+	db LAND_TILE         ; e3
+	db LAND_TILE         ; e4
+	db LAND_TILE         ; e5
+	db LAND_TILE         ; e6
+	db LAND_TILE         ; e7
+	db LAND_TILE         ; e8
+	db LAND_TILE         ; e9
+	db LAND_TILE         ; ea
+	db LAND_TILE         ; eb
+	db LAND_TILE         ; ec
+	db LAND_TILE         ; ed
+	db LAND_TILE         ; ee
+	db LAND_TILE         ; ef
+	db LAND_TILE         ; f0
+	db LAND_TILE         ; f1
+	db LAND_TILE         ; f2
+	db LAND_TILE         ; f3
+	db LAND_TILE         ; f4
+	db LAND_TILE         ; f5
+	db LAND_TILE         ; f6
+	db LAND_TILE         ; f7
+	db LAND_TILE         ; f8
+	db LAND_TILE         ; f9
+	db LAND_TILE         ; fa
+	db LAND_TILE         ; fb
+	db LAND_TILE         ; fc
+	db LAND_TILE         ; fd
+	db LAND_TILE         ; fe
+	db WALL_TILE         ; COLL_FF
--- /dev/null
+++ b/data/collision/collision_stdscripts.asm
@@ -1,0 +1,18 @@
+; std scripts associated with tile collisions
+
+stdcoll: MACRO
+	db \1
+	dw (\2StdScript - StdScripts) / 3
+ENDM
+
+TileCollisionStdScripts:
+	; collision type, std script
+	stdcoll COLL_BOOKSHELF,      MagazineBookshelfScript
+	stdcoll COLL_PC,             PCScript
+	stdcoll COLL_RADIO,          Radio1Script
+	stdcoll COLL_TOWN_MAP,       TownMapScript
+	stdcoll COLL_MART_SHELF,     MerchandiseShelfScript
+	stdcoll COLL_TV,             TVScript
+	stdcoll COLL_WINDOW,         WindowScript
+	stdcoll COLL_INCENSE_BURNER, IncenseBurnerScript
+	db -1 ; end
--- /dev/null
+++ b/data/collision/field_move_blocks.asm
@@ -1,0 +1,55 @@
+; these blocks all use COLL_CUT_TREE in one quadrant
+CutTreeBlockPointers:
+; tileset, block list pointer
+	dbw TILESET_JOHTO,        .johto
+	dbw TILESET_JOHTO_MODERN, .johto_modern
+	dbw TILESET_KANTO,        .kanto
+	dbw TILESET_PARK,         .park
+	dbw TILESET_FOREST,       .forest
+	db -1 ; end
+
+.johto:
+; facing block, replacement block, animation
+	db $03, $02, 1 ; grass
+	db $5b, $3c, 0 ; tree
+	db $5f, $3d, 0 ; tree
+	db $63, $3f, 0 ; tree
+	db $67, $3e, 0 ; tree
+	db -1 ; end
+
+.johto_modern:
+; facing block, replacement block, animation
+	db $03, $02, $01 ; grass
+	db -1 ; end
+
+.kanto:
+; facing block, replacement block, animation
+	db $0b, $0a, 1 ; grass
+	db $32, $6d, 0 ; tree
+	db $33, $6c, 0 ; tree
+	db $34, $6f, 0 ; tree
+	db $35, $4c, 0 ; tree
+	db $60, $6e, 0 ; tree
+	db -1 ; end
+
+.park:
+; facing block, replacement block, animation
+	db $13, $03, 1 ; grass
+	db $03, $04, 1 ; grass
+	db -1 ; end
+
+.forest:
+; facing block, replacement block, animation
+	db $0f, $17, 0
+	db -1 ; end
+
+
+; these blocks all use COLL_WHIRLPOOL in one quadrant
+WhirlpoolBlockPointers:
+	dbw TILESET_JOHTO, .johto
+	db -1 ; end
+
+.johto:
+; facing block, replacement block, animation
+	db $07, $36, 0
+	db -1 ; end
--- a/data/collision_permissions.asm
+++ /dev/null
@@ -1,258 +1,0 @@
-TileCollisionTable::
-; entries correspond to COLL_* constants
-	db LAND_TILE         ; COLL_FLOOR
-	db LAND_TILE         ; COLL_01
-	db LAND_TILE         ; 02
-	db LAND_TILE         ; COLL_03
-	db LAND_TILE         ; COLL_04
-	db LAND_TILE         ; 05
-	db LAND_TILE         ; 06
-	db WALL_TILE         ; COLL_WALL
-	db LAND_TILE         ; COLL_CUT_08
-	db LAND_TILE         ; 09
-	db LAND_TILE         ; 0a
-	db LAND_TILE         ; 0b
-	db LAND_TILE         ; 0c
-	db LAND_TILE         ; 0d
-	db LAND_TILE         ; 0e
-	db WALL_TILE         ; 0f
-	db LAND_TILE         ; COLL_TALL_GRASS_10
-	db LAND_TILE         ; 11
-	db WALL_TILE | TALK  ; COLL_CUT_TREE
-	db LAND_TILE         ; 13
-	db LAND_TILE         ; COLL_LONG_GRASS
-	db WALL_TILE | TALK  ; COLL_HEADBUTT_TREE
-	db LAND_TILE         ; 16
-	db LAND_TILE         ; 17
-	db LAND_TILE         ; COLL_TALL_GRASS
-	db LAND_TILE         ; 19
-	db WALL_TILE | TALK  ; COLL_CUT_TREE_1A
-	db LAND_TILE         ; 1b
-	db LAND_TILE         ; COLL_LONG_GRASS_1C
-	db WALL_TILE | TALK  ; COLL_HEADBUTT_TREE_1D
-	db LAND_TILE         ; 1e
-	db LAND_TILE         ; 1f
-	db WATER_TILE        ; 20
-	db WATER_TILE        ; COLL_WATER_21
-	db WATER_TILE | TALK ; 22
-	db LAND_TILE         ; COLL_ICE
-	db WATER_TILE | TALK ; COLL_WHIRLPOOL
-	db WATER_TILE        ; 25
-	db WATER_TILE        ; 26
-	db WALL_TILE         ; COLL_BUOY
-	db WATER_TILE        ; COLL_CUT_28
-	db WATER_TILE        ; COLL_WATER
-	db WATER_TILE | TALK ; 2a
-	db LAND_TILE         ; COLL_ICE_2B
-	db WATER_TILE | TALK ; COLL_WHIRLPOOL_2C
-	db WATER_TILE        ; 2d
-	db WATER_TILE        ; 2e
-	db WALL_TILE         ; 2f
-	db WATER_TILE        ; COLL_WATERFALL_RIGHT
-	db WATER_TILE        ; COLL_WATERFALL_LEFT
-	db WATER_TILE        ; COLL_WATERFALL_UP
-	db WATER_TILE        ; COLL_WATERFALL
-	db WATER_TILE        ; 34
-	db WATER_TILE        ; 35
-	db WATER_TILE        ; 36
-	db WATER_TILE        ; 37
-	db WATER_TILE        ; COLL_CURRENT_RIGHT
-	db WATER_TILE        ; COLL_CURRENT_LEFT
-	db WATER_TILE        ; COLL_CURRENT_UP
-	db WATER_TILE        ; COLL_CURRENT_DOWN
-	db WATER_TILE        ; 3c
-	db WATER_TILE        ; 3d
-	db WATER_TILE        ; 3e
-	db WATER_TILE        ; 3f
-	db LAND_TILE         ; COLL_BRAKE
-	db LAND_TILE         ; COLL_WALK_RIGHT
-	db LAND_TILE         ; COLL_WALK_LEFT
-	db LAND_TILE         ; COLL_WALK_UP
-	db LAND_TILE         ; COLL_WALK_DOWN
-	db LAND_TILE         ; COLL_BRAKE_45
-	db LAND_TILE         ; COLL_BRAKE_46
-	db LAND_TILE         ; COLL_BRAKE_47
-	db LAND_TILE         ; COLL_GRASS_48
-	db LAND_TILE         ; COLL_GRASS_49
-	db LAND_TILE         ; COLL_GRASS_4A
-	db LAND_TILE         ; COLL_GRASS_4B
-	db LAND_TILE         ; COLL_GRASS_4C
-	db LAND_TILE         ; 4d
-	db LAND_TILE         ; 4e
-	db LAND_TILE         ; 4f
-	db LAND_TILE         ; COLL_WALK_RIGHT_ALT
-	db LAND_TILE         ; COLL_WALK_LEFT_ALT
-	db LAND_TILE         ; COLL_WALK_UP_ALT
-	db LAND_TILE         ; COLL_WALK_DOWN_ALT
-	db LAND_TILE         ; COLL_BRAKE_ALT
-	db LAND_TILE         ; COLL_BRAKE_55
-	db LAND_TILE         ; COLL_BRAKE_56
-	db LAND_TILE         ; COLL_BRAKE_57
-	db LAND_TILE         ; 58
-	db LAND_TILE         ; 59
-	db LAND_TILE         ; 5a
-	db LAND_TILE         ; COLL_5B
-	db LAND_TILE         ; 5c
-	db LAND_TILE         ; 5d
-	db LAND_TILE         ; 5e
-	db LAND_TILE         ; 5f
-	db LAND_TILE         ; COLL_PIT
-	db LAND_TILE         ; COLL_VIRTUAL_BOY
-	db WALL_TILE         ; 62
-	db LAND_TILE         ; 63
-	db LAND_TILE         ; COLL_64
-	db LAND_TILE         ; COLL_65
-	db LAND_TILE         ; 66
-	db LAND_TILE         ; 67
-	db LAND_TILE         ; COLL_PIT_68
-	db LAND_TILE         ; 69
-	db WALL_TILE         ; 6a
-	db LAND_TILE         ; 6b
-	db LAND_TILE         ; 6c
-	db LAND_TILE         ; 6d
-	db LAND_TILE         ; 6e
-	db LAND_TILE         ; 6f
-	db LAND_TILE         ; COLL_WARP_CARPET_DOWN
-	db LAND_TILE         ; COLL_DOOR
-	db LAND_TILE         ; COLL_LADDER
-	db LAND_TILE         ; COLL_STAIRCASE_73
-	db LAND_TILE         ; COLL_CAVE_74
-	db LAND_TILE         ; COLL_DOOR_75
-	db LAND_TILE         ; COLL_WARP_CARPET_LEFT
-	db LAND_TILE         ; COLL_WARP_77
-	db LAND_TILE         ; COLL_WARP_CARPET_UP
-	db LAND_TILE         ; COLL_DOOR_79
-	db LAND_TILE         ; COLL_STAIRCASE
-	db LAND_TILE         ; COLL_CAVE
-	db LAND_TILE         ; COLL_WARP_PANEL
-	db LAND_TILE         ; COLL_DOOR_7D
-	db LAND_TILE         ; COLL_WARP_CARPET_RIGHT
-	db LAND_TILE         ; COLL_WARP_7F
-	db WALL_TILE         ; 80
-	db WALL_TILE         ; 81
-	db WALL_TILE         ; 82
-	db WALL_TILE         ; 83
-	db WALL_TILE         ; 84
-	db LAND_TILE         ; 85
-	db LAND_TILE         ; 86
-	db LAND_TILE         ; 87
-	db WALL_TILE         ; 88
-	db WALL_TILE         ; 89
-	db WALL_TILE         ; 8a
-	db WALL_TILE         ; 8b
-	db WALL_TILE         ; 8c
-	db LAND_TILE         ; 8d
-	db LAND_TILE         ; 8e
-	db LAND_TILE         ; 8f
-	db WALL_TILE         ; COLL_COUNTER
-	db WALL_TILE         ; COLL_BOOKSHELF
-	db WALL_TILE         ; 92
-	db WALL_TILE         ; COLL_PC
-	db WALL_TILE         ; COLL_RADIO
-	db WALL_TILE         ; COLL_TOWN_MAP
-	db WALL_TILE         ; COLL_MART_SHELF
-	db WALL_TILE         ; COLL_TV
-	db WALL_TILE         ; COLL_COUNTER_98
-	db WALL_TILE         ; 99
-	db WALL_TILE         ; 9a
-	db WALL_TILE         ; 9b
-	db WALL_TILE         ; COLL_9C
-	db WALL_TILE         ; COLL_WINDOW
-	db WALL_TILE         ; 9e
-	db WALL_TILE         ; COLL_INCENSE_BURNER
-	db LAND_TILE         ; COLL_HOP_RIGHT
-	db LAND_TILE         ; COLL_HOP_LEFT
-	db LAND_TILE         ; COLL_HOP_UP
-	db LAND_TILE         ; COLL_HOP_DOWN
-	db LAND_TILE         ; COLL_HOP_DOWN_RIGHT
-	db LAND_TILE         ; COLL_HOP_DOWN_LEFT
-	db LAND_TILE         ; COLL_HOP_UP_RIGHT
-	db LAND_TILE         ; COLL_HOP_UP_LEFT
-	db LAND_TILE         ; a8
-	db LAND_TILE         ; a9
-	db LAND_TILE         ; aa
-	db LAND_TILE         ; ab
-	db LAND_TILE         ; ac
-	db LAND_TILE         ; ad
-	db LAND_TILE         ; ae
-	db LAND_TILE         ; af
-	db LAND_TILE         ; COLL_RIGHT_WALL
-	db LAND_TILE         ; COLL_LEFT_WALL
-	db LAND_TILE         ; COLL_UP_WALL
-	db LAND_TILE         ; COLL_DOWN_WALL
-	db LAND_TILE         ; COLL_DOWN_RIGHT_WALL
-	db LAND_TILE         ; COLL_DOWN_LEFT_WALL
-	db LAND_TILE         ; COLL_UP_RIGHT_WALL
-	db LAND_TILE         ; COLL_UP_LEFT_WALL
-	db LAND_TILE         ; b8
-	db LAND_TILE         ; b9
-	db LAND_TILE         ; ba
-	db LAND_TILE         ; bb
-	db LAND_TILE         ; bc
-	db LAND_TILE         ; bd
-	db LAND_TILE         ; be
-	db LAND_TILE         ; bf
-	db WATER_TILE        ; COLL_RIGHT_BUOY
-	db WATER_TILE        ; COLL_LEFT_BUOY
-	db WATER_TILE        ; COLL_UP_BUOY
-	db WATER_TILE        ; COLL_DOWN_BUOY
-	db WATER_TILE        ; COLL_DOWN_RIGHT_BUOY
-	db WATER_TILE        ; COLL_DOWN_LEFT_BUOY
-	db WATER_TILE        ; COLL_UP_RIGHT_BUOY
-	db WATER_TILE        ; COLL_UP_LEFT_BUOY
-	db WATER_TILE        ; c8
-	db WATER_TILE        ; c9
-	db WATER_TILE        ; ca
-	db WATER_TILE        ; cb
-	db WATER_TILE        ; cc
-	db WATER_TILE        ; cd
-	db WATER_TILE        ; ce
-	db WATER_TILE        ; cf
-	db LAND_TILE         ; d0
-	db LAND_TILE         ; d1
-	db LAND_TILE         ; d2
-	db LAND_TILE         ; d3
-	db LAND_TILE         ; d4
-	db LAND_TILE         ; d5
-	db LAND_TILE         ; d6
-	db LAND_TILE         ; d7
-	db LAND_TILE         ; d8
-	db LAND_TILE         ; d9
-	db LAND_TILE         ; da
-	db LAND_TILE         ; db
-	db LAND_TILE         ; dc
-	db LAND_TILE         ; dd
-	db LAND_TILE         ; de
-	db LAND_TILE         ; df
-	db LAND_TILE         ; e0
-	db LAND_TILE         ; e1
-	db LAND_TILE         ; e2
-	db LAND_TILE         ; e3
-	db LAND_TILE         ; e4
-	db LAND_TILE         ; e5
-	db LAND_TILE         ; e6
-	db LAND_TILE         ; e7
-	db LAND_TILE         ; e8
-	db LAND_TILE         ; e9
-	db LAND_TILE         ; ea
-	db LAND_TILE         ; eb
-	db LAND_TILE         ; ec
-	db LAND_TILE         ; ed
-	db LAND_TILE         ; ee
-	db LAND_TILE         ; ef
-	db LAND_TILE         ; f0
-	db LAND_TILE         ; f1
-	db LAND_TILE         ; f2
-	db LAND_TILE         ; f3
-	db LAND_TILE         ; f4
-	db LAND_TILE         ; f5
-	db LAND_TILE         ; f6
-	db LAND_TILE         ; f7
-	db LAND_TILE         ; f8
-	db LAND_TILE         ; f9
-	db LAND_TILE         ; fa
-	db LAND_TILE         ; fb
-	db LAND_TILE         ; fc
-	db LAND_TILE         ; fd
-	db LAND_TILE         ; fe
-	db WALL_TILE         ; COLL_FF
--- a/data/decorations/decorations.asm
+++ b/data/decorations/decorations.asm
@@ -48,7 +48,8 @@
 	db DECO_BIG_SNORLAX_DOLL ; 1a
 	db DECO_BIG_ONIX_DOLL ; 1b
 	db DECO_BIG_LAPRAS_DOLL ; 1c
-TrophyIDs:
+
 	db DECO_GOLD_TROPHY_DOLL ; 33
 	db DECO_SILVER_TROPHY_DOLL ; 34
-	db -1
+
+	db -1 ; end
--- a/data/events/collision_stdscripts.asm
+++ /dev/null
@@ -1,18 +1,0 @@
-; std scripts associated with tile collisions
-
-stdcoll: MACRO
-	db \1
-	dw (\2StdScript - StdScripts) / 3
-ENDM
-
-TileCollisionStdScripts:
-	; collision type, std script
-	stdcoll COLL_BOOKSHELF,      MagazineBookshelfScript
-	stdcoll COLL_PC,             PCScript
-	stdcoll COLL_RADIO,          Radio1Script
-	stdcoll COLL_TOWN_MAP,       TownMapScript
-	stdcoll COLL_MART_SHELF,     MerchandiseShelfScript
-	stdcoll COLL_TV,             TVScript
-	stdcoll COLL_WINDOW,         WindowScript
-	stdcoll COLL_INCENSE_BURNER, IncenseBurnerScript
-	db -1 ; end
--- a/data/events/engine_flags.asm
+++ b/data/events/engine_flags.asm
@@ -125,7 +125,7 @@
 	engine_flag wSwarmFlags, SWARMFLAGS_BUENAS_PASSWORD_F
 	engine_flag wSwarmFlags, SWARMFLAGS_GOLDENROD_DEPT_STORE_SALE_F
 
-	engine_flag wGameTimerPause, GAMETIMERPAUSE_MOBILE_7_F
+	engine_flag wGameTimerPaused, GAME_TIMER_MOBILE_F
 
 	engine_flag wPlayerGender, PLAYERGENDER_FEMALE_F
 
--- a/data/events/field_move_blocks.asm
+++ /dev/null
@@ -1,52 +1,0 @@
-CutTreeBlockPointers:
-; tileset, block list pointer
-	dbw TILESET_JOHTO,        .johto
-	dbw TILESET_JOHTO_MODERN, .johto_modern
-	dbw TILESET_KANTO,        .kanto
-	dbw TILESET_PARK,         .park
-	dbw TILESET_FOREST,       .forest
-	db -1 ; end
-
-.johto:
-; facing block, replacement block, animation
-	db $03, $02, 1 ; grass
-	db $5b, $3c, 0 ; tree
-	db $5f, $3d, 0 ; tree
-	db $63, $3f, 0 ; tree
-	db $67, $3e, 0 ; tree
-	db -1 ; end
-
-.johto_modern:
-; facing block, replacement block, animation
-	db $03, $02, $01 ; grass
-	db -1 ; end
-
-.kanto:
-; facing block, replacement block, animation
-	db $0b, $0a, 1 ; grass
-	db $32, $6d, 0 ; tree
-	db $33, $6c, 0 ; tree
-	db $34, $6f, 0 ; tree
-	db $35, $4c, 0 ; tree
-	db $60, $6e, 0 ; tree
-	db -1 ; end
-
-.park:
-; facing block, replacement block, animation
-	db $13, $03, 1 ; grass
-	db $03, $04, 1 ; grass
-	db -1 ; end
-
-.forest:
-; facing block, replacement block, animation
-	db $0f, $17, 0
-	db -1 ; end
-
-WhirlpoolBlockPointers:
-	dbw TILESET_JOHTO, .johto
-	db -1 ; end
-
-.johto:
-; facing block, replacement block, animation
-	db $07, $36, 0
-	db -1 ; end
--- a/data/events/special_pointers.asm
+++ b/data/events/special_pointers.asm
@@ -55,8 +55,8 @@
 	add_special UnownPuzzle
 	add_special SlotMachine
 	add_special CardFlip
-	add_special DummyNonfunctionalGameCornerGame
-	add_special ClearBGPalettesBufferScreen
+	add_special UnusedDummyGame ; unused
+	add_special ClearBGPalettesBufferScreen ; unused
 	add_special FadeOutPalettes
 	add_special BattleTowerFade
 	add_special FadeBlackQuickly
@@ -65,21 +65,21 @@
 	add_special ReloadSpritesNoPalettes ; bank 0
 	add_special ClearBGPalettes ; bank 0
 	add_special UpdateTimePals ; bank 0
-	add_special ClearTilemap ; bank 0
+	add_special ClearTilemap ; bank 0; unused as special
 	add_special UpdateSprites ; bank 0
 	add_special UpdatePlayerSprite ; bank 0
 	add_special GameCornerPrizeMonCheckDex
-	add_special UnusedSetSeenMon
+	add_special UnusedSetSeenMon ; unused
 	add_special WaitSFX ; bank 0
 	add_special PlayMapMusic ; bank 0
 	add_special RestartMapMusic ; bank 0
 	add_special HealMachineAnim
 	add_special SurfStartStep
-	add_special FindPartyMonAboveLevel
-	add_special FindPartyMonAtLeastThatHappy
+	add_special FindPartyMonAboveLevel ; unused
+	add_special FindPartyMonAtLeastThatHappy ; unused
 	add_special FindPartyMonThatSpecies
 	add_special FindPartyMonThatSpeciesYourTrainerID
-	add_special UnusedCheckUnusedTwoDayTimer
+	add_special UnusedCheckUnusedTwoDayTimer ; unused
 	add_special DayCareMon1
 	add_special DayCareMon2
 	add_special SelectRandomBugContestContestants
@@ -134,7 +134,7 @@
 	add_special Function170114
 	add_special BattleTowerBattle
 	add_special Function1704e1
-	add_special DummySpecial_17021d
+	add_special UnusedBattleTowerDummySpecial1
 	add_special LoadOpponentTrainerAndPokemonWithOTSprite
 	add_special Function11ba38
 	add_special CheckForBattleTowerRules
@@ -166,7 +166,7 @@
 	add_special BeastsCheck
 	add_special MonCheck
 	add_special SetPlayerPalette
-	add_special DummySpecial_170bd2
+	add_special UnusedBattleTowerDummySpecial2
 	add_special Mobile_SelectThreeMons
 	add_special Function1037eb
 	add_special Function10383c
@@ -179,6 +179,7 @@
 	add_special AskRememberPassword
 	add_special LoadMapPalettes
 	add_special UnusedFindItemInPCOrBag
+
 	add_special InitialSetDSTFlag
 	add_special InitialClearDSTFlag
-	add_special DummySpecial_c224
+	add_special UnusedDummySpecial ; unused
--- a/data/maps/blocks.asm
+++ b/data/maps/blocks.asm
@@ -15,7 +15,7 @@
 Route28_Blocks:
 	INCBIN "maps/Route28.blk"
 
-BetaPlayersHouse2F_Blocks:
+BetaPlayersHouse2F_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaPlayersHouse2F.blk"
 
 CeladonCity_Blocks:
@@ -30,25 +30,25 @@
 ElmsHouse_Blocks:
 	INCBIN "maps/ElmsHouse.blk"
 
-BetaSproutTower1_Blocks:
+BetaSproutTower1_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTower1.blk"
 
 Route11_Blocks:
 	INCBIN "maps/Route11.blk"
 
-BetaSproutTower5_Blocks:
+BetaSproutTower5_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTower5.blk"
 
 Route15_Blocks:
 	INCBIN "maps/Route15.blk"
 
-BetaSproutTower9_Blocks:
+BetaSproutTower9_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTower9.blk"
 
 Route19_Blocks:
 	INCBIN "maps/Route19.blk"
 
-BetaBlackthornCity_Blocks:
+BetaBlackthornCity_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaBlackthornCity.blk"
 
 Route10South_Blocks:
@@ -94,7 +94,7 @@
 Route24_Blocks:
 	INCBIN "maps/Route24.blk"
 
-BetaVioletCity_Blocks:
+BetaVioletCity_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaVioletCity.blk"
 
 Route3_Blocks:
@@ -103,25 +103,25 @@
 PewterCity_Blocks:
 	INCBIN "maps/PewterCity.blk"
 
-BetaSilverCaveOutside_Blocks:
+BetaSilverCaveOutside_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSilverCaveOutside.blk"
 
-BetaSproutTower2_Blocks:
+BetaSproutTower2_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTower2.blk"
 
 Route12_Blocks:
 	INCBIN "maps/Route12.blk"
 
-BetaGoldenrodCity_Blocks:
+BetaGoldenrodCity_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaGoldenrodCity.blk"
 
 Route20_Blocks:
 	INCBIN "maps/Route20.blk"
 
-BetaSproutTower6_Blocks:
+BetaSproutTower6_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTower6.blk"
 
-BetaPokecenter_Blocks:
+BetaPokecenter_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaPokecenter.blk"
 
 Route30_Blocks:
@@ -145,7 +145,7 @@
 Route38_Blocks:
 	INCBIN "maps/Route38.blk"
 
-BetaCianwoodCity_Blocks:
+BetaCianwoodCity_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaCianwoodCity.blk"
 
 OlivineTimsHouse_Blocks:
@@ -214,10 +214,10 @@
 Route5SaffronGate_Blocks:
 	INCBIN "maps/NorthSouthGate.blk"
 
-BetaEcruteakCity_Blocks:
+BetaEcruteakCity_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaEcruteakCity.blk"
 
-BetaCherrygroveCity_Blocks:
+BetaCherrygroveCity_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaCherrygroveCity.blk"
 
 CinnabarIsland_Blocks:
@@ -229,7 +229,7 @@
 Route8_Blocks:
 	INCBIN "maps/Route8.blk"
 
-BetaSproutTower3_Blocks:
+BetaSproutTower3_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTower3.blk"
 
 ViridianCity_Blocks:
@@ -241,13 +241,13 @@
 Route21_Blocks:
 	INCBIN "maps/Route21.blk"
 
-BetaSproutTower7_Blocks:
+BetaSproutTower7_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTower7.blk"
 
 Route17_Blocks:
 	INCBIN "maps/Route17.blk"
 
-BetaMahoganyTown_Blocks:
+BetaMahoganyTown_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaMahoganyTown.blk"
 
 Route31_Blocks:
@@ -280,16 +280,16 @@
 Route31VioletGate_Blocks:
 	INCBIN "maps/EastWestGate.blk"
 
-BetaAzaleaTown_Blocks:
+BetaAzaleaTown_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaAzaleaTown.blk"
 
 VermilionCity_Blocks:
 	INCBIN "maps/VermilionCity.blk"
 
-BetaOlivineCity_Blocks:
+BetaOlivineCity_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaOlivineCity.blk"
 
-BetaNewBarkTown_Blocks:
+BetaNewBarkTown_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaNewBarkTown.blk"
 
 ElmsLab_Blocks:
@@ -316,7 +316,7 @@
 Route14_Blocks:
 	INCBIN "maps/Route14.blk"
 
-BetaSproutTower8_Blocks:
+BetaSproutTower8_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTower8.blk"
 
 OlivineMart_Blocks:
@@ -337,7 +337,7 @@
 Route10North_Blocks:
 	INCBIN "maps/Route10North.blk"
 
-BetaLakeOfRage_Blocks:
+BetaLakeOfRage_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaLakeOfRage.blk"
 
 OlivinePokecenter1F_Blocks:
@@ -363,25 +363,25 @@
 CherrygrovePokecenter1F_Blocks:
 	INCBIN "maps/Pokecenter1F.blk"
 
-BetaPewterMuseumOfScience1F_Blocks:
+BetaPewterMuseumOfScience1F_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaPewterMuseumOfScience1F.blk"
 
-BetaPewterMuseumOfScience2F_Blocks:
+BetaPewterMuseumOfScience2F_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaPewterMuseumOfScience2F.blk"
 
 EarlsPokemonAcademy_Blocks:
 	INCBIN "maps/EarlsPokemonAcademy.blk"
 
-BetaCinnabarPokemonLabHallway_Blocks:
+BetaCinnabarPokemonLabHallway_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaCinnabarPokemonLabHallway.blk"
 
-BetaCinnabarPokemonLabRoom1_Blocks:
+BetaCinnabarPokemonLabRoom1_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaCinnabarPokemonLabRoom1.blk"
 
-BetaCinnabarPokemonLabRoom2_Blocks:
+BetaCinnabarPokemonLabRoom2_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaCinnabarPokemonLabRoom2.blk"
 
-BetaCinnabarPokemonLabRoom3_Blocks:
+BetaCinnabarPokemonLabRoom3_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaCinnabarPokemonLabRoom3.blk"
 
 GoldenrodDeptStore1F_Blocks:
@@ -424,7 +424,7 @@
 CeladonMansionRoof_Blocks:
 	INCBIN "maps/CeladonMansionRoof.blk"
 
-BetaHouse_Blocks:
+BetaHouse_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaHouse.blk"
 
 CeladonGameCorner_Blocks:
@@ -446,7 +446,7 @@
 VioletKylesHouse_Blocks:
 	INCBIN "maps/House2.blk"
 
-BetaUnionCave_Blocks:
+BetaUnionCave_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaUnionCave.blk"
 
 UnionCaveB1F_Blocks:
@@ -466,7 +466,7 @@
 Route6UndergroundPathEntrance_Blocks:
 	INCBIN "maps/UndergroundPathEntrance.blk"
 
-BetaCapsuleHouse_Blocks:
+BetaCapsuleHouse_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaCapsuleHouse.blk"
 
 KurtsHouse_Blocks:
@@ -478,7 +478,7 @@
 RuinsOfAlphOutside_Blocks:
 	INCBIN "maps/RuinsOfAlphOutside.blk"
 
-BetaRuinsOfAlphUnsolvedPuzzleRoom_Blocks:
+BetaRuinsOfAlphUnsolvedPuzzleRoom_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaRuinsOfAlphUnsolvedPuzzleRoom.blk"
 
 RuinsOfAlphInnerChamber_Blocks:
@@ -493,19 +493,19 @@
 SproutTower1F_Blocks:
 	INCBIN "maps/SproutTower1F.blk"
 
-BetaSproutTowerCutOut1_Blocks:
+BetaSproutTowerCutOut1_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTowerCutOut1.blk"
 
 SproutTower2F_Blocks:
 	INCBIN "maps/SproutTower2F.blk"
 
-BetaSproutTowerCutOut2_Blocks:
+BetaSproutTowerCutOut2_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTowerCutOut2.blk"
 
 SproutTower3F_Blocks:
 	INCBIN "maps/SproutTower3F.blk"
 
-BetaSproutTowerCutOut3_Blocks:
+BetaSproutTowerCutOut3_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSproutTowerCutOut3.blk"
 
 RadioTower1F_Blocks:
@@ -583,7 +583,7 @@
 GoldenrodUndergroundWarehouse_Blocks:
 	INCBIN "maps/GoldenrodUndergroundWarehouse.blk"
 
-BetaElevator_Blocks:
+BetaElevator_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaElevator.blk"
 
 TinTower1F_Blocks:
@@ -622,7 +622,7 @@
 BurnedTowerB1F_Blocks:
 	INCBIN "maps/BurnedTowerB1F.blk"
 
-BetaCaveTestMap_Blocks:
+BetaCaveTestMap_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaCaveTestMap.blk"
 
 MountMortar1FOutside_Blocks:
@@ -685,16 +685,16 @@
 SilverCaveRoom3_Blocks:
 	INCBIN "maps/SilverCaveRoom3.blk"
 
-BetaRocketHideoutB2F_Blocks:
+BetaRocketHideoutB2F_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaRocketHideoutB2F.blk"
 
-BetaRocketHideoutB1F_Blocks:
+BetaRocketHideoutB1F_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaRocketHideoutB1F.blk"
 
-BetaRocketHideout1F_Blocks:
+BetaRocketHideout1F_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaRocketHideout1F.blk"
 
-BetaRocketHideoutB3F_Blocks:
+BetaRocketHideoutB3F_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaRocketHideoutB3F.blk"
 
 MahoganyMart1F_Blocks:
@@ -710,7 +710,7 @@
 TeamRocketBaseB3F_Blocks:
 	INCBIN "maps/TeamRocketBaseB3F.blk"
 
-BetaRoute23_Blocks:
+BetaRoute23_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaRoute23.blk"
 
 IndigoPlateauPokecenter1F_Blocks:
@@ -746,7 +746,7 @@
 OlivineGym_Blocks:
 	INCBIN "maps/OlivineGym.blk"
 
-BetaUnknownGym_Blocks:
+BetaUnknownGym_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaUnknownGym.blk"
 
 CianwoodGym_Blocks:
@@ -779,7 +779,7 @@
 
 SECTION "Map Blocks 3", ROMX
 
-BetaSlowpokeWell1F_Blocks:
+BetaSlowpokeWell1F_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaSlowpokeWell1F.blk"
 
 SlowpokeWellB1F_Blocks:
@@ -824,7 +824,7 @@
 FastShipB1F_Blocks:
 	INCBIN "maps/FastShipB1F.blk"
 
-BetaFastShipInsideCutOut_Blocks:
+BetaFastShipInsideCutOut_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaFastShipInsideCutOut.blk"
 
 FastShipCabins_NNW_NNE_NE_Blocks:
@@ -913,13 +913,13 @@
 CeladonGym_Blocks:
 	INCBIN "maps/CeladonGym.blk"
 
-BetaCeladonMansion1F_Blocks:
+BetaCeladonMansion1F_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaCeladonMansion1F.blk"
 
 CeladonCafe_Blocks:
 	INCBIN "maps/CeladonCafe.blk"
 
-BetaCeladonMansion2F_Blocks:
+BetaCeladonMansion2F_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaCeladonMansion2F.blk"
 
 RockTunnel1F_Blocks:
@@ -1040,7 +1040,7 @@
 BattleTowerOutside_Blocks:
 	INCBIN "maps/BattleTowerOutside.blk"
 
-BetaBlank_Blocks:
+BetaBlank_Blocks: ; unreferenced
 	INCBIN "maps/unused/BetaBlank.blk"
 
 GoldenrodDeptStoreRoof_Blocks:
--- a/data/maps/landmarks.asm
+++ b/data/maps/landmarks.asm
@@ -128,7 +128,7 @@
 MtMortarName:        db "MT.MORTAR@"
 DragonsDenName:      db "DRAGON'S¯DEN@"
 IcePathName:         db "ICE PATH@"
-NotApplicableName:   db "N/A@" ; "オバケやしき" ("HAUNTED HOUSE") in Japanese
+NotApplicableName:   db "N/A@" ; unreferenced ; "オバケやしき" ("HAUNTED HOUSE") in Japanese
 PalletTownName:      db "PALLET TOWN@"
 ViridianCityName:    db "VIRIDIAN¯CITY@"
 PewterCityName:      db "PEWTER CITY@"
@@ -144,11 +144,11 @@
 MtMoonName:          db "MT.MOON@"
 RockTunnelName:      db "ROCK TUNNEL@"
 LavRadioTowerName:   db "LAV¯RADIO TOWER@"
-SilphCoName:         db "SILPH CO.@"
-SafariZoneName:      db "SAFARI ZONE@"
+SilphCoName:         db "SILPH CO.@" ; unreferenced
+SafariZoneName:      db "SAFARI ZONE@" ; unreferenced
 SeafoamIslandsName:  db "SEAFOAM¯ISLANDS@"
-PokemonMansionName:  db "#MON¯MANSION@"
-CeruleanCaveName:    db "CERULEAN¯CAVE@"
+PokemonMansionName:  db "#MON¯MANSION@" ; unreferenced
+CeruleanCaveName:    db "CERULEAN¯CAVE@" ; unreferenced
 Route1Name:          db "ROUTE 1@"
 Route2Name:          db "ROUTE 2@"
 Route3Name:          db "ROUTE 3@"
@@ -199,7 +199,7 @@
 IlexForestName:      db "ILEX¯FOREST@"
 BurnedTowerName:     db "BURNED¯TOWER@"
 FastShipName:        db "FAST SHIP@"
-ViridianForestName:  db "VIRIDIAN¯FOREST@"
+ViridianForestName:  db "VIRIDIAN¯FOREST@" ; unreferenced
 DiglettsCaveName:    db "DIGLETT'S¯CAVE@"
 TohjoFallsName:      db "TOHJO FALLS@"
 UndergroundName:     db "UNDERGROUND@"
--- a/data/moves/animations.asm
+++ b/data/moves/animations.asm
@@ -481,7 +481,7 @@
 
 BattleAnim_ReturnMon:
 	anim_sound 0, 0, SFX_BALL_POOF
-.anim:
+BattleAnimSub_Return:
 	anim_bgeffect ANIM_BG_RETURN_MON, $0, BG_EFFECT_USER, $0
 	anim_wait 32
 	anim_ret
@@ -1314,7 +1314,7 @@
 	anim_wait 24
 	anim_ret
 
-BattleAnim_Sonicboom_JP:
+BattleAnim_Sonicboom_JP: ; unreferenced
 	anim_2gfx ANIM_GFX_WHIP, ANIM_GFX_HIT
 .loop
 	anim_sound 3, 0, SFX_RAZOR_WIND
@@ -4106,7 +4106,7 @@
 	anim_1gfx ANIM_GFX_MISC
 	anim_obj ANIM_OBJ_BATON_PASS, 44, 104, $20
 	anim_sound 0, 0, SFX_BATON_PASS
-	anim_call BattleAnim_ReturnMon.anim
+	anim_call BattleAnimSub_Return
 	anim_wait 64
 	anim_ret
 
--- a/data/phone/text/elm.asm
+++ b/data/phone/text/elm.asm
@@ -197,7 +197,6 @@
 	para "See you later!"
 	done
 
-; unused
 ElmPhoneGotAholdOfSomethingNeatText:
 	text "Hello, <PLAY_G>?"
 	line "How's it going?"
--- a/data/phone/text/todd_overworld.asm
+++ b/data/phone/text/todd_overworld.asm
@@ -57,9 +57,8 @@
 	line "my #MON better!"
 	done
 
-UnusedText_0xa43ca:
-; This is unused; Todd says this during the department store sale,
-; but this is a duplicate of the actual string in the Route 34 scripts.
+ToddSaleText: ; unreferenced
+; This is a duplicate of CamperToddSaleText in maps/Route34.asm.
 	text "Shopping under the"
 	line "sky!"
 
--- a/data/player_names.asm
+++ b/data/player_names.asm
@@ -2,8 +2,8 @@
 	db MENU_BACKUP_TILES ; flags
 	menu_coords 0, 0, 10, TEXTBOX_Y - 1
 	dw .MaleNames
-	db 1 ; ????
-	db 0 ; default option
+	db 1 ; default option
+	db 0 ; ????
 
 .MaleNames:
 	db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B ; flags
@@ -21,8 +21,8 @@
 	db MENU_BACKUP_TILES ; flags
 	menu_coords 0, 0, 10, TEXTBOX_Y - 1
 	dw .FemaleNames
-	db 1 ; ????
-	db 0 ; default option
+	db 1 ; default option
+	db 0 ; ????
 
 .FemaleNames:
 	db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B ; flags
--- a/data/sprite_anims/framesets.asm
+++ b/data/sprite_anims/framesets.asm
@@ -245,22 +245,22 @@
 	frame SPRITE_ANIM_OAMSET_MAGNET_TRAIN_RED_2,  8, OAM_X_FLIP
 	dorestart
 
-; unused
+.Frameset_Unknown1: ; unreferenced
 	frame SPRITE_ANIM_OAMSET_UNUSED_43,  8
 	frame SPRITE_ANIM_OAMSET_UNUSED_44,  8
 	dorestart
 
-; unused
+.Frameset_Unknown2: ; unreferenced
 	frame SPRITE_ANIM_OAMSET_UNUSED_45,  8
 	frame SPRITE_ANIM_OAMSET_UNUSED_46,  8
 	dorestart
 
-; unused
+.Frameset_Unknown3: ; unreferenced
 	frame SPRITE_ANIM_OAMSET_UNUSED_47,  8
 	frame SPRITE_ANIM_OAMSET_UNUSED_48,  8
 	dorestart
 
-; unused
+.Frameset_Unknown4: ; unreferenced
 	frame SPRITE_ANIM_OAMSET_UNUSED_49,  1
 	frame SPRITE_ANIM_OAMSET_UNUSED_49,  1, OAM_X_FLIP
 	frame SPRITE_ANIM_OAMSET_UNUSED_49,  1, OAM_X_FLIP, OAM_Y_FLIP
@@ -267,23 +267,23 @@
 	frame SPRITE_ANIM_OAMSET_UNUSED_49,  1, OAM_Y_FLIP
 	dorestart
 
-; unused
+.Frameset_Unknown5: ; unreferenced
 	frame SPRITE_ANIM_OAMSET_UNUSED_4A, 32
 	endanim
 
-; unused
+.Frameset_Unknown6: ; unreferenced
 	frame SPRITE_ANIM_OAMSET_UNUSED_4B, 32
 	endanim
 
-; unused
+.Frameset_Unknown7: ; unreferenced
 	frame SPRITE_ANIM_OAMSET_UNUSED_4C, 32
 	endanim
 
-; unused
+.Frameset_Unknown8: ; unreferenced
 	frame SPRITE_ANIM_OAMSET_UNUSED_4D, 32
 	endanim
 
-; unused
+.Frameset_Unknown9: ; unreferenced
 	frame SPRITE_ANIM_OAMSET_UNUSED_4E,  3
 	dowait 3
 	dorestart
--- a/data/sprite_anims/oam.asm
+++ b/data/sprite_anims/oam.asm
@@ -181,7 +181,7 @@
 	dbsprite -1,  0,  0,  0, $00, 7 | Y_FLIP
 	dbsprite  0,  0,  0,  0, $00, 7 | X_FLIP | Y_FLIP
 
-; unused
+.OAMData_Unknown1: ; unreferenced
 	db 4
 	dbsprite -1, -1,  0,  0, $00, 0 | PRIORITY
 	dbsprite  0, -1,  0,  0, $00, 0 | X_FLIP | PRIORITY
@@ -305,7 +305,7 @@
 	dbsprite  1,  0,  4,  4, $17, 0
 	dbsprite  1,  1,  4,  4, $18, 0
 
-; unused
+.OAMData_Unknown2: ; unreferenced
 	db 36
 	dbsprite -3, -3,  0,  0, $00, 0
 	dbsprite -2, -3,  0,  0, $01, 0
--- a/data/text/battle.asm
+++ b/data/text/battle.asm
@@ -349,7 +349,7 @@
 	sound_dex_fanfare_50_79
 	text_end
 
-	text_end ; unused
+	text_end ; unreferenced
 
 BattleText_WildMonIsEating:
 	text "Wild @"
@@ -1085,7 +1085,7 @@
 	line "attack!"
 	done
 
-RefusedGiftText:
+PresentFailedText:
 	text "<TARGET>"
 	line "refused the gift!"
 	prompt
@@ -1102,7 +1102,7 @@
 	line "been canceled…"
 	prompt
 
-BattleText_0x8188e:
+BattleText_NoTimeLeftToday: ; unreferenced
 	text "There is no time"
 	line "left today!"
 	done
--- a/data/text/common_1.asm
+++ b/data/text/common_1.asm
@@ -463,7 +463,6 @@
 	text "."
 	done
 
-; unreferenced
 _MobilePlayersMonTradeText::
 	text_ram wPlayerTrademonSenderName
 	text "'s"
@@ -1665,7 +1664,7 @@
 	cont "raise a #MON?"
 	done
 
-_DayCareManOddEggText::
+_DayCareManIntroEggText::
 	text "I'm the DAY-CARE"
 	line "MAN. Do you know"
 	cont "about EGGS?"
@@ -1692,7 +1691,7 @@
 	line "#MON for you?"
 	done
 
-_DayCareLadyOddEggText::
+_DayCareLadyIntroEggText::
 	text "I'm the DAY-CARE"
 	line "LADY. Do you know"
 	cont "about EGGS?"
--- a/data/text/common_2.asm
+++ b/data/text/common_2.asm
@@ -260,15 +260,15 @@
 	text "'s home."
 	prompt
 
-_MysteryGiftReceivedCardText::
+_NameCardReceivedCardText::
 	text "Received"
 	line "@"
-	text_ram wc850
+	text_ram wMysteryGiftCardHolderName
 	text "'s CARD."
 	prompt
 
-_MysteryGiftListedCardText::
-	text_ram wc850
+_NameCardListedCardText::
+	text_ram wMysteryGiftCardHolderName
 	text "'s CARD was"
 	line "listed as no.@"
 	text_decimal wDeciramBuffer, 1, 2
@@ -275,17 +275,17 @@
 	text "."
 	prompt
 
-_MysteryGiftNotRegisteredCardText::
+_NameCardNotRegisteredCardText::
 	text "The CARD was not"
 	line "registered."
 	prompt
 
-_MysteryGiftLinkCancelledText::
+_NameCardLinkCancelledText::
 	text "The link has been"
 	line "cancelled."
 	prompt
 
-_MysteryGiftLinkCommErrorText::
+_NameCardLinkCommErrorText::
 	text "Communication"
 	line "error."
 	prompt
@@ -487,7 +487,6 @@
 	text "Not even a nibble!"
 	prompt
 
-; unreferenced
 _UnusedNothingHereText::
 	text "Looks like there's"
 	line "nothing here."
--- a/data/text/common_3.asm
+++ b/data/text/common_3.asm
@@ -72,7 +72,7 @@
 
 _LinkAskTradeForText::
 	text "Trade @"
-	text_ram wd004
+	text_ram wBufferTrademonNick
 	text_start
 	line "for @"
 	text_ram wStringBuffer1
@@ -620,7 +620,6 @@
 	line "See you around."
 	done
 
-; unreferenced
 _NothingToSellText::
 	text "You don't have"
 	line "anything to sell."
@@ -744,25 +743,21 @@
 	text "Clock time unknown"
 	done
 
-; unreferenced mobile
 _DeleteSavedLoginPasswordText::
 	text "Delete the saved"
 	line "LOG-IN PASSWORD?"
 	done
 
-; unreferenced mobile
 _DeletedTheLoginPasswordText::
 	text "Deleted the LOG-IN"
 	line "PASSWORD."
 	done
 
-; unreferenced mobile
 _MobilePickThreeMonForBattle::
 	text "Pick three #MON"
 	line "for battle."
 	prompt
 
-; unreferenced mobile
 _MobileUseTheseThreeMonText::
 	text_ram wMobileParticipant1Nickname
 	text ","
@@ -776,13 +771,11 @@
 	para "Use these three?"
 	done
 
-; unreferenced mobile
 _MobileOnlyThreeMonMayEnterText::
 	text "Only three #MON"
 	line "may enter."
 	prompt
 
-; unreferenced mobile
 _MobileCardFolderIntro1Text::
 	text "The CARD FOLDER"
 	line "stores your and"
@@ -800,7 +793,6 @@
 	para ""
 	done
 
-; unreferenced mobile
 _MobileCardFolderIntro2Text::
 	text "This is your CARD."
 
@@ -814,7 +806,6 @@
 	para ""
 	done
 
-; unreferenced mobile
 _MobileCardFolderIntro3Text::
 	text "If you have your"
 	line "friend's CARD, you"
@@ -829,7 +820,6 @@
 	para ""
 	done
 
-; unreferenced mobile
 _MobileCardFolderIntro4Text::
 	text "To safely store"
 	line "your collection of"
@@ -841,7 +831,6 @@
 	para ""
 	done
 
-; unreferenced mobile
 _MobileCardFolderAskDeleteText::
 	text "If the CARD FOLDER"
 	line "is deleted, all"
@@ -858,13 +847,11 @@
 	line "your CARD FOLDER?"
 	done
 
-; unreferenced mobile
 _MobileCardFolderDeleteAreYouSureText::
 	text "Are you sure you"
 	line "want to delete it?"
 	done
 
-; unreferenced mobile
 _MobileCardFolderDeletedText::
 	text "The CARD FOLDER"
 	line "has been deleted."
@@ -872,7 +859,6 @@
 	para ""
 	done
 
-; unreferenced mobile
 _MobileCardFolderAskOpenOldText::
 	text "There is an older"
 	line "CARD FOLDER from a"
@@ -882,13 +868,11 @@
 	line "open it?"
 	done
 
-; unreferenced mobile
 _MobileCardFolderAskDeleteOldText::
 	text "Delete the old"
 	line "CARD FOLDER?"
 	done
 
-; unreferenced mobile
 _MobileCardFolderFinishRegisteringCardsText::
 	text "Finish registering"
 	line "CARDS?"
--- a/data/text/unused_sweet_honey.asm
+++ b/data/text/unused_sweet_honey.asm
@@ -8,7 +8,7 @@
 ; Most of these texts seem to be associated with a single NPC.
 ; The last text is associated with a second NPC, probably a Butterfree.
 
-UnusedSweetHoneyText:
+UnusedSweetHoneyText: ; unreferenced
 	text "My #MON is an"
 	line "expert at collect-"
 	cont "ing SWEET HONEY."
@@ -17,7 +17,7 @@
 	line "with you."
 	done
 
-UnusedSweetHoneyBagFullText:
+UnusedSweetHoneyBagFullText: ; unreferenced
 	text "I want to give you"
 	line "some SWEET HONEY,"
 
@@ -25,17 +25,17 @@
 	line "room for it."
 	done
 
-UnusedSweetHoneyGiveText:
+UnusedSweetHoneyGiveText: ; unreferenced
 	text "Here you go! Have"
 	line "some SWEET HONEY!"
 	done
 
-UnusedGotSweetHoneyText:
+UnusedGotSweetHoneyText: ; unreferenced
 	text "<PLAYER> received"
 	line "SWEET HONEY."
 	done
 
-UnusedSweetHoneyAfterText1:
+UnusedSweetHoneyAfterText1: ; unreferenced
 	text "My little brother"
 	line "takes SWEET HONEY"
 
@@ -46,7 +46,7 @@
 	line "up to?"
 	done
 
-UnusedSweetHoneyAfterText2:
+UnusedSweetHoneyAfterText2: ; unreferenced
 	text "Did you put SWEET"
 	line "HONEY on a tree?"
 
@@ -54,7 +54,7 @@
 	line "it?"
 	done
 
-UnusedSweetHoneyAfterText3:
+UnusedSweetHoneyAfterText3: ; unreferenced
 	text "Did you put SWEET"
 	line "HONEY on a tree?"
 
@@ -63,6 +63,6 @@
 	cont "be drawn to it."
 	done
 
-UnusedSweetHoneyButterfreeText:
+UnusedSweetHoneyButterfreeText: ; unreferenced
 	text "BUTTERFREE: Freeh!"
 	done
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -560,7 +560,7 @@
 
 ```diff
  .got_mon
- 	ld a, [wd002]
+ 	ld a, [wCurBeatUpPartyMon]
  	ld hl, wPartyMonNicknames
  	call GetNick
  	ld a, MON_HP
@@ -568,7 +568,7 @@
  	ld a, [hli]
  	or [hl]
  	jp z, .beatup_fail ; fainted
- 	ld a, [wd002]
+ 	ld a, [wCurBeatUpPartyMon]
  	ld c, a
  	ld a, [wCurBattleMon]
 -	; BUG: this can desynchronize link battles
--- a/engine/battle/ai/items.asm
+++ b/engine/battle/ai/items.asm
@@ -20,8 +20,9 @@
 	and a
 	jr nz, DontSwitch
 
+	; always load the first trainer class in wTrainerClass for Battle Tower trainers
 	ld hl, TrainerClassAttributes + TRNATTR_AI_ITEM_SWITCH
-	ld a, [wInBattleTowerBattle] ; always load the first trainer class in wTrainerClass for BattleTower-Trainers
+	ld a, [wInBattleTowerBattle]
 	and a
 	jr nz, .ok
 
@@ -29,6 +30,7 @@
 	dec a
 	ld bc, NUM_TRAINER_ATTRIBUTES
 	call AddNTimes
+
 .ok
 	bit SWITCH_OFTEN_F, [hl]
 	jp nz, SwitchOften
@@ -145,13 +147,13 @@
 	ld [wEnemySwitchMonIndex], a
 	jp AI_TrySwitch
 
-CheckSubstatusCantRun:
+CheckSubstatusCantRun: ; unreferenced
 	ld a, [wEnemySubStatus5]
 	bit SUBSTATUS_CANT_RUN, a
 	ret
 
 AI_TryItem:
-	; items are not allowed in the BattleTower
+	; items are not allowed in the Battle Tower
 	ld a, [wInBattleTowerBattle]
 	and a
 	ret nz
@@ -213,7 +215,7 @@
 	inc hl
 	jr c, .loop
 
-.used_item
+; used item
 	xor a
 	ld [de], a
 	inc a
@@ -259,7 +261,7 @@
 	cp e
 	jr nc, .yes
 
-.no
+.no ; unreferenced
 	and a
 	ret
 
--- a/engine/battle/battle_transition.asm
+++ b/engine/battle/battle_transition.asm
@@ -258,7 +258,7 @@
 StartTrainerBattle_SetUpBGMap:
 	call StartTrainerBattle_NextScene
 	xor a
-	ld [wcf64], a
+	ld [wBattleTransitionCounter], a
 	ldh [hBGMapMode], a
 	ret
 
@@ -272,7 +272,7 @@
 	ld a, [wTimeOfDayPalset]
 	cp DARKNESS_PALSET
 	jr z, .done
-	ld hl, wcf64
+	ld hl, wBattleTransitionCounter
 	ld a, [hl]
 	inc [hl]
 	srl a
@@ -290,7 +290,7 @@
 
 .done
 	xor a
-	ld [wcf64], a
+	ld [wBattleTransitionCounter], a
 	scf
 	ret
 
@@ -322,12 +322,12 @@
 	ld a, $90
 	ldh [hLYOverrideEnd], a
 	xor a
-	ld [wcf64], a
-	ld [wcf65], a
+	ld [wBattleTransitionCounter], a
+	ld [wBattleTransitionSineWaveOffset], a
 	ret
 
 StartTrainerBattle_SineWave:
-	ld a, [wcf64]
+	ld a, [wBattleTransitionCounter]
 	cp $60
 	jr nc, .end
 	call .DoSineWave
@@ -339,10 +339,10 @@
 	ret
 
 .DoSineWave:
-	ld hl, wcf65
+	ld hl, wBattleTransitionSineWaveOffset
 	ld a, [hl]
 	inc [hl]
-	ld hl, wcf64
+	ld hl, wBattleTransitionCounter
 	ld d, [hl]
 	add [hl]
 	ld [hl], a
@@ -372,13 +372,13 @@
 	ldh [rSVBK], a
 	call StartTrainerBattle_NextScene
 	xor a
-	ld [wcf64], a
+	ld [wBattleTransitionCounter], a
 	ret
 
 StartTrainerBattle_SpinToBlack:
 	xor a
 	ldh [hBGMapMode], a
-	ld a, [wcf64]
+	ld a, [wBattleTransitionCounter]
 	ld e, a
 	ld d, 0
 	ld hl, .spin_quadrants
@@ -388,13 +388,13 @@
 	ld a, [hli]
 	cp -1
 	jr z, .end
-	ld [wcf65], a
+	ld [wBattleTransitionSineWaveOffset], a
 	call .load
 	ld a, 1
 	ldh [hBGMapMode], a
 	call DelayFrame
 	call DelayFrame
-	ld hl, wcf64
+	ld hl, wBattleTransitionCounter
 	inc [hl]
 	ret
 
@@ -449,7 +449,7 @@
 	spin_quadrant LOWER_LEFT,  .wedge1,  1, 11
 	db -1
 
-.load
+.load:
 	ld a, [hli]
 	ld e, a
 	ld a, [hli]
@@ -464,7 +464,7 @@
 	inc de
 .loop1
 	ld [hl], BATTLETRANSITION_BLACK
-	ld a, [wcf65]
+	ld a, [wBattleTransitionSineWaveOffset]
 	bit RIGHT_QUADRANT_F, a
 	jr z, .leftside
 	inc hl
@@ -475,7 +475,7 @@
 	dec c
 	jr nz, .loop1
 	pop hl
-	ld a, [wcf65]
+	ld a, [wBattleTransitionSineWaveOffset]
 	bit LOWER_QUADRANT_F, a
 	ld bc, SCREEN_WIDTH
 	jr z, .upper
@@ -490,7 +490,7 @@
 	jr z, .loop
 	ld c, a
 .loop2
-	ld a, [wcf65]
+	ld a, [wBattleTransitionSineWaveOffset]
 	bit RIGHT_QUADRANT_F, a
 	jr z, .leftside2
 	dec hl
@@ -514,13 +514,13 @@
 	ldh [rSVBK], a
 	call StartTrainerBattle_NextScene
 	ld a, $10
-	ld [wcf64], a
+	ld [wBattleTransitionCounter], a
 	ld a, 1
 	ldh [hBGMapMode], a
 	ret
 
 StartTrainerBattle_SpeckleToBlack:
-	ld hl, wcf64
+	ld hl, wBattleTransitionCounter
 	ld a, [hl]
 	and a
 	jr z, .done
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -1697,7 +1697,7 @@
 	cp USING_EXTERNAL_CLOCK
 	jr z, .enemy_first
 
-.player_first
+; player first
 	call SetPlayerTurn
 	call .SandstormDamage
 	call SetEnemyTurn
@@ -2711,7 +2711,7 @@
 ForcePlayerMonChoice:
 	call EmptyBattleTextbox
 	call LoadStandardMenuHeader
-	call SetUpBattlePartyMenu_NoLoop
+	call SetUpBattlePartyMenu
 	call ForcePickPartyMonInBattle
 	ld a, [wLinkMode]
 	and a
@@ -2810,9 +2810,9 @@
 	cp LINK_MOBILE
 	ret
 
-SetUpBattlePartyMenu_NoLoop:
+SetUpBattlePartyMenu:
 	call ClearBGPalettes
-SetUpBattlePartyMenu: ; switch to fullscreen menu?
+SetUpBattlePartyMenu_Loop: ; switch to fullscreen menu?
 	farcall LoadPartyMenuGFX
 	farcall InitPartyMenuWithCancel
 	farcall InitPartyMenuBGPal7
@@ -3006,10 +3006,11 @@
 	jp MonFaintedAnimation
 
 MonFaintedAnimation:
-	ld a, [wcfbe]
+	ld a, [wJoypadDisable]
 	push af
-	set 6, a
-	ld [wcfbe], a
+	set JOYPAD_DISABLE_MON_FAINT_F, a
+	ld [wJoypadDisable], a
+
 	ld b, 7
 
 .OuterLoop:
@@ -3052,7 +3053,7 @@
 	jr nz, .OuterLoop
 
 	pop af
-	ld [wcfbe], a
+	ld [wJoypadDisable], a
 	ret
 
 .Spaces:
@@ -3486,7 +3487,7 @@
 	ld a, [wMenuCursorY]
 	dec a
 	jr nz, .said_no
-	call SetUpBattlePartyMenu_NoLoop
+	call SetUpBattlePartyMenu
 	call PickSwitchMonInBattle
 	jr c, .canceled_switch
 	ld a, [wCurBattleMon]
@@ -4639,7 +4640,7 @@
 PrintPlayerHUD:
 	ld de, wBattleMonNick
 	hlcoord 10, 7
-	call ret_3e138
+	call Battle_DummyFunction
 	call PlaceString
 
 	push bc
@@ -4725,7 +4726,7 @@
 	call GetBaseData
 	ld de, wEnemyMonNick
 	hlcoord 1, 0
-	call ret_3e138
+	call Battle_DummyFunction
 	call PlaceString
 	ld h, b
 	ld l, c
@@ -4854,7 +4855,8 @@
 	ret z
 	jp FinishBattleAnim
 
-ret_3e138:
+Battle_DummyFunction:
+; called before placing either battler's nickname in the HUD
 	ret
 
 BattleMenu:
@@ -5043,7 +5045,7 @@
 	call LoadStandardMenuHeader
 	call ClearBGPalettes
 BattleMenuPKMN_Loop:
-	call SetUpBattlePartyMenu
+	call SetUpBattlePartyMenu_Loop
 	xor a
 	ld [wPartyMenuActionText], a
 	call JumpToPartyMenuAndPrintText
@@ -7436,13 +7438,13 @@
 	jp nc, .finish
 
 	ldh a, [hProduct + 3]
-	ld [wd004], a
+	ld [wExperienceGained + 2], a
 	push af
 	ldh a, [hProduct + 2]
-	ld [wd003], a
+	ld [wExperienceGained + 1], a
 	push af
 	xor a
-	ld [wd002], a
+	ld [wExperienceGained], a
 	xor a ; PARTYMON
 	ld [wMonType], a
 	predef CopyMonToTempMon
@@ -7454,10 +7456,10 @@
 	call CalcExpBar
 	push bc
 	ld hl, wTempMonExp + 2
-	ld a, [wd004]
+	ld a, [wExperienceGained + 2]
 	add [hl]
 	ld [hld], a
-	ld a, [wd003]
+	ld a, [wExperienceGained + 1]
 	adc [hl]
 	ld [hld], a
 	jr nc, .NoOverflow
@@ -7781,7 +7783,8 @@
 	jr .finish
 
 .angry
-	dec hl ; wSafariMonAngerCount
+	dec hl
+	assert wSafariMonEating - 1 == wSafariMonAngerCount
 	ld a, [hl]
 	and a
 	ret z
@@ -8785,7 +8788,7 @@
 .FindOpponentAndAppendRecord:
 	ld b, NUM_LINK_BATTLE_RECORDS
 	ld hl, sLinkBattleRecord1End - 1
-	ld de, wd002
+	ld de, wLinkBattleRecordBuffer
 .loop3
 	push bc
 	push de
@@ -8814,8 +8817,8 @@
 	add b
 	add b
 	ld e, a
-	ld d, $0
-	ld hl, wd002
+	ld d, 0
+	ld hl, wLinkBattleRecordBuffer
 	add hl, de
 	push hl
 	ld a, c
@@ -8822,8 +8825,8 @@
 	add c
 	add c
 	ld e, a
-	ld d, $0
-	ld hl, wd002
+	ld d, 0
+	ld hl, wLinkBattleRecordBuffer
 	add hl, de
 	ld d, h
 	ld e, l
@@ -8855,7 +8858,7 @@
 	ld hl, sLinkBattleRecord
 	call AddNTimes
 	push hl
-	ld de, wd002
+	ld de, wLinkBattleRecordBuffer
 	ld bc, LINK_BATTLE_RECORD_LENGTH
 	call CopyBytes
 	pop hl
@@ -8869,7 +8872,7 @@
 	push hl
 	ld bc, LINK_BATTLE_RECORD_LENGTH
 	call CopyBytes
-	ld hl, wd002
+	ld hl, wLinkBattleRecordBuffer
 	ld bc, LINK_BATTLE_RECORD_LENGTH
 	pop de
 	call CopyBytes
@@ -8952,13 +8955,13 @@
 	ldh [rSVBK], a
 
 	ld hl, wDecompressScratch
-	ld bc, wScratchAttrmap - wDecompressScratch
+	ld bc, BG_MAP_WIDTH * BG_MAP_HEIGHT
 	ld a, " "
 	call ByteFill
 
 	ld de, wDecompressScratch
 	hlbgcoord 0, 0
-	lb bc, BANK(.BlankBGMap), $40
+	lb bc, BANK(@), (BG_MAP_WIDTH * BG_MAP_HEIGHT) / LEN_2BPP_TILE
 	call Request2bpp
 
 	pop af
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -134,7 +134,7 @@
 	and a
 	jp nz, CheckEnemyTurn
 
-CheckPlayerTurn:
+; check player turn
 	ld hl, wPlayerSubStatus4
 	bit SUBSTATUS_RECHARGE, [hl]
 	jr z, .no_recharge
@@ -2586,7 +2586,7 @@
 	cp SPECIAL
 	jr nc, .special
 
-.physical
+; physical
 	ld hl, wEnemyMonDefense
 	ld a, [hli]
 	ld b, a
@@ -2826,9 +2826,9 @@
 
 	ld a, [hl]
 	cp SPECIAL
-	jr nc, .Special
+	jr nc, .special
 
-.physical
+; physical
 	ld hl, wBattleMonDefense
 	ld a, [hli]
 	ld b, a
@@ -2852,7 +2852,7 @@
 	ld hl, wEnemyAttack
 	jr .thickclub
 
-.Special:
+.special
 	ld hl, wBattleMonSpclDef
 	ld a, [hli]
 	ld b, a
@@ -5714,8 +5714,7 @@
 	text_far _BattleDugText
 	text_end
 
-BattleCommand3c:
-; unused
+BattleCommand_Unused3C: ; unreferenced
 	ret
 
 BattleCommand_TrapTarget:
@@ -6124,7 +6123,7 @@
 BattleCommand_ResetStats:
 ; resetstats
 
-	ld a, 7 ; neutral
+	ld a, BASE_STAT_LEVEL
 	ld hl, wPlayerStatLevels
 	call .Fill
 	ld hl, wEnemyStatLevels
@@ -6147,7 +6146,7 @@
 	jp StdBattleTextbox
 
 .Fill:
-	ld b, wPlayerStatLevelsEnd - wPlayerStatLevels
+	ld b, NUM_LEVEL_STATS
 .next
 	ld [hli], a
 	dec b
@@ -6489,8 +6488,7 @@
 
 INCLUDE "engine/battle/move_effects/rollout.asm"
 
-BattleCommand5d:
-; unused
+BattleCommand_Unused5D: ; unreferenced
 	ret
 
 INCLUDE "engine/battle/move_effects/fury_cutter.asm"
--- a/engine/battle/menu.asm
+++ b/engine/battle/menu.asm
@@ -9,8 +9,7 @@
 	call ExitMenu
 	ret
 
-SafariBattleMenu:
-; untranslated
+SafariBattleMenu: ; unreferenced
 	ld hl, SafariBattleMenuHeader
 	call LoadMenuHeader
 	jr CommonBattleMenu
@@ -18,7 +17,8 @@
 ContestBattleMenu:
 	ld hl, ContestBattleMenuHeader
 	call LoadMenuHeader
-; fallthrough
+	; fallthrough
+
 CommonBattleMenu:
 	ld a, [wBattleMenuCursorBuffer]
 	ld [wMenuCursorBuffer], a
--- a/engine/battle/move_effects/baton_pass.asm
+++ b/engine/battle/move_effects/baton_pass.asm
@@ -17,7 +17,7 @@
 
 ; Transition into switchmon menu
 	call LoadStandardMenuHeader
-	farcall SetUpBattlePartyMenu_NoLoop
+	farcall SetUpBattlePartyMenu
 
 	farcall ForcePickSwitchMonInBattle
 
--- a/engine/battle/move_effects/beat_up.asm
+++ b/engine/battle/move_effects/beat_up.asm
@@ -14,7 +14,7 @@
 	call DelayFrames
 	xor a
 	ld [wPlayerRolloutCount], a
-	ld [wd002], a
+	ld [wCurBeatUpPartyMon], a
 	ld [wBeatUpHitAtLeastOnce], a
 	jr .got_mon
 
@@ -23,10 +23,10 @@
 	ld b, a
 	ld a, [wPartyCount]
 	sub b
-	ld [wd002], a
+	ld [wCurBeatUpPartyMon], a
 
 .got_mon
-	ld a, [wd002]
+	ld a, [wCurBeatUpPartyMon]
 	ld hl, wPartyMonNicknames
 	call GetNick
 	ld a, MON_HP
@@ -34,7 +34,7 @@
 	ld a, [hli]
 	or [hl]
 	jp z, .beatup_fail ; fainted
-	ld a, [wd002]
+	ld a, [wCurBeatUpPartyMon]
 	ld c, a
 	ld a, [wCurBattleMon]
 	; BUG: this can desynchronize link battles
@@ -88,7 +88,7 @@
 
 	xor a
 	ld [wEnemyRolloutCount], a
-	ld [wd002], a
+	ld [wCurBeatUpPartyMon], a
 	ld [wBeatUpHitAtLeastOnce], a
 	jr .enemy_got_mon
 
@@ -97,7 +97,7 @@
 	ld b, a
 	ld a, [wOTPartyCount]
 	sub b
-	ld [wd002], a
+	ld [wCurBeatUpPartyMon], a
 
 .enemy_got_mon
 	ld a, [wBattleMode]
@@ -112,7 +112,7 @@
 	and a
 	jr nz, .link_or_tower
 
-	ld a, [wd002]
+	ld a, [wCurBeatUpPartyMon]
 	ld c, a
 	ld b, 0
 	ld hl, wOTPartySpecies
@@ -123,7 +123,7 @@
 	jr .got_enemy_nick
 
 .link_or_tower
-	ld a, [wd002]
+	ld a, [wCurBeatUpPartyMon]
 	ld hl, wOTPartyMonNicknames
 	ld bc, NAME_LENGTH
 	call AddNTimes
@@ -137,7 +137,7 @@
 	or [hl]
 	jp z, .beatup_fail
 
-	ld a, [wd002]
+	ld a, [wCurBeatUpPartyMon]
 	ld b, a
 	ld a, [wCurOTMon]
 	cp b
@@ -217,7 +217,7 @@
 	ld hl, wOTPartyMon1Species
 
 .got_species
-	ld a, [wd002]
+	ld a, [wCurBeatUpPartyMon]
 	add hl, bc
 	call GetPartyLocation
 	pop bc
--- a/engine/battle/move_effects/present.asm
+++ b/engine/battle/move_effects/present.asm
@@ -80,7 +80,7 @@
 	call _CheckBattleScene
 	jr nc, .do_animation
 	call AnimateFailedMove
-	ld hl, RefusedGiftText
+	ld hl, PresentFailedText
 	call StdBattleTextbox
 .do_animation
 	jp EndMoveEffect
--- a/engine/battle_anims/anim_commands.asm
+++ b/engine/battle_anims/anim_commands.asm
@@ -245,7 +245,8 @@
 	ld c, NUM_SPRITE_OAM_STRUCTS
 .loop
 	ld a, [hl]
-	and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; PAL_BATTLE_OB_ENEMY (0)
+	and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; zeros out the palette bits
+	assert PAL_BATTLE_OB_ENEMY == 0
 	ld [hli], a
 rept SPRITEOAMSTRUCT_LENGTH - 1
 	inc hl
@@ -1050,7 +1051,7 @@
 	and a
 	jr z, .player
 
-	ld de, sScratch + $1a tiles
+	ld de, sScratch + (3 * 7 + 5) tiles
 	call CopyMinimizePic
 	ld hl, vTiles2 tile $00
 	ld de, sScratch
@@ -1058,7 +1059,7 @@
 	ret
 
 .player
-	ld de, sScratch + $160
+	ld de, sScratch + (3 * 6 + 4) tiles
 	call CopyMinimizePic
 	ld hl, vTiles2 tile $31
 	ld de, sScratch
--- a/engine/battle_anims/core.asm
+++ b/engine/battle_anims/core.asm
@@ -263,14 +263,12 @@
 	jr nz, .no_sub
 	ld a, [wFXAnimID]
 	cp KINESIS
-	jr z, .kinesis
+	jr z, .do_sub
 	cp SOFTBOILED
-	jr z, .softboiled
+	jr z, .do_sub
 	cp MILK_DRINK
 	jr nz, .no_sub
-.kinesis
-.softboiled
-.milk_drink
+.do_sub
 	pop af
 	sub 1 * 8
 	jr .done
--- a/engine/battle_anims/functions.asm
+++ b/engine/battle_anims/functions.asm
@@ -4299,7 +4299,7 @@
 	ld e, a
 	ret
 
-BattleAnim_AbsSinePrecise:
+BattleAnim_AbsSinePrecise: ; unreferenced
 	ld a, e
 	call BattleAnim_Sine
 	ld e, l
@@ -4306,7 +4306,7 @@
 	ld d, h
 	ret
 
-BattleAnim_AbsCosinePrecise:
+BattleAnim_AbsCosinePrecise: ; unreferenced
 	ld a, e
 	call BattleAnim_Cosine
 	ld e, l
--- a/engine/debug/color_picker.asm
+++ b/engine/debug/color_picker.asm
@@ -32,7 +32,7 @@
 	const DEBUGCOLORMAIN_INITTMHM       ; 4
 	const DEBUGCOLORMAIN_TMHMJOYPAD     ; 5
 
-DebugColorPicker:
+DebugColorPicker: ; unreferenced
 ; A debug menu to test monster and trainer palettes at runtime.
 	ldh a, [hCGB]
 	and a
@@ -929,13 +929,13 @@
 	ret
 
 DebugColor_PushSGBPals:
-	ld a, [wcfbe]
+	ld a, [wJoypadDisable]
 	push af
-	set 7, a
-	ld [wcfbe], a
+	set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+	ld [wJoypadDisable], a
 	call _DebugColor_PushSGBPals
 	pop af
-	ld [wcfbe], a
+	ld [wJoypadDisable], a
 	ret
 
 _DebugColor_PushSGBPals:
@@ -1069,7 +1069,7 @@
 DebugColor_GFX:
 INCBIN "gfx/debug/color_test.2bpp"
 
-TilesetColorPicker:
+TilesetColorPicker: ; unreferenced
 ; A debug menu to test tileset palettes at runtime.
 ; dummied out
 	ret
@@ -1437,8 +1437,8 @@
 	ld [hl], d
 	ret
 
-; unused
+.dummy1: ; unreferenced
 	ret
 
-; unused
+.dummy2: ; unreferenced
 	ret
--- a/engine/debug/debug_room.asm
+++ b/engine/debug/debug_room.asm
@@ -1328,9 +1328,9 @@
 .Move4:     db "MOVE 4@"
 .ID0:       db "ID[0]@"
 .ID1:       db "ID[1]@"
-.BaseExp0:  db "BASE EXP[0]@"
-.BaseExp1:  db "BASE EXP[1]@"
-.BaseExp2:  db "BASE EXP[2]@"
+.BaseExp0:  db "BASE EXP[0]@" ; unreferenced
+.BaseExp1:  db "BASE EXP[1]@" ; unreferenced
+.BaseExp2:  db "BASE EXP[2]@" ; unreferenced
 .HPExp0:    db "HP EXP[0]@"
 .HPExp1:    db "HP EXP[1]@"
 .AttkExp0:  db "ATTK EXP[0]@"
--- a/engine/events/battle_tower/battle_tower.asm
+++ b/engine/events/battle_tower/battle_tower.asm
@@ -67,7 +67,7 @@
 	call Function170c8b
 	ret
 
-Function170139:
+Function170139: ; unreferenced
 ; Convert the 4-digit decimal number at s5_aa41 into binary
 	ld a, BANK(s5_aa41)
 	call OpenSRAM
@@ -183,7 +183,7 @@
 	call _BattleTowerBattle
 	ret
 
-DummySpecial_17021d:
+UnusedBattleTowerDummySpecial1:
 	ret
 
 InitBattleTowerChallengeRAM:
@@ -374,7 +374,7 @@
 	ld [bc], a
 	ret
 
-ValidateBTParty:
+ValidateBTParty: ; unreferenced
 ; Check for and fix errors in party data
 	ld hl, wBT_OTTempMon1Species
 	ld d, BATTLETOWER_PARTY_LENGTH
@@ -386,7 +386,7 @@
 	ld a, [hl]
 	and a
 x = $ff
-rept ($ff - NUM_POKEMON)
+rept $ff - NUM_POKEMON
 	jr z, .invalid
 	cp x
 x = x - 1
@@ -1008,11 +1008,11 @@
 
 BattleTowerAction_SetByteToQuickSaveChallenge:
 	ld c, BATTLETOWER_SAVED_AND_LEFT
-	jr asm_17079f
+	jr SetBattleTowerChallengeState
 
 BattleTowerAction_SetByteToCancelChallenge:
 	ld c, BATTLETOWER_NO_CHALLENGE
-asm_17079f:
+SetBattleTowerChallengeState:
 	ld a, BANK(sBattleTowerChallengeState)
 	call OpenSRAM
 	ld a, c
@@ -1447,11 +1447,11 @@
 
 Function170a9c:
 	ld c, FALSE
-	jr asm_170aa2
+	jr Set_s5_aa8d
 
 Function170aa0:
 	ld c, TRUE
-asm_170aa2:
+Set_s5_aa8d:
 	ld a, BANK(s5_aa8d)
 	call OpenSRAM
 	ld a, c
@@ -1576,7 +1576,7 @@
 
 INCLUDE "data/trainers/sprites.asm"
 
-DummySpecial_170bd2:
+UnusedBattleTowerDummySpecial2:
 	ret
 
 CheckForBattleTowerRules:
--- a/engine/events/battle_tower/load_trainer.asm
+++ b/engine/events/battle_tower/load_trainer.asm
@@ -95,7 +95,7 @@
 	ld c, BATTLETOWER_PARTY_LENGTH
 .loop
 	push bc
-	ld a, BANK(sBTMonPrevTrainer1)
+	ld a, BANK(sBTMonOfTrainers)
 	call OpenSRAM
 
 .FindARandomBattleTowerMon:
--- a/engine/events/buena.asm
+++ b/engine/events/buena.asm
@@ -85,7 +85,7 @@
 	call Buena_PrizeMenu
 	jr z, .done
 	ld [wMenuSelectionQuantity], a
-	call Buena_getprize
+	call Buena_GetPrize
 	ld a, [hl]
 	ld [wNamedObjectIndexBuffer], a
 	call GetItemName
@@ -95,7 +95,7 @@
 	jr c, .loop
 
 	ld a, [wMenuSelectionQuantity]
-	call Buena_getprize
+	call Buena_GetPrize
 	inc hl
 	ld a, [hld]
 	ld c, a
@@ -258,11 +258,11 @@
 	db SCROLLINGMENU_DISPLAY_ARROWS ; flags
 	db 4, 13 ; rows, columns
 	db SCROLLINGMENU_ITEMS_NORMAL ; item format
-	dba .indices
-	dba .prizeitem
-	dba .prizepoints
+	dba .Prizes
+	dba .PrintPrizeItem
+	dba .PrintPrizePoints
 
-.indices:
+.Prizes:
 	db NUM_BUENA_PRIZES
 x = 1
 rept NUM_BUENA_PRIZES
@@ -271,9 +271,9 @@
 endr
 	db -1
 
-.prizeitem:
+.PrintPrizeItem:
 	ld a, [wMenuSelection]
-	call Buena_getprize
+	call Buena_GetPrize
 	ld a, [hl]
 	push de
 	ld [wNamedObjectIndexBuffer], a
@@ -282,9 +282,9 @@
 	call PlaceString
 	ret
 
-.prizepoints:
+.PrintPrizePoints:
 	ld a, [wMenuSelection]
-	call Buena_getprize
+	call Buena_GetPrize
 	inc hl
 	ld a, [hl]
 	ld c, "0"
@@ -292,7 +292,7 @@
 	ld [de], a
 	ret
 
-Buena_getprize:
+Buena_GetPrize:
 	dec a
 	ld hl, BuenaPrizeItems
 	ld b, 0
--- a/engine/events/bug_contest/judging.asm
+++ b/engine/events/bug_contest/judging.asm
@@ -68,7 +68,8 @@
 
 LoadContestantName:
 ; If a = 1, get your name.
-	dec a ; BUG_CONTEST_PLAYER
+	assert BUG_CONTEST_PLAYER == 1
+	dec a
 	jr z, .player
 ; Find the pointer for the trainer class of the Bug Catching Contestant whose ID is in a.
 	ld c, a
--- a/engine/events/celebi.asm
+++ b/engine/events/celebi.asm
@@ -1,6 +1,6 @@
 SPECIALCELEBIEVENT_CELEBI EQU $84
 
-UnusedForestTreeFrames:
+UnusedForestTreeFrames: ; unreferenced
 INCBIN "gfx/tilesets/forest-tree/1.2bpp"
 INCBIN "gfx/tilesets/forest-tree/2.2bpp"
 INCBIN "gfx/tilesets/forest-tree/3.2bpp"
@@ -99,9 +99,8 @@
 	set 7, [hl]
 	ret
 
-CelebiEvent_SpawnLeaf:
-; unused
-	ld hl, wcf65
+CelebiEvent_SpawnLeaf: ; unreferenced
+	ld hl, wFrameCounter2
 	ld a, [hl]
 	inc [hl]
 	and $7
--- a/engine/events/daycare.asm
+++ b/engine/events/daycare.asm
@@ -1,9 +1,9 @@
 ; PrintDayCareText.TextTable indexes
 	const_def
 	const DAYCARETEXT_MAN_INTRO
-	const DAYCARETEXT_MAN_ODD_EGG
+	const DAYCARETEXT_MAN_INTRO_EGG
 	const DAYCARETEXT_LADY_INTRO
-	const DAYCARETEXT_LADY_ODD_EGG
+	const DAYCARETEXT_LADY_INTRO_EGG
 	const DAYCARETEXT_WHICH_ONE
 	const DAYCARETEXT_DEPOSIT
 	const DAYCARETEXT_CANT_BREED_EGG
@@ -166,7 +166,7 @@
 	scf
 	ret
 
-.DaycareDummyText:
+.DaycareDummyText: ; unreferenced
 	text_far _DaycareDummyText
 	text_end
 
@@ -274,9 +274,9 @@
 .TextTable:
 ; entries correspond to DAYCARETEXT_* constants
 	dw .DayCareManIntroText ; 00
-	dw .DayCareManOddEggText ; 01
+	dw .DayCareManIntroEggText ; 01
 	dw .DayCareLadyIntroText ; 02
-	dw .DayCareLadyOddEggText ; 03
+	dw .DayCareLadyIntroEggText ; 03
 	dw .WhatShouldIRaiseText ; 04
 	dw .IllRaiseYourMonText ; 05
 	dw .CantAcceptEggText ; 06
@@ -298,8 +298,8 @@
 	text_far _DayCareManIntroText
 	text_end
 
-.DayCareManOddEggText:
-	text_far _DayCareManOddEggText
+.DayCareManIntroEggText:
+	text_far _DayCareManIntroEggText
 	text_end
 
 .DayCareLadyIntroText:
@@ -306,8 +306,8 @@
 	text_far _DayCareLadyIntroText
 	text_end
 
-.DayCareLadyOddEggText:
-	text_far _DayCareLadyOddEggText
+.DayCareLadyIntroEggText:
+	text_far _DayCareLadyIntroEggText
 	text_end
 
 .WhatShouldIRaiseText:
--- a/engine/events/diploma.asm
+++ b/engine/events/diploma.asm
@@ -87,4 +87,5 @@
 DiplomaPage2Tilemap:
 INCBIN "gfx/diploma/page2.tilemap"
 
-	ret ; unused
+Diploma_DummyFunction: ; unreferenced
+	ret
--- a/engine/events/engine_flags.asm
+++ b/engine/events/engine_flags.asm
@@ -57,7 +57,7 @@
 	jr z, .set   ; b = 1
 
 ; Return the given flag in c.
-.check
+; check
 	ld a, [de]
 	and c
 	ld c, a
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -426,7 +426,7 @@
 	ret
 
 .SpawnLeaf:
-	ld hl, wcf65
+	ld hl, wFrameCounter2
 	ld a, [hl]
 	inc [hl]
 	and $7
--- a/engine/events/heal_machine_anim.asm
+++ b/engine/events/heal_machine_anim.asm
@@ -56,7 +56,7 @@
 .Pointers:
 ; entries correspond to HEALMACHINE_* constants
 	dw .Pokecenter
-	dw .ElmLab
+	dw .ElmsLab
 	dw .HallOfFame
 
 healmachineanimseq: MACRO
@@ -68,7 +68,7 @@
 
 .Pokecenter:
 	healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH
-.ElmLab:
+.ElmsLab:
 	healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH
 .HallOfFame:
 	healmachineanimseq LOADGFX, HOFLOADBALLS, HOFPLAYSFX, FINISH
--- a/engine/events/magnet_train.asm
+++ b/engine/events/magnet_train.asm
@@ -69,7 +69,7 @@
 	ld [wRequested2bppSource + 1], a
 	ld [wRequested2bppDest], a
 	ld [wRequested2bppDest + 1], a
-	ld [wRequested2bpp], a
+	ld [wRequested2bppSize], a
 	call ClearTilemap
 
 	pop af
--- a/engine/events/mom_phone.asm
+++ b/engine/events/mom_phone.asm
@@ -228,9 +228,12 @@
 	text_far _MomItsInYourRoomText
 	text_end
 
-	db 0 ; unused
 
+DummyPredef3A_DummyData: ; unreferenced
+	db 0
+
 DummyPredef3A:
 	ret
 
-	ret ; unused
+DummyPredef3A_DummyFunction: ; unreferenced
+	ret
--- a/engine/events/npc_trade.asm
+++ b/engine/events/npc_trade.asm
@@ -56,11 +56,12 @@
 	call DisableSpriteUpdates
 	ld a, [wJumptableIndex]
 	push af
-	ld a, [wcf64]
+	; wTradeDialog aliases wFrameCounter, which TradeAnimation uses
+	ld a, [wTradeDialog]
 	push af
 	predef TradeAnimation
 	pop af
-	ld [wcf64], a
+	ld [wTradeDialog], a
 	pop af
 	ld [wJumptableIndex], a
 	call ReturnToMapWithSpeechTextbox
@@ -107,7 +108,7 @@
 	ld e, NPCTRADE_DIALOG
 	call GetTradeAttribute
 	ld a, [hl]
-	ld [wcf64], a
+	ld [wTradeDialog], a
 	ret
 
 DoNPCTrade:
@@ -392,7 +393,7 @@
 	ld bc, 2 * 4
 	ld hl, TradeTexts
 	call AddNTimes
-	ld a, [wcf64]
+	ld a, [wTradeDialog]
 	ld c, a
 	add hl, bc
 	add hl, bc
--- a/engine/events/overworld.asm
+++ b/engine/events/overworld.asm
@@ -271,7 +271,7 @@
 	xor a
 	ret
 
-INCLUDE "data/events/field_move_blocks.asm"
+INCLUDE "data/collision/field_move_blocks.asm"
 
 FlashFunction:
 	call .CheckUseFlash
@@ -1414,7 +1414,7 @@
 	ld d, ROCK_SMASH
 	call CheckPartyMove
 	jr nc, .yes
-.no
+; no
 	ld a, 1
 	jr .done
 .yes
@@ -1616,7 +1616,7 @@
 	text_far _RodNothingText
 	text_end
 
-UnusedNothingHereText: ; unused
+UnusedNothingHereText: ; unreferenced
 	text_far _UnusedNothingHereText
 	text_end
 
@@ -1722,7 +1722,7 @@
 	special UpdatePlayerSprite
 	end
 
-; unused
+Overworld_DummyFunction: ; unreferenced
 	nop
 	ret
 
--- a/engine/events/poisonstep.asm
+++ b/engine/events/poisonstep.asm
@@ -149,6 +149,6 @@
 	text_far _PoisonFaintText
 	text_end
 
-.PoisonWhiteoutText:
+.PoisonWhiteoutText: ; unreferenced
 	text_far _PoisonWhiteoutText
 	text_end
--- a/engine/events/print_unown_2.asm
+++ b/engine/events/print_unown_2.asm
@@ -9,7 +9,7 @@
 	push bc
 	push hl
 	push bc
-	ld de, wd002
+	ld de, wPrintedUnownTileSource
 	call .Copy
 	call .Rotate
 	ld hl, UnownPrinter_GBPrinterRectangle
@@ -19,10 +19,10 @@
 	ld a, [hli]
 	ld e, a
 	ld d, [hl]
-	ld hl, wd012
+	ld hl, wPrintedUnownTileDest
 	call .Copy
 	pop hl
-	ld bc, $10
+	ld bc, LEN_2BPP_TILE
 	add hl, bc
 	pop bc
 	inc c
@@ -30,7 +30,7 @@
 	cp 7 * 7
 	jr c, .loop
 
-	ld hl, wGameboyPrinterRAM
+	ld hl, wGameboyPrinter2bppSource
 	ld de, sScratch
 	ld bc, 7 * 7 tiles
 	call CopyBytes
@@ -44,7 +44,7 @@
 	ret
 
 .Copy:
-	ld c, $10
+	ld c, LEN_2BPP_TILE
 .loop_copy
 	ld a, [hli]
 	ld [de], a
@@ -54,18 +54,18 @@
 	ret
 
 .Rotate:
-	ld hl, wd012
+	ld hl, wPrintedUnownTileDest
 	ld e, %10000000
 	ld d, 8
 .loop_decompress
 	push hl
-	ld hl, wd002
+	ld hl, wPrintedUnownTileSource
 	call .CountSetBit
 	pop hl
 	ld a, b
 	ld [hli], a
 	push hl
-	ld hl, wd003
+	ld hl, wPrintedUnownTileSource + 1
 	call .CountSetBit
 	pop hl
 	ld a, b
@@ -100,7 +100,7 @@
 rept \1
 x = \1 * (\2 - 1) + y
 rept \2
-	dw wGameboyPrinterRAM tile x
+	dw wGameboyPrinter2bppSource tile x
 x = x - \2
 endr
 y = y + 1
--- a/engine/events/prof_oaks_pc.asm
+++ b/engine/events/prof_oaks_pc.asm
@@ -36,11 +36,11 @@
 	ld hl, wPokedexSeen
 	ld b, wEndPokedexSeen - wPokedexSeen
 	call CountSetBits
-	ld [wd002], a
+	ld [wTempPokedexSeenCount], a
 	ld hl, wPokedexCaught
 	ld b, wEndPokedexCaught - wPokedexCaught
 	call CountSetBits
-	ld [wd003], a
+	ld [wTempPokedexCaughtCount], a
 
 ; print appropriate rating
 	call .UpdateRatingBuffers
@@ -47,7 +47,7 @@
 	ld hl, OakPCText3
 	call PrintText
 	call JoyWaitAorB
-	ld a, [wd003]
+	ld a, [wTempPokedexCaughtCount]
 	ld hl, OakRatings
 	call FindOakRating
 	push de
@@ -57,10 +57,10 @@
 
 .UpdateRatingBuffers:
 	ld hl, wStringBuffer3
-	ld de, wd002
+	ld de, wTempPokedexSeenCount
 	call .UpdateRatingBuffer
 	ld hl, wStringBuffer4
-	ld de, wd003
+	ld de, wTempPokedexCaughtCount
 	call .UpdateRatingBuffer
 	ret
 
--- a/engine/events/specials.asm
+++ b/engine/events/specials.asm
@@ -15,7 +15,7 @@
 
 INCLUDE "data/events/special_pointers.asm"
 
-DummySpecial_c224:
+UnusedDummySpecial:
 	ret
 
 SetPlayerPalette:
@@ -207,7 +207,7 @@
 	call StartGameCornerGame
 	ret
 
-DummyNonfunctionalGameCornerGame:
+UnusedDummyGame:
 	call CheckCoinsAndCoinCase
 	ret c
 	ld a, BANK(_DummyGame)
@@ -380,17 +380,17 @@
 	ldh a, [hCGB]
 	and a
 	jr nz, .cgb
-
 	ldh a, [hSGB]
 	and a
 	jr nz, .sgb
-
-.gb
+; gb
 	xor a ; GBCHECK_GB
 	jr .done
+
 .sgb
 	ld a, GBCHECK_SGB
 	jr .done
+
 .cgb
 	ld a, GBCHECK_CGB
 .done
--- a/engine/events/std_collision.asm
+++ b/engine/events/std_collision.asm
@@ -23,7 +23,7 @@
 	xor a
 	ret
 
-INCLUDE "data/events/collision_stdscripts.asm"
+INCLUDE "data/collision/collision_stdscripts.asm"
 
 Script_JumpStdFromRAM:
 	sjump wJumpStdScriptBuffer
--- a/engine/events/treemons.asm
+++ b/engine/events/treemons.asm
@@ -210,7 +210,7 @@
 	cp 5
 	jr c, .good
 
-.bad
+; bad
 	xor a ; TREEMON_SCORE_BAD
 	ret
 
--- a/engine/games/card_flip.asm
+++ b/engine/games/card_flip.asm
@@ -1,7 +1,8 @@
 CARDFLIP_LIGHT_OFF EQU "♂" ; $ef
 CARDFLIP_LIGHT_ON  EQU "♀" ; $f5
 
-CARDFLIP_DECK_SIZE EQU 4 * 6
+CARDFLIP_DECK_SIZE EQUS "(wDeckEnd - wDeck)"
+	assert wDiscardPileEnd - wDiscardPile == wDeckEnd - wDeck
 
 DummyGameGFX:
 ; Graphics for an unused Game Corner
--- a/engine/games/dummy_game.asm
+++ b/engine/games/dummy_game.asm
@@ -20,7 +20,7 @@
 	ld a, BANK(DummyGameGFX)
 	call FarCopyBytes
 	ld a, $8
-	ld hl, wc300
+	ld hl, wSpriteAnimDict
 	ld [hli], a
 	ld [hl], $0
 	hlcoord 0, 0
@@ -133,11 +133,11 @@
 .next_try
 	dec [hl]
 	xor a
-	ld [wcf64], a
+	ld [wDummyGameCardChoice], a
 	ld hl, wJumptableIndex
 	inc [hl]
 .PickCard1:
-	ld a, [wcf64]
+	ld a, [wDummyGameCardChoice]
 	and a
 	ret z
 	dec a
@@ -155,13 +155,13 @@
 	call DummyGame_Card2Coord
 	call DummyGame_PlaceCard
 	xor a
-	ld [wcf64], a
+	ld [wDummyGameCardChoice], a
 	ld hl, wJumptableIndex
 	inc [hl]
 	ret
 
 .PickCard2:
-	ld a, [wcf64]
+	ld a, [wDummyGameCardChoice]
 	and a
 	ret z
 	dec a
@@ -527,7 +527,7 @@
 	add hl, bc
 	ld a, [hl]
 	inc a
-	ld [wcf64], a
+	ld [wDummyGameCardChoice], a
 	ret
 
 .pressed_left
--- a/engine/games/slot_machine.asm
+++ b/engine/games/slot_machine.asm
@@ -249,7 +249,7 @@
 
 AnimateSlotReelIcons: ; unreferenced
 ; This animation was present in pokegold-spaceworld.
-	ld hl, wcf66
+	ld hl, wUnusedSlotReelIconDelay
 	ld a, [hl]
 	inc [hl]
 	and $7
--- a/engine/games/unown_puzzle.asm
+++ b/engine/games/unown_puzzle.asm
@@ -504,13 +504,13 @@
 
 RedrawUnownPuzzlePieces:
 	call GetCurrentPuzzlePieceVTileCorner
-	ld [wd002], a
+	ld [wUnownPuzzleCornerTile], a
 	xor a
 	call GetUnownPuzzleCoordData ; get pixel positions
 	ld a, [hli]
 	ld b, [hl]
 	ld c, a
-	ld a, [wd002]
+	ld a, [wUnownPuzzleCornerTile]
 	cp $e0
 	jr z, .NoPiece
 	ld hl, .OAM_HoldingPiece
@@ -532,7 +532,7 @@
 	add c
 	ld [de], a ; x
 	inc de
-	ld a, [wd002]
+	ld a, [wUnownPuzzleCornerTile]
 	add [hl]
 	ld [de], a ; tile id
 	inc hl
--- a/engine/gfx/cgb_layouts.asm
+++ b/engine/gfx/cgb_layouts.asm
@@ -17,19 +17,18 @@
 	ld l, a
 	ld h, 0
 	add hl, hl
-	ld de, .dw
+	ld de, .Jumptable
 	add hl, de
 	ld a, [hli]
 	ld h, [hl]
 	ld l, a
-	ld de, .ReturnFromJumpTable
+	ld de, .done
 	push de
 	jp hl
-
-.ReturnFromJumpTable:
+.done:
 	ret
 
-.dw
+.Jumptable:
 	dw _CGB_BattleGrayscale
 	dw _CGB_BattleColors
 	dw _CGB_PokegearPals
@@ -43,7 +42,7 @@
 	dw _CGB_PartyMenu
 	dw _CGB_Evolution
 	dw _CGB_GSTitleScreen
-	dw _CGB0d
+	dw _CGB_Unused0D
 	dw _CGB_MoveList
 	dw _CGB_BetaPikachuMinigame
 	dw _CGB_PokedexSearchOption
@@ -60,7 +59,7 @@
 	dw _CGB_TradeTube
 	dw _CGB_TrainerOrMonFrontpicPals
 	dw _CGB_MysteryGift
-	dw _CGB1e
+	dw _CGB_Unused1E
 
 _CGB_BattleGrayscale:
 	ld hl, PalPacket_BattleGrayscale + 1
@@ -321,12 +320,12 @@
 	ldh [hCGBPalUpdate], a
 	ret
 
-Function9009: ; unreferenced
+_CGB_Unknown: ; unreferenced
 	ld hl, BillsPCOrangePalette
 	call LoadHLPaletteIntoDE
 	jr .GotPalette
 
-.GetMonPalette:
+.GetMonPalette: ; unreferenced
 	ld bc, wTempMonDVs
 	call GetPlayerOrMonPalettePointer
 	call LoadPalette_White_Col1_Col2_Black
@@ -595,7 +594,7 @@
 	ldh [hCGBPalUpdate], a
 	ret
 
-_CGB0d:
+_CGB_Unused0D:
 	ld hl, PalPacket_Diploma + 1
 	call CopyFourPalettes
 	call WipeAttrmap
@@ -911,7 +910,7 @@
 	call ApplyPals
 	ret
 
-_CGB1e:
+_CGB_Unused1E:
 	ld de, wBGPals1
 	ld a, [wCurPartySpecies]
 	call GetMonPalettePointer
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -15,31 +15,31 @@
 ; Attack
 	ld a, [hl]
 	and 1 << SHINY_ATK_BIT
-	jr z, .NotShiny
+	jr z, .not_shiny
 
 ; Defense
 	ld a, [hli]
 	and $f
 	cp  SHINY_DEF_VAL
-	jr nz, .NotShiny
+	jr nz, .not_shiny
 
 ; Speed
 	ld a, [hl]
 	and $f0
 	cp  SHINY_SPD_VAL << 4
-	jr nz, .NotShiny
+	jr nz, .not_shiny
 
 ; Special
 	ld a, [hl]
 	and $f
 	cp  SHINY_SPC_VAL
-	jr nz, .NotShiny
+	jr nz, .not_shiny
 
-.Shiny:
+; shiny
 	scf
 	ret
 
-.NotShiny:
+.not_shiny
 	and a
 	ret
 
@@ -49,30 +49,30 @@
 ; Attack
 	ld a, [hl]
 	cp 10 << 4
-	jr c, .NotShiny
+	jr c, .not_shiny
 
 ; Defense
 	ld a, [hli]
 	and $f
 	cp 10
-	jr c, .NotShiny
+	jr c, .not_shiny
 
 ; Speed
 	ld a, [hl]
 	cp 10 << 4
-	jr c, .NotShiny
+	jr c, .not_shiny
 
 ; Special
 	ld a, [hl]
 	and $f
 	cp 10
-	jr c, .NotShiny
+	jr c, .not_shiny
 
-.Shiny:
+; shiny
 	scf
 	ret
 
-.NotShiny:
+.not_shiny
 	and a
 	ret
 
@@ -136,6 +136,7 @@
 Intro_LoadMagikarpPalettes: ; unreferenced
 	call CheckCGB
 	ret z
+
 ; CGB only
 	ld hl, .BGPal
 	ld de, wBGPals1
@@ -789,13 +790,13 @@
 	ret
 
 PushSGBPals:
-	ld a, [wcfbe]
+	ld a, [wJoypadDisable]
 	push af
-	set 7, a
-	ld [wcfbe], a
+	set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+	ld [wJoypadDisable], a
 	call _PushSGBPals
 	pop af
-	ld [wcfbe], a
+	ld [wJoypadDisable], a
 	ret
 
 _PushSGBPals:
@@ -841,12 +842,14 @@
 InitSGBBorder:
 	call CheckCGB
 	ret nz
+
 ; SGB/DMG only
 	di
-	ld a, [wcfbe]
+	ld a, [wJoypadDisable]
 	push af
-	set 7, a
-	ld [wcfbe], a
+	set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+	ld [wJoypadDisable], a
+
 	xor a
 	ldh [rJOYP], a
 	ldh [hSGB], a
@@ -866,7 +869,7 @@
 
 .skip
 	pop af
-	ld [wcfbe], a
+	ld [wJoypadDisable], a
 	ei
 	ret
 
@@ -873,6 +876,7 @@
 InitCGBPals::
 	call CheckCGB
 	ret z
+
 ; CGB only
 	ld a, BANK(vTiles3)
 	ldh [rVBK], a
@@ -977,7 +981,7 @@
 
 .LoadSGBBorderPointers:
 	ld hl, SGBBorderGFX
-	ld de, SGBBorderMap
+	ld de, SGBBorderMapAndPalettes
 	ret
 
 SGB_ClearVRAM:
@@ -1174,12 +1178,10 @@
 PredefPals:
 INCLUDE "gfx/sgb/predef.pal"
 
-SGBBorderMap:
+SGBBorderMapAndPalettes:
 ; interleaved tile ids and palette ids, without the center 20x18 screen area
 INCBIN "gfx/sgb/sgb_border.sgb.tilemap"
-
-SGBBorderPalettes:
-; assumed to come after SGBBorderMap
+; four SGB palettes of 16 colors each; only the first 4 colors are used
 INCLUDE "gfx/sgb/sgb_border.pal"
 
 SGBBorderGFX:
@@ -1317,7 +1319,7 @@
 PartyMenuOBPals:
 INCLUDE "gfx/stats/party_menu_ob.pal"
 
-UnusedBattleObjectPals:
+UnusedBattleObjectPals: ; unreferenced
 INCLUDE "gfx/battle_anims/unused_battle_anims.pal"
 
 UnusedGSTitleBGPals:
--- a/engine/gfx/crystal_layouts.asm
+++ b/engine/gfx/crystal_layouts.asm
@@ -1,9 +1,9 @@
-GetMysteryGift_MobileAdapterLayout:
+GetCrystalCGBLayout:
 	ld a, b
 	cp SCGB_DEFAULT
-	jr nz, .not_ram
+	jr nz, .not_default
 	ld a, [wDefaultSGBLayout]
-.not_ram
+.not_default
 	push af
 	farcall ResetBGPals
 	pop af
@@ -10,7 +10,7 @@
 	ld l, a
 	ld h, 0
 	add hl, hl
-	ld de, .dw
+	ld de, .Jumptable
 	add hl, de
 	ld a, [hli]
 	ld h, [hl]
@@ -18,15 +18,16 @@
 	ld de, .done
 	push de
 	jp hl
-.done
+.done:
 	ret
 
-.dw
-	dw MG_Mobile_Layout00
-	dw MG_Mobile_Layout01
-	dw MG_Mobile_Layout02
+.Jumptable:
+	dw _CrystalCGB_MobileLayout0
+	dw _CrystalCGB_MobileLayout1
+	dw _CrystalCGB_NameCard
 
-MG_Mobile_Layout_FillBox:
+Crystal_FillBoxCGB:
+; This is a copy of FillBoxCGB.
 .row
 	push bc
 	push hl
@@ -42,7 +43,8 @@
 	jr nz, .row
 	ret
 
-MG_Mobile_Layout_WipeAttrmap:
+Crystal_WipeAttrmap:
+; This is a copy of WipeAttrmap.
 	hlcoord 0, 0, wAttrmap
 	ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
 	xor a
@@ -62,9 +64,9 @@
 	call FarCopyWRAM
 	ret
 
-MG_Mobile_Layout00:
+_CrystalCGB_MobileLayout0:
 	call MG_Mobile_Layout_LoadPals
-	call MG_Mobile_Layout_WipeAttrmap
+	call Crystal_WipeAttrmap
 	call MG_Mobile_Layout_CreatePalBoxes
 	farcall ApplyAttrmap
 	farcall ApplyPals
@@ -74,33 +76,33 @@
 	hlcoord 0, 0, wAttrmap
 	lb bc, 4, 1
 	ld a, $1
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	lb bc, 2, 1
 	ld a, $2
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	lb bc, 6, 1
 	ld a, $3
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	hlcoord 1, 0, wAttrmap
 	ld a, $1
 	lb bc, 3, 18
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	lb bc, 2, 18
 	ld a, $2
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	lb bc, 12, 18
 	ld a, $3
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	hlcoord 19, 0, wAttrmap
 	lb bc, 4, 1
 	ld a, $1
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	lb bc, 2, 1
 	ld a, $2
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	lb bc, 6, 1
 	ld a, $3
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	hlcoord 0, 12, wAttrmap
 	ld bc, 6 * SCREEN_WIDTH
 	ld a, $7
@@ -129,14 +131,14 @@
 	call FarCopyWRAM
 	ret
 
-MG_Mobile_Layout01:
+_CrystalCGB_MobileLayout1:
 	call MG_Mobile_Layout_LoadPals
 	ld de, wBGPals1 palette PAL_BG_TEXT
-	ld hl, .Palette_49478
+	ld hl, .TextPalette
 	ld bc, 1 palettes
 	ld a, BANK(wBGPals1)
 	call FarCopyWRAM
-	call MG_Mobile_Layout_WipeAttrmap
+	call Crystal_WipeAttrmap
 	hlcoord 0, 0, wAttrmap
 	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
 	xor a
@@ -149,12 +151,11 @@
 	bit 6, a
 	jr z, .asm_49464
 	call Function49480
-	jr .asm_49467
+	jr .done
 
 .asm_49464
 	call Function49496
-
-.asm_49467
+.done
 	farcall ApplyAttrmap
 	farcall ApplyPals
 	ld a, TRUE
@@ -161,7 +162,7 @@
 	ldh [hCGBPalUpdate], a
 	ret
 
-.Palette_49478:
+.TextPalette:
 	RGB 31, 31, 31
 	RGB 26, 31, 00
 	RGB 20, 16, 03
@@ -171,7 +172,7 @@
 	hlcoord 0, 0, wAttrmap
 	lb bc, 4, SCREEN_WIDTH
 	ld a, $7
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	hlcoord 0, 2, wAttrmap
 	ld a, $4
 	ld [hl], a
@@ -183,7 +184,7 @@
 	hlcoord 0, 0, wAttrmap
 	lb bc, 2, SCREEN_WIDTH
 	ld a, $7
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	hlcoord 0, 1, wAttrmap
 	ld a, $4
 	ld [hl], a
@@ -193,16 +194,16 @@
 
 INCLUDE "engine/tilesets/tileset_palettes.asm"
 
-MG_Mobile_Layout02:
-	ld hl, .Palette_49732
+_CrystalCGB_NameCard:
+	ld hl, .BGPalette
 	ld de, wBGPals1
 	ld bc, 1 palettes
 	ld a, BANK(wBGPals1)
 	call FarCopyWRAM
 	farcall ApplyPals
-	call MG_Mobile_Layout_WipeAttrmap
+	call Crystal_WipeAttrmap
 	farcall ApplyAttrmap
-	ld hl, .Palette_4973a
+	ld hl, .OBPalette
 	ld de, wOBPals1
 	ld bc, 1 palettes
 	ld a, BANK(wOBPals1)
@@ -209,13 +210,13 @@
 	call FarCopyWRAM
 	ret
 
-.Palette_49732:
+.BGPalette:
 	RGB 31, 31, 31
 	RGB 23, 16, 07
 	RGB 23, 07, 07
 	RGB 03, 07, 20
 
-.Palette_4973a:
+.OBPalette:
 	RGB 00, 00, 00
 	RGB 07, 05, 31
 	RGB 14, 18, 31
@@ -237,7 +238,7 @@
 	hlcoord 0, 0, wAttrmap
 	lb bc, 16, 2
 	ld a, $4
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	ld a, $3
 	ldcoord_a 0, 1, wAttrmap
 	ldcoord_a 0, 14, wAttrmap
@@ -244,31 +245,31 @@
 	hlcoord 2, 0, wAttrmap
 	lb bc, 8, 18
 	ld a, $5
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	hlcoord 2, 8, wAttrmap
 	lb bc, 8, 18
 	ld a, $6
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	hlcoord 0, 16, wAttrmap
 	lb bc, 2, SCREEN_WIDTH
 	ld a, $4
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	ld a, $3
 	lb bc, 6, 1
 	hlcoord 6, 1, wAttrmap
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	ld a, $3
 	lb bc, 6, 1
 	hlcoord 17, 1, wAttrmap
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	ld a, $3
 	lb bc, 6, 1
 	hlcoord 6, 9, wAttrmap
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	ld a, $3
 	lb bc, 6, 1
 	hlcoord 17, 9, wAttrmap
-	call MG_Mobile_Layout_FillBox
+	call Crystal_FillBoxCGB
 	ld a, $2
 	hlcoord 2, 16, wAttrmap
 	ld [hli], a
--- a/engine/gfx/load_pics.asm
+++ b/engine/gfx/load_pics.asm
@@ -208,7 +208,8 @@
 	push de
 
 	; These are assumed to be at the same address in their respective banks.
-	ld hl, PokemonPicPointers ; UnownPicPointers
+	assert PokemonPicPointers == UnownPicPointers
+	ld hl, PokemonPicPointers
 	ld a, b
 	ld d, BANK(PokemonPicPointers)
 	cp UNOWN
--- a/engine/gfx/pic_animation.asm
+++ b/engine/gfx/pic_animation.asm
@@ -648,7 +648,7 @@
 .skip2
 	ret
 
-; unused
+.UnusedSizeData: ; unreferenced
 	db 6, 5, 4
 
 .GetTilemap:
--- a/engine/gfx/player_gfx.asm
+++ b/engine/gfx/player_gfx.asm
@@ -113,10 +113,10 @@
 	ld bc, $23 tiles
 	ld a, BANK(ChrisCardPic) ; aka BANK(KrisCardPic)
 	call FarCopyBytes
-	ld hl, CardGFX
+	ld hl, TrainerCardGFX
 	ld de, vTiles2 tile $23
 	ld bc, 6 tiles
-	ld a, BANK(CardGFX)
+	ld a, BANK(TrainerCardGFX)
 	call FarCopyBytes
 	ret
 
@@ -126,7 +126,7 @@
 KrisCardPic:
 INCBIN "gfx/trainer_card/kris_card.2bpp"
 
-CardGFX:
+TrainerCardGFX:
 INCBIN "gfx/trainer_card/trainer_card.2bpp"
 
 GetPlayerBackpic:
--- a/engine/gfx/sgb_layouts.asm
+++ b/engine/gfx/sgb_layouts.asm
@@ -35,7 +35,7 @@
 	dw .SGB_PartyMenu
 	dw .SGB_Evolution
 	dw .SGB_GSTitleScreen
-	dw .SGB0d
+	dw .SGB_Unused0D
 	dw .SGB_MoveList
 	dw .SGB_BetaPikachuMinigame
 	dw .SGB_PokedexSearchOption
@@ -52,7 +52,7 @@
 	dw .SGB_TradeTube
 	dw .SGB_TrainerOrMonFrontpicPals
 	dw .SGB_MysteryGift
-	dw .SGB1e
+	dw .SGB_Unused1E
 
 .SGB_BattleGrayscale:
 	ld hl, PalPacket_BattleGrayscale
@@ -397,7 +397,7 @@
 	ld de, BlkPacket_AllPal0
 	ret
 
-.SGB0d:
+.SGB_Unused0D:
 .SGB_TrainerCard:
 	ld hl, PalPacket_Diploma
 	ld de, BlkPacket_AllPal0
@@ -437,7 +437,7 @@
 	ld de, wSGBPals + PALPACKET_LENGTH
 	ret
 
-.SGB1e:
+.SGB_Unused1E:
 	ld hl, PalPacket_Pal01
 	ld de, wSGBPals
 	ld bc, PALPACKET_LENGTH
@@ -450,7 +450,7 @@
 	add hl, hl
 	ld de, PokemonPalettes
 	add hl, de
-	ld a, [wcf65]
+	ld a, [wUnusedSGB1eColorOffset]
 	and 3
 	sla a
 	sla a
--- a/engine/gfx/sprite_anims.asm
+++ b/engine/gfx/sprite_anims.asm
@@ -357,7 +357,7 @@
 
 AnimSeq_SlotsChansey:
 	callfar Slots_AnimateChansey
-	ld hl, wcf64
+	ld hl, wSlotsDelay
 	ld a, [hl]
 	cp $2
 	ret nz
@@ -382,7 +382,7 @@
 	jr c, .move_right
 	call DeinitializeSprite
 	ld a, $4
-	ld [wcf64], a
+	ld [wSlotsDelay], a
 	ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
 	call PlaySFX
 	ret
@@ -819,7 +819,7 @@
 	ret
 
 AnimSeq_IntroUnownF:
-	ld a, [wcf64]
+	ld a, [wSlotsDelay]
 	cp $40
 	ret nz
 	ld a, SPRITE_ANIM_FRAMESET_INTRO_UNOWN_F_2
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -1062,14 +1062,13 @@
 	ld b, $ff
 	ret
 
-; These two texts were carried over from gen 1.
-; They are not used in gen 2, and are dummied out.
+; BallDodgedText and BallMissedText were used in Gen 1.
 
-BallDodgedText:
+BallDodgedText: ; unreferenced
 	text_far _BallDodgedText
 	text_end
 
-BallMissedText:
+BallMissedText: ; unreferenced
 	text_far _BallMissedText
 	text_end
 
@@ -1896,7 +1895,7 @@
 	ld [wBuffer5], a
 	ret
 
-LoadHPIntoBuffer5:
+LoadHPIntoBuffer5: ; unreferenced
 	ld a, d
 	ld [wBuffer6], a
 	ld a, e
@@ -1903,7 +1902,7 @@
 	ld [wBuffer5], a
 	ret
 
-LoadHPFromBuffer5:
+LoadHPFromBuffer5: ; unreferenced
 	ld a, [wBuffer6]
 	ld d, a
 	ld a, [wBuffer5]
@@ -2167,11 +2166,12 @@
 PokeFluteEffect:
 	ld a, [wBattleMode]
 	and a
-	jr nz, .dummy
-.dummy
+	jr nz, .in_battle
+	; overworld flute code was dummied out here
 
+.in_battle
 	xor a
-	ld [wd002], a
+	ld [wPokeFluteCuredSleep], a
 
 	ld b, $ff ^ SLP
 
@@ -2194,7 +2194,7 @@
 	and b
 	ld [hl], a
 
-	ld a, [wd002]
+	ld a, [wPokeFluteCuredSleep]
 	and a
 	ld hl, .PlayedFluteText
 	jp z, PrintText
@@ -2203,8 +2203,9 @@
 
 	ld a, [wLowHealthAlarm]
 	and 1 << DANGER_ON_F
-	jr nz, .dummy2
-.dummy2
+	jr nz, .dummy
+	; more code was dummied out here
+.dummy
 	ld hl, .FluteWakeUpText
 	jp PrintText
 
@@ -2211,14 +2212,13 @@
 .CureSleep:
 	ld de, PARTYMON_STRUCT_LENGTH
 	ld c, PARTY_LENGTH
-
 .loop
 	ld a, [hl]
 	push af
 	and SLP
 	jr z, .not_asleep
-	ld a, 1
-	ld [wd002], a
+	ld a, TRUE
+	ld [wPokeFluteCuredSleep], a
 .not_asleep
 	pop af
 	and b
@@ -2291,7 +2291,7 @@
 
 RestorePPEffect:
 	ld a, [wCurItem]
-	ld [wd002], a
+	ld [wTempRestorePPItem], a
 
 .loop
 	; Party Screen opens to choose on which mon to use the Item
@@ -2300,7 +2300,7 @@
 	jp c, PPRestoreItem_Cancel
 
 .loop2
-	ld a, [wd002]
+	ld a, [wTempRestorePPItem]
 	cp MAX_ELIXER
 	jp z, Elixer_RestorePPofAllMoves
 	cp ELIXER
@@ -2307,7 +2307,7 @@
 	jp z, Elixer_RestorePPofAllMoves
 
 	ld hl, RaiseThePPOfWhichMoveText
-	ld a, [wd002]
+	ld a, [wTempRestorePPItem]
 	cp PP_UP
 	jr z, .ppup
 	ld hl, RestoreThePPOfWhichMoveText
@@ -2338,7 +2338,7 @@
 	call CopyName1
 	pop hl
 
-	ld a, [wd002]
+	ld a, [wTempRestorePPItem]
 	cp PP_UP
 	jp nz, Not_PP_Up
 
@@ -2353,7 +2353,6 @@
 	jr c, .do_ppup
 
 .CantUsePPUpOnSketch:
-.pp_is_maxed_out
 	ld hl, PPIsMaxedOutText
 	call PrintText
 	jr .loop2
@@ -2488,7 +2487,7 @@
 	cp b
 	jr nc, .dont_restore
 
-	ld a, [wd002]
+	ld a, [wTempRestorePPItem]
 	cp MAX_ELIXER
 	jr z, .restore_all
 	cp MAX_ETHER
@@ -2650,16 +2649,17 @@
 	ld hl, ItemWontHaveEffectText
 	jr CantUseItemMessage
 
-BelongsToSomeoneElseMessage:
+BelongsToSomeoneElseMessage: ; unreferenced
 	ld hl, ItemBelongsToSomeoneElseText
 	jr CantUseItemMessage
 
-CyclingIsntAllowedMessage:
+CyclingIsntAllowedMessage: ; unreferenced
 	ld hl, NoCyclingText
 	jr CantUseItemMessage
 
-CantGetOnYourBikeMessage:
+CantGetOnYourBikeMessage: ; unreferenced
 	ld hl, ItemCantGetOnText
+	; fallthrough
 
 CantUseItemMessage:
 ; Item couldn't be used.
@@ -2711,11 +2711,11 @@
 	text_far _ItemUsedText
 	text_end
 
-ItemGotOnText:
+ItemGotOnText: ; unreferenced
 	text_far _ItemGotOnText
 	text_end
 
-ItemGotOffText:
+ItemGotOffText: ; unreferenced
 	text_far _ItemGotOffText
 	text_end
 
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -481,7 +481,7 @@
 	jr c, .done
 	cp ITEM_DC - (TM01 - 1) - 1
 	jr c, .skip_one
-.skip_two
+; skip two
 	inc a
 .skip_one
 	inc a
--- a/engine/items/pack.asm
+++ b/engine/items/pack.asm
@@ -1531,7 +1531,7 @@
 	dba PlaceMenuItemQuantity
 	dba UpdateItemDescription
 
-PackNoItemText:
+PackNoItemText: ; unreferenced
 	text_far _PackNoItemText
 	text_end
 
@@ -1571,7 +1571,7 @@
 	text_far _PackEmptyText
 	text_end
 
-YouCantUseItInABattleText:
+YouCantUseItInABattleText: ; unreferenced
 	text_far _YouCantUseItInABattleText
 	text_end
 
--- a/engine/items/tmhm.asm
+++ b/engine/items/tmhm.asm
@@ -159,7 +159,7 @@
 	and a
 	ret
 
-.unused
+.didnt_use ; unreferenced
 	ld a, 2
 	ld [wItemEffectSucceeded], a
 .learned_move
--- a/engine/link/init_list.asm
+++ b/engine/link/init_list.asm
@@ -44,9 +44,9 @@
 	ld a, h
 	ld [wListPointer + 1], a
 	ld a, e
-	ld [wUnusedD102], a
+	ld [wUnusedNamesPointer], a
 	ld a, d
-	ld [wUnusedD102 + 1], a
+	ld [wUnusedNamesPointer + 1], a
 	ld bc, ItemAttributes
 	ld a, c
 	ld [wItemAttributesPtr], a
--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -27,10 +27,11 @@
 	call PlaceString
 	call SetTradeRoomBGPals
 	call WaitBGMap2
-	ld hl, wcf5d
-	xor a ; LOW($5000)
+	ld hl, wLinkByteTimeout
+	assert LOW(SERIAL_LINK_BYTE_TIMEOUT) == 0
+	xor a ; LOW(SERIAL_LINK_BYTE_TIMEOUT)
 	ld [hli], a
-	ld [hl], HIGH($5000)
+	ld [hl], HIGH(SERIAL_LINK_BYTE_TIMEOUT)
 	ld a, [wLinkMode]
 	cp LINK_TIMECAPSULE
 	jp nz, Gen2ToGen2LinkComms
@@ -101,14 +102,14 @@
 	ld a, [hl]
 	pop hl
 	and a
-	jp z, Function28b22
+	jp z, ExitLinkCommunications
 	cp $7
-	jp nc, Function28b22
+	jp nc, ExitLinkCommunications
 	ld de, wLinkData
 	ld bc, $1a2
 	call Link_CopyOTData
-	ld de, wPlayerTrademonSpecies
-	ld hl, wTimeCapsulePartyMon1Species
+	ld de, wPlayerTrademon
+	ld hl, wTimeCapsulePlayerData
 	ld c, 2
 .loop
 	ld a, [de]
@@ -162,12 +163,12 @@
 
 .done_party
 	ld [de], a
-	ld hl, wTimeCapsulePartyMon1Species
-	call Function2868a
+	ld hl, wTimeCapsulePlayerData
+	call Link_ConvertPartyStruct1to2
 	ld a, LOW(wOTPartyMonOT)
-	ld [wUnusedD102], a
+	ld [wUnusedNamesPointer], a
 	ld a, HIGH(wOTPartyMonOT)
-	ld [wUnusedD102 + 1], a
+	ld [wUnusedNamesPointer + 1], a
 	ld de, MUSIC_NONE
 	call PlayMusic
 	ldh a, [hSerialConnectionStatus]
@@ -253,8 +254,8 @@
 	ld de, wLinkData
 	ld bc, $1b9
 	call Link_CopyOTData
-	ld de, wPlayerTrademonSpecies
-	ld hl, wLinkPlayerPartyMon1Species
+	ld de, wPlayerTrademon
+	ld hl, wLinkPlayerData
 	ld c, 2
 .loop1
 	ld a, [de]
@@ -407,9 +408,9 @@
 	ld bc, wOTPartyDataEnd - wOTPartyMons
 	call CopyBytes
 	ld a, LOW(wOTPartyMonOT)
-	ld [wUnusedD102], a
+	ld [wUnusedNamesPointer], a
 	ld a, HIGH(wOTPartyMonOT)
-	ld [wUnusedD102 + 1], a
+	ld [wUnusedNamesPointer + 1], a
 	ld de, MUSIC_NONE
 	call PlayMusic
 	ldh a, [hSerialConnectionStatus]
@@ -467,7 +468,7 @@
 	pop af
 	ld [wOptions], a
 	farcall LoadPokemonData
-	jp Function28b22
+	jp ExitLinkCommunications
 
 .ready_to_trade
 	ld de, MUSIC_ROUTE_30
@@ -510,6 +511,8 @@
 	text_end
 
 ExchangeBytes:
+; This is similar to Serial_ExchangeBytes,
+; but without a SERIAL_PREAMBLE_BYTE check.
 	ld a, TRUE
 	ldh [hSerialIgnoringInitialData], a
 .loop
@@ -520,9 +523,9 @@
 	ld b, a
 	inc hl
 	ld a, 48
-.delay_cycles
+.wait
 	dec a
-	jr nz, .delay_cycles
+	jr nz, .wait
 	ldh a, [hSerialIgnoringInitialData]
 	and a
 	ld a, b
@@ -584,7 +587,7 @@
 	ld [hli], a
 	dec b
 	jr nz, .loop3
-	ld hl, wTimeCapsulePartyMon1 - 1 + PARTY_LENGTH
+	ld hl, wTimeCapsulePlayerData - 1 + PARTY_LENGTH
 	ld de, wc612
 	lb bc, 0, 0
 .loop4
@@ -831,7 +834,7 @@
 ; Fill 5 bytes at wc9f4 with $20
 	ld de, wc9f4
 	ld a, $20
-	call Function28682
+	call Link_CopyMailPreamble
 
 ; Copy all the mail messages to wc9f9
 	ld a, BANK(sPartyMail)
@@ -932,7 +935,8 @@
 	ld [de], a
 	ret
 
-Function28682:
+Link_CopyMailPreamble:
+; fill 5 bytes with the value of a, starting at de
 	ld c, 5
 .loop
 	ld [de], a
@@ -941,7 +945,7 @@
 	jr nz, .loop
 	ret
 
-Function2868a:
+Link_ConvertPartyStruct1to2:
 	push hl
 	ld d, h
 	ld e, l
@@ -1245,7 +1249,7 @@
 .not_d_up
 	bit D_DOWN_F, a
 	jp z, LinkTradePartiesMenuMasterLoop
-	jp Function28ac9
+	jp LinkTradeCheckCancel
 
 LinkTrade_PlayerPartyMenu:
 	farcall InitMG_Mobile_LinkTradePalMap
@@ -1281,7 +1285,7 @@
 .check_joypad
 	bit A_BUTTON_F, a
 	jr z, .not_a_button
-	jp Function28926
+	jp LinkTrade_TradeStatsMenu
 
 .not_a_button
 	bit D_DOWN_F, a
@@ -1327,7 +1331,7 @@
 	jp z, LinkTradePartymonMenuLoop ; PARTYMON
 	jp LinkTradeOTPartymonMenuLoop  ; OTPARTYMON
 
-Function28926:
+LinkTrade_TradeStatsMenu:
 	call LoadTilemapToTempTilemap
 	ld a, [wMenuCursorY]
 	push af
@@ -1423,14 +1427,14 @@
 	pop af
 	ld [wMenuCursorY], a
 	dec a
-	ld [wd002], a
+	ld [wCurTradePartyMon], a
 	ld [wPlayerLinkAction], a
-	farcall Function16d6ce
+	farcall PrintWaitingTextAndSyncAndExchangeNybble
 	ld a, [wOtherPlayerLinkMode]
 	cp $f
 	jp z, InitTradeMenuDisplay
-	ld [wd003], a
-	call Function28b68
+	ld [wCurOTTradePartyMon], a
+	call LinkTradePlaceArrow
 	ld c, 100
 	call DelayFrames
 	farcall ValidateOTTrademon
@@ -1454,7 +1458,7 @@
 	xor a
 	ld [wcf57], a
 	ld [wOtherPlayerLinkAction], a
-	ld a, [wd003]
+	ld a, [wCurOTTradePartyMon]
 	ld hl, wOTPartySpecies
 	ld c, a
 	ld b, 0
@@ -1481,7 +1485,7 @@
 	call PlaceString
 	ld a, $1
 	ld [wPlayerLinkAction], a
-	farcall Function16d6ce
+	farcall PrintWaitingTextAndSyncAndExchangeNybble
 	ld c, 100
 	call DelayFrames
 	jp InitTradeMenuDisplay
@@ -1497,7 +1501,7 @@
 	text_far _LinkAbnormalMonText
 	text_end
 
-Function28ac9:
+LinkTradeCheckCancel:
 	ld a, [wMenuCursorY]
 	cp 1
 	jp nz, LinkTradePartiesMenuMasterLoop
@@ -1540,11 +1544,11 @@
 	ldcoord_a 9, 17
 	ld a, $f
 	ld [wPlayerLinkAction], a
-	farcall Function16d6ce
+	farcall PrintWaitingTextAndSyncAndExchangeNybble
 	ld a, [wOtherPlayerLinkMode]
 	cp $f
 	jr nz, .loop1
-Function28b22:
+ExitLinkCommunications:
 	call RotateThreePalettesRight
 	call ClearScreen
 	ld b, SCGB_DIPLOMA
@@ -1551,7 +1555,7 @@
 	call GetSGBLayout
 	call WaitBGMap2
 	xor a
-	ld [wcfbb], a
+	ld [wUnusedLinkCommunicationByte], a
 	xor a
 	ldh [rSB], a
 	ldh [hSerialSend], a
@@ -1561,15 +1565,18 @@
 	ldh [rSC], a
 	ret
 
-Function28b42: ; unreferenced
+GSPlaceTradeScreenFooter: ; unreferenced
+; Fill the screen footer with pattern tile
 	hlcoord 0, 16
-	ld a, "┘"
+	ld a, $7e
 	ld bc, 2 * SCREEN_WIDTH
 	call ByteFill
+; Clear out area for cancel string
 	hlcoord 1, 16
 	ld a, " "
 	ld bc, SCREEN_WIDTH - 2
 	call ByteFill
+; Place the string
 	hlcoord 2, 16
 	ld de, .CancelString
 	jp PlaceString
@@ -1577,7 +1584,8 @@
 .CancelString:
 	db "CANCEL@"
 
-Function28b68:
+LinkTradePlaceArrow:
+; Indicates which pokemon the other player has selected to trade
 	ld a, [wOtherPlayerLinkMode]
 	hlcoord 6, 9
 	ld bc, SCREEN_WIDTH
@@ -1610,7 +1618,7 @@
 	ld c, 18
 	call LinkTextboxAtHL
 	farcall Link_WaitBGMap
-	ld a, [wd002]
+	ld a, [wCurTradePartyMon]
 	ld hl, wPartySpecies
 	ld c, a
 	ld b, 0
@@ -1619,10 +1627,10 @@
 	ld [wNamedObjectIndexBuffer], a
 	call GetPokemonName
 	ld hl, wStringBuffer1
-	ld de, wd004
+	ld de, wBufferTrademonNick
 	ld bc, MON_NAME_LENGTH
 	call CopyBytes
-	ld a, [wd003]
+	ld a, [wCurOTTradePartyMon]
 	ld hl, wOTPartySpecies
 	ld c, a
 	ld b, 0
@@ -1638,7 +1646,7 @@
 	ld b, 3
 	ld c, 7
 	call LinkTextboxAtHL
-	ld de, String28eab
+	ld de, String_TradeCancel
 	hlcoord 12, 8
 	call PlaceString
 	ld a, 8
@@ -1666,12 +1674,12 @@
 	call WaitBGMap2
 	pop af
 	bit 1, a
-	jr nz, .asm_28c33
+	jr nz, .canceled
 	ld a, [wMenuCursorY]
 	dec a
-	jr z, .asm_28c54
+	jr z, .try_trade
 
-.asm_28c33
+.canceled
 	ld a, $1
 	ld [wPlayerLinkAction], a
 	hlcoord 0, 12
@@ -1681,16 +1689,17 @@
 	hlcoord 1, 14
 	ld de, String_TooBadTheTradeWasCanceled
 	call PlaceString
-	farcall Function16d6ce
-	jp Function28ea3
+	farcall PrintWaitingTextAndSyncAndExchangeNybble
+	jp InitTradeMenuDisplay_Delay
 
-.asm_28c54
+.try_trade
 	ld a, $2
 	ld [wPlayerLinkAction], a
-	farcall Function16d6ce
+	farcall PrintWaitingTextAndSyncAndExchangeNybble
 	ld a, [wOtherPlayerLinkMode]
 	dec a
-	jr nz, .asm_28c7b
+	jr nz, .do_trade
+; If we're here, the other player canceled the trade
 	hlcoord 0, 12
 	ld b, 4
 	ld c, 18
@@ -1698,11 +1707,11 @@
 	hlcoord 1, 14
 	ld de, String_TooBadTheTradeWasCanceled
 	call PlaceString
-	jp Function28ea3
+	jp InitTradeMenuDisplay_Delay
 
-.asm_28c7b
+.do_trade
 	ld hl, sPartyMail
-	ld a, [wd002]
+	ld a, [wCurTradePartyMon]
 	ld bc, MAIL_STRUCT_LENGTH
 	call AddNTimes
 	ld a, BANK(sPartyMail)
@@ -1711,20 +1720,20 @@
 	ld e, l
 	ld bc, MAIL_STRUCT_LENGTH
 	add hl, bc
-	ld a, [wd002]
+	ld a, [wCurTradePartyMon]
 	ld c, a
-.asm_28c96
+.copy_mail
 	inc c
 	ld a, c
 	cp PARTY_LENGTH
-	jr z, .asm_28ca6
+	jr z, .copy_player_data
 	push bc
 	ld bc, MAIL_STRUCT_LENGTH
 	call CopyBytes
 	pop bc
-	jr .asm_28c96
+	jr .copy_mail
 
-.asm_28ca6
+.copy_player_data
 	ld hl, sPartyMail
 	ld a, [wPartyCount]
 	dec a
@@ -1732,7 +1741,7 @@
 	call AddNTimes
 	push hl
 	ld hl, wc9f4
-	ld a, [wd003]
+	ld a, [wCurOTTradePartyMon]
 	ld bc, MAIL_STRUCT_LENGTH
 	call AddNTimes
 	pop de
@@ -1739,11 +1748,15 @@
 	ld bc, MAIL_STRUCT_LENGTH
 	call CopyBytes
 	call CloseSRAM
+
+; Buffer player data
+; nickname
 	ld hl, wPlayerName
 	ld de, wPlayerTrademonSenderName
 	ld bc, NAME_LENGTH
 	call CopyBytes
-	ld a, [wd002]
+; species
+	ld a, [wCurTradePartyMon]
 	ld hl, wPartySpecies
 	ld b, 0
 	ld c, a
@@ -1751,27 +1764,31 @@
 	ld a, [hl]
 	ld [wPlayerTrademonSpecies], a
 	push af
-	ld a, [wd002]
+; OT name
+	ld a, [wCurTradePartyMon]
 	ld hl, wPartyMonOT
 	call SkipNames
 	ld de, wPlayerTrademonOTName
 	ld bc, NAME_LENGTH
 	call CopyBytes
+; ID
 	ld hl, wPartyMon1ID
-	ld a, [wd002]
+	ld a, [wCurTradePartyMon]
 	call GetPartyLocation
 	ld a, [hli]
 	ld [wPlayerTrademonID], a
 	ld a, [hl]
 	ld [wPlayerTrademonID + 1], a
+; DVs
 	ld hl, wPartyMon1DVs
-	ld a, [wd002]
+	ld a, [wCurTradePartyMon]
 	call GetPartyLocation
 	ld a, [hli]
 	ld [wPlayerTrademonDVs], a
 	ld a, [hl]
 	ld [wPlayerTrademonDVs + 1], a
-	ld a, [wd002]
+; caught data
+	ld a, [wCurTradePartyMon]
 	ld hl, wPartyMon1Species
 	call GetPartyLocation
 	ld b, h
@@ -1779,11 +1796,15 @@
 	farcall GetCaughtGender
 	ld a, c
 	ld [wPlayerTrademonCaughtData], a
+
+; Buffer other player data
+; nickname
 	ld hl, wOTPlayerName
 	ld de, wOTTrademonSenderName
 	ld bc, NAME_LENGTH
 	call CopyBytes
-	ld a, [wd003]
+; species
+	ld a, [wCurOTTradePartyMon]
 	ld hl, wOTPartySpecies
 	ld b, 0
 	ld c, a
@@ -1790,27 +1811,31 @@
 	add hl, bc
 	ld a, [hl]
 	ld [wOTTrademonSpecies], a
-	ld a, [wd003]
+; OT name
+	ld a, [wCurOTTradePartyMon]
 	ld hl, wOTPartyMonOT
 	call SkipNames
 	ld de, wOTTrademonOTName
 	ld bc, NAME_LENGTH
 	call CopyBytes
+; ID
 	ld hl, wOTPartyMon1ID
-	ld a, [wd003]
+	ld a, [wCurOTTradePartyMon]
 	call GetPartyLocation
 	ld a, [hli]
 	ld [wOTTrademonID], a
 	ld a, [hl]
 	ld [wOTTrademonID + 1], a
+; DVs
 	ld hl, wOTPartyMon1DVs
-	ld a, [wd003]
+	ld a, [wCurOTTradePartyMon]
 	call GetPartyLocation
 	ld a, [hli]
 	ld [wOTTrademonDVs], a
 	ld a, [hl]
 	ld [wOTTrademonDVs + 1], a
-	ld a, [wd003]
+; caught data
+	ld a, [wCurOTTradePartyMon]
 	ld hl, wOTPartyMon1Species
 	call GetPartyLocation
 	ld b, h
@@ -1818,7 +1843,8 @@
 	farcall GetCaughtGender
 	ld a, c
 	ld [wOTTrademonCaughtData], a
-	ld a, [wd002]
+
+	ld a, [wCurTradePartyMon]
 	ld [wCurPartyMon], a
 	ld hl, wPartySpecies
 	ld b, 0
@@ -1825,7 +1851,8 @@
 	ld c, a
 	add hl, bc
 	ld a, [hl]
-	ld [wd002], a
+	ld [wCurTradePartyMon], a
+
 	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	callfar RemoveMonFromPartyOrBox
@@ -1834,7 +1861,7 @@
 	ld [wCurPartyMon], a
 	ld a, TRUE
 	ld [wForceEvolution], a
-	ld a, [wd003]
+	ld a, [wCurOTTradePartyMon]
 	push af
 	ld hl, wOTPartySpecies
 	ld b, 0
@@ -1841,7 +1868,8 @@
 	ld c, a
 	add hl, bc
 	ld a, [hl]
-	ld [wd003], a
+	ld [wCurOTTradePartyMon], a
+
 	ld c, 100
 	call DelayFrames
 	call ClearTilemap
@@ -1933,7 +1961,7 @@
 	ld c, 18
 	call LinkTextboxAtHL
 	hlcoord 1, 14
-	ld de, String28ebd
+	ld de, String_TradeCompleted
 	call PlaceString
 	farcall Link_WaitBGMap
 	ld c, 50
@@ -1943,12 +1971,12 @@
 	jp z, Gen2ToGen1LinkComms
 	jp Gen2ToGen2LinkComms
 
-Function28ea3:
+InitTradeMenuDisplay_Delay:
 	ld c, 100
 	call DelayFrames
 	jp InitTradeMenuDisplay
 
-String28eab:
+String_TradeCancel:
 	db   "TRADE"
 	next "CANCEL@"
 
@@ -1956,7 +1984,7 @@
 	text_far _LinkAskTradeForText
 	text_end
 
-String28ebd:
+String_TradeCompleted:
 	db   "Trade completed!@"
 
 String_TooBadTheTradeWasCanceled:
@@ -2248,7 +2276,7 @@
 	ld a, $1
 	ld [wPlayerLinkAction], a
 	ld hl, wLinkTimeoutFrames
-	ld a, $3
+	ld a, 3
 	ld [hli], a
 	xor a
 	ld [hl], a
--- a/engine/link/link_trade.asm
+++ b/engine/link/link_trade.asm
@@ -15,7 +15,7 @@
 	call CopyBytes
 	ret
 
-Function16d43b:
+Function16d43b: ; unreferenced
 	call LoadStandardMenuHeader
 	call ClearBGPalettes
 	call ClearTilemap
@@ -153,15 +153,15 @@
 	call _LinkTextbox
 	ret
 
-Function16d6ce:
+PrintWaitingTextAndSyncAndExchangeNybble:
 	call LoadStandardMenuHeader
-	call Function16d6e1
+	call .PrintWaitingText
 	farcall WaitLinkTransfer
 	call Call_ExitMenu
 	call WaitBGMap2
 	ret
 
-Function16d6e1:
+.PrintWaitingText:
 	hlcoord 4, 10
 	ld b, 1
 	ld c, 10
--- a/engine/link/mystery_gift.asm
+++ b/engine/link/mystery_gift.asm
@@ -1,3 +1,29 @@
+; hMGRole values
+IR_RECEIVER EQU 1
+IR_SENDER   EQU 2
+
+; hMGStatusFlags error bits
+MG_WRONG_CHECKSUM_F EQU 0
+MG_TIMED_OUT_F      EQU 1
+MG_CANCELED_F       EQU 4
+MG_WRONG_PREFIX_F   EQU 7
+
+; hMGStatusFlags values
+MG_WRONG_CHECKSUM EQU 1 << MG_WRONG_CHECKSUM_F
+MG_TIMED_OUT      EQU 1 << MG_TIMED_OUT_F
+MG_CANCELED       EQU 1 << MG_CANCELED_F
+MG_WRONG_PREFIX   EQU 1 << MG_WRONG_PREFIX_F
+MG_NOT_OKAY       EQU MG_WRONG_CHECKSUM | MG_TIMED_OUT | MG_CANCELED | MG_WRONG_PREFIX
+MG_OKAY           EQU $ff ^ MG_NOT_OKAY
+MG_START_END      EQU %11111111
+
+REGION_PREFIX EQU $96
+REGION_CODE   EQU $90 ; USA
+
+MESSAGE_PREFIX EQU $5a
+
+NAME_CARD_PREFIX EQU $3c
+
 DoMysteryGift:
 	call ClearTilemap
 	call ClearSprites
@@ -7,22 +33,24 @@
 	ld de, .String_PressAToLink_BToCancel
 	call PlaceString
 	call WaitBGMap
-	farcall PrepMysteryGiftDataToSend
-	call MysteryGift_ClearTrainerData
-	ld a, $2
-	ld [wca01], a
-	ld a, $14
-	ld [wca02], a
-	ldh a, [rIE]
-	push af
 
-	call Function104a95
+	; Prepare the first of two messages for wMysteryGiftPartnerData
+	farcall StageDataForMysteryGift
+	call ClearMysteryGiftTrainer
+	ld a, 2
+	ld [wMysteryGiftMessageCount], a
+	ld a, wMysteryGiftPartnerDataEnd - wMysteryGiftPartnerData
+	ld [wMysteryGiftStagedDataLength], a
 
+	ldh a, [rIE]
+	push af
+	call ExchangeMysteryGiftData
 	ld d, a
 	xor a
 	ldh [rIF], a
 	pop af
 	ldh [rIE], a
+
 	push de
 	call ClearTilemap
 	call EnableLCD
@@ -31,15 +59,16 @@
 	call GetSGBLayout
 	call SetPalettes
 	pop de
+
 	hlcoord 2, 8
 	ld a, d
 	ld de, .MysteryGiftCanceledText ; Link has been canceled
-	cp $10
+	cp MG_CANCELED
 	jp z, .LinkCanceled
-	cp $6c
+	cp MG_OKAY
 	jp nz, .CommunicationError
-	ld a, [wc900]
-	cp 3
+	ld a, [wMysteryGiftGameVersion]
+	cp POKEMON_PIKACHU_2_VERSION
 	jr z, .skip_checks
 	call .CheckAlreadyGotFiveGiftsToday
 	ld hl, .MysteryGiftFiveADayText ; Only 5 gifts a day
@@ -54,12 +83,12 @@
 	ld a, [wMysteryGiftPartnerBackupItem]
 	and a
 	jp nz, .FriendNotReady
-	ld a, [wc900]
-	cp 3
+	ld a, [wMysteryGiftGameVersion]
+	cp POKEMON_PIKACHU_2_VERSION
 	jr z, .skip_append_save
 	call .AddMysteryGiftPartnerID
-	ld a, [wc900]
-	cp 4
+	ld a, [wMysteryGiftGameVersion]
+	cp 4 ; ???
 	jr z, .skip_append_save
 	call .SaveMysteryGiftTrainerName
 	farcall RestoreMobileEventIndex
@@ -68,14 +97,16 @@
 .skip_append_save
 	ld a, [wMysteryGiftPartnerSentDeco]
 	and a
-	jr z, .item
+	jr z, .SentItem
+; sent decoration
 	ld a, [wMysteryGiftPartnerWhichDeco]
 	ld c, a
 	farcall MysteryGiftGetDecoration
 	push bc
-	call MysteryGift_CheckAndSetDecorationAlreadyReceived
+	call CheckAndSetMysteryGiftDecorationAlreadyReceived
 	pop bc
-	jr nz, .item
+	jr nz, .SentItem
+; keep the decoration if it wasn't already received
 	callfar GetDecorationName_c
 	ld h, d
 	ld l, e
@@ -85,17 +116,17 @@
 	ld hl, .MysteryGiftSentHomeText ; sent decoration to home
 	jr .PrintTextAndExit
 
-.item
+.SentItem:
 	call GetMysteryGiftBank
 	ld a, [wMysteryGiftPartnerWhichItem]
 	ld c, a
-	farcall MysteryGiftGetItemHeldEffect
+	farcall MysteryGiftGetItem
 	ld a, c
 	ld [sBackupMysteryGiftItem], a
 	ld [wNamedObjectIndexBuffer], a
 	call CloseSRAM
 	call GetItemName
-	ld hl, .MysteryGiftSentText ; sent item
+	ld hl, .MysteryGiftSentText ; sent item/decoration
 	jr .PrintTextAndExit
 
 .LinkCanceled:
@@ -113,6 +144,7 @@
 
 .FriendNotReady:
 	ld hl, .YourFriendIsNotReadyText ; friend not ready
+	; fallthrough
 
 .PrintTextAndExit:
 	call PrintText
@@ -162,7 +194,7 @@
 .CheckAlreadyGotFiveGiftsToday:
 	call GetMysteryGiftBank
 	ld a, [sNumDailyMysteryGiftPartnerIDs]
-	cp $5
+	cp MAX_MYSTERY_GIFT_PARTNERS
 	jp CloseSRAM
 
 .CheckAlreadyGotAGiftFromThatPerson:
@@ -198,9 +230,9 @@
 	ld hl, sNumDailyMysteryGiftPartnerIDs
 	ld a, [hl]
 	inc [hl]
-	ld hl, sDailyMysteryGiftPartnerIDs ; inc hl
+	ld hl, sDailyMysteryGiftPartnerIDs ; could have done "inc hl" instead
 	ld e, a
-	ld d, $0
+	ld d, 0
 	add hl, de
 	add hl, de
 	ld a, [wMysteryGiftPartnerID]
@@ -211,226 +243,268 @@
 
 .SaveMysteryGiftTrainerName:
 	call GetMysteryGiftBank
-	ld a, $1
+	ld a, TRUE
 	ld [sMysteryGiftTrainerHouseFlag], a
 	ld hl, wMysteryGiftPartnerName
 	ld de, sMysteryGiftPartnerName
 	ld bc, NAME_LENGTH
 	call CopyBytes
-	ld a, $1
+	assert sMysteryGiftPartnerName + NAME_LENGTH == sMysteryGiftUnusedFlag
+	ld a, TRUE
 	ld [de], a
 	inc de
-	ld hl, wMysteryGiftTrainerData
-	ld bc, (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 2
+	assert sMysteryGiftUnusedFlag + 1 == sMysteryGiftTrainer
+	ld hl, wMysteryGiftTrainer
+	ld bc, wMysteryGiftTrainerEnd - wMysteryGiftTrainer
 	call CopyBytes
 	jp CloseSRAM
 
-Function104a95:
+ExchangeMysteryGiftData:
 	di
 	farcall ClearChannels
-	call Function104d5e
+	call InitializeIRCommunicationInterrupts
 
-.loop2
-	call Function104d96
-	call Function104ddd
+.restart
+	call BeginIRCommunication
+	call InitializeIRCommunicationRoles
 	ldh a, [hMGStatusFlags]
-	cp $10
-	jp z, Function104bd0
-	cp $6c
-	jr nz, .loop2
+	cp MG_CANCELED
+	jp z, EndOrContinueMysteryGiftIRCommunication
+	cp MG_OKAY
+	jr nz, .restart
 
-	ldh a, [hPrintNumBuffer + 8]
-	cp $2
-	jr z, Function104b22
-	ld hl, hPrintNumBuffer
-	ld b, $1
-	call Function104d56
-	jr nz, .ly_loop
-	call Function104b49
-	jp nz, Function104bd0
-	jr Function104b0a
+	ldh a, [hMGRole]
+	cp IR_SENDER
+	jr z, SenderExchangeMysteryGiftDataPayloads
+; receiver
+	ld hl, hMGExchangedByte
+	ld b, 1
+	call TryReceivingIRDataBlock
+	jr nz, .failed
+	call ReceiveMysteryGiftDataPayload_GotRegionPrefix
+	jp nz, EndOrContinueMysteryGiftIRCommunication
+	jr ReceiverExchangeMysteryGiftDataPayloads_GotPayload
+
+.failed
 	; Delay frame
-.ly_loop
+.wait_frame
 	ldh a, [rLY]
 	cp LY_VBLANK
-	jr c, .ly_loop
+	jr c, .wait_frame
+
 	ld c, LOW(rRP)
-	ld a, $c0
+	ld a, rRP_ENABLE_READ_MASK
 	ldh [c], a
-	ld b, 240 ; This might have been intended as a 4-second timeout buffer.
-	          ; However, it is reset with each frame.
-.loop3
-	push bc
-	call MysteryGift_ReadJoypad
 
-	ld b, $2
+	ld b, 60 * 4 ; 4 seconds
+.continue
+	push bc
+	call MysteryGift_UpdateJoypad
+	ld b, 1 << rRP_RECEIVING
 	ld c, LOW(rRP)
-	; Delay frame
-.ly_loop2
+.in_vblank
 	ldh a, [c]
 	and b
 	ld b, a
 	ldh a, [rLY]
 	cp LY_VBLANK
-	jr nc, .ly_loop2
-.ly_loop3
+	jr nc, .in_vblank
+.wait_vblank
 	ldh a, [c]
 	and b
 	ld b, a
 	ldh a, [rLY]
 	cp LY_VBLANK
-	jr c, .ly_loop3
-
+	jr c, .wait_vblank
 	ld a, b
 	pop bc
+	; Restart if the 4-second timeout has elapsed
 	dec b
-	jr z, .loop2 ; we never jump here
+	jr z, .restart
+	; Restart if rRP is not receiving data
 	or a
-	jr nz, .loop2
-	; Check if we've pressed the B button
+	jr nz, .restart
+	; Check if we've pressed the B button to cancel
 	ldh a, [hMGJoypadReleased]
 	bit B_BUTTON_F, a
-	jr z, .loop3
-	ld a, $10
+	jr z, .continue
+	ld a, MG_CANCELED
 	ldh [hMGStatusFlags], a
-	jp Function104bd0
+	jp EndOrContinueMysteryGiftIRCommunication
 
-Function104b04:
-	call Function104b40
-	jp nz, Function104bd0
-Function104b0a:
-	call Function104d38
-	jp nz, Function104bd0
-	call Function104b88
-	jp nz, Function104bd0
-	call Function104d43
-	jp nz, Function104bd0
-	call Function105033
-	jp Function104bd0
+ReceiverExchangeMysteryGiftDataPayloads:
+	; Receive the data payload
+	call ReceiveMysteryGiftDataPayload
+	jp nz, EndOrContinueMysteryGiftIRCommunication
+	; fallthrough
+ReceiverExchangeMysteryGiftDataPayloads_GotPayload:
+	; Switch roles
+	call BeginSendingIRCommunication
+	jp nz, EndOrContinueMysteryGiftIRCommunication
+	; Send the data payload
+	call SendMysteryGiftDataPayload
+	jp nz, EndOrContinueMysteryGiftIRCommunication
+	; Switch roles
+	call BeginReceivingIRCommunication
+	jp nz, EndOrContinueMysteryGiftIRCommunication
+	; Receive an empty block
+	call ReceiveEmptyIRDataBlock
+	jp EndOrContinueMysteryGiftIRCommunication
 
-Function104b22:
-	call Function104b88
-	jp nz, Function104bd0
-	call Function104d43
-	jp nz, Function104bd0
-	call Function104b40
-	jp nz, Function104bd0
-	call Function104d38
-	jp nz, Function104bd0
-	call Function10502e
-	jp Function104bd0
+SenderExchangeMysteryGiftDataPayloads:
+	; Send the data payload
+	call SendMysteryGiftDataPayload
+	jp nz, EndOrContinueMysteryGiftIRCommunication
+	; Switch roles
+	call BeginReceivingIRCommunication
+	jp nz, EndOrContinueMysteryGiftIRCommunication
+	; Receive the data payload
+	call ReceiveMysteryGiftDataPayload
+	jp nz, EndOrContinueMysteryGiftIRCommunication
+	; Switch roles
+	call BeginSendingIRCommunication
+	jp nz, EndOrContinueMysteryGiftIRCommunication
+	; Send an empty block
+	call SendEmptyIRDataBlock
+	jp EndOrContinueMysteryGiftIRCommunication
 
-Function104b40:
-	ld hl, hPrintNumBuffer
-	ld b, $1
-	call Function104d56
+ReceiveMysteryGiftDataPayload:
+	; Receive the region prefix
+	ld hl, hMGExchangedByte
+	ld b, 1
+	call TryReceivingIRDataBlock
 	ret nz
-
-Function104b49:
-	call Function105033
+	; fallthrough
+ReceiveMysteryGiftDataPayload_GotRegionPrefix:
+	; Receive an empty block
+	call ReceiveEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret nz
-	ldh a, [hPrintNumBuffer]
-	cp $96
-	jp nz, Function104d32
-	ld a, $90
-	ldh [hPrintNumBuffer], a
-	call Function104d38
+	; Verify the received region prefix
+	ldh a, [hMGExchangedByte]
+	cp REGION_PREFIX
+	jp nz, WrongMysteryGiftRegion
+	ld a, REGION_CODE
+	ldh [hMGExchangedByte], a
+	; Switch roles
+	call BeginSendingIRCommunication
 	ret nz
-	ld hl, hPrintNumBuffer
-	ld b, $1
-	call Function104d4e
+	; Send the region code
+	ld hl, hMGExchangedByte
+	ld b, 1
+	call TrySendingIRDataBlock
 	ret nz
-	call Function10502e
+	; Send an empty block
+	call SendEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret nz
-	call Function104d43
+	; Switch roles
+	call BeginReceivingIRCommunication
 	ret nz
-	ld hl, wMysteryGiftTrainerData
-	ld a, [wca02]
+	; Receive the staged data
+	ld hl, wMysteryGiftTrainer
+	ld a, [wMysteryGiftStagedDataLength]
 	ld b, a
-	call Function104d56
+	call TryReceivingIRDataBlock
 	ret nz
-	call Function105033
+	; Receive an empty block
+	call ReceiveEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret
 
-Function104b88:
-	ld a, $96
-	ldh [hPrintNumBuffer], a
-	ld hl, hPrintNumBuffer
-	ld b, $1
-	call Function104d4e
+SendMysteryGiftDataPayload:
+	; Send the region prefix
+	ld a, REGION_PREFIX
+	ldh [hMGExchangedByte], a
+	ld hl, hMGExchangedByte
+	ld b, 1
+	call TrySendingIRDataBlock
 	ret nz
-	call Function10502e
+	; Send an empty block
+	call SendEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret nz
-	call Function104d43
+	; Switch roles
+	call BeginReceivingIRCommunication
 	ret nz
-	ld hl, hPrintNumBuffer
-	ld b, $1
-	call Function104d56
+	; Receive the region code
+	ld hl, hMGExchangedByte
+	ld b, 1
+	call TryReceivingIRDataBlock
 	ret nz
-	call Function105033
+	; Receive an empty block
+	call ReceiveEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret nz
-	ldh a, [hPrintNumBuffer]
-	cp $90
-	jp nz, Function104d32
-	call Function104d38
+	; Verify the received region code
+	ldh a, [hMGExchangedByte]
+	cp REGION_CODE
+	jp nz, WrongMysteryGiftRegion
+	; Switch roles
+	call BeginSendingIRCommunication
 	ret nz
-	ld hl, wLinkData
-	ld a, [wca02]
+	; Send the staged data
+	ld hl, wMysteryGiftStaging
+	ld a, [wMysteryGiftStagedDataLength]
 	ld b, a
-	call Function104d4e
+	call TrySendingIRDataBlock
 	ret nz
-	call Function10502e
+	; Send an empty block
+	call SendEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret
 
-Function104bd0:
+EndOrContinueMysteryGiftIRCommunication:
 	nop
 	ldh a, [hMGStatusFlags]
-	cp $10
+	; Quit if player canceled
+	cp MG_CANCELED
 	jr z, .quit
-	cp $6c
+	; Quit if there was a communication error
+	cp MG_OKAY
 	jr nz, .quit
-	ld hl, wca01
+	; Quit if all messages are sent/received
+	ld hl, wMysteryGiftMessageCount
 	dec [hl]
 	jr z, .quit
-	ld hl, wMysteryGiftTrainerData
+	; Quit if communicating with Pokémon Pikachu 2 device
+	ld hl, wMysteryGiftTrainer
 	ld de, wMysteryGiftPartnerData
 	ld bc, wMysteryGiftPartnerDataEnd - wMysteryGiftPartnerData
 	call CopyBytes
-	ld a, [wMysteryGiftTrainerData]
-	cp $3
+	ld a, [wMysteryGiftTrainer] ; first byte is the version
+	cp POKEMON_PIKACHU_2_VERSION
 	jr nc, .quit
+
+	; Prepare the second message for wMysteryGiftTrainer
 	farcall StagePartyDataForMysteryGift
-	call MysteryGift_ClearTrainerData
-	ld a, $26
-	ld [wca02], a
-	ldh a, [hPrintNumBuffer + 8]
-	cp $2
-	jr z, .asm_104c10
-	call Function104d43
-	jr nz, Function104bd0
-	jp Function104b04
+	call ClearMysteryGiftTrainer
+	ld a, wMysteryGiftTrainerEnd - wMysteryGiftTrainer
+	ld [wMysteryGiftStagedDataLength], a
 
-.asm_104c10
-	call Function104d38
-	jr nz, Function104bd0
-	jp Function104b22
+	ldh a, [hMGRole]
+	cp IR_SENDER
+	jr z, .sender
+; receiver
+	call BeginReceivingIRCommunication
+	jr nz, EndOrContinueMysteryGiftIRCommunication
+	jp ReceiverExchangeMysteryGiftDataPayloads
 
+.sender
+	call BeginSendingIRCommunication
+	jr nz, EndOrContinueMysteryGiftIRCommunication
+	jp SenderExchangeMysteryGiftDataPayloads
+
 .quit
 	ldh a, [hMGStatusFlags]
 	push af
-	call Function104da0
+	call EndIRCommunication
 	xor a
 	ldh [rIF], a
 	ldh a, [rIE]
@@ -441,121 +515,153 @@
 	pop af
 	ret
 
-Function104c2d:
+ExchangeNameCardData:
 	di
 	farcall ClearChannels
-	call Function104d5e
-.asm_104c37
-	call Function104d96
-	call Function104ddd
+	call InitializeIRCommunicationInterrupts
+
+.restart
+	call BeginIRCommunication
+	call InitializeIRCommunicationRoles
 	ldh a, [hMGStatusFlags]
-	cp $10
-	jp z, Function104d1c
-	cp $6c
-	jr nz, .asm_104c37
-	ldh a, [hPrintNumBuffer + 8]
-	cp $2
-	jr z, .asm_104c6c
-	call Function104c8a
-	jp nz, Function104d1c
-	call Function104d38
-	jp nz, Function104d1c
-	call Function104cd2
-	jp nz, Function104d1c
-	call Function104d43
-	jp nz, Function104d1c
-	call Function105033
-	jp Function104d1c
-.asm_104c6c
-	call Function104cd2
-	jp nz, Function104d1c
-	call Function104d43
-	jp nz, Function104d1c
-	call Function104c8a
-	jp nz, Function104d1c
-	call Function104d38
-	jp nz, Function104d1c
-	call Function10502e
-	jp Function104d1c
+	cp MG_CANCELED
+	jp z, EndNameCardIRCommunication
+	cp MG_OKAY
+	jr nz, .restart
 
-Function104c8a:
-	ld hl, hPrintNumBuffer
-	ld b, $1
-	call Function104d56
+	ldh a, [hMGRole]
+	cp IR_SENDER
+	jr z, .sender
+; receiver
+	; Receive the data payload
+	call ReceiveNameCardDataPayload
+	jp nz, EndNameCardIRCommunication
+	; Switch roles
+	call BeginSendingIRCommunication
+	jp nz, EndNameCardIRCommunication
+	; Send the data payload
+	call SendNameCardDataPayload
+	jp nz, EndNameCardIRCommunication
+	; Switch roles
+	call BeginReceivingIRCommunication
+	jp nz, EndNameCardIRCommunication
+	; Receive an empty block
+	call ReceiveEmptyIRDataBlock
+	jp EndNameCardIRCommunication
+
+.sender
+	; Send the data payload
+	call SendNameCardDataPayload
+	jp nz, EndNameCardIRCommunication
+	; Switch roles
+	call BeginReceivingIRCommunication
+	jp nz, EndNameCardIRCommunication
+	; Receive the data payload
+	call ReceiveNameCardDataPayload
+	jp nz, EndNameCardIRCommunication
+	; Switch roles
+	call BeginSendingIRCommunication
+	jp nz, EndNameCardIRCommunication
+	; Send an empty block
+	call SendEmptyIRDataBlock
+	jp EndNameCardIRCommunication
+
+ReceiveNameCardDataPayload:
+	; Receive the Name Card prefix
+	ld hl, hMGExchangedByte
+	ld b, 1
+	call TryReceivingIRDataBlock
 	ret nz
-	call Function105033
+	; Receive an empty block
+	call ReceiveEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret nz
-	ldh a, [hPrintNumBuffer]
-	cp $3c
-	jp nz, Function104d32
+	; Verify the received Name Card prefix
+	ldh a, [hMGExchangedByte]
+	cp NAME_CARD_PREFIX
+	jp nz, WrongMysteryGiftRegion
 	swap a
-	ldh [hPrintNumBuffer], a
-	call Function104d38
+	ldh [hMGExchangedByte], a
+	; Switch roles
+	call BeginSendingIRCommunication
 	ret nz
-	ld hl, hPrintNumBuffer
-	ld b, $1
-	call Function104d4e
+	; Send the swapped Name Card prefix
+	ld hl, hMGExchangedByte
+	ld b, 1
+	call TrySendingIRDataBlock
 	ret nz
-	call Function10502e
+	; Send an empty block
+	call SendEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret nz
-	call Function104d43
+	; Switch roles
+	call BeginReceivingIRCommunication
 	ret nz
-	ld hl, wMysteryGiftTrainerData
-	ld a, [wca02]
+	; Receive the staged data
+	ld hl, wNameCardData
+	ld a, [wMysteryGiftStagedDataLength]
 	ld b, a
-	call Function104d56
+	call TryReceivingIRDataBlock
 	ret nz
-	call Function105033
+	; Receive an empty block
+	call ReceiveEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret
 
-Function104cd2:
-	ld a, $3c
-	ldh [hPrintNumBuffer], a
-	ld hl, hPrintNumBuffer
-	ld b, $1
-	call Function104d4e
+SendNameCardDataPayload:
+	; Send the Name Card prefix
+	ld a, NAME_CARD_PREFIX
+	ldh [hMGExchangedByte], a
+	ld hl, hMGExchangedByte
+	ld b, 1
+	call TrySendingIRDataBlock
 	ret nz
-	call Function10502e
+	; Send an empty block
+	call SendEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret nz
-	call Function104d43
+	; Switch roles
+	call BeginReceivingIRCommunication
 	ret nz
-	ld hl, hPrintNumBuffer
-	ld b, $1
-	call Function104d56
+	; Receive the swapped Name Card prefix
+	ld hl, hMGExchangedByte
+	ld b, 1
+	call TryReceivingIRDataBlock
 	ret nz
-	call Function105033
+	; Receive an empty block
+	call ReceiveEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret nz
-	ldh a, [hPrintNumBuffer]
+	; Verify the received swapped Name Card prefix
+	ldh a, [hMGExchangedByte]
 	swap a
-	cp $3c
-	jp nz, Function104d32
-	call Function104d38
+	cp NAME_CARD_PREFIX
+	jp nz, WrongMysteryGiftRegion
+	; Switch roles
+	call BeginSendingIRCommunication
 	ret nz
-	ld hl, wLinkData
-	ld a, [wca02]
+	; Send the staged data
+	ld hl, wMysteryGiftStaging
+	ld a, [wMysteryGiftStagedDataLength]
 	ld b, a
-	call Function104d4e
+	call TrySendingIRDataBlock
 	ret nz
-	call Function10502e
+	; Send an empty block
+	call SendEmptyIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret
 
-Function104d1c:
+EndNameCardIRCommunication:
 	nop
 	ldh a, [hMGStatusFlags]
 	push af
-	call Function104da0
+	call EndIRCommunication
 	xor a
 	ldh [rIF], a
 	ldh a, [rIE]
@@ -566,46 +672,46 @@
 	pop af
 	ret
 
-Function104d32:
-	ld a, $80
+WrongMysteryGiftRegion:
+	ld a, MG_WRONG_PREFIX
 	ldh [hMGStatusFlags], a
 	and a
 	ret
 
-Function104d38:
-	call Function104d96
-	call Function104e46
+BeginSendingIRCommunication:
+	call BeginIRCommunication
+	call SendIRHelloMessage
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret
 
-Function104d43:
-	call Function104d96
-	call Function104dfe
+BeginReceivingIRCommunication:
+	call BeginIRCommunication
+	call ReceiveIRHelloMessage
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret
 
-Function104d4e:
-	call Function104e93
+TrySendingIRDataBlock:
+	call SendIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret
 
-Function104d56:
-	call Function104f57
+TryReceivingIRDataBlock:
+	call ReceiveIRDataBlock
 	ldh a, [hMGStatusFlags]
-	cp $6c
+	cp MG_OKAY
 	ret
 
-Function104d5e:
-	call Function104d74
+InitializeIRCommunicationInterrupts:
+	call StartFastIRTimer
 	ld a, 1 << TIMER
 	ldh [rIE], a
 	xor a
 	ldh [rIF], a
-	call Function104d96
-; runs for ~$40400 cycles
+	call BeginIRCommunication
+; waits for ~$40400 cycles = ~0.25 seconds
 	xor a
 	ld b, a
 .busy_wait
@@ -615,44 +721,48 @@
 	jr nz, .busy_wait
 	ret
 
-Function104d74:
+StartFastIRTimer:
+; Starts a 65,536 Hz timer that interrupts every 3 increments (21,845 Hz).
 	xor a
 	ldh [rTAC], a
-	ld a, $fe
+	ld a, -2
 	ldh [rTMA], a
 	ldh [rTIMA], a
-	ld a, $2
+	ld a, rTAC_65536_HZ
 	ldh [rTAC], a
-	or $4
+	or 1 << rTAC_ON
 	ldh [rTAC], a
 	ret
 
-Function104d86:
+StartSlowIRTimer:
+; Starts a 65,536 Hz timer that interrupts every 256 increments (256 Hz).
 	xor a
 	ldh [rTAC], a
 	ldh [rTMA], a
 	ldh [rTIMA], a
-	ld a, $2
+	ld a, rTAC_65536_HZ
 	ldh [rTAC], a
-	or $4
+	or 1 << rTAC_ON
 	ldh [rTAC], a
 	ret
 
-Function104d96:
-	ld a, $c0
-	call Function104e8c
-	ld a, $1
-	ldh [hPrintNumBuffer + 8], a
+BeginIRCommunication:
+	ld a, rRP_ENABLE_READ_MASK
+	call ToggleIRCommunication
+	ld a, IR_RECEIVER
+	ldh [hMGRole], a
 	ret
 
-Function104da0:
+EndIRCommunication:
 	xor a
-	call Function104e8c
-	ld a, $2
+	call ToggleIRCommunication
+	ld a, rTAC_65536_HZ
 	ldh [rTAC], a
 	ret
 
-Function104da9:
+ReceiveInfraredLEDOn:
+; Count interrupts of the partner's IR LED on; quit after 256-d interrupts.
+.recv_loop
 	inc d
 	ret z
 	xor a
@@ -659,12 +769,14 @@
 	ldh [rIF], a
 	halt
 	ldh a, [c]
-	bit 1, a
-	jr z, Function104da9
+	bit rRP_RECEIVING, a
+	jr z, .recv_loop
 	or a
 	ret
 
-Function104db7:
+ReceiveInfraredLEDOff:
+; Count interrupts of the partner's IR LED off; quit after 256-d interrupts.
+.no_recv_loop
 	inc d
 	ret z
 	xor a
@@ -671,13 +783,14 @@
 	ldh [rIF], a
 	halt
 	ldh a, [c]
-	bit 1, a
-	jr nz, Function104db7
+	bit rRP_RECEIVING, a
+	jr nz, .no_recv_loop
 	or a
 	ret
 
-Function104dc5:
-	ld a, $c1
+SendInfraredLEDOn:
+; Holds the IR LED on for d-1 interrupts.
+	ld a, rRP_ENABLE_READ_MASK | (1 << rRP_LED_ON)
 	ldh [c], a
 .wait
 	dec d
@@ -687,8 +800,9 @@
 	halt
 	jr .wait
 
-Function104dd1:
-	ld a, $c0
+SendInfraredLEDOff:
+; Holds the IR LED off for d-1 interrupts.
+	ld a, rRP_ENABLE_READ_MASK
 	ldh [c], a
 .wait
 	dec d
@@ -698,175 +812,204 @@
 	halt
 	jr .wait
 
-Function104ddd:
-	ld d, $0
+InitializeIRCommunicationRoles:
+	ld d, 0
 	ld e, d
-	ld a, $1
-	ldh [hPrintNumBuffer + 8], a
+
+	ld a, IR_RECEIVER
+	ldh [hMGRole], a
 .loop
-	call MysteryGift_ReadJoypad
-	ld b, $2
+	call MysteryGift_UpdateJoypad
+	ld b, 1 << rRP_RECEIVING
 	ld c, LOW(rRP)
+	; Check if we've pressed the B button to cancel
 	ldh a, [hMGJoypadReleased]
 	bit B_BUTTON_F, a
-	jr z, .next
-	ld a, $10
+	jr z, .not_canceled
+	ld a, MG_CANCELED
 	ldh [hMGStatusFlags], a
 	ret
 
-.next
-	bit 0, a
-	jr nz, Function104e3a
+.not_canceled
+	; Check if we've pressed the A button to start sending
+	bit A_BUTTON_F, a
+	jr nz, SendIRHelloMessageAfterDelay
+	; If rRP is not receiving data, keep checking for input
 	ldh a, [c]
 	and b
 	jr nz, .loop
+	; fallthrough
 
-Function104dfe:
+ReceiveIRHelloMessage:
 	ld c, LOW(rRP)
-	ld d, $0
+	ld d, 0
 	ld e, d
-	call Function104db7
-	jp z, Function104f42
+
+	call ReceiveInfraredLEDOff
+	jp z, InfraredLEDReceiveTimedOut
 	ld d, e
-	call Function104da9
-	jp z, Function104f42
-	call Function104db7
-	jp z, Function104f42
-	call Function104da9
-	jp z, Function104f42
-	ld a, $6c
+	call ReceiveInfraredLEDOn
+	jp z, InfraredLEDReceiveTimedOut
+	call ReceiveInfraredLEDOff
+	jp z, InfraredLEDReceiveTimedOut
+	call ReceiveInfraredLEDOn
+	jp z, InfraredLEDReceiveTimedOut
+
+	ld a, MG_OKAY
 	ldh [hMGStatusFlags], a
-	ld d, $3d
-	call Function104dd1
-	ld d, $5
-	call Function104dc5
-	ld d, $15
-	call Function104dd1
-	ld d, $5
-	call Function104dc5
-	ld d, $5
-	call Function104dd1
+
+	ld d, 61
+	call SendInfraredLEDOff
+	ld d, 5
+	call SendInfraredLEDOn
+	ld d, 21
+	call SendInfraredLEDOff
+	ld d, 5
+	call SendInfraredLEDOn
+	ld d, 5
+	call SendInfraredLEDOff
 	ret
 
-Function104e3a:
+SendIRHelloMessageAfterDelay:
 	; Wait a random amount of time
 	call Random
 	ld e, a
 	and $f
 	ld d, a
-.loop
+.wait_loop
 	dec de
 	ld a, d
 	or e
-	jr nz, .loop
-Function104e46:
-	ld a, $2
-	ldh [hPrintNumBuffer + 8], a
+	jr nz, .wait_loop
+	; fallthrough
+
+SendIRHelloMessage:
+	ld a, IR_SENDER
+	ldh [hMGRole], a
+
 	ld c, LOW(rRP)
-	ld d, $0
+	ld d, 0
 	ld e, d
-	ld d, $3d
-	call Function104dd1
-	ld d, $5
-	call Function104dc5
-	ld d, $15
-	call Function104dd1
-	ld d, $5
-	call Function104dc5
-	ld d, $5
-	call Function104dd1
+
+	ld d, 61
+	call SendInfraredLEDOff
+	ld d, 5
+	call SendInfraredLEDOn
+	ld d, 21
+	call SendInfraredLEDOff
+	ld d, 5
+	call SendInfraredLEDOn
+	ld d, 5
+	call SendInfraredLEDOff
+
 	ld d, e
-	call Function104db7
-	jp z, Function104f42
+	call ReceiveInfraredLEDOff
+	jp z, InfraredLEDReceiveTimedOut
 	ld d, e
-	call Function104da9
-	jp z, Function104f42
-	call Function104db7
-	jp z, Function104f42
-	call Function104da9
-	jp z, Function104f42
-	ld d, $3d
-	call Function104dd1
-	ld a, $6c
+	call ReceiveInfraredLEDOn
+	jp z, InfraredLEDReceiveTimedOut
+	call ReceiveInfraredLEDOff
+	jp z, InfraredLEDReceiveTimedOut
+	call ReceiveInfraredLEDOn
+	jp z, InfraredLEDReceiveTimedOut
+
+	ld d, 61
+	call SendInfraredLEDOff
+
+	ld a, MG_OKAY
 	ldh [hMGStatusFlags], a
 	ret
 
-Function104e8c:
+ToggleIRCommunication:
 	ldh [rRP], a
-	ld a, $ff
+	ld a, MG_START_END
 	ldh [hMGStatusFlags], a
 	ret
 
-Function104e93:
+SendIRDataBlock:
+; Send b bytes of data in three messages:
+; 1. two bytes: MESSAGE_PREFIX and the length b
+; 2. b bytes: the actual data
+; 3. two bytes: a little-endian checksum
+; Then receive a one-byte acknowledgement message: the status.
 	xor a
-	ldh [hPrintNumBuffer + 4], a
-	ldh [hPrintNumBuffer + 5], a
+	ldh [hMGChecksum + 0], a
+	ldh [hMGChecksum + 1], a
 	push hl
 	push bc
 	ld c, LOW(rRP)
-	ld d, $3d
-	call Function104dd1
-	ld hl, hPrintNumBuffer + 1
-	ld a, $5a
+	ld d, 61
+	call SendInfraredLEDOff
+	ld hl, hMGExchangedWord
+	ld a, MESSAGE_PREFIX
 	ld [hli], a
 	ld [hl], b
 	dec hl
-	ld b, $2
-	call Function104ed6
+	ld b, 2
+	call SendIRDataMessage
 	pop bc
 	pop hl
-	call Function104ed6
-	ldh a, [hPrintNumBuffer + 4]
-	ldh [hPrintNumBuffer + 1], a
-	ldh a, [hPrintNumBuffer + 5]
-	ldh [hPrintNumBuffer + 2], a
+	call SendIRDataMessage
+	ldh a, [hMGChecksum + 0]
+	ldh [hMGExchangedWord + 0], a
+	ldh a, [hMGChecksum + 1]
+	ldh [hMGExchangedWord + 1], a
 	push hl
-	ld hl, hPrintNumBuffer + 1
-	ld b, $2
-	call Function104ed6
+	ld hl, hMGExchangedWord
+	ld b, 2
+	call SendIRDataMessage
 	ld hl, hMGStatusFlags
-	ld b, $1
-	call Function104faf
-	ldh a, [hPrintNumBuffer + 1]
-	ldh [hPrintNumBuffer + 4], a
-	ldh a, [hPrintNumBuffer + 2]
-	ldh [hPrintNumBuffer + 5], a
+	ld b, 1
+	call ReceiveIRDataMessage
+	ldh a, [hMGExchangedWord + 0]
+	ldh [hMGChecksum + 0], a
+	ldh a, [hMGExchangedWord + 1]
+	ldh [hMGChecksum + 1], a
 	pop hl
 	ret
 
-Function104ed6:
+SendIRDataMessage:
+; Send b bytes of data one bit at a time, and update the checksum.
 	ld c, LOW(rRP)
-	ld d, $5
-	call Function104dd1
-	ld d, $5
-	call Function104dc5
-	ld d, $15
-	call Function104dd1
+
+	ld d, 5
+	call SendInfraredLEDOff
+	ld d, 5
+	call SendInfraredLEDOn
+	ld d, 21
+	call SendInfraredLEDOff
+
+	; b = -b - 1; then count up to 0
 	ld a, b
 	cpl
 	ld b, a
-	ld a, $f4
+
+	ld a, -12
 	ldh [rTMA], a
-.main_loop
+.byte_loop
 	inc b
 	jr z, .done
-	ld a, $8
-	ldh [hPrintNumBuffer + 3], a
+	ld a, 8
+	ldh [hMGNumBits], a
+	; Get the next data byte
 	ld a, [hli]
 	ld e, a
-	ldh a, [hPrintNumBuffer + 4]
+	; Add the next data byte to the checksum
+	ldh a, [hMGChecksum + 0]
 	add e
-	ldh [hPrintNumBuffer + 4], a
-	ldh a, [hPrintNumBuffer + 5]
+	ldh [hMGChecksum + 0], a
+	ldh a, [hMGChecksum + 1]
 	adc 0
-	ldh [hPrintNumBuffer + 5], a
-.inner_loop
+	ldh [hMGChecksum + 1], a
+	; Send each bit of the byte
+.bit_loop
 	xor a
 	ldh [rIF], a
 	halt
-	ld a, $c1
+	ld a, rRP_ENABLE_READ_MASK | (1 << rRP_LED_ON)
 	ldh [rRP], a
-	ld d, $1
+	; Turn the LED off for longer if the bit is 1
+	ld d, 1
 	ld a, e
 	rlca
 	ld e, a
@@ -874,9 +1017,9 @@
 	inc d
 .wait
 	ldh a, [rTIMA]
-	cp $f8
+	cp -8
 	jr c, .wait
-	ld a, $c0
+	ld a, rRP_ENABLE_READ_MASK
 	ldh [rRP], a
 	dec d
 	jr z, .no_halt
@@ -884,73 +1027,79 @@
 	ldh [rIF], a
 	halt
 .no_halt
-	ldh a, [hPrintNumBuffer + 3]
+	ldh a, [hMGNumBits]
 	dec a
-	jr z, .main_loop
-	ldh [hPrintNumBuffer + 3], a
-	jr .inner_loop
+	jr z, .byte_loop
+	ldh [hMGNumBits], a
+	jr .bit_loop
 
 .done
-	ld a, $fe
+	ld a, -2
 	ldh [rTMA], a
 	xor a
 	ldh [rIF], a
 	halt
-	ld d, $5
-	call Function104dc5
-	ld d, $11
-	call Function104dd1
+
+	ld d, 5
+	call SendInfraredLEDOn
+	ld d, 17
+	call SendInfraredLEDOff
 	ret
 
-Function104f42:
+InfraredLEDReceiveTimedOut:
 	ldh a, [hMGStatusFlags]
-	or $2
+	or MG_TIMED_OUT
 	ldh [hMGStatusFlags], a
 	ret
 
-Function104f49:
+ReceivedWrongIRChecksum:
 	ldh a, [hMGStatusFlags]
-	or $1
+	or MG_WRONG_CHECKSUM
 	ldh [hMGStatusFlags], a
 	ret
 
-Function104f50:
+ReceivedWrongIRMessagePrefix:
 	ldh a, [hMGStatusFlags]
-	or $80
+	or MG_WRONG_PREFIX
 	ldh [hMGStatusFlags], a
 	ret
 
-Function104f57:
+ReceiveIRDataBlock:
+; Receive b bytes of data in three messages:
+; 1. two bytes: MESSAGE_PREFIX and the length b
+; 2. b bytes: the actual data
+; 3. two bytes: a little-endian checksum
+; Then send a one-byte acknowledgement message: the status.
 	xor a
-	ldh [hPrintNumBuffer + 4], a
-	ldh [hPrintNumBuffer + 5], a
+	ldh [hMGChecksum + 0], a
+	ldh [hMGChecksum + 1], a
 	push bc
 	push hl
-	ld hl, hPrintNumBuffer + 1
-	ld b, $2
-	call Function104faf
-	ldh a, [hPrintNumBuffer + 2]
-	ldh [hPrintNumBuffer + 7], a
+	ld hl, hMGExchangedWord
+	ld b, 2
+	call ReceiveIRDataMessage
+	ldh a, [hMGExchangedWord + 1]
+	ldh [hMGUnusedMsgLength], a
 	ld b, a
 	pop hl
 	pop af
 	cp b
-	jp c, Function104f50
-	ldh a, [hPrintNumBuffer + 1]
-	cp $5a
-	jp nz, Function104f50
-	call Function104faf
-	ldh a, [hPrintNumBuffer + 4]
+	jp c, ReceivedWrongIRMessagePrefix
+	ldh a, [hMGExchangedWord + 0]
+	cp MESSAGE_PREFIX
+	jp nz, ReceivedWrongIRMessagePrefix
+	call ReceiveIRDataMessage
+	ldh a, [hMGChecksum + 0]
 	ld d, a
-	ldh a, [hPrintNumBuffer + 5]
+	ldh a, [hMGChecksum + 1]
 	ld e, a
 	push hl
 	push de
-	ld hl, hPrintNumBuffer + 1
-	ld b, $2
-	call Function104faf
+	ld hl, hMGExchangedWord
+	ld b, 2
+	call ReceiveIRDataMessage
 	pop de
-	ld hl, hPrintNumBuffer + 1
+	ld hl, hMGExchangedWord
 	ld a, [hli]
 	xor d
 	ld b, a
@@ -957,60 +1106,66 @@
 	ld a, [hl]
 	xor e
 	or b
-	call nz, Function104f49
+	call nz, ReceivedWrongIRChecksum
 	push de
-	ld d, $3d
-	call Function104dd1
+
+	ld d, 61
+	call SendInfraredLEDOff
+
 	ld hl, hMGStatusFlags
-	ld b, $1
-	call Function104ed6
+	ld b, 1
+	call SendIRDataMessage
+
 	pop de
 	pop hl
 	ld a, d
-	ldh [hPrintNumBuffer + 4], a
+	ldh [hMGChecksum + 0], a
 	ld a, e
-	ldh [hPrintNumBuffer + 5], a
+	ldh [hMGChecksum + 1], a
 	ret
 
-Function104faf:
+ReceiveIRDataMessage:
 	ld c, LOW(rRP)
-	ld d, $0
-	call Function104db7
-	jp z, Function104f42
-	ld d, $0
-	call Function104da9
-	jp z, Function104f42
-	ld d, $0
-	call Function104db7
-	jp z, Function104f42
+
+	ld d, 0
+	call ReceiveInfraredLEDOff
+	jp z, InfraredLEDReceiveTimedOut
+	ld d, 0
+	call ReceiveInfraredLEDOn
+	jp z, InfraredLEDReceiveTimedOut
+	ld d, 0
+	call ReceiveInfraredLEDOff
+	jp z, InfraredLEDReceiveTimedOut
+
 	ld a, b
 	cpl
 	ld b, a
 	xor a
 	ldh [hMGPrevTIMA], a
-	call Function104d86
+
+	call StartSlowIRTimer
 .main_loop
 	inc b
 	jr z, .done
-	ld a, $8
-	ldh [hPrintNumBuffer + 3], a
+	ld a, 8
+	ldh [hMGNumBits], a
 .inner_loop
-	ld d, $0
-.wait_one
+	ld d, 0
+.recv_loop
 	inc d
-	jr z, .got_one
+	jr z, .recv_done
 	ldh a, [c]
-	bit 1, a
-	jr z, .wait_one
-	ld d, $0
-.got_one
-.wait_zero
+	bit rRP_RECEIVING, a
+	jr z, .recv_loop
+	ld d, 0
+.recv_done
+.send_loop
 	inc d
-	jr z, .got_zero
+	jr z, .send_done
 	ldh a, [c]
-	bit 1, a
-	jr nz, .wait_zero
-.got_zero
+	bit rRP_RECEIVING, a
+	jr nz, .send_loop
+.send_done
 	ldh a, [hMGPrevTIMA]
 	ld d, a
 	ldh a, [rTIMA]
@@ -1023,9 +1178,9 @@
 .zero
 	res 0, e
 .ok
-	ldh a, [hPrintNumBuffer + 3]
+	ldh a, [hMGNumBits]
 	dec a
-	ldh [hPrintNumBuffer + 3], a
+	ldh [hMGNumBits], a
 	jr z, .continue
 	ld a, e
 	rlca
@@ -1035,34 +1190,35 @@
 .continue
 	ld a, e
 	ld [hli], a
-	ldh a, [hPrintNumBuffer + 4]
+	ldh a, [hMGChecksum + 0]
 	add e
-	ldh [hPrintNumBuffer + 4], a
-	ldh a, [hPrintNumBuffer + 5]
+	ldh [hMGChecksum + 0], a
+	ldh a, [hMGChecksum + 1]
 	adc 0
-	ldh [hPrintNumBuffer + 5], a
+	ldh [hMGChecksum + 1], a
 	jr .main_loop
 
 .done
-	call Function104d74
+	call StartFastIRTimer
 	xor a
 	ldh [rIF], a
-	ld d, $0
-	call Function104da9
-	jp z, Function104f42
-	ld d, $10
-	call Function104dd1
+	ld d, 0
+	call ReceiveInfraredLEDOn
+	jp z, InfraredLEDReceiveTimedOut
+
+	ld d, 16
+	call SendInfraredLEDOff
 	ret
 
-Function10502e:
-	ld b, $0
-	jp Function104e93
+SendEmptyIRDataBlock:
+	ld b, 0
+	jp SendIRDataBlock
 
-Function105033:
-	ld b, $0
-	jp Function104f57
+ReceiveEmptyIRDataBlock:
+	ld b, 0
+	jp ReceiveIRDataBlock
 
-MysteryGift_ReadJoypad:
+MysteryGift_UpdateJoypad:
 ; We can only get four inputs at a time.
 ; We take d-pad first for no particular reason.
 	ld a, R_DPAD
@@ -1107,9 +1263,10 @@
 	ldh [rJOYP], a
 	ret
 
-MysteryGift_CheckAndSetDecorationAlreadyReceived:
+CheckAndSetMysteryGiftDecorationAlreadyReceived:
+; Return nz if decoration c was already received; otherwise receive it.
 	call GetMysteryGiftBank
-	ld d, $0
+	ld d, 0
 	ld b, CHECK_FLAG
 	ld hl, sMysteryGiftDecorationsReceived
 	lda_predef SmallFarFlagAction
@@ -1129,12 +1286,12 @@
 	xor a
 	ret
 
-MysteryGift_CopyReceivedDecosToPC:
+CopyMysteryGiftReceivedDecorationsToPC:
 	call GetMysteryGiftBank
-	ld c, $0
+	ld c, 0
 .loop
 	push bc
-	ld d, $0
+	ld d, 0
 	ld b, CHECK_FLAG
 	ld hl, sMysteryGiftDecorationsReceived
 	predef SmallFarFlagAction
@@ -1148,11 +1305,13 @@
 .skip
 	inc c
 	ld a, c
-	cp TrophyIDs - DecorationIDs
+	cp NUM_NON_TROPHY_DECOS
 	jr c, .loop
 	jp CloseSRAM
 
 UnlockMysteryGift:
+; If [sMysteryGiftUnlocked] was -1, this sets both
+; [sMysteryGiftUnlocked] and [sMysteryGiftItem] to 0.
 	call GetMysteryGiftBank
 	ld hl, sMysteryGiftUnlocked
 	ld a, [hl]
@@ -1159,21 +1318,24 @@
 	inc a
 	jr nz, .ok
 	ld [hld], a
+	assert sMysteryGiftUnlocked - 1 == sMysteryGiftItem
 	ld [hl], a
 .ok
 	jp CloseSRAM
 
-Function1050c8:
+ResetDailyMysteryGiftLimitIfUnlocked:
 	call GetMysteryGiftBank
 	ld a, [sNumDailyMysteryGiftPartnerIDs]
-	cp $ff
-	jr z, .okay
+	cp -1 ; locked?
+	jr z, .dont_clear
 	xor a
 	ld [sNumDailyMysteryGiftPartnerIDs], a
-.okay
+.dont_clear
 	jp CloseSRAM
 
 BackupMysteryGift:
+; Copies [sMysteryGiftItem] to [sBackupMysteryGiftItem],
+; and [sMysteryGiftUnlocked] to [sNumDailyMysteryGiftPartnerIDs].
 	call GetMysteryGiftBank
 	ld hl, sMysteryGiftItem
 	ld de, sBackupMysteryGiftItem
@@ -1180,11 +1342,15 @@
 	ld a, [hli]
 	ld [de], a
 	inc de
+	assert sMysteryGiftItem + 1 == sMysteryGiftUnlocked
+	assert sBackupMysteryGiftItem + 1 == sNumDailyMysteryGiftPartnerIDs
 	ld a, [hl]
 	ld [de], a
 	jp CloseSRAM
 
 RestoreMysteryGift:
+; Copies [sBackupMysteryGiftItem] to [sMysteryGiftItem],
+; and [sNumDailyMysteryGiftPartnerIDs] to [sMysteryGiftUnlocked].
 	call GetMysteryGiftBank
 	ld hl, sBackupMysteryGiftItem
 	ld de, sMysteryGiftItem
@@ -1191,14 +1357,16 @@
 	ld a, [hli]
 	ld [de], a
 	inc de
+	assert sBackupMysteryGiftItem + 1 == sNumDailyMysteryGiftPartnerIDs
+	assert sMysteryGiftItem + 1 == sMysteryGiftUnlocked
 	ld a, [hl]
 	ld [de], a
 	jp CloseSRAM
 
-MysteryGift_ClearTrainerData:
-	ld hl, wMysteryGiftTrainerData
+ClearMysteryGiftTrainer:
+	ld hl, wMysteryGiftTrainer
 	xor a
-	ld b, wMysteryGiftTrainerDataEnd - wMysteryGiftTrainerData
+	ld b, wMysteryGiftTrainerEnd - wMysteryGiftTrainer
 .loop
 	ld [hli], a
 	dec b
@@ -1206,7 +1374,7 @@
 	ret
 
 GetMysteryGiftBank:
-	ld a, BANK(sBackupMysteryGiftItem)
+	ld a, BANK(sMysteryGiftData)
 	jp OpenSRAM
 
 StagePartyDataForMysteryGift:
@@ -1256,8 +1424,8 @@
 .party_end
 	ld a, -1
 	ld [de], a
-	ld a, $26
-	ld [wca00], a
+	ld a, wMysteryGiftTrainerEnd - wMysteryGiftTrainer
+	ld [wUnusedMysteryGiftStagedDataLength], a
 	jp CloseSRAM
 
 InitMysteryGiftLayout:
@@ -1399,22 +1567,22 @@
 MysteryGiftGFX:
 INCBIN "gfx/mystery_gift/mystery_gift.2bpp"
 
-Function105688:
+DoNameCardSwap:
 	call ClearTilemap
 	call ClearSprites
 	call WaitBGMap
-	call Function1057d7
+	call InitNameCardLayout
 	hlcoord 3, 8
-	ld de, String_PressAToLink_BToCancel_JP
+	ld de, .String_PressAToLink_BToCancel_JP
 	call PlaceString
 	call WaitBGMap
-	call Function10578c
-	call MysteryGift_ClearTrainerData
-	ld a, $24
-	ld [wca02], a
+	call StageDataForNameCard
+	call ClearMysteryGiftTrainer
+	ld a, wNameCardDataEnd - wNameCardData
+	ld [wMysteryGiftStagedDataLength], a
 	ldh a, [rIE]
 	push af
-	call Function104c2d
+	call ExchangeNameCardData
 	ld d, a
 	xor a
 	ldh [rIF], a
@@ -1422,25 +1590,25 @@
 	ldh [rIE], a
 	ld a, d
 	cp $10
-	jp z, Function105712
-	cp $6c
-	jp nz, Function10571a
-	call Function1056eb
+	jp z, .LinkCanceled
+	cp MG_OKAY
+	jp nz, .CommunicationError
+	call .SlideNameCardUpOffScreen
 	ld c, 60
 	call DelayFrames
-	call Function105777
-	ld hl, MysteryGiftReceivedCardText
+	call .ClearScreen
+	ld hl, .NameCardReceivedCardText
 	call PrintText
-	ld de, wMysteryGiftTrainerData
+	ld de, wNameCardData
 	farcall Function8ac70
 	ld a, c
 	ld [wDeciramBuffer], a
-	ld hl, MysteryGiftNotRegisteredCardText
-	jr c, PrintTextAndExit_JP
-	ld hl, MysteryGiftListedCardText
-	jr PrintTextAndExit_JP
+	ld hl, .NameCardNotRegisteredCardText
+	jr c, .PrintTextAndExit
+	ld hl, .NameCardListedCardText
+	jr .PrintTextAndExit
 
-Function1056eb:
+.SlideNameCardUpOffScreen:
 	ld c, 16
 .loop
 	ld hl, wVirtualOAMSprite00YCoord
@@ -1469,24 +1637,24 @@
 	pop bc
 	jr .loop
 
-Function105712:
-	call Function105777
-	ld hl, MysteryGiftLinkCancelledText
-	jr PrintTextAndExit_JP
+.LinkCanceled:
+	call .ClearScreen
+	ld hl, .NameCardLinkCancelledText
+	jr .PrintTextAndExit
 
-Function10571a:
-	call Function105777
-	ld hl, MysteryGiftLinkCommErrorText
+.CommunicationError:
+	call .ClearScreen
+	ld hl, .NameCardCommErrorText
 	call PrintText
-	jp Function105688
+	jp DoNameCardSwap
 
-PrintTextAndExit_JP:
+.PrintTextAndExit:
 	call PrintText
 	ld a, LCDC_DEFAULT
 	ldh [rLCDC], a
 	ret
 
-String_PressAToLink_BToCancel_JP:
+.String_PressAToLink_BToCancel_JP:
 	db   "エーボタン<WO>おすと"
 	next "つうしん<PKMN>おこなわれるよ!"
 	next "ビーボタン<WO>おすと"
@@ -1493,27 +1661,27 @@
 	next "つうしん<WO>ちゅうし します"
 	db   "@"
 
-MysteryGiftReceivedCardText:
-	text_far _MysteryGiftReceivedCardText
+.NameCardReceivedCardText:
+	text_far _NameCardReceivedCardText
 	text_end
 
-MysteryGiftListedCardText:
-	text_far _MysteryGiftListedCardText
+.NameCardListedCardText:
+	text_far _NameCardListedCardText
 	text_end
 
-MysteryGiftNotRegisteredCardText:
-	text_far _MysteryGiftNotRegisteredCardText
+.NameCardNotRegisteredCardText:
+	text_far _NameCardNotRegisteredCardText
 	text_end
 
-MysteryGiftLinkCancelledText:
-	text_far _MysteryGiftLinkCancelledText
+.NameCardLinkCancelledText:
+	text_far _NameCardLinkCancelledText
 	text_end
 
-MysteryGiftLinkCommErrorText:
-	text_far _MysteryGiftLinkCommErrorText
+.NameCardCommErrorText:
+	text_far _NameCardLinkCommErrorText
 	text_end
 
-Function105777:
+.ClearScreen:
 	call ClearSprites
 	call ClearTilemap
 	call EnableLCD
@@ -1523,8 +1691,8 @@
 	call SetPalettes
 	ret
 
-Function10578c:
-	ld de, wLinkData
+StageDataForNameCard:
+	ld de, wMysteryGiftStaging
 	ld a, BANK(sPlayerData)
 	call OpenSRAM
 	ld hl, sPlayerData + wPlayerName - wPlayerData
@@ -1545,15 +1713,15 @@
 	ld a, BANK(s4_a603) ; aka BANK(s4_a007) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
 	call OpenSRAM
 	ld hl, s4_a603 ; address of MBC30 bank
-	ld bc, $8
+	ld bc, 8
 	call CopyBytes
 	ld hl, s4_a007 ; address of MBC30 bank
-	ld bc, $c
+	ld bc, 12
 	call CopyBytes
 	call CloseSRAM
 	ret
 
-Function1057d7:
+InitNameCardLayout:
 	call ClearBGPalettes
 	call DisableLCD
 	ld hl, CardTradeGFX
@@ -1638,13 +1806,13 @@
 	hlcoord 17, 15
 	ld [hl], $3e
 	ld de, wVirtualOAMSprite00
-	ld hl, .OAM_data
+	ld hl, .NameCardOAMData
 	ld bc, 16 * SPRITEOAMSTRUCT_LENGTH
 	call CopyBytes
 	call EnableLCD
 	call WaitBGMap
-	ld b, $2
-	farcall GetMysteryGift_MobileAdapterLayout
+	ld b, CRYSTAL_CGB_NAME_CARD
+	farcall GetCrystalCGBLayout
 	jp SetPalettes
 
 .Load6Row:
@@ -1692,7 +1860,7 @@
 	jr nz, .row_loop_no_inc
 	ret
 
-.OAM_data:
+.NameCardOAMData:
 	dbsprite  6,  2, 4, 1, $00, 0
 	dbsprite  7,  2, 4, 1, $01, 0
 	dbsprite  8,  2, 4, 1, $02, 0
--- a/engine/link/mystery_gift_2.asm
+++ b/engine/link/mystery_gift_2.asm
@@ -1,8 +1,8 @@
-PrepMysteryGiftDataToSend:
+StageDataForMysteryGift:
 	ld de, wMysteryGiftStaging
-	ld a, $1 + GS_VERSION
+	ld a, GS_VERSION + 1
 	ld [de], a
-	inc de ; wc801
+	inc de ; wMysteryGiftStaging+1
 	ld a, BANK(sGameData)
 	call OpenSRAM
 	ld hl, sPlayerData + wPlayerID - wPlayerData
@@ -9,16 +9,16 @@
 	ld a, [hli]
 	ld [de], a
 	ld b, a
-	inc de ; wc802
+	inc de ; wMysteryGiftStaging+2
 	ld a, [hl]
 	ld [de], a
 	ld c, a
-	inc de ; wc803
+	inc de ; wMysteryGiftStaging+3
 	push bc
 	ld hl, sPlayerData + wPlayerName - wPlayerData
 	ld bc, NAME_LENGTH
 	call CopyBytes
-	push de ; wc80e
+	push de ; wMysteryGiftStaging+14
 	ld hl, sPokemonData + wPokedexCaught - wPokemonData
 	ld b, wEndPokedexCaught - wPokedexCaught
 	call CountSetBits
@@ -26,30 +26,30 @@
 	pop bc
 	ld a, [wNumSetBits]
 	ld [de], a
-	inc de ; wc80f
+	inc de ; wMysteryGiftStaging+15
 	call CloseSRAM
 	call Random
 	and 1
 	ld [de], a
-	inc de ; wc810
+	inc de ; wMysteryGiftStaging+16
 	call .RandomSample
 	ld [de], a
-	inc de ; wc811
+	inc de ; wMysteryGiftStaging+17
 	ld a, c
 	ld c, b
 	ld b, a
 	call .RandomSample
 	ld [de], a
-	inc de ; wc812
+	inc de ; wMysteryGiftStaging+18
 	ld a, BANK(sBackupMysteryGiftItem)
 	call OpenSRAM
 	ld a, [sBackupMysteryGiftItem]
 	ld [de], a
 	inc de
-	ld a, [sBackupMysteryGiftItem + 1]
+	ld a, [sNumDailyMysteryGiftPartnerIDs]
 	ld [de], a
-	ld a, $14
-	ld [wca00], a
+	ld a, wMysteryGiftPlayerDataEnd - wMysteryGiftPlayerData
+	ld [wUnusedMysteryGiftStagedDataLength], a
 	call CloseSRAM
 	ld hl, wMysteryGiftStaging
 	ld de, wMysteryGiftPlayerData
@@ -121,7 +121,7 @@
 	pop de
 	ret
 
-MysteryGiftGetItemHeldEffect:
+MysteryGiftGetItem:
 	ld a, c
 	cp MysteryGiftItems.End - MysteryGiftItems
 	jr nc, MysteryGiftFallbackItem
--- a/engine/link/time_capsule.asm
+++ b/engine/link/time_capsule.asm
@@ -1,11 +1,11 @@
 ; These functions seem to be related to backwards compatibility
 
 ValidateOTTrademon:
-	ld a, [wd003]
+	ld a, [wCurOTTradePartyMon]
 	ld hl, wOTPartyMon1Species
 	call GetPartyLocation
 	push hl
-	ld a, [wd003]
+	ld a, [wCurOTTradePartyMon]
 	inc a
 	ld c, a
 	ld b, 0
@@ -30,7 +30,7 @@
 	cp LINK_TIMECAPSULE
 	jr nz, .normal
 	ld hl, wOTPartySpecies
-	ld a, [wd003]
+	ld a, [wCurOTTradePartyMon]
 	ld c, a
 	ld b, 0
 	add hl, bc
@@ -65,11 +65,11 @@
 	ret
 
 CheckAnyOtherAliveMonsForTrade:
-	ld a, [wd002]
+	ld a, [wCurTradePartyMon]
 	ld d, a
 	ld a, [wPartyCount]
 	ld b, a
-	ld c, $0
+	ld c, 0
 .loop
 	ld a, c
 	cp d
@@ -87,7 +87,7 @@
 	inc c
 	dec b
 	jr nz, .loop
-	ld a, [wd003]
+	ld a, [wCurOTTradePartyMon]
 	ld hl, wOTPartyMon1HP
 	call GetPartyLocation
 	ld a, [hli]
--- a/engine/math/print_num.asm
+++ b/engine/math/print_num.asm
@@ -35,7 +35,6 @@
 	cp 2
 	jr z, .word
 ; maximum 3 bytes
-.long
 	ld a, [de]
 	ldh [hPrintNumBuffer + 1], a
 	inc de
@@ -81,7 +80,7 @@
 	cp 6
 	jr z, .six
 
-.seven
+; seven
 	ld a, HIGH(1000000 >> 8)
 	ldh [hPrintNumBuffer + 4], a
 	ld a, HIGH(1000000) ; mid
--- a/engine/menus/intro_menu.asm
+++ b/engine/menus/intro_menu.asm
@@ -9,7 +9,7 @@
 	farcall MainMenu
 	jp StartTitleScreen
 
-; unused
+IntroMenu_DummyFunction: ; unreferenced
 	ret
 
 PrintDayOfWeek:
@@ -173,12 +173,13 @@
 	ld [wRoamMon2MapNumber], a
 	ld [wRoamMon3MapNumber], a
 
-	ld a, BANK(sMysteryGiftItem)
+	ld a, BANK(sMysteryGiftItem) ; aka BANK(sMysteryGiftUnlocked)
 	call OpenSRAM
 	ld hl, sMysteryGiftItem
 	xor a
 	ld [hli], a
-	dec a
+	assert sMysteryGiftItem + 1 == sMysteryGiftUnlocked
+	dec a ; -1
 	ld [hl], a
 	call CloseSRAM
 
@@ -370,7 +371,7 @@
 	ld c, 20
 	call DelayFrames
 	farcall JumpRoamMons
-	farcall MysteryGift_CopyReceivedDecosToPC
+	farcall CopyMysteryGiftReceivedDecorationsToPC
 	farcall ClockContinue
 	ld a, [wSpawnAfterChampion]
 	cp SPAWN_LANCE
@@ -464,9 +465,9 @@
 	xor a
 	ld [wDontPlayMapMusicOnReload], a
 	ld [wLinkMode], a
-	ld hl, wGameTimerPause
-	set GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
-	res GAMETIMERPAUSE_MOBILE_7_F, [hl]
+	ld hl, wGameTimerPaused
+	set GAME_TIMER_PAUSED_F, [hl]
+	res GAME_TIMER_MOBILE_F, [hl]
 	ld hl, wEnteredMapFromContinue
 	set 1, [hl]
 	farcall OverworldLoop
--- a/engine/menus/main_menu.asm
+++ b/engine/menus/main_menu.asm
@@ -31,8 +31,8 @@
 	ld b, SCGB_DIPLOMA
 	call GetSGBLayout
 	call SetPalettes
-	ld hl, wGameTimerPause
-	res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
+	ld hl, wGameTimerPaused
+	res GAME_TIMER_PAUSED_F, [hl]
 	call MainMenu_GetWhichMenu
 	ld [wWhichIndexSet], a
 	call MainMenu_PrintCurrentTimeAndDay
@@ -206,7 +206,7 @@
 	ld a, BANK(sNumDailyMysteryGiftPartnerIDs)
 	call OpenSRAM
 	ld a, [sNumDailyMysteryGiftPartnerIDs]
-	cp -1
+	cp -1 ; locked?
 	call CloseSRAM
 	jr nz, .mystery_gift
 	; This check makes no difference.
@@ -316,20 +316,19 @@
 	call PrintNum
 	ret
 
-.min
-; unused
+.minString: ; unreferenced
 	db "min.@"
 
 .PrintTimeNotSet:
 	hlcoord 1, 14
-	ld de, .TimeNotSet
+	ld de, .TimeNotSetString
 	call PlaceString
 	ret
 
-.TimeNotSet:
+.TimeNotSetString:
 	db "TIME NOT SET@"
 
-.MainMenuTimeUnknownText:
+.MainMenuTimeUnknownText: ; unreferenced
 	text_far _MainMenuTimeUnknownText
 	text_end
 
--- a/engine/menus/menu_2.asm
+++ b/engine/menus/menu_2.asm
@@ -156,7 +156,7 @@
 	set NO_TEXT_SCROLL, [hl]
 	call StartMenu_DrawBugContestStatusBox
 	hlcoord 1, 5
-	ld de, .Balls_EN
+	ld de, .BallsString
 	call PlaceString
 	hlcoord 8, 5
 	ld de, wParkBallsRemaining
@@ -163,11 +163,11 @@
 	lb bc, PRINTNUM_LEFTALIGN | 1, 2
 	call PrintNum
 	hlcoord 1, 1
-	ld de, .CAUGHT
+	ld de, .CaughtString
 	call PlaceString
 	ld a, [wContestMon]
 	and a
-	ld de, .None
+	ld de, .NoneString
 	jr z, .no_contest_mon
 	ld [wNamedObjectIndexBuffer], a
 	call GetPokemonName
@@ -179,7 +179,7 @@
 	and a
 	jr z, .skip_level
 	hlcoord 1, 3
-	ld de, .LEVEL
+	ld de, .LevelString
 	call PlaceString
 	ld a, [wContestMonLevel]
 	ld h, b
@@ -193,15 +193,15 @@
 	ld [wOptions], a
 	ret
 
-.Balls_JP:
+.BallsJPString: ; unreferenced
 	db "ボール   こ@"
-.CAUGHT:
+.CaughtString:
 	db "CAUGHT@"
-.Balls_EN:
+.BallsString:
 	db "BALLS:@"
-.None:
+.NoneString:
 	db "None@"
-.LEVEL:
+.LevelString:
 	db "LEVEL@"
 
 FindApricornsInBag:
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -275,6 +275,7 @@
 NamingScreen_ApplyTextInputMode:
 	call NamingScreen_IsTargetBox
 	jr nz, .not_box
+	assert BoxNameInputLower - NameInputLower == BoxNameInputUpper - NameInputUpper
 	ld hl, BoxNameInputLower - NameInputLower
 	add hl, de
 	ld d, h
@@ -880,7 +881,7 @@
 
 INCLUDE "data/text/name_input_chars.asm"
 
-NamingScreenGFX_End: ; unused
+NamingScreenGFX_End: ; unreferenced
 INCBIN "gfx/naming_screen/end.1bpp"
 
 NamingScreenGFX_MiddleLine:
@@ -1333,7 +1334,7 @@
 	ld a, [wNamingScreenLastCharacter]
 	jp MailComposition_TryAddCharacter
 
-; unused
+.add_dakuten ; unreferenced
 	ld a, [wNamingScreenCurNameLength]
 	and a
 	ret z
--- a/engine/menus/trainer_card.asm
+++ b/engine/menus/trainer_card.asm
@@ -296,7 +296,8 @@
 	db   "#DEX"
 	next "PLAY TIME@"
 
-	db "@" ; unused
+.Unused: ; unreferenced
+	db "@"
 
 .Badges:
 	db "  BADGES▶@"
--- a/engine/movie/credits.asm
+++ b/engine/movie/credits.asm
@@ -199,7 +199,7 @@
 	xor a
 	ldh [hBGMapMode], a
 	ld a, 8
-	ld [wRequested2bpp], a
+	ld [wRequested2bppSize], a
 	jp Credits_Next
 
 Credits_LYOverride:
--- a/engine/movie/intro.asm
+++ b/engine/movie/intro.asm
@@ -21,7 +21,7 @@
 	call DelayFrame
 	jp .loop
 
-.ShutOffMusic:
+.ShutOffMusic
 	ld de, MUSIC_NONE
 	call PlayMusic
 
@@ -152,7 +152,7 @@
 	cp $80
 	jr nc, .endscene
 	cp $60
-	jr nz, .DontPlaySound
+	jr nz, .nosound
 	push af
 	depixel 11, 11
 	call CrystalIntro_InitUnownAnim
@@ -159,7 +159,7 @@
 	ld de, SFX_INTRO_UNOWN_1
 	call PlaySFX
 	pop af
-.DontPlaySound:
+.nosound
 	ld [wIntroSceneTimer], a
 	xor a
 	call CrystalIntro_UnownFade
@@ -971,7 +971,8 @@
 	xor a
 	call Intro_Scene20_AppearUnown
 	ret
-; unused
+
+.AppearUnownPal2: ; unreferenced
 	ld a, c
 	and $1c
 	srl a
@@ -981,7 +982,7 @@
 	call Intro_Scene20_AppearUnown
 	ret
 
-.finished
+.finished:
 	call NextIntroScene
 	ret
 
--- a/engine/movie/trade_animation.asm
+++ b/engine/movie/trade_animation.asm
@@ -20,7 +20,7 @@
 
 TradeAnimation:
 	xor a
-	ld [wcf66], a
+	ld [wUnusedTradeAnimPlayEvolutionMusic], a
 	ld hl, wPlayerTrademonSenderName
 	ld de, wOTTrademonSenderName
 	call LinkTradeAnim_LoadTradePlayerNames
@@ -71,7 +71,7 @@
 
 TradeAnimationPlayer2:
 	xor a
-	ld [wcf66], a
+	ld [wUnusedTradeAnimPlayEvolutionMusic], a
 	ld hl, wOTTrademonSenderName
 	ld de, wPlayerTrademonSenderName
 	call LinkTradeAnim_LoadTradePlayerNames
@@ -137,7 +137,7 @@
 	push af
 	set NO_TEXT_SCROLL, [hl]
 	call .TradeAnimLayout
-	ld a, [wcf66]
+	ld a, [wUnusedTradeAnimPlayEvolutionMusic]
 	and a
 	jr nz, .anim_loop
 	ld de, MUSIC_EVOLUTION
@@ -225,7 +225,7 @@
 	jr nz, .finished
 	call .DoTradeAnimCommand
 	callfar PlaySpriteAnimations
-	ld hl, wcf65
+	ld hl, wFrameCounter2
 	inc [hl]
 	call DelayFrame
 	and a
@@ -273,8 +273,8 @@
 	add_tradeanim TradeAnim_TextboxScrollStart   ; 1e
 	add_tradeanim TradeAnim_ScrollOutRight       ; 1f
 	add_tradeanim TradeAnim_ScrollOutRight2      ; 20
-	add_tradeanim TradeAnim_Wait80              ; 21
-	add_tradeanim TradeAnim_Wait40              ; 22
+	add_tradeanim TradeAnim_Wait80               ; 21
+	add_tradeanim TradeAnim_Wait40               ; 22
 	add_tradeanim TradeAnim_RockingBall          ; 23
 	add_tradeanim TradeAnim_DropBall             ; 24
 	add_tradeanim TradeAnim_WaitAnim             ; 25
@@ -285,9 +285,9 @@
 	add_tradeanim TradeAnim_GetTrademonSFX       ; 2a
 	add_tradeanim TradeAnim_End                  ; 2b
 	add_tradeanim TradeAnim_AnimateFrontpic      ; 2c
-	add_tradeanim TradeAnim_Wait96              ; 2d
-	add_tradeanim TradeAnim_Wait80IfOTEgg       ; 2e
-	add_tradeanim TradeAnim_Wait180IfOTEgg      ; 2f
+	add_tradeanim TradeAnim_Wait96               ; 2d
+	add_tradeanim TradeAnim_Wait80IfOTEgg        ; 2e
+	add_tradeanim TradeAnim_Wait180IfOTEgg       ; 2f
 
 TradeAnim_IncrementJumptableIndex:
 	ld hl, wJumptableIndex
@@ -1333,7 +1333,7 @@
 	ret
 
 TradeAnim_FlashBGPals:
-	ld a, [wcf65]
+	ld a, [wFrameCounter2]
 	and $7
 	ret nz
 	ldh a, [rBGP]
--- a/engine/movie/unused_title.asm
+++ b/engine/movie/unused_title.asm
@@ -1,4 +1,4 @@
-UnusedTitleScreen:
+UnusedTitleScreen: ; unreferenced
 	call ClearBGPalettes
 	call ClearTilemap
 	call DisableLCD
@@ -154,7 +154,7 @@
 	dbsprite 13, 11,  0,  0, $4c, 1
 	dbsprite 14, 11,  0,  0, $4e, 1
 
-Function10ed51:
+Function10ed51: ; unreferenced
 	call _TitleScreen
 .loop
 	call JoyTextDelay
--- a/engine/overworld/decorations.asm
+++ b/engine/overworld/decorations.asm
@@ -44,7 +44,7 @@
 .MenuData:
 	db STATICMENU_CURSOR | STATICMENU_WRAP ; flags
 	db 0 ; items
-	dw wd002
+	dw wNumOwnedDecoCategories
 	dw PlaceNthMenuStrings
 	dw .pointers
 
@@ -75,7 +75,7 @@
 	ld a, 7
 	call .AppendToStringBuffer2
 	ld hl, wStringBuffer2
-	ld de, wd002
+	ld de, wDecoNameBuffer
 	ld bc, ITEM_NAME_LENGTH
 	call CopyBytes
 	ret
@@ -133,10 +133,11 @@
 
 Deco_FillTempWithMinusOne:
 	xor a
-	ld hl, wd002
+	ld hl, wNumOwnedDecoCategories
 	ld [hli], a
+	assert wNumOwnedDecoCategories + 1 == wOwnedDecoCategories
 	ld a, -1
-	ld bc, $10
+	ld bc, 16
 	call ByteFill
 	ret
 
@@ -161,10 +162,11 @@
 	ret
 
 AppendDecoIndex:
-	ld hl, wd002
+	ld hl, wNumOwnedDecoCategories
 	inc [hl]
+	assert wNumOwnedDecoCategories + 1 == wOwnedDecoCategories
 	ld e, [hl]
-	ld d, $0
+	ld d, 0
 	add hl, de
 	ld [hl], a
 	ret
@@ -176,7 +178,7 @@
 	pop hl
 	call CheckAllDecorationFlags
 	pop bc
-	ld a, [wd002]
+	ld a, [wNumOwnedDecoCategories]
 	and a
 	ret z
 
@@ -335,7 +337,7 @@
 	ret
 
 PopulateDecoCategoryMenu:
-	ld a, [wd002]
+	ld a, [wNumOwnedDecoCategories]
 	and a
 	jr z, .empty
 	cp 8
@@ -353,9 +355,10 @@
 	ret
 
 .beyond_eight
-	ld hl, wd002
+	ld hl, wNumOwnedDecoCategories
 	ld e, [hl]
 	dec [hl]
+	assert wNumOwnedDecoCategories + 1 == wOwnedDecoCategories
 	ld d, 0
 	add hl, de
 	ld [hl], -1
@@ -395,7 +398,7 @@
 .NonscrollingMenuData:
 	db STATICMENU_CURSOR | STATICMENU_WRAP ; flags
 	db 0 ; items
-	dw wd002
+	dw wDecoNameBuffer
 	dw DecorationMenuFunction
 	dw DecorationAttributes
 
@@ -409,10 +412,10 @@
 	db SCROLLINGMENU_DISPLAY_ARROWS ; flags
 	db 8, 0 ; rows, columns
 	db SCROLLINGMENU_ITEMS_NORMAL ; item format
-	dbw 0, wd002 ; text pointer
+	dbw 0, wDecoNameBuffer ; text pointer
 	dba DecorationMenuFunction
-	dbw 0, 0
-	dbw 0, 0
+	dbw 0, NULL
+	dbw 0, NULL
 
 GetDecorationData:
 	ld hl, DecorationAttributes
@@ -549,7 +552,7 @@
 	ld a, e
 	jr .getpokename
 
-.unused
+.unused ; unreferenced
 	push de
 	call .getdeconame
 	pop de
@@ -939,7 +942,7 @@
 	pop hl
 	ret
 
-SetAllDecorationFlags:
+SetAllDecorationFlags: ; unreferenced
 	ld hl, DecorationIDs
 .loop
 	ld a, [hli]
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -25,76 +25,76 @@
 
 DisableEvents:
 	xor a
-	ld [wScriptFlags3], a
+	ld [wScriptFlags2], a
 	ret
 
 EnableEvents::
 	ld a, $ff
-	ld [wScriptFlags3], a
+	ld [wScriptFlags2], a
 	ret
 
-CheckBit5_ScriptFlags3:
-	ld hl, wScriptFlags3
+CheckBit5_ScriptFlags2:
+	ld hl, wScriptFlags2
 	bit 5, [hl]
 	ret
 
-DisableWarpsConnxns:
-	ld hl, wScriptFlags3
+DisableWarpsConnxns: ; unreferenced
+	ld hl, wScriptFlags2
 	res 2, [hl]
 	ret
 
-DisableCoordEvents:
-	ld hl, wScriptFlags3
+DisableCoordEvents: ; unreferenced
+	ld hl, wScriptFlags2
 	res 1, [hl]
 	ret
 
-DisableStepCount:
-	ld hl, wScriptFlags3
+DisableStepCount: ; unreferenced
+	ld hl, wScriptFlags2
 	res 0, [hl]
 	ret
 
-DisableWildEncounters:
-	ld hl, wScriptFlags3
+DisableWildEncounters: ; unreferenced
+	ld hl, wScriptFlags2
 	res 4, [hl]
 	ret
 
-EnableWarpsConnxns:
-	ld hl, wScriptFlags3
+EnableWarpsConnxns: ; unreferenced
+	ld hl, wScriptFlags2
 	set 2, [hl]
 	ret
 
-EnableCoordEvents:
-	ld hl, wScriptFlags3
+EnableCoordEvents: ; unreferenced
+	ld hl, wScriptFlags2
 	set 1, [hl]
 	ret
 
-EnableStepCount:
-	ld hl, wScriptFlags3
+EnableStepCount: ; unreferenced
+	ld hl, wScriptFlags2
 	set 0, [hl]
 	ret
 
 EnableWildEncounters:
-	ld hl, wScriptFlags3
+	ld hl, wScriptFlags2
 	set 4, [hl]
 	ret
 
 CheckWarpConnxnScriptFlag:
-	ld hl, wScriptFlags3
+	ld hl, wScriptFlags2
 	bit 2, [hl]
 	ret
 
 CheckCoordEventScriptFlag:
-	ld hl, wScriptFlags3
+	ld hl, wScriptFlags2
 	bit 1, [hl]
 	ret
 
 CheckStepCountScriptFlag:
-	ld hl, wScriptFlags3
+	ld hl, wScriptFlags2
 	bit 0, [hl]
 	ret
 
 CheckWildEncountersScriptFlag:
-	ld hl, wScriptFlags3
+	ld hl, wScriptFlags2
 	bit 4, [hl]
 	ret
 
@@ -135,7 +135,7 @@
 	ld [wMapStatus], a
 	ret
 
-UnusedWait30Frames:
+UnusedWait30Frames: ; unreferenced
 	ld c, 30
 	call DelayFrames
 	ret
@@ -248,7 +248,7 @@
 	and a
 	ret nz
 
-	call Dummy_CheckScriptFlags3Bit5 ; This is a waste of time
+	call Dummy_CheckScriptFlags2Bit5 ; This is a waste of time
 
 	call CheckTrainerBattle_GetPlayerEvent
 	jr c, .ok
@@ -395,8 +395,8 @@
 	ld [wWildEncounterCooldown], a
 	ret
 
-Dummy_CheckScriptFlags3Bit5:
-	call CheckBit5_ScriptFlags3
+Dummy_CheckScriptFlags2Bit5:
+	call CheckBit5_ScriptFlags2
 	ret z
 	call SetXYCompareFlags
 	ret
@@ -480,8 +480,8 @@
 	scf
 	ret
 
-.unused
-	ld a, 8
+.unused ; unreferenced
+	ld a, $8 ; ???
 	scf
 	ret
 
@@ -812,7 +812,7 @@
 CheckMenuOW:
 	xor a
 	ldh [hMenuReturn], a
-	ldh [hUnusedFFA1], a
+	ldh [hUnusedByte], a
 	ldh a, [hJoyPressed]
 
 	bit SELECT_F, a
--- a/engine/overworld/map_object_action.asm
+++ b/engine/overworld/map_object_action.asm
@@ -273,7 +273,8 @@
 	and 2
 	ld a, FACING_BOULDER_DUST_1
 	jr z, .ok
-	inc a ; FACING_BOULDER_DUST_2
+	inc a
+	assert FACING_BOULDER_DUST_1 + 1 == FACING_BOULDER_DUST_2
 .ok
 	ld [hl], a
 	ret
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -2894,20 +2894,20 @@
 	ldh [hCurSpriteTile], a
 	xor a
 	bit 7, [hl]
-	jr nz, .skip1
+	jr nz, .not_vram1
 	or VRAM_BANK_1
-.skip1
+.not_vram1
 	ld hl, OBJECT_FLAGS2
 	add hl, bc
 	ld e, [hl]
 	bit OBJ_FLAGS2_7, e
-	jr z, .skip2
+	jr z, .not_priority
 	or PRIORITY
-.skip2
+.not_priority
 	bit USE_OBP1_F, e
-	jr z, .skip3
+	jr z, .not_obp_num
 	or OBP_NUM
-.skip3
+.not_obp_num
 	ld hl, OBJECT_PALETTE
 	add hl, bc
 	ld d, a
@@ -2917,9 +2917,9 @@
 	ld d, a
 	xor a
 	bit OVERHEAD_F, e
-	jr z, .skip4
+	jr z, .not_overhead
 	or PRIORITY
-.skip4
+.not_overhead
 	ldh [hCurSpriteOAMFlags], a
 	ld hl, OBJECT_SPRITE_X
 	add hl, bc
--- a/engine/overworld/map_setup.asm
+++ b/engine/overworld/map_setup.asm
@@ -82,7 +82,7 @@
 	farcall InitializeVisibleSprites
 	ret
 
-; unused
+MapSetup_DummyFunction: ; unreferenced
 	ret
 
 ResetPlayerObjectAction:
--- a/engine/overworld/player_movement.asm
+++ b/engine/overworld/player_movement.asm
@@ -311,7 +311,7 @@
 	scf
 	ret
 
-; unused
+.unused ; unreferenced
 	xor a
 	ret
 
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -458,11 +458,11 @@
 	ld de, GiveItemScript
 	jp ScriptCall
 
-ret_96f76:
+GiveItemScript_DummyFunction:
 	ret
 
 GiveItemScript:
-	callasm ret_96f76
+	callasm GiveItemScript_DummyFunction
 	writetext .ReceivedItemText
 	iffalse .Full
 	waitsfx
@@ -1703,7 +1703,7 @@
 	push bc
 	inc hl
 	ld bc, MAIL_MSG_LENGTH
-	ld de, wd002
+	ld de, wMonMailMessageBuffer
 	ld a, [wScriptBank]
 	call FarCopyBytes
 	pop bc
@@ -2173,8 +2173,7 @@
 	farcall EnableEvents
 	ret
 
-Script_enableevents:
-; unused
+Script_enableevents: ; unreferenced
 	farcall EnableEvents
 	ret
 
@@ -2204,7 +2203,8 @@
 	ld [wUnusedScriptByteBuffer], a
 	ret
 
-	db closetext_command ; unused
+UnusedClosetextScript: ; unreferenced
+	closetext
 
 Script_closetext:
 	call _OpenAndCloseMenu_HDMATransferTilemapAndAttrmap
@@ -2316,13 +2316,13 @@
 	ret
 
 Script_halloffame:
-	ld hl, wGameTimerPause
-	res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
+	ld hl, wGameTimerPaused
+	res GAME_TIMER_PAUSED_F, [hl]
 	farcall StubbedTrainerRankings_HallOfFame
 	farcall StubbedTrainerRankings_HallOfFame2
 	farcall HallOfFame
-	ld hl, wGameTimerPause
-	set GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
+	ld hl, wGameTimerPaused
+	set GAME_TIMER_PAUSED_F, [hl]
 	jr ReturnFromCredits
 
 Script_credits:
@@ -2353,7 +2353,7 @@
 	ld [wScriptVar], a
 	ret
 
-; unused
+Script_checkver_duplicate: ; unreferenced
 	ld a, [.gs_version]
 	ld [wScriptVar], a
 	ret
--- a/engine/overworld/time.asm
+++ b/engine/overworld/time.asm
@@ -203,7 +203,7 @@
 	xor a
 	ret
 
-SetUnusedTwoDayTimer:
+SetUnusedTwoDayTimer: ; unreferenced
 	ld a, 2
 	ld hl, wUnusedTwoDayTimer
 	ld [hl], a
@@ -220,12 +220,12 @@
 	call UpdateTimeRemaining
 	ret
 
-; unused
+UnusedSetSwarmFlag: ; unreferenced
 	ld hl, wDailyFlags1
 	set DAILYFLAGS1_FISH_SWARM_F, [hl]
 	ret
 
-; unused
+UnusedCheckSwarmFlag: ; unreferenced
 	and a
 	ld hl, wDailyFlags1
 	bit DAILYFLAGS1_FISH_SWARM_F, [hl]
@@ -272,7 +272,7 @@
 	ld hl, wBuffer1
 	call InitOneDayCountdown
 	call CloseSRAM
-	farcall Function1050c8
+	farcall ResetDailyMysteryGiftLimitIfUnlocked
 
 .not_timed_out
 	ld a, BANK(sMysteryGiftTimer)
@@ -308,7 +308,7 @@
 	scf
 	ret
 
-GetSecondsSinceIfLessThan60:
+GetSecondsSinceIfLessThan60: ; unreferenced
 	ld a, [wDaysSince]
 	and a
 	jr nz, GetTimeElapsed_ExceedsUnitLimit
@@ -330,7 +330,7 @@
 	ld a, [wMinutesSince]
 	ret
 
-GetHoursSinceIfLessThan24:
+GetHoursSinceIfLessThan24: ; unreferenced
 	ld a, [wDaysSince]
 	and a
 	jr nz, GetTimeElapsed_ExceedsUnitLimit
@@ -349,7 +349,7 @@
 	xor a
 	jr _CalcDaysSince
 
-CalcHoursDaysSince:
+CalcHoursDaysSince: ; unreferenced
 	inc hl
 	xor a
 	jr _CalcHoursDaysSince
@@ -423,7 +423,7 @@
 	ld [hl], a
 	ret
 
-CopyDayHourToHL:
+CopyDayHourToHL: ; unreferenced
 	ld a, [wCurDay]
 	ld [hli], a
 	ldh a, [hHours]
--- a/engine/overworld/warp_connection.asm
+++ b/engine/overworld/warp_connection.asm
@@ -175,7 +175,8 @@
 ; MOUNT_MOON_SQUARE and TIN_TOWER_ROOF are outdoor maps within indoor maps.
 ; Dig and Escape Rope should not take you to them.
 	ld a, [wPrevMapGroup]
-	cp GROUP_MOUNT_MOON_SQUARE ; aka GROUP_TIN_TOWER_ROOF
+	cp GROUP_MOUNT_MOON_SQUARE
+	assert GROUP_MOUNT_MOON_SQUARE == GROUP_TIN_TOWER_ROOF
 	jr nz, .not_mt_moon_or_tin_tower
 	ld a, [wPrevMapNumber]
 	cp MAP_MOUNT_MOON_SQUARE
@@ -390,35 +391,33 @@
 	ld hl, wOverworldMapBlocks
 	ld a, [wXCoord]
 	bit 0, a
-	jr nz, .increment_then_halve1
+	jr nz, .odd_x
+; even x
 	srl a
-	add $1
-	jr .resume
-
-.increment_then_halve1
-	add $1
+	add 1
+	jr .got_block_x
+.odd_x
+	add 1
 	srl a
-
-.resume
+.got_block_x
 	ld c, a
-	ld b, $0
+	ld b, 0
 	add hl, bc
 	ld a, [wMapWidth]
-	add $6
+	add MAP_CONNECTION_PADDING_WIDTH * 2
 	ld c, a
-	ld b, $0
+	ld b, 0
 	ld a, [wYCoord]
 	bit 0, a
-	jr nz, .increment_then_halve2
+	jr nz, .odd_y
+; even y
 	srl a
-	add $1
-	jr .resume2
-
-.increment_then_halve2
-	add $1
+	add 1
+	jr .got_block_y
+.odd_y
+	add 1
 	srl a
-
-.resume2
+.got_block_y
 	call AddNTimes
 	ld a, l
 	ld [wOverworldMapAnchor], a
@@ -425,9 +424,9 @@
 	ld a, h
 	ld [wOverworldMapAnchor + 1], a
 	ld a, [wYCoord]
-	and $1
+	and 1
 	ld [wMetatileStandingY], a
 	ld a, [wXCoord]
-	and $1
+	and 1
 	ld [wMetatileStandingX], a
 	ret
--- a/engine/phone/phone.asm
+++ b/engine/phone/phone.asm
@@ -437,7 +437,7 @@
 	ld e, PHONE_BILL
 	jp LoadCallerScript
 
-LoadElmCallScript:
+Script_SpecialElmCall: ; unreferenced
 	callasm .LoadElmScript
 	pause 30
 	sjump Script_ReceivePhoneCall
@@ -720,7 +720,7 @@
 	text_far _PhoneJustTalkToThemText
 	text_end
 
-PhoneThankYouTextScript:
+PhoneThankYouTextScript: ; unreferenced
 	writetext PhoneThankYouText
 	end
 
--- a/engine/phone/scripts/elm.asm
+++ b/engine/phone/scripts/elm.asm
@@ -95,7 +95,7 @@
 	specialphonecall SPECIALCALL_NONE
 	end
 
-.unused
+.neat ; unreferenced
 	farwritetext ElmPhoneGotAholdOfSomethingNeatText
 	specialphonecall SPECIALCALL_NONE
 	end
--- a/engine/phone/scripts/generic_callee.asm
+++ b/engine/phone/scripts/generic_callee.asm
@@ -1103,7 +1103,7 @@
 	promptbutton
 	end
 
-.Unknown:
+.Unknown: ; unreferenced
 	farwritetext UnknownGenericText
 	promptbutton
 	end
--- a/engine/phone/scripts/hangups_2.asm
+++ b/engine/phone/scripts/hangups_2.asm
@@ -3,7 +3,7 @@
 	promptbutton
 	sjump PhoneScript_HangUpText_Female
 
-JoseComePickUpScript:
+JoseComePickUpScript: ; unreferenced
 	farwritetext JoseComePickUpText
 	promptbutton
 	sjump PhoneScript_HangUpText_Male
--- a/engine/pokedex/pokedex.asm
+++ b/engine/pokedex/pokedex.asm
@@ -91,7 +91,7 @@
 	ld [wJumptableIndex], a
 	ld [wPrevDexEntryJumptableIndex], a
 	ld [wPrevDexEntryBackup], a
-	ld [wcf66], a
+	ld [wUnusedPokedexByte], a
 
 	call Pokedex_CheckUnlockedUnownMode
 
@@ -1166,7 +1166,7 @@
 	call Pokedex_PlaceFrontpicTopLeftCorner
 	ret
 
-.Unused:
+.Number: ; unreferenced
 	db $5c, $5d, -1 ; No.
 .Height:
 	db "HT  ?", $5e, "??", $5f, -1 ; HT  ?'??"
@@ -2480,6 +2480,7 @@
 	ld a, BANK(sScratch)
 	call OpenSRAM
 	ld hl, UnownFont
+	; sScratch + $188 was the address of sDecompressBuffer in pokegold
 	ld de, sScratch + $188
 	ld bc, 39 tiles
 	ld a, BANK(UnownFont)
--- a/engine/pokegear/pokegear.asm
+++ b/engine/pokegear/pokegear.asm
@@ -92,7 +92,7 @@
 	ld [wJumptableIndex], a ; POKEGEARSTATE_CLOCKINIT
 	ld [wPokegearCard], a ; POKEGEARCARD_CLOCK
 	ld [wPokegearMapRegion], a ; JOHTO_REGION
-	ld [wcf66], a
+	ld [wUnusedPokegearByte], a
 	ld [wPokegearPhoneScrollPosition], a
 	ld [wPokegearPhoneCursorPosition], a
 	ld [wPokegearPhoneSelectedPerson], a
@@ -1271,7 +1271,7 @@
 	dw .Call
 	dw .Cancel
 
-; unused
+GetAMPMHours: ; unreferenced
 	ldh a, [hHours]
 	cp 12
 	jr c, .am
@@ -1442,7 +1442,7 @@
 	ldh [hBGMapMode], a
 	ret
 
-; unused
+LoadPokegearRadioChannelPointer: ; unreferenced
 	ld [wPokegearRadioChannelBank], a
 	ld a, [hli]
 	ld [wPokegearRadioChannelAddr], a
@@ -1546,7 +1546,7 @@
 	jr z, .johto
 	cp KANTO_LANDMARK
 	jr c, .johto
-.kanto
+; kanto
 	and a
 	ret
 
@@ -2038,7 +2038,7 @@
 	lb bc, BANK(FlyMapLabelBorderGFX), 6
 	call Request1bpp
 	call FlyMap
-	call ret_91c8f
+	call Pokegear_DummyFunction
 	ld b, SCGB_POKEGEAR_PALS
 	call GetSGBLayout
 	call SetPalettes
@@ -2243,7 +2243,7 @@
 
 INCLUDE "data/maps/flypoints.asm"
 
-ret_91c8f:
+Pokegear_DummyFunction:
 	ret
 
 FlyMap:
@@ -2265,7 +2265,7 @@
 ; The first 46 locations are part of Johto. The rest are in Kanto.
 	cp KANTO_LANDMARK
 	jr nc, .KantoFlyMap
-.JohtoFlyMap:
+; Johto fly map
 ; Note that .NoKanto should be modified in tandem with this branch
 	push af
 	ld a, JOHTO_FLYPOINT ; first Johto flypoint
@@ -2569,7 +2569,7 @@
 	jr z, .johto
 	cp KANTO_LANDMARK
 	jr c, .johto
-.kanto
+; kanto
 	ld a, [wTownMapCursorLandmark]
 	and a
 	jr z, .clear
--- a/engine/pokegear/radio.asm
+++ b/engine/pokegear/radio.asm
@@ -141,7 +141,7 @@
 	ld [wRadioTextDelay], a
 	ret
 
-ReplacePeriodsWithSpaces:
+ReplacePeriodsWithSpaces: ; unreferenced
 	push hl
 	ld b, SCREEN_WIDTH * 2
 .loop
@@ -149,7 +149,6 @@
 	cp "."
 	jr nz, .next
 	ld [hl], " "
-
 .next
 	inc hl
 	dec b
@@ -335,6 +334,7 @@
 	; so no need for a retry loop
 	call Random
 	maskbits NUM_OAKS_POKEMON_TALK_ADVERBS
+	assert_power_of_2 NUM_OAKS_POKEMON_TALK_ADVERBS
 	ld e, a
 	ld d, 0
 	ld hl, .Adverbs
@@ -434,6 +434,7 @@
 	; so no need for a retry loop
 	call Random
 	maskbits NUM_OAKS_POKEMON_TALK_ADJECTIVES
+	assert_power_of_2 NUM_OAKS_POKEMON_TALK_ADJECTIVES
 	ld e, a
 	ld d, 0
 	ld hl, .Adjectives
@@ -1131,6 +1132,7 @@
 	; so no need for a retry loop
 	call Random
 	maskbits NUM_PNP_PEOPLE_ADJECTIVES
+	assert_power_of_2 NUM_PNP_PEOPLE_ADJECTIVES
 	ld e, a
 	ld d, 0
 	ld hl, .Adjectives
@@ -1264,6 +1266,7 @@
 	; so no need for a retry loop
 	call Random
 	maskbits NUM_PNP_PLACES_ADJECTIVES
+	assert_power_of_2 NUM_PNP_PLACES_ADJECTIVES
 	ld e, a
 	ld d, 0
 	ld hl, .Adjectives
@@ -1779,7 +1782,7 @@
 	cp TX_FAR
 	jp z, FarCopyRadioText
 	ld de, wRadioText
-	ld bc, SCREEN_WIDTH * 2
+	ld bc, 2 * SCREEN_WIDTH
 	jp CopyBytes
 
 StartRadioStation:
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -101,7 +101,7 @@
 	ld [wJumptableIndex], a
 	ret
 
-.go_back
+.go_back ; unreferenced
 	ld hl, wJumptableIndex
 	dec [hl]
 	ret
@@ -358,7 +358,7 @@
 	ld [wJumptableIndex], a
 	ret
 
-.unused
+.go_back ; unreferenced
 	ld hl, wJumptableIndex
 	dec [hl]
 	ret
@@ -609,7 +609,7 @@
 	ld [wJumptableIndex], a
 	ret
 
-.unused
+.go_back ; unreferenced
 	ld hl, wJumptableIndex
 	dec [hl]
 	ret
@@ -782,9 +782,9 @@
 	call ByteFill
 	xor a
 	ld [wJumptableIndex], a
-	ld [wcf64], a
-	ld [wcf65], a
-	ld [wcf66], a
+	ld [wUnusedBillsPCData], a
+	ld [wUnusedBillsPCData+1], a
+	ld [wUnusedBillsPCData+2], a
 	ld [wBillsPC_CursorPosition], a
 	ld [wBillsPC_ScrollPosition], a
 	ret
@@ -1377,20 +1377,20 @@
 	jr z, .done\@
 	and a
 	jr z, .done\@
-	ld [de], a
+	ld [de], a ; species
 	inc de
 	ld a, [wBillsPC_LoadedBox]
-	ld [de], a
+	ld [de], a ; box number
 	inc de
-	ld a, [wd003]
-	ld [de], a
+	ld a, [wBillsPCTempListIndex]
+	ld [de], a ; list index
 	inc a
-	ld [wd003], a
+	ld [wBillsPCTempListIndex], a
 	inc de
 	inc hl
-	ld a, [wd004]
+	ld a, [wBillsPCTempBoxCount]
 	inc a
-	ld [wd004], a
+	ld [wBillsPCTempBoxCount], a
 	jr .loop\@
 
 .done\@
@@ -1399,7 +1399,7 @@
 endc
 	ld a, -1
 	ld [de], a
-	ld a, [wd004]
+	ld a, [wBillsPCTempBoxCount]
 	inc a
 	ld [wBillsPC_NumMonsInBox], a
 ENDM
@@ -1411,8 +1411,8 @@
 	call ByteFill
 	ld de, wBillsPCPokemonList
 	xor a
-	ld [wd003], a
-	ld [wd004], a
+	ld [wBillsPCTempListIndex], a
+	ld [wBillsPCTempBoxCount], a
 	ld a, [wBillsPC_LoadedBox]
 	and a
 	jr z, .party
@@ -2222,7 +2222,7 @@
 PCString_Bye: db "Bye,@"
 PCString_Stored: db "Stored @"
 PCString_Got: db "Got @"
-PCString_Non: db "Non.@"
+PCString_Non: db "Non.@" ; unreferenced
 PCString_BoxFull: db "The BOX is full.@"
 PCString_PartyFull: db "The party's full!@"
 PCString_NoReleasingEGGS: db "No releasing EGGS!@"
@@ -2268,16 +2268,16 @@
 	dw .MenuData
 	db 1 ; default option
 
-.MenuData
+.MenuData:
 	db SCROLLINGMENU_CALL_FUNCTION3_NO_SWITCH | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags
 	db 4, 0 ; rows, columns
 	db SCROLLINGMENU_ITEMS_NORMAL ; item format
-	dba .boxes
-	dba .boxnames
+	dba .Boxes
+	dba .PrintBoxNames
 	dba NULL
 	dba BillsPC_PrintBoxCountAndCapacity
 
-.boxes
+.Boxes:
 	db NUM_BOXES
 x = 1
 rept NUM_BOXES
@@ -2286,7 +2286,7 @@
 endr
 	db -1
 
-.boxnames
+.PrintBoxNames:
 	push de
 	ld a, [wMenuSelection]
 	dec a
@@ -2455,7 +2455,7 @@
 
 .Name:
 	ld b, NAME_BOX
-	ld de, wd002
+	ld de, wBoxNameBuffer
 	farcall NamingScreen
 	call ClearTilemap
 	call LoadStandardFont
@@ -2465,17 +2465,17 @@
 	call GetBoxName
 	ld e, l
 	ld d, h
-	ld hl, wd002
+	ld hl, wBoxNameBuffer
 	ld c, BOX_NAME_LENGTH - 1
 	call InitString
 	ld a, [wMenuSelection]
 	dec a
 	call GetBoxName
-	ld de, wd002
+	ld de, wBoxNameBuffer
 	call CopyName2
 	ret
 
-	hlcoord 11, 7 ; unused
+	hlcoord 11, 7 ; unreferenced
 
 .MenuHeader:
 	db MENU_BACKUP_TILES ; flags
--- a/engine/pokemon/breedmon_level_growth.asm
+++ b/engine/pokemon/breedmon_level_growth.asm
@@ -1,5 +1,5 @@
 GetBreedMon1LevelGrowth:
-	ld hl, wBreedMon1Stats
+	ld hl, wBreedMon1
 	ld de, wTempMon
 	ld bc, BOXMON_STRUCT_LENGTH
 	call CopyBytes
@@ -13,7 +13,7 @@
 	ret
 
 GetBreedMon2LevelGrowth:
-	ld hl, wBreedMon2Stats
+	ld hl, wBreedMon2
 	ld de, wTempMon
 	ld bc, BOXMON_STRUCT_LENGTH
 	call CopyBytes
--- a/engine/pokemon/evolve.asm
+++ b/engine/pokemon/evolve.asm
@@ -327,7 +327,7 @@
 	inc hl
 	jp .loop
 
-; unused
+.UnusedReturnToMap: ; unreferenced
 	pop hl
 .ReturnToMap:
 	pop de
@@ -512,7 +512,7 @@
 	ld a, [wEvolutionOldSpecies]
 	and a
 	jr z, .CheckMove
-	ld a, [wd002]
+	ld a, [wPrevPartyLevel]
 	cp b
 	jr nc, .GetMove
 
--- a/engine/pokemon/mail.asm
+++ b/engine/pokemon/mail.asm
@@ -8,7 +8,7 @@
 	cp MAILBOX_CAPACITY
 	jr nc, .full
 	ld bc, MAIL_STRUCT_LENGTH
-	ld hl, sMailbox
+	ld hl, sMailboxes
 	call AddNTimes
 	ld d, h
 	ld e, l
@@ -44,7 +44,7 @@
 	call OpenSRAM
 	ld a, b
 	push bc
-	ld hl, sMailbox
+	ld hl, sMailboxes
 	ld bc, MAIL_STRUCT_LENGTH
 	call AddNTimes
 	push hl
@@ -73,7 +73,7 @@
 
 ReadMailMessage:
 	ld a, b
-	ld hl, sMailbox
+	ld hl, sMailboxes
 	ld bc, MAIL_STRUCT_LENGTH
 	call AddNTimes
 	ld d, h
@@ -87,7 +87,7 @@
 	push bc
 	ld a, b
 	ld bc, MAIL_STRUCT_LENGTH
-	ld hl, sMailbox
+	ld hl, sMailboxes
 	call AddNTimes
 	push hl
 	ld a, [wCurPartyMon]
@@ -206,7 +206,7 @@
 	call AddNTimes
 	ld d, h
 	ld e, l
-	ld hl, wd002
+	ld hl, wMonMailMessageBuffer
 	ld bc, MAIL_MSG_LENGTH + 1
 	ld a, BANK(sPartyMail)
 	call OpenSRAM
@@ -314,19 +314,19 @@
 	text_end
 
 InitMail:
-; initialize wMailboxCount and beyond with incrementing values, one per mail
-; set z if no mail
+; return z if no mail
 	ld a, BANK(sMailboxCount)
 	call OpenSRAM
 	ld a, [sMailboxCount]
 	call CloseSRAM
+
+; initialize wMailboxCount from sMailboxCount
 	ld hl, wMailboxCount
-	ld [hli], a
+	ld [hli], a ; now hl = wMailboxItems
 	and a
-
 	jr z, .done ; if no mail, we're done
 
-	; load values in memory with incrementing values starting at wMailboxCount
+; initialize wMailboxItems with incrementing values starting at 1
 	ld b, a
 	ld a, 1
 .loop
@@ -334,6 +334,7 @@
 	inc a
 	dec b
 	jr nz, .loop
+
 .done
 	ld [hl], -1 ; terminate
 
--- a/engine/pokemon/mail_2.asm
+++ b/engine/pokemon/mail_2.asm
@@ -404,7 +404,7 @@
 	ld de, BlueSkyMailGrassGFX
 	ld c, 1 * LEN_1BPP_TILE
 	call LoadMailGFX_Color3
-	ld de, MailDragoniteGFX
+	ld de, MailDragoniteAndSentretGFX
 	ld c, 23 * LEN_1BPP_TILE
 	call LoadMailGFX_Color3
 	ld de, MailCloudGFX
@@ -767,7 +767,7 @@
 	ld b, 14 / 2
 	jr Mail_PlaceAlternatingRow
 
-Mail_Place16TileAlternatingRow:
+Mail_Place16TileAlternatingRow: ; unreferenced
 	push af
 	ld b, 16 / 2
 	jr Mail_PlaceAlternatingRow
@@ -775,6 +775,7 @@
 Mail_Place18TileAlternatingRow:
 	push af
 	ld b, 18 / 2
+	; fallthrough
 
 Mail_PlaceAlternatingRow:
 .loop
@@ -812,16 +813,16 @@
 	pop af
 	ret
 
-Mail_Draw7TileRow:
-	ld b, $7
+Mail_Draw7TileRow: ; unreferenced
+	ld b, 7
 	jr Mail_DrawRowLoop
 
 Mail_Draw13TileRow:
-	ld b, $d
+	ld b, 13
 	jr Mail_DrawRowLoop
 
 Mail_Draw16TileRow:
-	ld b, $10
+	ld b, 16
 	jr Mail_DrawRowLoop
 
 Mail_DrawTopBottomBorder:
@@ -830,6 +831,7 @@
 
 Mail_DrawFullWidthBorder:
 	ld b, SCREEN_WIDTH
+	; fallthrough
 
 Mail_DrawRowLoop:
 .loop
--- a/engine/pokemon/move_mon.asm
+++ b/engine/pokemon/move_mon.asm
@@ -780,7 +780,7 @@
 	call WaitSFX
 	call GetBreedMon1LevelGrowth
 	ld a, b
-	ld [wd002], a
+	ld [wPrevPartyLevel], a
 	ld a, e
 	ld [wCurPartyLevel], a
 	xor a
@@ -795,12 +795,12 @@
 	call WaitSFX
 	call GetBreedMon2LevelGrowth
 	ld a, b
-	ld [wd002], a
+	ld [wPrevPartyLevel], a
 	ld a, e
 	ld [wCurPartyLevel], a
 	ld a, PC_DEPOSIT
 	ld [wPokemonWithdrawDepositParameter], a
-	jp RetrieveBreedmon
+	jp RetrieveBreedmon ; pointless
 
 RetrieveBreedmon:
 	ld hl, wPartyCount
--- a/engine/pokemon/party_menu.asm
+++ b/engine/pokemon/party_menu.asm
@@ -758,12 +758,10 @@
 MoveToWhereString:
 	db "Move to where?@"
 
-ChooseAFemalePKMNString:
-; unused
+ChooseAFemalePKMNString: ; unreferenced
 	db "Choose a ♀<PK><MN>.@"
 
-ChooseAMalePKMNString:
-; unused
+ChooseAMalePKMNString: ; unreferenced
 	db "Choose a ♂<PK><MN>.@"
 
 ToWhichPKMNString:
--- a/engine/pokemon/stats_screen.asm
+++ b/engine/pokemon/stats_screen.asm
@@ -33,7 +33,7 @@
 	push af
 	ld a, [wJumptableIndex]
 	ld b, a
-	ld a, [wcf64]
+	ld a, [wStatsScreenFlags]
 	ld c, a
 
 	push bc
@@ -52,7 +52,7 @@
 	ld a, b
 	ld [wJumptableIndex], a
 	ld a, c
-	ld [wcf64], a
+	ld [wStatsScreenFlags], a
 	pop af
 	ld [wBoxAlignment], a
 	pop af
@@ -63,11 +63,11 @@
 	xor a
 	ld [wJumptableIndex], a
 ; ???
-	ld [wcf64], a
-	ld a, [wcf64]
+	ld [wStatsScreenFlags], a
+	ld a, [wStatsScreenFlags]
 	and $ff ^ STAT_PAGE_MASK
 	or PINK_PAGE ; first_page
-	ld [wcf64], a
+	ld [wStatsScreenFlags], a
 .loop
 	ld a, [wJumptableIndex]
 	and $ff ^ (1 << 7)
@@ -83,11 +83,11 @@
 	xor a
 	ld [wJumptableIndex], a
 ; ???
-	ld [wcf64], a
-	ld a, [wcf64]
+	ld [wStatsScreenFlags], a
+	ld a, [wStatsScreenFlags]
 	and $ff ^ STAT_PAGE_MASK
 	or PINK_PAGE ; first_page
-	ld [wcf64], a
+	ld [wStatsScreenFlags], a
 .loop
 	farcall Mobile_SetOverworldDelay
 	ld a, [wJumptableIndex]
@@ -115,7 +115,7 @@
 	dw StatsScreen_Exit
 
 StatsScreen_WaitAnim:
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	bit 6, [hl]
 	jr nz, .try_anim
 	bit 5, [hl]
@@ -126,10 +126,10 @@
 .try_anim
 	farcall SetUpPokeAnim
 	jr nc, .finish
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	res 6, [hl]
 .finish
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	res 5, [hl]
 	farcall HDMATransferTilemapToWRAMBank3
 	ret
@@ -147,7 +147,7 @@
 	ret
 
 MonStatsInit:
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	res 6, [hl]
 	call ClearBGPalettes
 	call ClearTilemap
@@ -157,7 +157,7 @@
 	cp EGG
 	jr z, .egg
 	call StatsScreen_InitUpperHalf
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	set 4, [hl]
 	ld h, 4
 	call StatsScreen_SetJumptableIndex
@@ -217,7 +217,7 @@
 	ld de, .HatchSoonString
 	hlcoord 8, 17
 	call PlaceString
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	set 5, [hl]
 	pop hl
 	pop de
@@ -232,7 +232,7 @@
 
 StatsScreen_LoadPage:
 	call StatsScreen_LoadGFX
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	res 4, [hl]
 	ld a, [wJumptableIndex]
 	inc a
@@ -314,7 +314,7 @@
 
 StatsScreen_JoypadAction:
 	push af
-	ld a, [wcf64]
+	ld a, [wStatsScreenFlags]
 	maskbits NUM_STAT_PAGES
 	ld c, a
 	pop af
@@ -393,10 +393,10 @@
 	ret
 
 .set_page
-	ld a, [wcf64]
+	ld a, [wStatsScreenFlags]
 	and $ff ^ STAT_PAGE_MASK
 	or c
-	ld [wcf64], a
+	ld [wStatsScreenFlags], a
 	ld h, 4
 	call StatsScreen_SetJumptableIndex
 	ret
@@ -530,7 +530,7 @@
 	call .ClearBox
 	call .PageTilemap
 	call .LoadPals
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	bit 4, [hl]
 	jr nz, .place_frontpic
 	call SetPalettes
@@ -541,7 +541,7 @@
 	ret
 
 .ClearBox:
-	ld a, [wcf64]
+	ld a, [wStatsScreenFlags]
 	maskbits NUM_STAT_PAGES
 	ld c, a
 	call StatsScreen_LoadPageIndicators
@@ -551,17 +551,17 @@
 	ret
 
 .LoadPals:
-	ld a, [wcf64]
+	ld a, [wStatsScreenFlags]
 	maskbits NUM_STAT_PAGES
 	ld c, a
 	farcall LoadStatsScreenPals
 	call DelayFrame
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	set 5, [hl]
 	ret
 
 .PageTilemap:
-	ld a, [wcf64]
+	ld a, [wStatsScreenFlags]
 	maskbits NUM_STAT_PAGES
 	dec a
 	ld hl, .Jumptable
@@ -848,7 +848,7 @@
 	ret
 
 .AnimateMon:
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	set 5, [hl]
 	ld a, [wCurPartySpecies]
 	cp UNOWN
@@ -890,7 +890,7 @@
 	ld d, $0
 	ld e, ANIM_MON_MENU
 	predef LoadMonAnimation
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	set 6, [hl]
 	ret
 
@@ -1033,7 +1033,7 @@
 .picked
 	hlcoord 1, 9
 	call PlaceString
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	set 5, [hl]
 	call SetPalettes ; pals
 	call DelayFrame
@@ -1099,7 +1099,7 @@
 	hlcoord 0, 0
 	ld d, $0
 	predef LoadMonAnimation
-	ld hl, wcf64
+	ld hl, wStatsScreenFlags
 	set 6, [hl]
 	ret
 
--- a/engine/pokemon/switchpartymons.asm
+++ b/engine/pokemon/switchpartymons.asm
@@ -65,7 +65,7 @@
 	ld bc, PARTYMON_STRUCT_LENGTH
 	call AddNTimes
 	push hl
-	ld de, wd002
+	ld de, wSwitchMonBuffer
 	ld bc, PARTYMON_STRUCT_LENGTH
 	call CopyBytes
 	ld a, [wBuffer3]
@@ -77,7 +77,7 @@
 	ld bc, PARTYMON_STRUCT_LENGTH
 	call CopyBytes
 	pop de
-	ld hl, wd002
+	ld hl, wSwitchMonBuffer
 	ld bc, PARTYMON_STRUCT_LENGTH
 	call CopyBytes
 	ld a, [wBuffer2]
@@ -84,7 +84,7 @@
 	ld hl, wPartyMonOT
 	call SkipNames
 	push hl
-	call .CopyNameTowd002
+	call .CopyNameToSwitchMonBuffer
 	ld a, [wBuffer3]
 	ld hl, wPartyMonOT
 	call SkipNames
@@ -92,13 +92,13 @@
 	push hl
 	call .CopyName
 	pop de
-	ld hl, wd002
+	ld hl, wSwitchMonBuffer
 	call .CopyName
 	ld hl, wPartyMonNicknames
 	ld a, [wBuffer2]
 	call SkipNames
 	push hl
-	call .CopyNameTowd002
+	call .CopyNameToSwitchMonBuffer
 	ld hl, wPartyMonNicknames
 	ld a, [wBuffer3]
 	call SkipNames
@@ -106,7 +106,7 @@
 	push hl
 	call .CopyName
 	pop de
-	ld hl, wd002
+	ld hl, wSwitchMonBuffer
 	call .CopyName
 	ld hl, sPartyMail
 	ld a, [wBuffer2]
@@ -113,7 +113,7 @@
 	ld bc, MAIL_STRUCT_LENGTH
 	call AddNTimes
 	push hl
-	ld de, wd002
+	ld de, wSwitchMonBuffer
 	ld bc, MAIL_STRUCT_LENGTH
 	ld a, BANK(sPartyMail)
 	call OpenSRAM
@@ -127,7 +127,7 @@
 	ld bc, MAIL_STRUCT_LENGTH
 	call CopyBytes
 	pop de
-	ld hl, wd002
+	ld hl, wSwitchMonBuffer
 	ld bc, MAIL_STRUCT_LENGTH
 	call CopyBytes
 	call CloseSRAM
@@ -136,8 +136,8 @@
 	pop hl
 	ret
 
-.CopyNameTowd002:
-	ld de, wd002
+.CopyNameToSwitchMonBuffer:
+	ld de, wSwitchMonBuffer
 
 .CopyName:
 	ld bc, NAME_LENGTH
--- a/engine/printer/printer.asm
+++ b/engine/printer/printer.asm
@@ -447,9 +447,11 @@
 	ret
 
 .pressed_b
-	ld a, [wca80]
+	ld a, [wUnusedGameboyPrinterSafeCancelFlag]
 	cp $0c
 	jr nz, .cancel
+
+; wait for printer activity to finish before canceling?
 .loop
 	ld a, [wPrinterOpcode]
 	and a
--- a/engine/printer/printer_serial.asm
+++ b/engine/printer/printer_serial.asm
@@ -304,7 +304,7 @@
 	xor a
 	ld [wPrinterSendByteCounter], a
 	ld [wPrinterSendByteCounter + 1], a
-	ld hl, wGameboyPrinterRAM
+	ld hl, wGameboyPrinter2bppSource
 	ld bc, wGameboyPrinter2bppSourceEnd - wGameboyPrinter2bppSource
 	call Printer_ByteFill
 	ret
@@ -435,10 +435,10 @@
 PrinterDataPacket4:
 	db  4, 0, $00, 0
 	dw 4
-PrinterDataPacket5: ; unused
+PrinterDataPacket5: ; unreferenced
 	db  8, 0, $00, 0
 	dw 8
-PrinterDataPacket6: ; unused
+PrinterDataPacket6: ; unreferenced
 	db 15, 0, $00, 0
 	dw 15
 
--- a/engine/smallflag.asm
+++ b/engine/smallflag.asm
@@ -36,9 +36,9 @@
 	jr z, .set ; 1 = SET_FLAG
 	dec b
 	jr z, .check ; 2 = CHECK_FLAG
-; 0 = RESET_FLAG
+	; 0 = RESET_FLAG
 
-.reset
+; reset
 	ld a, c
 	cpl
 	and [hl]
--- a/engine/tilesets/tileset_anims.asm
+++ b/engine/tilesets/tileset_anims.asm
@@ -305,7 +305,7 @@
 	jr nz, ScrollTileLeft
 	jr ScrollTileRight
 
-ScrollTileUpDown:
+ScrollTileUpDown: ; unreferenced
 ; Scroll up for 4 ticks, then down for 4 ticks.
 	ld a, [wTileAnimationTimer]
 	inc a
@@ -891,7 +891,7 @@
 	cp %100 ; frame 4
 	jr z, .color2
 
-.color1
+; color1
 	ld hl, wBGPals1 palette PAL_BG_WATER color 1
 	ld a, [hli]
 	ldh [rBGPD], a
--- a/gfx/font.asm
+++ b/gfx/font.asm
@@ -33,13 +33,13 @@
 TownMapGFX:
 INCBIN "gfx/pokegear/town_map.2bpp.lz"
 
-UnusedWeekdayKanjiGFX:
+UnusedWeekdayKanjiGFX: ; unreferenced
 INCBIN "gfx/font/unused_weekday_kanji.2bpp"
 
 PokegearPhoneIconGFX:
 INCBIN "gfx/font/phone_icon.2bpp"
 
-UnusedBoldFontGFX:
+UnusedBoldFontGFX: ; unreferenced
 INCBIN "gfx/font/unused_bold_font.1bpp"
 
 TextboxSpaceGFX:
@@ -49,7 +49,7 @@
 FontsExtra_SolidBlackGFX:
 INCBIN "gfx/font/black.1bpp"
 
-UnusedUpArrowGFX:
+UnusedUpArrowGFX: ; unreferenced
 INCBIN "gfx/font/unused_up_arrow.1bpp"
 
 MobilePhoneTilesGFX:
--- a/gfx/mail.asm
+++ b/gfx/mail.asm
@@ -55,14 +55,9 @@
 MailMewGFX:
 INCBIN "gfx/mail/mew.1bpp"
 
-MailDragoniteGFX:
+MailDragoniteAndSentretGFX:
 INCBIN "gfx/mail/dragonite.1bpp"
-
-MailSentretGFX:
 INCBIN "gfx/mail/sentret.1bpp"
-
-MailUnusedGrassGFX:
-INCBIN "gfx/mail/unused_grass.1bpp"
 
 PortraitMailLargePokeballGFX:
 INCBIN "gfx/mail/large_pokeball.1bpp"
binary files a/gfx/mail/sentret.png b/gfx/mail/sentret.png differ
--- a/gfx/tileset_palette_maps.asm
+++ b/gfx/tileset_palette_maps.asm
@@ -90,7 +90,7 @@
 TilesetPlayersRoomPalMap:
 INCLUDE "gfx/tilesets/players_room_palette_map.asm"
 
-UnusedMuseumPalMap:
+UnusedMuseumPalMap: ; unreferenced
 INCLUDE "gfx/tilesets/unused_museum_palette_map.asm"
 
 TilesetIcePathPalMap:
--- a/gfx/trade/mobile_border.pal
+++ b/gfx/trade/mobile_border.pal
@@ -1,9 +1,9 @@
-	RGB 31, 31, 63
+	dw $ffff ; RGB 31, 31, 63
 	RGB 00, 00, 00
 	RGB 00, 00, 00
 	RGB 00, 00, 00
 
-	RGB 31, 31, 63
+	dw $ffff ; RGB 31, 31, 63
 	RGB 00, 00, 00
 	RGB 00, 00, 00
 	RGB 00, 00, 00
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -436,7 +436,7 @@
 	and a
 	ret
 
-.bike
+.bike ; unreferenced
 	ld de, MUSIC_BICYCLE
 	scf
 	ret
--- a/home/battle.asm
+++ b/home/battle.asm
@@ -275,6 +275,6 @@
 	ld a, HIGH(wLYOverrides)
 	ld [wRequested2bppDest + 1], a
 
-	ld a, (wLYOverridesEnd - wLYOverrides) / 16
-	ld [wRequested2bpp], a
+	ld a, (wLYOverridesEnd - wLYOverrides) / LEN_2BPP_TILE
+	ld [wRequested2bppSize], a
 	ret
--- a/home/decompress.asm
+++ b/home/decompress.asm
@@ -80,7 +80,6 @@
 	cp LZ_LONG
 	jr nz, .short
 
-.long
 ; The count is now 10 bits.
 
 	; Read the next 3 bits.
@@ -133,7 +132,7 @@
 	cp LZ_ZERO
 	jr z, .Zero
 
-.Literal:
+; Literal
 ; Read literal data for bc bytes.
 .lloop
 	dec c
@@ -215,10 +214,8 @@
 	bit 7, a ; sign
 	jr z, .positive
 
-.negative
-; hl = de - a
-	; Since we can't subtract a from de,
-	; Make it negative and add de.
+; negative
+	; hl = de + -a
 	and %01111111
 	cpl
 	add e
--- a/home/game_time.asm
+++ b/home/game_time.asm
@@ -22,7 +22,7 @@
 	ldh [rSVBK], a
 	ret
 
-.Function
+.Function:
 ; Increment the game timer by one frame.
 ; The game timer is capped at 999:59:59.00.
 
@@ -32,8 +32,8 @@
 	ret nz
 
 ; Is the timer paused?
-	ld hl, wGameTimerPause
-	bit GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
+	ld hl, wGameTimerPaused
+	bit GAME_TIMER_PAUSED_F, [hl]
 	ret z
 
 ; Is the timer already capped?
--- a/home/gfx.asm
+++ b/home/gfx.asm
@@ -111,7 +111,7 @@
 	farcall _LoadFontsExtra2
 	ret
 
-LoadFontsExtra2:
+LoadFontsExtra2: ; unreferenced
 	farcall _LoadFontsExtra2
 	ret
 
@@ -226,10 +226,10 @@
 	cp [hl]
 	jr nc, .cycle
 
-	ld [wRequested2bpp], a
+	ld [wRequested2bppSize], a
 .wait
 	call DelayFrame
-	ld a, [wRequested2bpp]
+	ld a, [wRequested2bppSize]
 	and a
 	jr nz, .wait
 
@@ -245,11 +245,11 @@
 
 .cycle
 	ldh a, [hTilesPerCycle]
-	ld [wRequested2bpp], a
+	ld [wRequested2bppSize], a
 
 .wait2
 	call DelayFrame
-	ld a, [wRequested2bpp]
+	ld a, [wRequested2bppSize]
 	and a
 	jr nz, .wait2
 
@@ -300,10 +300,10 @@
 	cp [hl]
 	jr nc, .cycle
 
-	ld [wRequested1bpp], a
+	ld [wRequested1bppSize], a
 .wait
 	call DelayFrame
-	ld a, [wRequested1bpp]
+	ld a, [wRequested1bppSize]
 	and a
 	jr nz, .wait
 
@@ -319,11 +319,11 @@
 
 .cycle
 	ldh a, [hTilesPerCycle]
-	ld [wRequested1bpp], a
+	ld [wRequested1bppSize], a
 
 .wait2
 	call DelayFrame
-	ld a, [wRequested1bpp]
+	ld a, [wRequested1bppSize]
 	and a
 	jr nz, .wait2
 
--- a/home/init.asm
+++ b/home/init.asm
@@ -10,8 +10,8 @@
 	ldh [rIE], a
 	ei
 
-	ld hl, wcfbe
-	set 7, [hl]
+	ld hl, wJoypadDisable
+	set JOYPAD_DISABLE_SGB_TRANSFER_F, [hl]
 
 	ld c, 32
 	call DelayFrames
@@ -50,7 +50,7 @@
 	ldh [rOBP1], a
 	ldh [rTMA], a
 	ldh [rTAC], a
-	ld [wd000], a
+	ld [wBetaTitleSequenceOpeningType], a
 
 	ld a, %100 ; Start timer at 4096Hz
 	ldh [rTAC], a
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -27,8 +27,8 @@
 ; hJoypadSum: pressed so far
 
 ; Any of these three bits can be used to disable input.
-	ld a, [wcfbe]
-	and %11010000
+	ld a, [wJoypadDisable]
+	and (1 << JOYPAD_DISABLE_MON_FAINT_F) | (1 << JOYPAD_DISABLE_SGB_TRANSFER_F) | (1 << 4)
 	ret nz
 
 ; If we're saving, input is disabled.
--- a/home/map.asm
+++ b/home/map.asm
@@ -124,12 +124,12 @@
 	ld a, [wOverworldMapAnchor + 1]
 	ld d, a
 	ld hl, wSurroundingTiles
-	ld b, SURROUNDING_HEIGHT / METATILE_WIDTH ; 5
+	ld b, SCREEN_META_HEIGHT
 
 .row
 	push de
 	push hl
-	ld c, SURROUNDING_WIDTH / METATILE_WIDTH ; 6
+	ld c, SCREEN_META_WIDTH
 
 .col
 	push de
@@ -195,7 +195,7 @@
 	add hl, de
 	pop de
 	ld a, [wMapWidth]
-	add 6
+	add MAP_CONNECTION_PADDING_WIDTH * 2
 	add e
 	ld e, a
 	jr nc, .ok2
@@ -2163,7 +2163,8 @@
 	pop hl
 	ret
 
-	ret ; unused
+Map_DummyFunction:: ; unreferenced
+	ret
 
 GetAnyMapEnvironment::
 	push hl
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -257,6 +257,7 @@
 	ld c, a
 	ld a, [wMenuBorderTopCoord]
 	ld b, a
+	; fallthrough
 
 Coord2Tile::
 ; Return the address of wTilemap(c, b) in hl.
@@ -330,7 +331,7 @@
 	pop hl
 	jp PrintText
 
-; unused
+Menu_DummyFunction:: ; unreferenced
 	ret
 
 LoadMenuTextbox::
@@ -430,12 +431,12 @@
 	ld hl, YesNoMenuHeader
 	call CopyMenuHeader
 	pop bc
-; This seems to be an overflow prevention, but
-; it was coded wrong.
+; This seems to be an overflow prevention,
+; but it was coded wrong.
 	ld a, b
-	cp SCREEN_WIDTH - 6
+	cp SCREEN_WIDTH - 1 - 5
 	jr nz, .okay ; should this be "jr nc"?
-	ld a, SCREEN_WIDTH - 6
+	ld a, SCREEN_WIDTH - 1 - 5
 	ld b, a
 
 .okay
--- a/home/movement.asm
+++ b/home/movement.asm
@@ -2,7 +2,7 @@
 	ld [wMovementBufferObject], a
 	xor a
 	ld [wMovementBufferCount], a
-	ld a, $0 ; useless
+	ld a, $0 ; was BANK(wMovementBuffer) in G/S
 	ld [wUnusedMovementBufferBank], a
 	ld a, LOW(wMovementBuffer)
 	ld [wUnusedMovementBufferPointer], a
--- a/home/names.asm
+++ b/home/names.asm
@@ -56,9 +56,9 @@
 
 .done
 	ld a, e
-	ld [wUnusedD102], a
+	ld [wUnusedNamesPointer], a
 	ld a, d
-	ld [wUnusedD102 + 1], a
+	ld [wUnusedNamesPointer + 1], a
 
 	pop de
 	pop bc
--- a/home/print_bcd.asm
+++ b/home/print_bcd.asm
@@ -33,10 +33,11 @@
 	jr nz, .loop
 	bit PRINTNUM_LEADINGZEROS_F, b
 	jr z, .done ; if so, we are done
-.numberEqualsZero ; if every digit of the BCD number is zero
+; every digit of the BCD number is zero
 	bit PRINTNUM_LEFTALIGN_F, b
 	jr nz, .skipLeftAlignmentAdjustment
-	dec hl ; if the string is left-aligned, it needs to be moved back one space
+; the string is left-aligned; it needs to be moved back one space
+	dec hl
 .skipLeftAlignmentAdjustment
 	bit PRINTNUM_MONEY_F, b
 	jr z, .skipCurrencySymbol
@@ -53,7 +54,7 @@
 	and %00001111
 	and a
 	jr z, .zeroDigit
-.nonzeroDigit
+; nonzero digit
 	bit PRINTNUM_LEADINGZEROS_F, b ; have any non-space characters been printed?
 	jr z, .outputDigit
 ; if bit 7 is set, then no numbers have been printed yet
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -57,13 +57,13 @@
 
 	xor a
 	ldh [rSB], a
+
 	ld a, 3
 	ldh [rDIV], a
-
-.wait_bit_7
+.delay_loop
 	ldh a, [rDIV]
 	bit 7, a
-	jr nz, .wait_bit_7
+	jr nz, .delay_loop
 
 	ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
 	ldh [rSC], a
@@ -89,8 +89,9 @@
 	reti
 
 Serial_ExchangeBytes::
-	ld a, $1
+	ld a, TRUE
 	ldh [hSerialIgnoringInitialData], a
+
 .loop
 	ld a, [hl]
 	ldh [hSerialSend], a
@@ -98,10 +99,12 @@
 	push bc
 	ld b, a
 	inc hl
-	ld a, $30
+
+	ld a, 48
 .wait
 	dec a
 	jr nz, .wait
+
 	ldh a, [hSerialIgnoringInitialData]
 	and a
 	ld a, b
@@ -124,7 +127,7 @@
 	ret
 
 Serial_ExchangeByte::
-.loop
+.timeout_loop
 	xor a
 	ldh [hSerialReceivedNewData], a
 	ldh a, [hSerialConnectionStatus]
@@ -135,16 +138,16 @@
 	ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
 	ldh [rSC], a
 .not_player_2
-.loop2
+.loop
 	ldh a, [hSerialReceivedNewData]
 	and a
-	jr nz, .reset_ffca
+	jr nz, .await_new_data
 	ldh a, [hSerialConnectionStatus]
 	cp USING_EXTERNAL_CLOCK
-	jr nz, .not_player_1_or_wLinkTimeoutFrames_zero
-	call CheckwLinkTimeoutFramesNonzero
-	jr z, .not_player_1_or_wLinkTimeoutFrames_zero
-	call .delay_15_cycles
+	jr nz, .not_player_1_or_timed_out
+	call CheckLinkTimeoutFramesNonzero
+	jr z, .not_player_1_or_timed_out
+	call .ShortDelay
 	push hl
 	ld hl, wLinkTimeoutFrames + 1
 	inc [hl]
@@ -154,51 +157,52 @@
 
 .no_rollover_up
 	pop hl
-	call CheckwLinkTimeoutFramesNonzero
-	jr nz, .loop2
+	call CheckLinkTimeoutFramesNonzero
+	jr nz, .loop
 	jp SerialDisconnected
 
-.not_player_1_or_wLinkTimeoutFrames_zero
+.not_player_1_or_timed_out
 	ldh a, [rIE]
 	and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
 	cp 1 << SERIAL
-	jr nz, .loop2
-	ld a, [wcf5d]
+	jr nz, .loop
+	ld a, [wLinkByteTimeout]
 	dec a
-	ld [wcf5d], a
-	jr nz, .loop2
-	ld a, [wcf5d + 1]
+	ld [wLinkByteTimeout], a
+	jr nz, .loop
+	ld a, [wLinkByteTimeout + 1]
 	dec a
-	ld [wcf5d + 1], a
-	jr nz, .loop2
+	ld [wLinkByteTimeout + 1], a
+	jr nz, .loop
 	ldh a, [hSerialConnectionStatus]
 	cp USING_EXTERNAL_CLOCK
-	jr z, .reset_ffca
+	jr z, .await_new_data
 
 	ld a, 255
-.delay_255_cycles
+.long_delay_loop
 	dec a
-	jr nz, .delay_255_cycles
+	jr nz, .long_delay_loop
 
-.reset_ffca
+.await_new_data
 	xor a
 	ldh [hSerialReceivedNewData], a
 	ldh a, [rIE]
 	and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
 	sub 1 << SERIAL
-	jr nz, .rIE_not_equal_8
+	jr nz, .non_serial_interrupts_enabled
 
-	; LOW($5000)
-	ld [wcf5d], a
-	ld a, HIGH($5000)
-	ld [wcf5d + 1], a
+	; a == 0
+	assert LOW(SERIAL_LINK_BYTE_TIMEOUT) == 0
+	ld [wLinkByteTimeout], a
+	ld a, HIGH(SERIAL_LINK_BYTE_TIMEOUT)
+	ld [wLinkByteTimeout + 1], a
 
-.rIE_not_equal_8
+.non_serial_interrupts_enabled
 	ldh a, [hSerialReceive]
 	cp SERIAL_NO_DATA_BYTE
 	ret nz
-	call CheckwLinkTimeoutFramesNonzero
-	jr z, .linkTimeoutFrames_zero
+	call CheckLinkTimeoutFramesNonzero
+	jr z, .timed_out
 	push hl
 	ld hl, wLinkTimeoutFrames + 1
 	ld a, [hl]
@@ -210,10 +214,10 @@
 
 .no_rollover
 	pop hl
-	call CheckwLinkTimeoutFramesNonzero
+	call CheckLinkTimeoutFramesNonzero
 	jr z, SerialDisconnected
 
-.linkTimeoutFrames_zero
+.timed_out
 	ldh a, [rIE]
 	and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
 	cp 1 << SERIAL
@@ -222,16 +226,16 @@
 	ld a, [hl]
 	ldh [hSerialSend], a
 	call DelayFrame
-	jp .loop
+	jp .timeout_loop
 
-.delay_15_cycles
+.ShortDelay:
 	ld a, 15
-.delay_cycles
+.short_delay_loop
 	dec a
-	jr nz, .delay_cycles
+	jr nz, .short_delay_loop
 	ret
 
-CheckwLinkTimeoutFramesNonzero::
+CheckLinkTimeoutFramesNonzero::
 	push hl
 	ld hl, wLinkTimeoutFrames
 	ld a, [hli]
@@ -239,8 +243,10 @@
 	pop hl
 	ret
 
+; This sets wLinkTimeoutFrames to $ffff, since
+; a is always 0 when it is called.
 SerialDisconnected::
-	dec a ; a is always 0 when this is called
+	dec a
 	ld [wLinkTimeoutFrames], a
 	ld [wLinkTimeoutFrames + 1], a
 	ret
@@ -278,13 +284,11 @@
 	call WaitLinkTransfer
 	jp SafeLoadTempTilemapToTilemap
 
-Serial_SyncAndExchangeNybble::
+Serial_SyncAndExchangeNybble:: ; unreferenced
 	call LoadTilemapToTempTilemap
 	callfar PlaceWaitingText
-	jp WaitLinkTransfer
+	jp WaitLinkTransfer ; pointless
 
-; One "giant" leap for machinekind
-
 WaitLinkTransfer::
 	ld a, $ff
 	ld [wOtherPlayerLinkAction], a
@@ -291,7 +295,7 @@
 .loop
 	call LinkTransfer
 	call DelayFrame
-	call CheckwLinkTimeoutFramesNonzero
+	call CheckLinkTimeoutFramesNonzero
 	jr z, .check
 	push hl
 	ld hl, wLinkTimeoutFrames + 1
--- a/home/text.asm
+++ b/home/text.asm
@@ -141,6 +141,8 @@
 
 PrintText::
 	call SetUpTextbox
+	; fallthrough
+
 BuenaPrintText::
 	push hl
 	hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
@@ -147,6 +149,7 @@
 	lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
 	call ClearBox
 	pop hl
+	; fallthrough
 
 PrintTextboxText::
 	bccoord TEXTBOX_INNERX, TEXTBOX_INNERY
@@ -163,6 +166,7 @@
 
 PlaceString::
 	push hl
+	; fallthrough
 
 PlaceNextChar::
 	ld a, [de]
@@ -173,7 +177,9 @@
 	pop hl
 	ret
 
-	pop de ; unused
+DummyChar:: ; unreferenced
+	pop de
+	; fallthrough
 
 NextChar::
 	inc de
@@ -242,7 +248,7 @@
 	dict "゙",         .place ; should be .diacritic
 	jr .not_diacritic
 
-.diacritic
+.diacritic ; unreferenced
 	ld b, a
 	call Diacritic
 	jp NextChar
@@ -250,18 +256,19 @@
 .not_diacritic
 	cp FIRST_REGULAR_TEXT_CHAR
 	jr nc, .place
-
+; dakuten or handakuten
 	cp "パ"
 	jr nc, .handakuten
-
-.dakuten
+; dakuten
 	cp FIRST_HIRAGANA_DAKUTEN_CHAR
 	jr nc, .hiragana_dakuten
+; katakana dakuten
 	add "カ" - "ガ"
-	jr .katakana_dakuten
+	jr .place_dakuten
+
 .hiragana_dakuten
 	add "か" - "が"
-.katakana_dakuten
+.place_dakuten
 	ld b, "゙" ; dakuten
 	call Diacritic
 	jr .place
@@ -269,11 +276,13 @@
 .handakuten
 	cp "ぱ"
 	jr nc, .hiragana_handakuten
+; katakana handakuten
 	add "ハ" - "パ"
-	jr .katakana_handakuten
+	jr .place_handakuten
+
 .hiragana_handakuten
 	add "は" - "ぱ"
-.katakana_handakuten
+.place_handakuten
 	ld b, "゚" ; handakuten
 	call Diacritic
 
@@ -316,12 +325,13 @@
 PlaceMoveTargetsName::
 	ldh a, [hBattleTurn]
 	xor 1
-	jr PlaceMoveUsersName.place
+	jr PlaceBattlersName
 
 PlaceMoveUsersName::
 	ldh a, [hBattleTurn]
+	; fallthrough
 
-.place:
+PlaceBattlersName:
 	push de
 	and a
 	jr nz, .enemy
--- a/home/tilemap.asm
+++ b/home/tilemap.asm
@@ -60,7 +60,7 @@
 CopyTilemapAtOnce::
 	jr _CopyTilemapAtOnce
 
-; unused
+CopyAttrmapAndTilemapToWRAMBank3: ; unreferenced
 	farcall HDMATransferAttrmapAndTilemapToWRAMBank3
 	ret
 
--- a/home/video.asm
+++ b/home/video.asm
@@ -184,7 +184,7 @@
 
 THIRD_HEIGHT EQU SCREEN_HEIGHT / 3
 
-.bottom
+; bottom
 	ld de, 2 * THIRD_HEIGHT * SCREEN_WIDTH
 	add hl, de
 	ld sp, hl
@@ -267,7 +267,7 @@
 Serve1bppRequest::
 ; Only call during the first fifth of VBlank
 
-	ld a, [wRequested1bpp]
+	ld a, [wRequested1bppSize]
 	and a
 	ret z
 
@@ -278,7 +278,7 @@
 	cp LY_VBLANK + 2
 	ret nc
 
-; Copy [wRequested1bpp] 1bpp tiles from [wRequested1bppSource] to [wRequested1bppDest]
+; Copy [wRequested1bppSize] 1bpp tiles from [wRequested1bppSource] to [wRequested1bppDest]
 
 	ld [hSPBuffer], sp
 
@@ -296,11 +296,11 @@
 	ld l, a
 
 ; # tiles to copy
-	ld a, [wRequested1bpp]
+	ld a, [wRequested1bppSize]
 	ld b, a
 
 	xor a
-	ld [wRequested1bpp], a
+	ld [wRequested1bppSize], a
 
 .next
 
@@ -345,7 +345,7 @@
 Serve2bppRequest::
 ; Only call during the first fifth of VBlank
 
-	ld a, [wRequested2bpp]
+	ld a, [wRequested2bppSize]
 	and a
 	ret z
 
@@ -358,12 +358,12 @@
 	jr _Serve2bppRequest
 
 Serve2bppRequest_VBlank::
-	ld a, [wRequested2bpp]
+	ld a, [wRequested2bppSize]
 	and a
 	ret z
 
 _Serve2bppRequest::
-; Copy [wRequested2bpp] 2bpp tiles from [wRequested2bppSource] to [wRequested2bppDest]
+; Copy [wRequested2bppSize] 2bpp tiles from [wRequested2bppSource] to [wRequested2bppDest]
 
 	ld [hSPBuffer], sp
 
@@ -381,11 +381,11 @@
 	ld l, a
 
 ; # tiles to copy
-	ld a, [wRequested2bpp]
+	ld a, [wRequested2bppSize]
 	ld b, a
 
 	xor a
-	ld [wRequested2bpp], a
+	ld [wRequested2bppSize], a
 
 .next
 
--- a/home/window.asm
+++ b/home/window.asm
@@ -92,6 +92,6 @@
 	ldh [hOAMUpdate], a
 	ret
 
-; unused
+SetCarryFlag:: ; unreferenced
 	scf
 	ret
--- a/hram.asm
+++ b/hram.asm
@@ -31,7 +31,7 @@
 hMapEntryMethod:: db
 
 hMenuReturn:: db
-hUnusedFFA1:: db
+hUnusedByte:: db
 
 hJoypadReleased:: db
 hJoypadPressed::  db
@@ -88,8 +88,14 @@
 hPrintNumBuffer:: ds 10
 
 NEXTU
-; miscellaneous
-	ds 9
+; Mystery Gift
+hMGExchangedByte:: db
+hMGExchangedWord:: dw
+hMGNumBits:: db
+hMGChecksum:: dw
+	ds 1
+hMGUnusedMsgLength:: db
+hMGRole:: db
 hMGStatusFlags:: db
 ENDU
 
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -6858,7 +6858,7 @@
 	dec a
 	jp .asm_112e46
 
-; unused
+.asm_112d4c ; unreferenced
 	ret
 
 .asm_112d4d
--- a/macros/code.asm
+++ b/macros/code.asm
@@ -38,6 +38,7 @@
 ; 	maskbits 26
 ; 	cp 26
 ; 	jr nc, .loop
+	assert 0 < (\1) && (\1) <= $100, "bitmask must be 8-bit"
 x = 1
 rept 8
 if x + 1 < (\1)
--- a/macros/data.asm
+++ b/macros/data.asm
@@ -25,6 +25,10 @@
 ; e.g. 1 out_of 2 == 50 percent + 1 == $80
 out_of EQUS "* $100 /"
 
+assert_power_of_2: MACRO
+	assert (\1) & ((\1) - 1) == 0, "\1 must be a power of 2"
+ENDM
+
 ; Constant data (db, dw, dl) macros
 
 dwb: MACRO
--- a/macros/gfx.asm
+++ b/macros/gfx.asm
@@ -1,5 +1,13 @@
+assert_valid_rgb: MACRO
+rept _NARG
+	assert 0 <= (\1) && (\1) <= 31, "RGB channel must be 0-31"
+	shift
+endr
+ENDM
+
 RGB: MACRO
 rept _NARG / 3
+	assert_valid_rgb \1, \2, \3
 	dw palred (\1) + palgreen (\2) + palblue (\3)
 	shift 3
 endr
--- a/macros/scripts/audio.asm
+++ b/macros/scripts/audio.asm
@@ -1,8 +1,12 @@
 channel_count: MACRO
+	assert 0 < (\1) && (\1) <= NUM_MUSIC_CHANS, \
+		"channel_count must be 1-{d:NUM_MUSIC_CHANS}"
 _num_channels = \1 - 1
 ENDM
 
 channel: MACRO
+	assert 0 < (\1) && (\1) <= NUM_CHANNELS, \
+		"channel id must be 1-{d:NUM_CHANNELS}"
 	dn (_num_channels << 2), \1 - 1 ; channel id
 	dw \2 ; address
 _num_channels = 0
@@ -46,6 +50,7 @@
 
 	const octave_cmd ; $d0
 octave: MACRO
+	assert 0 < (\1) && (\1) < 8, "octave must be 1-8"
 	db octave_cmd | 8 - (\1) ; octave
 ENDM
 
--- a/macros/scripts/battle_anims.asm
+++ b/macros/scripts/battle_anims.asm
@@ -1,7 +1,5 @@
 anim_wait: MACRO
-if \1 >= $d0
-	fail "anim_wait argument must be less than $d0."
-endc
+	assert (\1) < $d0, "anim_wait argument must be less than $d0"
 	db \1
 ENDM
 
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -1,5 +1,7 @@
 map_id: MACRO
 ;\1: map id
+	assert DEF(GROUP_\1) && DEF(MAP_\1), \
+		"Missing 'map_const \1' in constants/map_constants.asm"
 	db GROUP_\1, MAP_\1
 ENDM
 
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -108,7 +108,8 @@
 \1MonOT::           ds NAME_LENGTH * MONS_PER_BOX
 \1MonNicknames::    ds MON_NAME_LENGTH * MONS_PER_BOX
 \1MonNicknamesEnd::
-\1End::             ds 2 ; padding
+\1End::
+	ds 2 ; padding
 ENDM
 
 map_connection_struct: MACRO
--- a/main.asm
+++ b/main.asm
@@ -203,7 +203,7 @@
 
 INCLUDE "engine/tilesets/map_palettes.asm"
 INCLUDE "gfx/tileset_palette_maps.asm"
-INCLUDE "data/collision_permissions.asm"
+INCLUDE "data/collision/collision_permissions.asm"
 INCLUDE "engine/menus/empty_sram.asm"
 INCLUDE "engine/menus/savemenu_copytilemapatonce.asm"
 INCLUDE "engine/events/checksave.asm"
@@ -262,7 +262,7 @@
 INCLUDE "data/pokemon/unused_pic_banks.asm"
 
 UnusedEggPic::
-; Another egg pic. This is shifted up a few pixels.
+; The G/S Egg pic. This is shifted up a few pixels.
 INCBIN "gfx/pokemon/egg/unused_front.2bpp.lz"
 
 
--- a/maps/AzaleaPokecenter1F.asm
+++ b/maps/AzaleaPokecenter1F.asm
@@ -36,8 +36,7 @@
 	line "fainted."
 	done
 
-AzaleaPokecenter1FUnusedText:
-; unreferenced
+AzaleaPokecenter1FUnusedText: ; unreferenced
 	text "This BILL guy"
 	line "created the system"
 
--- a/maps/AzaleaTown.asm
+++ b/maps/AzaleaTown.asm
@@ -143,8 +143,7 @@
 	closetext
 	end
 
-UnusedWoosterScript:
-; unused
+UnusedWoosterScript: ; unreferenced
 	faceplayer
 	opentext
 	writetext WoosterText
--- a/maps/BattleTower1F.asm
+++ b/maps/BattleTower1F.asm
@@ -364,7 +364,7 @@
 	line "your BATTLE ROOM."
 	done
 
-Text_BattleTowerIntroduction_1:
+Text_BattleTowerIntroduction_1: ; unreferenced
 	text "BATTLE TOWER is a"
 	line "facility made for"
 	cont "#MON battles."
@@ -473,7 +473,7 @@
 	line "this monitor."
 	done
 
-Text_ThankYou:
+Text_ThankYou: ; unreferenced
 	text "Thank you!"
 
 	para ""
@@ -484,7 +484,7 @@
 	line "visiting!"
 	done
 
-Text_BeatenAllTheTrainers_Mobile:
+Text_BeatenAllTheTrainers_Mobile: ; unreferenced
 	text "Congratulations!"
 
 	para "You've beaten all"
@@ -514,7 +514,7 @@
 	para ""
 	done
 
-Text_AskRegisterRecord_Mobile:
+Text_AskRegisterRecord_Mobile: ; unreferenced
 	text "Would you like to"
 	line "register your"
 
@@ -539,7 +539,7 @@
 	line "and come back."
 	done
 
-Text_YourRegistrationIsComplete:
+Text_YourRegistrationIsComplete: ; unreferenced
 	text "Your registration"
 	line "is complete."
 
@@ -582,7 +582,7 @@
 	cont "deleted. OK?"
 	done
 
-Text_CheckTheLeaderHonorRoll:
+Text_CheckTheLeaderHonorRoll: ; unreferenced
 	text "Check the LEADER"
 	line "HONOR ROLL?"
 	done
@@ -639,7 +639,7 @@
 	text ". Ready?"
 	done
 
-Text_SaveBeforeConnecting_Mobile:
+Text_SaveBeforeConnecting_Mobile: ; unreferenced
 	text "Your session will"
 	line "be SAVED before"
 
@@ -673,7 +673,7 @@
 	line "ROOM challenge?"
 	done
 
-Text_RegisterRecordOnFile_Mobile:
+Text_RegisterRecordOnFile_Mobile: ; unreferenced
 	text "We have your"
 	line "previous record on"
 
@@ -714,8 +714,8 @@
 	cont "challenge."
 	done
 
-; a dupe?
-Text_RegisterRecordTimedOut_Mobile:
+Text_RegisterRecordTimedOut_Mobile: ; unreferenced
+; duplicate of Text_TooMuchTimeElapsedNoRegister
 	text "Sorry, but it's"
 	line "not possible to"
 
--- a/maps/BattleTowerBattleRoom.asm
+++ b/maps/BattleTowerBattleRoom.asm
@@ -131,7 +131,7 @@
 	closetext
 	end
 
-Text_ReturnedAfterSave_Mobile:
+Text_ReturnedAfterSave_Mobile: ; unreferenced
 	text "You'll be returned"
 	line "after you SAVE."
 	done
--- a/maps/BattleTowerOutside.asm
+++ b/maps/BattleTowerOutside.asm
@@ -30,8 +30,7 @@
 BattleTowerOutsideSign:
 	jumptext BattleTowerOutsideSignText
 
-BattleTowerOutsideYoungsterText_NotYetOpen:
-; unreferenced
+BattleTowerOutsideYoungsterText_NotYetOpen: ; unreferenced
 	text "Wow, the BATTLE"
 	line "TOWER is huge! My"
 
@@ -39,8 +38,7 @@
 	line "looking up at it."
 	done
 
-BattleTowerOutsideYoungsterText_Mobile:
-; unreferenced
+BattleTowerOutsideYoungsterText_Mobile: ; unreferenced
 	text "Wow, the BATTLE"
 	line "TOWER is huge!"
 
@@ -63,8 +61,7 @@
 	cont "in there!"
 	done
 
-BattleTowerOutsideBeautyText_NotYetOpen:
-; unreferenced
+BattleTowerOutsideBeautyText_NotYetOpen: ; unreferenced
 	text "What on earth do"
 	line "they do here?"
 
@@ -86,8 +83,7 @@
 	line "battle…"
 	done
 
-BattleTowerOutsideSailorText_Mobile:
-; unreferenced
+BattleTowerOutsideSailorText_Mobile: ; unreferenced
 	text "Ehehehe…"
 	line "I sneaked out of"
 	cont "work to come here."
@@ -108,8 +104,8 @@
 	line "all. That I must!"
 	done
 
-BattleTowerOutsideSignText_NotYetOpen:
-; unused; originally shown when the Battle Tower was closed
+BattleTowerOutsideSignText_NotYetOpen: ; unreferenced
+; originally shown when the Battle Tower was closed
 	text "BATTLE TOWER"
 	done
 
@@ -120,14 +116,14 @@
 	line "Trainer Challenge!"
 	done
 
-BattleTowerOutsideText_DoorsClosed:
-; unused; originally shown when the Battle Tower was closed
+BattleTowerOutsideText_DoorsClosed: ; unreferenced
+; originally shown when the Battle Tower was closed
 	text "The BATTLE TOWER's"
 	line "doors are closed…"
 	done
 
-BattleTowerOutsideText_DoorsOpen:
-; unused; originally shown after the Battle Tower opened
+BattleTowerOutsideText_DoorsOpen: ; unreferenced
+; originally shown after the Battle Tower opened
 	text "It's open!"
 	done
 
--- a/maps/BlackthornDragonSpeechHouse.asm
+++ b/maps/BlackthornDragonSpeechHouse.asm
@@ -18,12 +18,10 @@
 	closetext
 	end
 
-; unused
-BlackthornDragonSpeechHousePictureBookshelf:
+BlackthornDragonSpeechHousePictureBookshelf: ; unreferenced
 	jumpstd PictureBookshelfScript
 
-; unused
-BlackthornDragonSpeechHouseMagazineBookshelf:
+BlackthornDragonSpeechHouseMagazineBookshelf: ; unreferenced
 	jumpstd MagazineBookshelfScript
 
 BlackthornDragonSpeechHouseGrannyText:
--- a/maps/BurnedTowerB1F.asm
+++ b/maps/BurnedTowerB1F.asm
@@ -155,8 +155,7 @@
 	remove_sliding
 	step_end
 
-BurnedTowerUnusedMovement:
-; unreferenced
+BurnedTowerUnusedMovement: ; unreferenced
 	set_sliding
 	big_step DOWN
 	remove_sliding
--- a/maps/CeladonCity.asm
+++ b/maps/CeladonCity.asm
@@ -164,8 +164,7 @@
 	line "a sales clerk."
 	done
 
-CeladonCityLassText_Mobile:
-; unused
+CeladonCityLassText_Mobile: ; unreferenced
 	text "I love being"
 	line "surrounded by tall"
 	cont "buildings!"
--- a/maps/CeladonDeptStore6F.asm
+++ b/maps/CeladonDeptStore6F.asm
@@ -98,8 +98,7 @@
 CeladonDeptStore6FDirectory:
 	jumptext CeladonDeptStore6FDirectoryText
 
-; unused
-CeladonDeptStore6FElevatorButton:
+CeladonDeptStore6FElevatorButton: ; unreferenced
 	jumpstd ElevatorButtonScript
 
 CeladonVendingText:
--- a/maps/CeladonGameCorner.asm
+++ b/maps/CeladonGameCorner.asm
@@ -141,8 +141,7 @@
 	closetext
 	end
 
-CeladonGameCornerUnusedMovementData:
-; unreferenced
+CeladonGameCornerUnusedMovementData: ; unreferenced
 	step RIGHT
 	turn_head LEFT
 	step_end
--- a/maps/CeladonMansion3F.asm
+++ b/maps/CeladonMansion3F.asm
@@ -57,8 +57,7 @@
 	closetext
 	end
 
-.CancelPrinting:
-; unused
+.CancelPrinting: ; unreferenced
 	writetext GameFreakGraphicArtistErrorText
 	waitbutton
 	closetext
--- a/maps/CherrygroveCity.asm
+++ b/maps/CherrygroveCity.asm
@@ -317,7 +317,7 @@
 	turn_head UP
 	step_end
 
-CherrygroveCity_UnusedMovementData:
+CherrygroveCity_UnusedMovementData: ; unreferenced
 	step LEFT
 	turn_head DOWN
 	step_end
--- a/maps/CianwoodCity.asm
+++ b/maps/CianwoodCity.asm
@@ -118,8 +118,7 @@
 CianwoodCityLass:
 	jumptextfaceplayer CianwoodCityLassText
 
-CianwoodCityUnusedScript:
-; unreferenced
+CianwoodCityUnusedScript: ; unreferenced
 	jumptextfaceplayer CianwoodCityUnusedText
 
 CianwoodCitySign:
@@ -266,7 +265,6 @@
 	done
 
 CianwoodCityUnusedText:
-; unused
 	text "There are several"
 	line "islands between"
 	cont "here and OLIVINE."
--- a/maps/CianwoodPokecenter1F.asm
+++ b/maps/CianwoodPokecenter1F.asm
@@ -89,8 +89,7 @@
 	cont "looking at you!"
 	done
 
-CianwoodPokecenter1FUnusedText1:
-; unreferenced
+CianwoodPokecenter1FUnusedText1: ; unreferenced
 	text "Don't you get the"
 	line "urge to show off"
 
@@ -104,8 +103,7 @@
 	line "in VIOLET."
 	done
 
-CianwoodPokecenter1FUnusedText2:
-; unreferenced
+CianwoodPokecenter1FUnusedText2: ; unreferenced
 	text "I've been battling"
 	line "my pal in VIOLET"
 
--- a/maps/DayCare.asm
+++ b/maps/DayCare.asm
@@ -78,7 +78,7 @@
 	line "for you."
 	done
 
-Text_DayCareManTalksAboutEggTicket:
+Text_DayCareManTalksAboutEggTicket: ; unreferenced
 	text "I'm the DAY-CARE"
 	line "MAN."
 
@@ -125,7 +125,7 @@
 	line "yours to keep!"
 	done
 
-DayCareText_ComeAgain:
+DayCareText_ComeAgain: ; unreferenced
 	text "Come again."
 	done
 
--- a/maps/DragonsDenB1F.asm
+++ b/maps/DragonsDenB1F.asm
@@ -56,7 +56,7 @@
 	giveitem TM_DRAGONBREATH
 	iffalse .BagFull
 	getitemname STRING_BUFFER_3, TM_DRAGONBREATH
-	writetext NotifyReceiveDragonbreath
+	writetext Text_ReceivedTM24
 	playsound SFX_ITEM
 	waitsfx
 	itemnotify
@@ -214,7 +214,7 @@
 	line "my apology."
 	done
 
-NotifyReceiveDragonbreath:
+Text_ReceivedTM24:
 	text "<PLAYER> received"
 	line "TM24."
 	done
--- a/maps/EarlsPokemonAcademy.asm
+++ b/maps/EarlsPokemonAcademy.asm
@@ -138,8 +138,7 @@
 	closetext
 	end
 
-AcademyStickerMachine:
-; unused
+AcademyStickerMachine: ; unreferenced
 	jumptext AcademyStickerMachineText
 
 AcademyBookshelf:
@@ -271,8 +270,7 @@
 	line "battle."
 	done
 
-AcademyBlackboardText2:
-; unused
+AcademyBlackboardText2: ; unreferenced
 	text "Read which topic?"
 	done
 
--- a/maps/EcruteakCity.asm
+++ b/maps/EcruteakCity.asm
@@ -88,8 +88,7 @@
 EcruteakCityHiddenHyperPotion:
 	hiddenitem HYPER_POTION, EVENT_ECRUTEAK_CITY_HIDDEN_HYPER_POTION
 
-UnusedMissingDaughterText:
-; unused
+UnusedMissingDaughterText: ; unreferenced
 	text "Oh, no. Oh, no…"
 
 	para "My daughter is"
--- a/maps/ElmsHouse.asm
+++ b/maps/ElmsHouse.asm
@@ -43,15 +43,13 @@
 	cont "professor!"
 	done
 
-ElmsHouseLabFoodText:
-; unused
+ElmsHouseLabFoodText: ; unreferenced
 	text "There's some food"
 	line "here. It must be"
 	cont "for the LAB."
 	done
 
-ElmsHousePokemonFoodText:
-; unused
+ElmsHousePokemonFoodText: ; unreferenced
 	text "There's some food"
 	line "here. This must be"
 	cont "for #MON."
--- a/maps/ElmsLab.asm
+++ b/maps/ElmsLab.asm
@@ -601,8 +601,7 @@
 ElmsLabPC:
 	jumptext ElmsLabPCText
 
-ElmsLabTrashcan2:
-; unused
+ElmsLabTrashcan2: ; unreferenced
 	jumpstd TrashCanScript
 
 ElmsLabBookshelf:
@@ -1209,7 +1208,7 @@
 	line "PROF.OAK in KANTO!"
 	done
 
-ElmsLabSignpostText_Egg:
+ElmsLabMonEggText: ; unreferenced
 	text "It's the #MON"
 	line "EGG being studied"
 	cont "by PROF.ELM."
--- a/maps/GoldenrodBikeShop.asm
+++ b/maps/GoldenrodBikeShop.asm
@@ -39,8 +39,7 @@
 	closetext
 	end
 
-GoldenrodBikeShopJustReleasedCompactBike:
-; unused
+GoldenrodBikeShopJustReleasedCompactBike: ; unreferenced
 	jumptext GoldenrodBikeShopJustReleasedCompactBikeText
 
 GoldenrodBikeShopBicycle:
--- a/maps/GoldenrodCity.asm
+++ b/maps/GoldenrodCity.asm
@@ -476,8 +476,7 @@
 	line "ENTRANCE"
 	done
 
-GoldenrodCityPokeComCenterSignText:
-; unused
+GoldenrodCityPokeComCenterSignText: ; unreferenced
 	text "For Mobile Tips!"
 	line "#COM CENTER"
 	done
--- a/maps/GoldenrodDeptStore2F.asm
+++ b/maps/GoldenrodDeptStore2F.asm
@@ -39,8 +39,7 @@
 GoldenrodDeptStore2FElevatorButton:
 	jumpstd ElevatorButtonScript
 
-GoldenrodDeptStore2FUnusedText1:
-; unused
+GoldenrodDeptStore2FUnusedText1: ; unreferenced
 	text "We intend to sell"
 	line "items for #MON"
 	cont "to hold."
@@ -50,8 +49,7 @@
 	cont "MON hold it."
 	done
 
-GoldenrodDeptStore2FUnusedText2:
-; unused
+GoldenrodDeptStore2FUnusedText2: ; unreferenced
 	text "By giving #MON"
 	line "items to hold, I"
 
--- a/maps/GoldenrodFlowerShop.asm
+++ b/maps/GoldenrodFlowerShop.asm
@@ -73,16 +73,13 @@
 	closetext
 	end
 
-FlowerShopShelf1:
-; unused
+FlowerShopShelf1: ; unreferenced
 	jumpstd PictureBookshelfScript
 
-FlowerShopShelf2:
-; unused
+FlowerShopShelf2: ; unreferenced
 	jumpstd MagazineBookshelfScript
 
-FlowerShopRadio:
-; unused
+FlowerShopRadio: ; unreferenced
 	jumpstd Radio2Script
 
 GoldenrodFlowerShopTeacherMySisterWentToSeeWigglyTreeRoute36Text:
--- a/maps/GoldenrodPokecenter1F.asm
+++ b/maps/GoldenrodPokecenter1F.asm
@@ -149,8 +149,7 @@
 	step DOWN
 	step_end
 
-; unused
-UnknownText_0x61072:
+UnknownText_0x61072: ; unreferenced
 	text "Hello! Welcome to"
 	line "#COM CENTER"
 	cont "TRADE CORNER."
@@ -160,7 +159,7 @@
 	cont "people far away."
 	done
 
-UnknownText_0x610ce:
+UnknownText_0x610ce: ; unreferenced
 	text "To make a trade,"
 	line "we must hold your"
 	cont "#MON."
@@ -169,13 +168,13 @@
 	line "trade?"
 	done
 
-UnknownText_0x61111:
+UnknownText_0x61111: ; unreferenced
 	text "What kind of"
 	line "#MON do you"
 	cont "want in return?"
 	done
 
-UnknownText_0x6113b:
+UnknownText_0x6113b: ; unreferenced
 	text "Fine. We will try"
 	line "to trade your"
 
@@ -195,7 +194,7 @@
 	cont "room for it."
 	done
 
-UnknownText_0x611c9:
+UnknownText_0x611c9: ; unreferenced
 	text "Fine. We will try"
 	line "to trade your"
 
@@ -214,7 +213,7 @@
 	cont "room for it."
 	done
 
-UnknownText_0x61271:
+UnknownText_0x61271: ; unreferenced
 	text "Your trade #MON"
 	line "has been received."
 
@@ -225,7 +224,7 @@
 	line "come back later."
 	done
 
-UnknownText_0x612d8:
+UnknownText_0x612d8: ; unreferenced
 	text "Oh? You have only"
 	line "one #MON in"
 	cont "your party. "
@@ -236,28 +235,28 @@
 	cont "of your party."
 	done
 
-UnknownText_0x61344:
+UnknownText_0x61344: ; unreferenced
 	text "We hope to see you"
 	line "again."
 	done
 
-UnknownText_0x6135f:
+UnknownText_0x6135f: ; unreferenced
 	text "Communication"
 	line "error…"
 	done
 
-UnknownText_0x61375:
+UnknownText_0x61375: ; unreferenced
 	text "If we accept that"
 	line "#MON, what will"
 	cont "you battle with?"
 	done
 
-UnknownText_0x613a9:
+UnknownText_0x613a9: ; unreferenced
 	text "Sorry. We can't"
 	line "accept an EGG."
 	done
 
-UnknownText_0x613c8:
+UnknownText_0x613c8: ; unreferenced
 	text "Sorry, but your"
 	line "#MON appears to"
 
@@ -265,13 +264,13 @@
 	line "can't accept it."
 	done
 
-UnknownText_0x61409:
+UnknownText_0x61409: ; unreferenced
 	text "Oh? Aren't we"
 	line "already holding a"
 	cont "#MON of yours?"
 	done
 
-UnknownText_0x61438:
+UnknownText_0x61438: ; unreferenced
 	text "We'll check the"
 	line "rooms."
 
@@ -278,7 +277,7 @@
 	para "Please wait."
 	done
 
-UnknownText_0x6145c:
+UnknownText_0x6145c: ; unreferenced
 	text "Thank you for your"
 	line "patience."
 
@@ -286,7 +285,7 @@
 	line "has been found."
 	done
 
-UnknownText_0x6149a:
+UnknownText_0x6149a: ; unreferenced
 	text "It's your new"
 	line "partner."
 
@@ -297,7 +296,7 @@
 	line "again."
 	done
 
-UnknownText_0x614ed:
+UnknownText_0x614ed: ; unreferenced
 	text "Uh-oh. Your party"
 	line "is already full."
 
@@ -306,7 +305,7 @@
 	cont "in your party."
 	done
 
-UnknownText_0x61544:
+UnknownText_0x61544: ; unreferenced
 	text "It's unfortunate,"
 	line "but no one has"
 
@@ -317,12 +316,12 @@
 	line "your #MON back?"
 	done
 
-UnknownText_0x615a5:
+UnknownText_0x615a5: ; unreferenced
 	text "We have returned"
 	line "your #MON."
 	done
 
-UnknownText_0x615c2:
+UnknownText_0x615c2: ; unreferenced
 	text "It's unfortunate,"
 	line "but no one has"
 
@@ -339,18 +338,18 @@
 	line "return it to you."
 	done
 
-UnknownText_0x6166e:
+UnknownText_0x6166e: ; unreferenced
 	text "We hope to see you"
 	line "again."
 	done
 
-UnknownText_0x61689:
+UnknownText_0x61689: ; unreferenced
 	text "Fine. We will"
 	line "continue to hold"
 	cont "your #MON."
 	done
 
-UnknownText_0x616b4:
+UnknownText_0x616b4: ; unreferenced
 	text "Oh? You left your"
 	line "#MON with us"
 	cont "only recently."
@@ -359,23 +358,23 @@
 	line "later."
 	done
 
-UnknownText_0x616fb:
+UnknownText_0x616fb: ; unreferenced
 	text "We'll SAVE before"
 	line "connecting to the"
 	cont "CENTER."
 	done
 
-UnknownText_0x61727:
+UnknownText_0x61727: ; unreferenced
 	text "Which #MON do"
 	line "you want to trade?"
 	done
 
-UnknownText_0x61749:
+UnknownText_0x61749: ; unreferenced
 	text "Sorry, but we must"
 	line "cancel the trade."
 	done
 
-UnknownText_0x6176f:
+UnknownText_0x6176f: ; unreferenced
 	text "Oh!"
 
 	para "I see you have an"
@@ -388,7 +387,7 @@
 	line "special #MON!"
 	done
 
-UnknownText_0x617d2:
+UnknownText_0x617d2: ; unreferenced
 	text "Let me give you a"
 	line "quick briefing."
 
@@ -421,12 +420,12 @@
 	line "chosen room."
 	done
 
-UnknownText_0x6191f:
+UnknownText_0x6191f: ; unreferenced
 	text "Please wait a"
 	line "moment."
 	done
 
-UnknownText_0x61936:
+UnknownText_0x61936: ; unreferenced
 	text "Thank you for"
 	line "waiting."
 
@@ -439,7 +438,7 @@
 	line "with loving care."
 	done
 
-UnknownText_0x61996:
+UnknownText_0x61996: ; unreferenced
 	text "I'm awfully sorry."
 
 	para "The EGG TICKET"
@@ -447,17 +446,17 @@
 	cont "isn't running now."
 	done
 
-UnknownText_0x619db:
+UnknownText_0x619db: ; unreferenced
 	text "It's a #MON"
 	line "NEWS MACHINE."
 	done
 
-UnknownText_0x619f5:
+UnknownText_0x619f5: ; unreferenced
 	text "What would you"
 	line "like to do?"
 	done
 
-UnknownText_0x61a11:
+UnknownText_0x61a11: ; unreferenced
 	text "#MON NEWS is"
 	line "news compiled from"
 
@@ -492,22 +491,22 @@
 	line "in the NEWS!"
 	done
 
-UnknownText_0x61b7c:
+UnknownText_0x61b7c: ; unreferenced
 	text "Would you like to"
 	line "get the NEWS?"
 	done
 
-UnknownText_0x61b9d:
+UnknownText_0x61b9d: ; unreferenced
 	text "Reading the latest"
 	line "NEWS… Please wait."
 	done
 
-UnknownText_0x61bc4:
+UnknownText_0x61bc4: ; unreferenced
 	text "There is no old"
 	line "NEWS…"
 	done
 
-UnknownText_0x61bdb:
+UnknownText_0x61bdb: ; unreferenced
 	text "The NEWS data is"
 	line "corrupted."
 
@@ -515,7 +514,7 @@
 	line "the NEWS again."
 	done
 
-UnknownText_0x61c18:
+UnknownText_0x61c18: ; unreferenced
 	text "We're making"
 	line "preparations."
 
@@ -523,7 +522,7 @@
 	line "later."
 	done
 
-UnknownText_0x61c4b:
+UnknownText_0x61c4b: ; unreferenced
 	text "We will SAVE your"
 	line "progress before"
 
@@ -531,7 +530,7 @@
 	line "MACHINE."
 	done
 
-UnknownText_0x61c89:
+UnknownText_0x61c89: ; unreferenced
 	text "Whoa, this #MON"
 	line "CENTER is huge."
 
@@ -542,7 +541,7 @@
 	line "new machines too."
 	done
 
-UnknownText_0x61cef:
+UnknownText_0x61cef: ; unreferenced
 	text "I thought up a fun"
 	line "new thing for the"
 	cont "TRADE CORNER!"
@@ -570,7 +569,7 @@
 	line "friends!"
 	done
 
-UnknownText_0x61dfd:
+UnknownText_0x61dfd: ; unreferenced
 	text "They said you can"
 	line "trade #MON with"
 
@@ -581,7 +580,7 @@
 	line "adjusting things."
 	done
 
-UnknownText_0x61e5c:
+UnknownText_0x61e5c: ; unreferenced
 	text "Some girl I don't"
 	line "know sent me her"
 
@@ -592,7 +591,7 @@
 	line "you want."
 	done
 
-UnknownText_0x61eb2:
+UnknownText_0x61eb2: ; unreferenced
 	text "I received a"
 	line "female HOPPIP, but"
 	cont "its named STANLEY!"
@@ -601,7 +600,7 @@
 	line "name!"
 	done
 
-UnknownText_0x61efa:
+UnknownText_0x61efa: ; unreferenced
 	text "What is the NEWS"
 	line "MACHINE?"
 
@@ -610,7 +609,7 @@
 	cont "than the radio?"
 	done
 
-UnknownText_0x61f48:
+UnknownText_0x61f48: ; unreferenced
 	text "The #COM CENTER"
 	line "will link with all"
 
@@ -624,7 +623,7 @@
 	line "sorts of people."
 	done
 
-UnknownText_0x61fc9:
+UnknownText_0x61fc9: ; unreferenced
 	text "The machines here"
 	line "can't be used yet."
 
@@ -635,7 +634,7 @@
 	line "people."
 	done
 
-UnknownText_0x6202c:
+UnknownText_0x6202c: ; unreferenced
 	text "My friend was in"
 	line "the NEWS a while"
 
@@ -643,13 +642,13 @@
 	line "surprised!"
 	done
 
-UnknownText_0x6206d:
+UnknownText_0x6206d: ; unreferenced
 	text "I get anxious if I"
 	line "don't check out"
 	cont "the latest NEWS!"
 	done
 
-UnknownText_0x620a1:
+UnknownText_0x620a1: ; unreferenced
 	text "If I get in the"
 	line "NEWS and become"
 
@@ -673,7 +672,7 @@
 	line "afford to lose."
 	done
 
-UnknownText_0x62173:
+UnknownText_0x62173: ; unreferenced
 	text "I came over here"
 	line "when I got word"
 
@@ -691,7 +690,7 @@
 	line "preparations…"
 	done
 
-UnknownText_0x62222:
+UnknownText_0x62222: ; unreferenced
 	text "Just seeing all"
 	line "these new things"
 
@@ -732,7 +731,7 @@
 	line "again!"
 	done
 
-UnknownText_0x62370:
+UnknownText_0x62370: ; unreferenced
 	text "#COM CENTER"
 	line "1F INFORMATION"
 
@@ -746,7 +745,7 @@
 	line "#MON NEWS"
 	done
 
-UnknownText_0x623c7:
+UnknownText_0x623c7: ; unreferenced
 	text "It's a #MON"
 	line "NEWS MACHINE!"
 
--- a/maps/GoldenrodUnderground.asm
+++ b/maps/GoldenrodUnderground.asm
@@ -58,7 +58,7 @@
 	ifequal FRIDAY, .Friday
 	ifequal SATURDAY, .Saturday
 
-.Sunday:
+; Sunday
 	disappear GOLDENRODUNDERGROUND_GRAMPS
 	disappear GOLDENRODUNDERGROUND_OLDER_HAIRCUT_BROTHER
 	appear GOLDENRODUNDERGROUND_YOUNGER_HAIRCUT_BROTHER
--- a/maps/IlexForest.asm
+++ b/maps/IlexForest.asm
@@ -420,8 +420,7 @@
 IlexForestHiddenFullHeal:
 	hiddenitem FULL_HEAL, EVENT_ILEX_FOREST_HIDDEN_FULL_HEAL
 
-IlexForestBoulder:
-; unused
+IlexForestBoulder: ; unreferenced
 	jumpstd StrengthBoulderScript
 
 IlexForestSignpost:
--- a/maps/LakeOfRageMagikarpHouse.asm
+++ b/maps/LakeOfRageMagikarpHouse.asm
@@ -83,8 +83,7 @@
 	closetext
 	end
 
-LakeOfRageMagikarpHouseUnusedRecordSign:
-; unused
+LakeOfRageMagikarpHouseUnusedRecordSign: ; unreferenced
 	jumptext LakeOfRageMagikarpHouseUnusedRecordText
 
 MagikarpHouseBookshelf:
@@ -205,7 +204,8 @@
 	text_ram wStringBuffer4
 	text_end
 
-	text_end ; unused
+LakeOfRageMagikarpHouseUnusedDummyText: ; unreferenced
+	text_end
 
 LakeOfRageMagikarpHouse_MapEvents:
 	db 0, 0 ; filler
--- a/maps/LavRadioTower1F.asm
+++ b/maps/LavRadioTower1F.asm
@@ -72,8 +72,7 @@
 LavRadioTower1FPokeFluteSign:
 	jumptext LavRadioTower1FPokeFluteSignText
 
-LavRadioTower1FReferenceLibrary:
-; unreferenced
+LavRadioTower1FReferenceLibrary: ; unreferenced
 	jumptext LavRadioTower1FReferenceLibraryText
 
 LavRadioTower1FReceptionistText:
--- a/maps/LavenderNameRater.asm
+++ b/maps/LavenderNameRater.asm
@@ -18,8 +18,7 @@
 	closetext
 	end
 
-LavenderNameRaterUnusedBookshelf:
-; unused
+LavenderNameRaterUnusedBookshelf: ; unreferenced
 	jumpstd DifficultBookshelfScript
 
 LavenderNameRater_MapEvents:
--- a/maps/MahoganyRedGyaradosSpeechHouse.asm
+++ b/maps/MahoganyRedGyaradosSpeechHouse.asm
@@ -26,12 +26,10 @@
 	closetext
 	end
 
-MahoganyRedGyaradosSpeechHouseUnusedBookshelf1:
-; unused
+MahoganyRedGyaradosSpeechHouseUnusedBookshelf1: ; unreferenced
 	jumpstd PictureBookshelfScript
 
-MahoganyRedGyaradosSpeechHouseUnusedBookshelf2:
-; unused
+MahoganyRedGyaradosSpeechHouseUnusedBookshelf2: ; unreferenced
 	jumpstd MagazineBookshelfScript
 
 MahoganyRedGyaradosSpeechHouseBlackBeltText:
--- a/maps/ManiasHouse.asm
+++ b/maps/ManiasHouse.asm
@@ -83,7 +83,7 @@
 	closetext
 	end
 
-.nothingleft
+.nothingleft ; unreferenced
 	writetext ManiaText_ShuckleIsYourLastMon
 	waitbutton
 	closetext
@@ -95,8 +95,7 @@
 	closetext
 	end
 
-ManiasHouseUnusedBookshelf:
-; unused
+ManiasHouseUnusedBookshelf: ; unreferenced
 	jumpstd PictureBookshelfScript
 
 ManiaText_AskLookAfterShuckle:
--- a/maps/OaksLab.asm
+++ b/maps/OaksLab.asm
@@ -9,7 +9,7 @@
 
 	def_callbacks
 
-.DummyScene:
+.DummyScene: ; unreferenced
 	end
 
 Oak:
--- a/maps/OlivineCity.asm
+++ b/maps/OlivineCity.asm
@@ -281,8 +281,8 @@
 	line "Opening Now!"
 	done
 
-OlivineCityBattleTowerSignText_NotYetOpen:
-; unused; originally shown when the Battle Tower was closed
+OlivineCityBattleTowerSignText_NotYetOpen: ; unreferenced
+; originally shown when the Battle Tower was closed
 	text "BATTLE TOWER AHEAD"
 	done
 
--- a/maps/OlivineGoodRodHouse.asm
+++ b/maps/OlivineGoodRodHouse.asm
@@ -35,8 +35,7 @@
 	closetext
 	end
 
-GoodRodHouseBookshelf:
-; unused
+GoodRodHouseBookshelf: ; unreferenced
 	jumpstd PictureBookshelfScript
 
 OfferGoodRodText:
--- a/maps/OlivineGym.asm
+++ b/maps/OlivineGym.asm
@@ -145,7 +145,7 @@
 	line "this too…"
 	done
 
-Text_ReceivedTM09:
+Text_ReceivedTM09: ; unreferenced
 	text "<PLAYER> received"
 	line "TM09."
 	done
--- a/maps/OlivineLighthouse2F.asm
+++ b/maps/OlivineLighthouse2F.asm
@@ -162,8 +162,7 @@
 	line "I lose!"
 	done
 
-SailorHueyUnusedText:
-; unused
+SailorHueyUnusedText: ; unreferenced
 	text "What power!"
 	line "How would you like"
 
--- a/maps/OlivineLighthouse6F.asm
+++ b/maps/OlivineLighthouse6F.asm
@@ -27,7 +27,7 @@
 .BroughtSecretpotion:
 	writetext JasmineCureAmphyText
 	yesorno
-	iffalse .no
+	iffalse .Refused
 	writetext PlayerHandedSecretpotionText
 	promptbutton
 	takeitem SECRETPOTION
@@ -84,7 +84,7 @@
 	disappear OLIVINELIGHTHOUSE6F_JASMINE
 	end
 
-.no:
+.Refused:
 	writetext JasmineISeeText
 	waitbutton
 	closetext
@@ -97,8 +97,7 @@
 	closetext
 	end
 
-OlivineLighthouseUnusedDummyScript:
-; unused
+.Unused: ; unreferenced
 	end
 
 OlivineLighthouseAmphy:
--- a/maps/PlayersHouse2F.asm
+++ b/maps/PlayersHouse2F.asm
@@ -11,8 +11,7 @@
 	callback MAPCALLBACK_NEWMAP, .InitializeRoom
 	callback MAPCALLBACK_TILES, .SetUpTileDecorations
 
-; unused
-.Null:
+.DummyScene: ; unreferenced
 	end
 
 .InitializeRoom:
--- a/maps/Pokecenter2F.asm
+++ b/maps/Pokecenter2F.asm
@@ -97,7 +97,7 @@
 	iffalse .LinkedToFirstGen
 	special CheckBothSelectedSameRoom
 	iffalse .IncompatibleRooms
-	writetext Text_PleaseComeIn2
+	writetext Text_PleaseComeIn
 	waitbutton
 	closetext
 	scall Pokecenter2F_CheckGender
@@ -152,7 +152,7 @@
 	special TryQuickSave
 	iffalse .Mobile_DidNotSave
 	special Function1011f1
-	writetext Text_PleaseComeIn2
+	writetext Text_PleaseComeIn
 	waitbutton
 	closetext
 	setval FALSE
@@ -199,7 +199,7 @@
 	iffalse .LinkedToFirstGen
 	special CheckBothSelectedSameRoom
 	iffalse .IncompatibleRooms
-	writetext Text_PleaseComeIn2
+	writetext Text_PleaseComeIn
 	waitbutton
 	closetext
 	scall Pokecenter2F_CheckGender
@@ -256,7 +256,7 @@
 	special Function103780
 	iffalse .Mobile_DidNotSave
 	special Function1011f1
-	writetext Text_PleaseComeIn2
+	writetext Text_PleaseComeIn
 	waitbutton
 	closetext
 	setval FALSE
@@ -332,7 +332,7 @@
 
 .OK:
 	special EnterTimeCapsule
-	writetext Text_PleaseComeIn2
+	writetext Text_PleaseComeIn
 	waitbutton
 	closetext
 	scall TimeCapsuleScript_CheckPlayerGender
@@ -813,7 +813,7 @@
 	line "mobile phone?"
 	done
 
-Text_ThisWayToMobileRoom:
+Text_ThisWayToMobileRoom: ; unreferenced
 	text "This way to the"
 	line "MOBILE ROOM."
 	done
@@ -882,11 +882,11 @@
 	text "Please come again."
 	prompt
 
-Text_PleaseComeIn:
+Text_PleaseComeInDuplicate: ; unreferenced
 	text "Please come in."
 	prompt
 
-Text_TemporaryStagingInLinkRoom:
+Text_TemporaryStagingInLinkRoom: ; unreferenced
 	text "We'll put you in"
 	line "the link room for"
 	cont "the time being."
@@ -902,11 +902,11 @@
 	line "were chosen."
 	prompt
 
-Text_PleaseComeIn2:
+Text_PleaseComeIn:
 	text "Please come in."
 	done
 
-Text_PleaseEnter:
+Text_PleaseEnter: ; unreferenced
 	text "Please enter."
 	prompt
 
--- a/maps/RadioTower2F.asm
+++ b/maps/RadioTower2F.asm
@@ -16,8 +16,7 @@
 
 	def_callbacks
 
-RadioTower2FUnusedDummyScene:
-; unused
+RadioTower2FUnusedDummyScene: ; unreferenced
 	end
 
 RadioTower2FSuperNerdScript:
--- a/maps/Route12SuperRodHouse.asm
+++ b/maps/Route12SuperRodHouse.asm
@@ -32,8 +32,7 @@
 	closetext
 	end
 
-SuperRodHouseBookshelf:
-; unused
+SuperRodHouseBookshelf: ; unreferenced
 	jumpstd PictureBookshelfScript
 
 OfferSuperRodText:
--- a/maps/Route25.asm
+++ b/maps/Route25.asm
@@ -423,7 +423,7 @@
 	line "BILL'S HOUSE"
 	done
 
-; unused
+UnusedBillsHouseSignText: ; unreferenced
 	text "BILL'S HOUSE"
 	done
 
--- a/maps/Route29.asm
+++ b/maps/Route29.asm
@@ -322,8 +322,7 @@
 	line "progress."
 	done
 
-; unused
-Text_WaitingForDay:
+Text_WaitingForDay: ; unreferenced
 	text "I'm waiting for"
 	line "#MON that"
 
--- a/maps/Route2NuggetHouse.asm
+++ b/maps/Route2NuggetHouse.asm
@@ -23,8 +23,7 @@
 	closetext
 	end
 
-Route2NuggetHouseBookshelf:
-; unused
+Route2NuggetHouseBookshelf: ; unreferenced
 	jumpstd DifficultBookshelfScript
 
 Route2NuggetHouseFisherText:
--- a/maps/Route32.asm
+++ b/maps/Route32.asm
@@ -542,7 +542,6 @@
 	done
 
 Route32CooltrainerMText_UnusedSproutTower:
-; unused
 	text "Have you gone to"
 	line "SPROUT TOWER?"
 
@@ -679,9 +678,7 @@
 	line "as you can, kid!"
 	done
 
-; --- start a segment of unused text
-
-Route32UnusedFisher1SeenText:
+Route32UnusedFisher1SeenText: ; unreferenced
 	text "I keep catching"
 	line "the same #MON…"
 
@@ -690,29 +687,29 @@
 	cont "around for me."
 	done
 
-Route32UnusedFisher1BeatenText:
+Route32UnusedFisher1BeatenText: ; unreferenced
 	text "Nothing ever goes"
 	line "right for me now…"
 	done
 
-Route32UnusedFisher1AfterText:
+Route32UnusedFisher1AfterText: ; unreferenced
 	text "How come the guy"
 	line "next to me catches"
 	cont "good #MON?"
 	done
 
-Route32UnusedFisher2SeenText:
+Route32UnusedFisher2SeenText: ; unreferenced
 	text "Heh, I'm on a roll"
 	line "today. How about a"
 	cont "battle, kid?"
 	done
 
-Route32UnusedFisher2BeatenText:
+Route32UnusedFisher2BeatenText: ; unreferenced
 	text "Oof. I wasn't"
 	line "lucky that time."
 	done
 
-Route32UnusedFisher2AfterText:
+Route32UnusedFisher2AfterText: ; unreferenced
 	text "You have to have a"
 	line "good ROD if you"
 
@@ -720,8 +717,6 @@
 	line "#MON."
 	done
 
-; --- end a segment of unused texts
-
 FisherHenrySeenText:
 	text "My #MON?"
 	line "Freshly caught!"
@@ -835,8 +830,7 @@
 	cont "in VIOLET CITY."
 	done
 
-Route32UnusedText:
-; unused
+Route32UnusedText: ; unreferenced
 	text "The fishermen"
 	line "yelled at me for"
 	cont "bugging them…"
--- a/maps/Route34.asm
+++ b/maps/Route34.asm
@@ -470,8 +470,7 @@
 	closetext
 	end
 
-Route34IlexForestSign:
-; unused
+Route34IlexForestSign: ; unreferenced
 	jumptext Route34IlexForestSignText
 
 Route34Sign:
@@ -516,7 +515,7 @@
 	line "passing stranger!"
 	done
 
-YoungsterSamuelMobileText:
+YoungsterSamuelMobileText: ; unreferenced
 	text "Have you been to"
 	line "GOLDENROD CITY?"
 
@@ -726,7 +725,6 @@
 	done
 
 Route34IlexForestSignText:
-; unused
 	text "ILEX FOREST"
 	line "THROUGH THE GATE"
 	done
--- a/maps/Route36.asm
+++ b/maps/Route36.asm
@@ -489,7 +489,7 @@
 	cont "have this."
 	done
 
-UnusedReceivedTM08Text:
+Text_ReceivedTM08: ; unreferenced
 	text "<PLAYER> received"
 	line "TM08."
 	done
@@ -509,7 +509,7 @@
 	cont "smash 'em up!"
 	done
 
-UnusedOddTreeText:
+UnusedOddTreeText: ; unreferenced
 	text "An odd tree is"
 	line "blocking the way"
 	cont "to GOLDENROD CITY."
--- a/maps/Route36NationalParkGate.asm
+++ b/maps/Route36NationalParkGate.asm
@@ -463,7 +463,7 @@
 	closetext
 	end
 
-UnusedBugCatchingContestExplanationSign:
+UnusedBugCatchingContestExplanationSign: ; unreferenced
 ; duplicate of BugCatchingContestExplanationSign in Route35NationalParkGate.asm
 	jumptext UnusedBugCatchingContestExplanationText
 
@@ -795,10 +795,9 @@
 	line "win."
 	done
 
-UnusedSudowoodoText:
-; This text is unused and unreferenced in the final game.
-; The tree Pokémon is Sudowoodo.
-; The Silph Scope 2 was later reworked into the Squirtbottle.
+UnusedSilphScope2Text: ; unreferenced
+; This text is referring to Sudowoodo.
+; The SILPHSCOPE2 was later reworked into the SQUIRTBOTTLE.
 	text "I hear there's a"
 	line "#MON that looks"
 	cont "just like a tree."
--- a/maps/Route39Farmhouse.asm
+++ b/maps/Route39Farmhouse.asm
@@ -172,7 +172,7 @@
 	line "fer your trouble."
 	done
 
-Text_ReceivedTM13:
+Text_ReceivedTM13: ; unreferenced
 	text "<PLAYER> received"
 	line "TM13."
 	done
--- a/maps/Route40BattleTowerGate.asm
+++ b/maps/Route40BattleTowerGate.asm
@@ -18,7 +18,7 @@
 Route40BattleTowerGateTwinScript:
 	jumptextfaceplayer Route40BattleTowerGateTwinText
 
-UnknownText_0x9f66f:
+Route40BattleTowerGateUnusedText1: ; unreferenced
 	text "Did you come to"
 	line "see the BATTLE"
 	cont "TOWER too?"
@@ -27,7 +27,7 @@
 	line "can't go in yet."
 	done
 
-UnknownText_0x9f6ba:
+Route40BattleTowerGateUnusedText2: ; unreferenced
 	text "BATTLE TOWER has"
 	line "opened."
 
@@ -49,7 +49,7 @@
 	line "win special gifts."
 	done
 
-UnknownText_0x9f783:
+Route40BattleTowerGateUnusedText3: ; unreferenced
 	text "I'm going to train"
 	line "my #MON so I'll"
 
--- a/maps/Route41.asm
+++ b/maps/Route41.asm
@@ -125,8 +125,7 @@
 	closetext
 	end
 
-Route41Rock:
-; unused
+Route41Rock: ; unreferenced
 	jumpstd SmashRockScript
 
 Route41HiddenMaxEther:
--- a/maps/Route43Gate.asm
+++ b/maps/Route43Gate.asm
@@ -234,7 +234,7 @@
 	cont "you take it away?"
 	done
 
-Text_ReceivedTM30:
+Text_ReceivedTM30: ; unreferenced
 	text "<PLAYER> received"
 	line "TM30."
 	done
--- a/maps/Route45.asm
+++ b/maps/Route45.asm
@@ -285,7 +285,7 @@
 	closetext
 	end
 
-Route45DummyScript:
+Route45DummyScript: ; unreferenced
 	writetext Route45DummyText
 	waitbutton
 	closetext
--- a/maps/RuinsOfAlphAerodactylChamber.asm
+++ b/maps/RuinsOfAlphAerodactylChamber.asm
@@ -112,8 +112,7 @@
 	line "on the walls…"
 	done
 
-RuinsOfAlphAerodactylChamberUnownText:
-; unused
+RuinsOfAlphAerodactylChamberUnownText: ; unreferenced
 	text "It's UNOWN text!"
 	done
 
--- a/maps/RuinsOfAlphHoOhChamber.asm
+++ b/maps/RuinsOfAlphHoOhChamber.asm
@@ -113,8 +113,7 @@
 	line "on the walls…"
 	done
 
-RuinsOfAlphHoOhChamberUnownText:
-; unused
+RuinsOfAlphHoOhChamberUnownText: ; unreferenced
 	text "It's UNOWN text!"
 	done
 
--- a/maps/RuinsOfAlphKabutoChamber.asm
+++ b/maps/RuinsOfAlphKabutoChamber.asm
@@ -200,8 +200,7 @@
 	cont "this wall here…"
 	done
 
-RuinsOfAlphKabutoChamberUnusedText:
-; unused
+RuinsOfAlphKabutoChamberUnusedText: ; unreferenced
 	text "The patterns on"
 	line "the wall appear to"
 	cont "be words!"
@@ -224,8 +223,7 @@
 	line "on the walls…"
 	done
 
-RuinsOfAlphKabutoChamberUnownText:
-; unused
+RuinsOfAlphKabutoChamberUnownText: ; unreferenced
 	text "It's UNOWN text!"
 	done
 
--- a/maps/RuinsOfAlphOmanyteChamber.asm
+++ b/maps/RuinsOfAlphOmanyteChamber.asm
@@ -113,8 +113,7 @@
 	line "on the walls…"
 	done
 
-RuinsOfAlphOmanyteChamberUnownText:
-; unused
+RuinsOfAlphOmanyteChamberUnownText: ; unreferenced
 	text "It's UNOWN text!"
 	done
 
--- a/maps/RuinsOfAlphOutside.asm
+++ b/maps/RuinsOfAlphOutside.asm
@@ -110,7 +110,7 @@
 	closetext
 	end
 
-TrainerSuperNerdStan:
+TrainerSuperNerdStan: ; unreferenced
 	trainer SUPER_NERD, STAN, EVENT_BEAT_SUPER_NERD_STAN, SuperNerdStanSeenText, SuperNerdStanBeatenText, 0, .Script
 
 .Script:
--- a/maps/RuinsOfAlphResearchCenter.asm
+++ b/maps/RuinsOfAlphResearchCenter.asm
@@ -167,8 +167,7 @@
 	closetext
 	end
 
-RuinsOfAlphResearchCenterPhoto:
-; unreferenced
+RuinsOfAlphResearchCenterPhoto: ; unreferenced
 	jumptext RuinsOfAlphResearchCenterProfSilktreePhotoText
 
 RuinsOfAlphResearchCenterBookshelf:
@@ -307,8 +306,7 @@
 	cont "kinds of them…"
 	done
 
-RuinsOfAlphResearchCenterUnusedText1:
-; unused
+RuinsOfAlphResearchCenterUnusedText1: ; unreferenced
 	text "We think something"
 	line "caused the cryptic"
 
@@ -319,8 +317,7 @@
 	line "studies on that."
 	done
 
-RuinsOfAlphResearchCenterUnusedText2:
-; unused
+RuinsOfAlphResearchCenterUnusedText2: ; unreferenced
 	text "According to my"
 	line "research…"
 
@@ -374,7 +371,6 @@
 	done
 
 RuinsOfAlphResearchCenterProfSilktreePhotoText:
-; unused
 	text "It's a photo of"
 	line "the RESEARCH"
 
--- a/maps/TeamRocketBaseB2F.asm
+++ b/maps/TeamRocketBaseB2F.asm
@@ -731,7 +731,7 @@
 	cont "any need for it."
 	done
 
-RocketBaseReceivedHM06Text: ; unused
+RocketBaseReceivedHM06Text: ; unreferenced
 	text "<PLAYER> received"
 	line "HM06."
 	done
--- a/maps/TinTower9F.asm
+++ b/maps/TinTower9F.asm
@@ -9,13 +9,11 @@
 TinTower9FHPUp:
 	itemball HP_UP
 
-TinTower9FUnusedHoOhText:
-; unused
+TinTower9FUnusedHoOhText: ; unreferenced
 	text "HO-OH: Shaoooh!"
 	done
 
-TinTower9FUnusedLugiaText:
-; unused
+TinTower9FUnusedLugiaText: ; unreferenced
 	text "LUGIA: Gyaaan!"
 	done
 
--- a/maps/TradeCenter.asm
+++ b/maps/TradeCenter.asm
@@ -39,15 +39,14 @@
 	newloadmap MAPSETUP_LINKRETURN
 	end
 
-TradeCenterFriendScript:
-; unreferenced
+TradeCenterFriendScript: ; unreferenced
 	opentext
-	writetext .FriendReadyText
+	writetext TradeCenterFriendReadyText
 	waitbutton
 	closetext
 	end
 
-.FriendReadyText:
+TradeCenterFriendReadyText:
 	text "Your friend is"
 	line "ready."
 	done
--- a/maps/UnionCave1F.asm
+++ b/maps/UnionCave1F.asm
@@ -81,8 +81,7 @@
 UnionCave1FAwakening:
 	itemball AWAKENING
 
-UnionCave1FUnusedSign:
-; unused
+UnionCave1FUnusedSign: ; unreferenced
 	jumptext UnionCave1FUnusedSignText
 
 HikerRussellSeenText:
--- a/maps/VermilionFishingSpeechHouse.asm
+++ b/maps/VermilionFishingSpeechHouse.asm
@@ -12,8 +12,7 @@
 FishingDudesHousePhoto:
 	jumptext FishingDudesHousePhotoText
 
-FishingDudesHouseBookshelf:
-; unused
+FishingDudesHouseBookshelf: ; unreferenced
 	jumpstd PictureBookshelfScript
 
 FishingDudeText:
--- a/maps/VioletPokecenter1F.asm
+++ b/maps/VioletPokecenter1F.asm
@@ -157,8 +157,7 @@
 	line "take the EGG?"
 	done
 
-; unused
-VioletPokecenterFarawayLinkText:
+VioletPokecenterFarawayLinkText: ; unreferenced
 	text "I've been thinking"
 	line "it'd be great to"
 
@@ -169,8 +168,7 @@
 	line "far away."
 	done
 
-; unused
-VioletPokecenterMobileAdapterText:
+VioletPokecenterMobileAdapterText: ; unreferenced
 	text "I just battled a"
 	line "friend in CIANWOOD"
 	cont "over a link."
--- a/mobile/fixed_words.asm
+++ b/mobile/fixed_words.asm
@@ -1334,7 +1334,7 @@
 	jr nz, .asm_11c8c2
 	ret
 
-BCD2String:
+BCD2String: ; unreferenced
 	inc a
 	push af
 	and $f
@@ -1356,7 +1356,7 @@
 	ld [hli], a
 	ret
 
-MobileString_Page:
+MobileString_Page: ; unreferenced
 	db "ぺージ@"
 
 MobileString_Prev:
--- a/mobile/mobile_12.asm
+++ b/mobile/mobile_12.asm
@@ -45,8 +45,8 @@
 	ld [wMusicFadeID + 1], a
 	ld c, 20
 	call DelayFrames
-	ld b, $1
-	call GetMysteryGift_MobileAdapterLayout
+	ld b, CRYSTAL_CGB_MOBILE_1
+	call GetCrystalCGBLayout
 	call ClearBGPalettes
 	hlcoord 0, 0
 	ld b,  2
@@ -652,8 +652,8 @@
 Function48689:
 	ld c, 7
 	call DelayFrames
-	ld b, $1
-	call GetMysteryGift_MobileAdapterLayout
+	ld b, CRYSTAL_CGB_MOBILE_1
+	call GetCrystalCGBLayout
 	call ClearBGPalettes
 	hlcoord 0, 0
 	ld b, 4
@@ -1080,7 +1080,7 @@
 	call DelayFrames
 	jr asm_48972
 
-Function4895a:
+Function4895a: ; unreferenced
 	ldh a, [hJoyPressed]
 	and a
 	jr z, .asm_48965
@@ -1608,7 +1608,7 @@
 	call WaitBGMap
 	ret
 
-Function48ca3:
+Function48ca3: ; unreferenced
 	push af
 	push bc
 	push de
--- a/mobile/mobile_12_2.asm
+++ b/mobile/mobile_12_2.asm
@@ -332,7 +332,7 @@
 	pop af
 	ret
 
-Function4aa6e:
+Function4aa6e: ; unreferenced
 	pop af
 	ld de, SFX_WRONG
 	call PlaySFX
@@ -803,7 +803,7 @@
 	farcall ManagePokemonMoves
 	ret
 
-Function4ad67:
+Function4ad67: ; unreferenced
 	ret
 
 Function4ad68:
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -20,18 +20,18 @@
 	ret
 
 Function89168:
-	ld hl, wGameTimerPause
-	set GAMETIMERPAUSE_MOBILE_7_F, [hl]
+	ld hl, wGameTimerPaused
+	set GAME_TIMER_MOBILE_F, [hl]
 	ret
 
 Function8916e:
-	ld hl, wGameTimerPause
-	res GAMETIMERPAUSE_MOBILE_7_F, [hl]
+	ld hl, wGameTimerPaused
+	res GAME_TIMER_MOBILE_F, [hl]
 	ret
 
 Function89174:
-	ld hl, wGameTimerPause
-	bit GAMETIMERPAUSE_MOBILE_7_F, [hl]
+	ld hl, wGameTimerPaused
+	bit GAME_TIMER_MOBILE_F, [hl]
 	ret
 
 Function8917a:
@@ -507,7 +507,7 @@
 	call FarCopyBytes
 	ret
 
-Function893fe:
+Function893fe: ; unreferenced
 	call DisableLCD
 	call Function893ef
 	call EnableLCD
@@ -792,7 +792,7 @@
 	RGB 07, 07, 06
 	RGB 00, 00, 00
 
-Function895e6:
+Function895e6: ; unreferenced
 	ld a, 7
 	hlcoord 0, 0, wAttrmap
 	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
@@ -989,32 +989,33 @@
 	inc hl
 	ld b, 2
 
-ClearScreenArea:
-; clears an area of the screen
+Function896ff: ; unreferenced
 ; INPUT:
 ; hl = address of upper left corner of the area
 ; b = height
 ; c = width
 
-	ld a, " " ; blank tile
-	ld de, 20 ; screen width
-.loop
+; clears an area of the screen
+	ld a, " "
+	ld de, SCREEN_WIDTH
+.row_loop
 	push bc
 	push hl
-.innerLoop
+.col_loop
 	ld [hli], a
 	dec c
-	jr nz, .innerLoop
+	jr nz, .col_loop
 	pop hl
 	pop bc
 	add hl, de
 	dec b
-	jr nz, .loop
+	jr nz, .row_loop
 
+; alternates tiles $36 and $18 at the bottom of the area
 	dec hl
 	inc c
 	inc c
-.asm_89713
+.bottom_loop
 	ld a, $36
 	ld [hli], a
 	dec c
@@ -1022,7 +1023,7 @@
 	ld a, $18
 	ld [hli], a
 	dec c
-	jr nz, .asm_89713
+	jr nz, .bottom_loop
 	ret
 
 Function8971f:
@@ -1695,7 +1696,7 @@
 	farcall Function4a3a7
 	ret
 
-Function89b14:
+Function89b14: ; unreferenced
 	call ClearBGPalettes
 	call Function89b07
 	call Function89b00
@@ -3963,7 +3964,7 @@
 Function8ab93:
 	call ClearBGPalettes
 	call LoadStandardMenuHeader
-	farcall Function105688
+	farcall DoNameCardSwap
 	call ClearSprites
 	call Function891fe
 	call Function89b28
@@ -4225,7 +4226,7 @@
 	pop af
 	ret
 
-Function8adbf:
+Function8adbf: ; unreferenced
 	call OpenSRAMBank4
 	ld hl, $a603
 	call Function89b45
--- a/mobile/mobile_22_2.asm
+++ b/mobile/mobile_22_2.asm
@@ -32,7 +32,7 @@
 .two
 	ret
 
-Function8b35d:
+Function8b35d: ; unreferenced
 	ld a, h
 	cp d
 	ret nz
@@ -40,7 +40,7 @@
 	cp e
 	ret
 
-Function8b363:
+Function8b363: ; unreferenced
 	push bc
 	farcall Mobile_AlwaysReturnNotCarry
 	pop bc
@@ -719,7 +719,7 @@
 	jr nz, .asm_8b780
 	jr Function8b79e
 
-Function8b787:
+Function8b787: ; unreferenced
 	ret
 
 Function8b788:
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -429,7 +429,7 @@
 	farcall Mobile_ReloadMapPart
 	ret
 
-Function100327:
+Function100327: ; unreferenced
 	farcall HDMATransferTilemapToWRAMBank3
 	ret
 
@@ -523,7 +523,7 @@
 	call FarCopyWRAM
 	ret
 
-Function1003ab:
+Function1003ab: ; unreferenced
 	ld hl, w3_d000
 	ld de, wcc60
 	ld bc, $54
@@ -2217,29 +2217,29 @@
 Function100edf:
 	ld hl, Unknown_100fc0
 	ld c, 1
-	jr asm_100f02
+	jr Function100f02
 
 Function100ee6:
 	ld hl, Unknown_100fc0
 	ld c, 2
-	jr asm_100f02
+	jr Function100f02
 
 Function100eed:
 	ld hl, Unknown_100feb
 	ld c, 1
-	jr asm_100f02
+	jr Function100f02
 
 Function100ef4:
 	ld hl, Unknown_100ff3
 	ld c, 1
-	jr asm_100f02
+	jr Function100f02
 
-Function100efb:
+Function100efb: ; unreferenced
 	ld hl, Unknown_10102c
 	ld c, 1
-	jr asm_100f02
+	jr Function100f02
 
-asm_100f02:
+Function100f02:
 	ld a, c
 	ld [wStringBuffer2], a
 	; someting that was previously stored in de gets backed up to here
@@ -2660,8 +2660,8 @@
 	call CloseSRAM
 	ld hl, wdc41
 	res 4, [hl]
-	ld hl, wGameTimerPause
-	bit GAMETIMERPAUSE_MOBILE_7_F, [hl]
+	ld hl, wGameTimerPaused
+	bit GAME_TIMER_MOBILE_F, [hl]
 	jr z, .skip
 	ld hl, wdc41
 	set 4, [hl]
@@ -4425,15 +4425,15 @@
 	call ClearSprites
 	farcall Function8adb3
 	ret c
-	ld hl, wGameTimerPause
-	set GAMETIMERPAUSE_MOBILE_7_F, [hl]
+	ld hl, wGameTimerPaused
+	set GAME_TIMER_MOBILE_F, [hl]
 	ld hl, wdc41
 	set 4, [hl]
 	ret
 
 Function101ead:
-	ld hl, wGameTimerPause
-	bit GAMETIMERPAUSE_MOBILE_7_F, [hl]
+	ld hl, wGameTimerPaused
+	bit GAME_TIMER_MOBILE_F, [hl]
 	jr nz, .asm_101ec8
 	ld hl, wdc41
 	bit 2, [hl]
@@ -4812,7 +4812,7 @@
 	call ExitMenu
 	ret
 
-UnknownText_0x1021ea:
+UnknownText_0x1021ea: ; unreferenced
 	text_far UnknownText_0x1bd201
 	text_end
 
@@ -5169,7 +5169,7 @@
 	ld [wcd49], a
 	ret
 
-Function102480:
+Function102480: ; unreferenced
 	ld c, $32
 	call DelayFrames
 	ld a, [wcd49]
@@ -5183,7 +5183,7 @@
 	ld [wcd49], a
 	ret
 
-Function102496:
+Function102496: ; unreferenced
 	ld hl, wcd4e
 	dec [hl]
 	ret nz
--- a/mobile/mobile_41.asm
+++ b/mobile/mobile_41.asm
@@ -282,7 +282,7 @@
 	ld hl, sTrainerRankingTrainerBattles
 	jp StubbedTrainerRankings_Increment3Byte
 
-StubbedTrainerRankings_Unused1:
+StubbedTrainerRankings_Unused1: ; unreferenced
 	ret
 	ld hl, sTrainerRankingUnused1
 	jp StubbedTrainerRankings_Increment3Byte
@@ -362,7 +362,7 @@
 	ld hl, sTrainerRankingPhoneCalls
 	jr StubbedTrainerRankings_Increment3Byte
 
-StubbedTrainerRankings_Unused2:
+StubbedTrainerRankings_Unused2: ; unreferenced
 	ret
 	ld hl, sTrainerRankingUnused2
 	jr StubbedTrainerRankings_Increment3Byte
@@ -386,7 +386,7 @@
 	ld hl, sTrainerRankingTreeEncounters
 	jr StubbedTrainerRankings_Increment3Byte
 
-StubbedTrainerRankings_Unused3:
+StubbedTrainerRankings_Unused3: ; unreferenced
 	ret
 	ld hl, sTrainerRankingUnused3
 	jr StubbedTrainerRankings_Increment3Byte
@@ -431,8 +431,7 @@
 	ld bc, 1
 	jr StubbedTrainerRankings_Increment
 
-; unused
-StubbedTrainerRankings_Increment1Byte:
+StubbedTrainerRankings_Increment1Byte: ; unreferenced
 	push bc
 	ld bc, 0
 
@@ -556,9 +555,8 @@
 	call CloseSRAM
 	ret
 
-; Used in the Japanese version to initialize Trainer Rankings data
-; for a new save file. Unreferenced in the English version.
-InitializeTrainerRankings:
+InitializeTrainerRankings: ; unreferenced
+; Initializes Trainer Rankings data for a new save file in JP Crystal.
 	ld hl, sTrainerRankings
 	ld bc, sTrainerRankingsEnd - sTrainerRankings
 	xor a
@@ -807,8 +805,8 @@
 	or a
 	ret
 
-Function106331:
-; called by Mobile_DummyReturnFalse in Crystal-J
+Function106331: ; unreferenced
+; called by Mobile_DummyReturnFalse in JP Crystal
 	; check ~[s4_b000] == [s7_a800]
 	ld a, BANK(s4_b000)
 	call OpenSRAM
@@ -1028,7 +1026,7 @@
 	farcall LoadFrame
 	ret
 
-Function10649b:
+Function10649b: ; unreferenced
 	ld a, [wTextboxFrame]
 	maskbits NUM_FRAMES
 	ld bc, 6 * LEN_1BPP_TILE
@@ -1063,7 +1061,7 @@
 	ldh [rSVBK], a
 	jr asm_1064ed
 
-Function1064d8:
+Function1064d8: ; unreferenced
 	ldh a, [rSVBK]
 	push af
 	ld a, $6
@@ -1097,7 +1095,7 @@
 	ldh [rSVBK], a
 	ret
 
-Function10650a:
+Function10650a: ; unreferenced
 	ld de, MobilePhoneTilesGFX
 	lb bc, BANK(MobilePhoneTilesGFX), 17
 	call Get2bpp
--- a/mobile/mobile_42.asm
+++ b/mobile/mobile_42.asm
@@ -309,7 +309,7 @@
 	predef GetAnimatedFrontpic
 	ret
 
-Function108219:
+Function108219: ; unreferenced
 	ld [wCurPartySpecies], a
 	hlcoord 7, 2
 	ld d, $0
@@ -1557,7 +1557,7 @@
 	text_far _MobileForPartnersMonText
 	text_end
 
-.MobilePlayersMonTradeText:
+.MobilePlayersMonTradeText: ; unreferenced
 	text_far _MobilePlayersMonTradeText
 	text_end
 
@@ -1636,7 +1636,7 @@
 	ldh [rVBK], a
 	ret
 
-DebugMobileTrade:
+DebugMobileTrade: ; unreferenced
 ; localization error: NAME_LENGTH (11) should be NAME_LENGTH_JAPANESE (6) here
 
 	ld hl, .DebugTradeData
@@ -1741,7 +1741,7 @@
 MobileTradeAttrmapLZ:
 INCBIN "gfx/mobile/mobile_trade.attrmap.lz"
 
-UnusedMobilePulsePalettes:
+UnusedMobilePulsePalettes: ; unreferenced
 INCLUDE "gfx/mobile/unused_mobile_pulses.pal"
 
 MobileTradeBGPalettes:
--- a/mobile/mobile_45.asm
+++ b/mobile/mobile_45.asm
@@ -1959,7 +1959,7 @@
 	jr z, .asm_114c24
 	jr .asm_114c18
 
-Function114c55:
+Function114c55: ; unreferenced
 	push bc
 	ld bc, $dc00
 	call Function115d80
--- a/mobile/mobile_45_sprite_engine.asm
+++ b/mobile/mobile_45_sprite_engine.asm
@@ -475,7 +475,7 @@
 	ld [wc319], a
 	ret
 
-MenuHeader_11628c:
+MenuHeader_11628c: ; unreferenced
 	db MENU_BACKUP_TILES ; flags
 	menu_coords 0, 6, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
 	dw NULL
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -331,7 +331,7 @@
 	call BattleTowerRoomMenu_Cleanup
 	ret
 
-Function1182d5:
+Function1182d5: ; unreferenced
 	call BattleTowerRoomMenu_InitRAM
 	ld a, $18
 	ld [wcd33], a
@@ -1039,7 +1039,7 @@
 	ld a, $2
 	jp Function119e2b
 
-Function118896:
+Function118896: ; unreferenced
 	ld a, [wc821]
 	bit 1, a
 	jr nz, .asm_1188a5
@@ -1302,7 +1302,7 @@
 	ld [wMobileInactivityTimerFrames], a
 	ret
 
-Function118a54:
+Function118a54: ; unreferenced
 	ld a, [wcd55]
 	ld l, a
 	ld a, [wcd56]
@@ -1311,7 +1311,7 @@
 	ld bc, $0004
 	jp Function118ae4
 
-Function118a65:
+Function118a65: ; unreferenced
 	ld hl, BattleDownloadURL
 	ld de, wcc60
 	ld bc, $80
@@ -3530,7 +3530,7 @@
 XGameCode:
 	db "CGB-BXTJ-00", $0
 
-XGameResult:
+XGameResult: ; unreferenced
 	db "pokemon_crystal", $0
 
 popc
@@ -3861,7 +3861,7 @@
 	dw NULL
 	db 0 ; default option
 
-MenuData_119cff:
+MenuData_119cff: ; unreferenced
 	db MENU_BACKUP_TILES ; flags
 	menu_coords 15, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
 	dw NULL
@@ -4627,7 +4627,7 @@
 String_11a2d3:
 	db "NO@"
 
-MenuHeader_11a2d6:
+MenuHeader_11a2d6: ; unreferenced
 	db MENU_BACKUP_TILES ; flags
 	menu_coords 14, 6, SCREEN_WIDTH - 1, 10
 	dw NULL
@@ -5151,7 +5151,7 @@
 String_11a7f4:
 	db   "               @"
 
-MenuHeader_11a804:
+MenuHeader_11a804: ; unreferenced
 	db MENU_BACKUP_TILES ; flags
 	menu_coords 0, 0, SCREEN_WIDTH - 1, 5
 	dw NULL
@@ -5402,7 +5402,7 @@
 	and a
 	ret
 
-Function11a9f4:
+Function11a9f4: ; unreferenced
 	ld a, [wcd8a]
 	ld l, a
 	ld a, [wcd8b]
@@ -5443,12 +5443,12 @@
 	text "Quit reading NEWS?"
 	done
 
-Text_CanceledSendingSaveFile:
+Text_CanceledSendingSaveFile: ; unreferenced
 	text "Canceled sending"
 	line "SAVE FILE."
 	done
 
-Text_ReceivedOddEgg:
+Text_ReceivedOddEgg: ; unreferenced
 	text "ODD EGG"
 	line "was received!"
 	done
@@ -5458,7 +5458,7 @@
 	line "record…"
 	done
 
-Text_BattleRoomVisitLimit:
+Text_BattleRoomVisitLimit: ; unreferenced
 	text "One visit per day"
 	line "per BATTLE ROOM!"
 	done
@@ -5487,7 +5487,7 @@
 	line "HONOR ROLL?"
 	done
 
-Text_LinkingWithCenter:
+Text_LinkingWithCenter: ; unreferenced
 	text "Linking with the"
 	line "CENTER…"
 	done
@@ -5502,16 +5502,16 @@
 	line "list by max level?"
 	done
 
-Text_EnterWhichBattleRoom:
+Text_EnterWhichBattleRoom: ; unreferenced
 	text "Enter which"
 	line "BATTLE ROOM?"
 	done
 
-Text_WhichBattleRoom:
+Text_WhichBattleRoom: ; unreferenced
 	text "Which BATTLE ROOM?"
 	done
 
-Text_ThisBattleRoomPleaseWait:
+Text_ThisBattleRoomPleaseWait: ; unreferenced
 	text_ram wStringBuffer3
 	text "'s ROOM"
 	line "@"
@@ -6379,7 +6379,7 @@
 	scf
 	ret
 
-Function11b1f7:
+FillScreenWithTile32: ; unreferenced
 	hlcoord 0, 0
 	ld a, $32
 	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
@@ -6386,14 +6386,14 @@
 	call ByteFill
 	ret
 
-Function11b203:
-.asm_11b203
+CopyDataUntilFF: ; unreferenced
+.loop
 	ld a, [de]
 	cp $ff
 	ret z
 	inc de
 	ld [hli], a
-	jr .asm_11b203
+	jr .loop
 
 Function11b20b:
 	ld a, [wc7d1]
@@ -6554,10 +6554,10 @@
 	call PlaceString
 	ret
 
-String_11b2fe:
+String_11b2fe: ; unreferenced
 	db "あげる#@"
 
-String_11b303:
+String_11b303: ; unreferenced
 	db "ほしい#@"
 
 String_11b308:
--- a/mobile/mobile_5b.asm
+++ b/mobile/mobile_5b.asm
@@ -7,11 +7,11 @@
 	ldh a, [hSystemBooted]
 	and a
 	ret z
-	; Set some flag, preserving the old state
-	ld a, [wcfbe]
+	; Disable the joypad during mobile setup
+	ld a, [wJoypadDisable]
 	push af
-	set 7, a
-	ld [wcfbe], a
+	set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+	ld [wJoypadDisable], a
 	; Do stuff
 	call MobileSystemSplashScreen_InitGFX ; Load GFX
 	farcall SetRAMStateForMobile
@@ -24,7 +24,7 @@
 	ldh [hSystemBooted], a
 	; Restore the flag state
 	pop af
-	ld [wcfbe], a
+	ld [wJoypadDisable], a
 	ret
 
 .RunJumptable:
--- a/mobile/mobile_5c.asm
+++ b/mobile/mobile_5c.asm
@@ -93,7 +93,7 @@
 	call CloseSRAM
 	ret
 
-Function170c06:
+Function170c06: ; unreferenced
 	ld a, $5
 	call OpenSRAM
 	ld hl, $a894
--- a/mobile/mobile_5e.asm
+++ b/mobile/mobile_5e.asm
@@ -186,7 +186,7 @@
 	farcall ReloadMapPart
 	ret
 
-Function17a7a6:
+Function17a7a6: ; unreferenced
 	ld a, [$d087]
 	inc a
 	ld [$d087], a
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -1882,7 +1882,7 @@
 	call Function17e40f
 	ret
 
-MenuData_17dc96:
+MenuData_17dc96: ; unreferenced
 	db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING | STATICMENU_WRAP ; flags
 	db 2
 	db "はい@"
@@ -4645,7 +4645,7 @@
 	dw MobileErrorCode_101_009_Text
 	dw MobileErrorCode_101_009_Text
 
-Palette_17f6af:
+Palette_17f6af: ; unreferenced
 	RGB  5,  5, 16
 	RGB  8, 19, 28
 	RGB  0,  0,  0
@@ -4678,7 +4678,7 @@
 MobileCommunicationErrorText:
 	db "つうしんエラー   ー@"
 
-String_17f6e8:
+String_17f6e8: ; unreferenced
 	db   "みていぎ<NO>エラーです"
 	next "プログラム<WO>"
 	next "かくにん してください"
@@ -5115,7 +5115,7 @@
 	next "せつめいしょを ごらんください"
 	db   "@"
 
-String_17fe9a: ; unused
+String_17fe9a: ; unreferenced
 ; Cannot send your save data because Pokémon News is being updated.
 ; Please send your save data after loading new Pokémon News.
 	db   "ポケモンニュースが"
--- a/mobile/mobile_menu.asm
+++ b/mobile/mobile_menu.asm
@@ -108,24 +108,20 @@
 	db   "@"
 
 MobileStrings2:
-
+; string 0
 String_0x49fe9:
 	db   "めいし¯つくったり"
 	next "ほぞんしておける フォルダーです@"
-
-String_0x4a004:
+; string 1
 	db   "モバイルたいせんや じぶんのめいしで"
 	next "つかう あいさつ¯つくります@"
-
-String_0x4a026:
+; string 2
 	db   "あなた<NO>じゅうしょや ねんれいの"
 	next "せ<TTE>い¯かえられます@"
-
-String_0x4a042:
+; string 3
 	db  "モバイルセンター<NI>せつぞくするとき"
 	next "ひつような こと¯きめます@"
-
-String_0x4a062:
+; string 4
 	db   "まえ<NO>がめん <NI>もどります"
 	next "@"
 
@@ -446,7 +442,7 @@
 	xor a
 	ret
 
-MenuHeader_0x4a346:
+MenuHeader_0x4a346: ; unreferenced
 	db MENU_BACKUP_TILES ; flags
 	menu_coords 12, 0, SCREEN_WIDTH - 1, 6
 
@@ -502,7 +498,7 @@
 	ld [hli], a
 	ret
 
-Function4a39a:
+Function4a39a: ; unreferenced
 	call Function4a485
 	call Function4a492
 	call Function4a3aa
@@ -574,7 +570,7 @@
 	call Function4a6d8
 	ret
 
-Function4a449:
+Function4a449: ; unreferenced
 	ld bc, 3 * SCREEN_WIDTH
 	ld a, $0
 	hlcoord 0, 0
@@ -607,7 +603,7 @@
 	ret
 
 Function4a492:
-	call MG_Mobile_Layout00
+	call _CrystalCGB_MobileLayout0
 	ret
 
 MainMenu_MobileStudium:
--- a/mobile/news/news.asm
+++ b/mobile/news/news.asm
@@ -28,7 +28,7 @@
 .news_data
 INCBIN "mobile/news/news_2.bin"
 
-Function1f5d9f:
+Function1f5d9f: ; unreferenced
 	ld a, BANK(s6_a000)
 	call OpenSRAM
 	ld hl, .news_data
--- a/sram.asm
+++ b/sram.asm
@@ -1,6 +1,6 @@
 SECTION "Scratch", SRAM
 
-sScratch:: ds $600
+sScratch:: ds $60 tiles
 
 
 SECTION "SRAM Bank 0", SRAM
@@ -22,7 +22,7 @@
 sPartyMon6MailBackup:: mailmsg sPartyMon6MailBackup
 
 sMailboxCount:: db
-sMailbox::
+sMailboxes::
 sMailbox1::  mailmsg sMailbox1
 sMailbox2::  mailmsg sMailbox2
 sMailbox3::  mailmsg sMailbox3
@@ -35,7 +35,7 @@
 sMailbox10:: mailmsg sMailbox10
 
 sMailboxCountBackup:: db
-sMailboxBackup::
+sMailboxesBackup::
 sMailbox1Backup::  mailmsg sMailbox1Backup
 sMailbox2Backup::  mailmsg sMailbox2Backup
 sMailbox3Backup::  mailmsg sMailbox3Backup
@@ -47,20 +47,20 @@
 sMailbox9Backup::  mailmsg sMailbox9Backup
 sMailbox10Backup:: mailmsg sMailbox10Backup
 
+sMysteryGiftData::
 sMysteryGiftItem:: db
 sMysteryGiftUnlocked:: db
 sBackupMysteryGiftItem:: db
 sNumDailyMysteryGiftPartnerIDs:: db
-sDailyMysteryGiftPartnerIDs:: ds 5 * 2 ; maximum 5 per day, 2 bytes per ID
+sDailyMysteryGiftPartnerIDs:: ds MAX_MYSTERY_GIFT_PARTNERS * 2
 sMysteryGiftDecorationsReceived:: flag_array NUM_NON_TROPHY_DECOS
 	ds 4
-sMysteryGiftTimer:: db
-sMysteryGiftTimerStartDay:: db
+sMysteryGiftTimer:: dw
 	ds 1
 sMysteryGiftTrainerHouseFlag:: db
 sMysteryGiftPartnerName:: ds NAME_LENGTH
-	ds 1
-sMysteryGiftTrainer:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 2
+sMysteryGiftUnusedFlag:: db
+sMysteryGiftTrainer:: ds wMysteryGiftTrainerEnd - wMysteryGiftTrainer
 sBackupMysteryGiftItemEnd::
 
 	ds $30
@@ -194,7 +194,6 @@
 ; 2: battle tower
 	db
 
-sBattleTower::
 sNrOfBeatenBattleTowerTrainers:: db
 sBTChoiceOfLevelGroup:: db
 ; Battle Tower trainers are saved here, so nobody appears more than once
--- a/wram.asm
+++ b/wram.asm
@@ -10,7 +10,6 @@
 
 wStackBottom::
 	ds $100 - 1
-wStack::
 wStackTop::
 	ds 1
 
@@ -17,18 +16,16 @@
 
 SECTION "Audio RAM", WRAM0
 
-wMusic::
-
 ; nonzero if playing
 wMusicPlaying:: db
 
-wChannels::
+wAudio::
+
 wChannel1:: channel_struct wChannel1
 wChannel2:: channel_struct wChannel2
 wChannel3:: channel_struct wChannel3
 wChannel4:: channel_struct wChannel4
 
-wSFXChannels::
 wChannel5:: channel_struct wChannel5
 wChannel6:: channel_struct wChannel6
 wChannel7:: channel_struct wChannel7
@@ -118,12 +115,12 @@
 wCurSFX::
 ; id of sfx currently playing
 	db
-wChannelsEnd::
 
+wAudioEnd::
+
 wMapMusic:: db
 
 wDontPlayMapMusicOnReload:: db
-wMusicEnd::
 
 
 SECTION "WRAM", WRAM0
@@ -169,7 +166,6 @@
 
 	ds 2
 
-wc2e2::
 wMovementObject::
 	db
 wMovementDataBank:: db
@@ -240,10 +236,6 @@
 wSpriteAnimationStructsEnd::
 
 NEXTU
-; dummy game
-wc300::
-
-NEXTU
 ; mobile data
 wMobileWRAM::
 wMobileErrorCodeBuffer:: ds 3
@@ -410,6 +402,7 @@
 
 wWildMon:: db
 	ds 1
+
 wEnemyTrainerItem1:: db
 wEnemyTrainerItem2:: db
 wEnemyTrainerBaseReward:: db
@@ -443,71 +436,17 @@
 ; nonzero for a miss
 	db
 
-wPlayerSubStatus1::
-; bit
-; 0 nightmare
-; 1 curse
-; 2 protect
-; 3 identified
-; 4 perish song
-; 5 endure
-; 6 rollout
-; 7 in love
-	db
-wPlayerSubStatus2::
-; bit
-; 0 curled
-; 1-7 unused
-	db
-wPlayerSubStatus3::
-; bit
-; 0 bide
-; 1 rampage
-; 2 in loop
-; 3 flinched
-; 4 charged
-; 5 underground
-; 6 flying
-; 7 confused
-	db
-wPlayerSubStatus4::
-; bit
-; 0 x accuracy
-; 1 mist
-; 2 focus energy
-; 3
-; 4 substitute
-; 5 recharge
-; 6 rage
-; 7 leech seed
-	db
-wPlayerSubStatus5::
-; bit
-; 0 toxic
-; 1
-; 2
-; 3 transformed
-; 4 encored
-; 5 lock-on
-; 6 destiny bond
-; 7 can't run
-	db
+wPlayerSubStatus1:: db
+wPlayerSubStatus2:: db
+wPlayerSubStatus3:: db
+wPlayerSubStatus4:: db
+wPlayerSubStatus5:: db
 
-wEnemySubStatus1::
-; see wPlayerSubStatus1
-	db
-wEnemySubStatus2::
-; see wPlayerSubStatus2
-	db
-wEnemySubStatus3::
-; see wPlayerSubStatus3
-	db
-wEnemySubStatus4::
-; see wPlayerSubStatus4
-	db
-wEnemySubStatus5::
-; see wPlayerSubStatus5
-	db
+wEnemySubStatus1:: db
+wEnemySubStatus2:: db
+wEnemySubStatus3:: db
+wEnemySubStatus4:: db
+wEnemySubStatus5:: db
 
 wPlayerRolloutCount:: db
 wPlayerConfuseCount:: db
@@ -528,7 +467,7 @@
 wEnemyProtectCount:: db
 
 wPlayerDamageTaken:: dw
-wEnemyDamageTaken:: dw
+wEnemyDamageTaken::  dw
 
 wBattleReward:: ds 3
 
@@ -543,56 +482,53 @@
 	ds 1
 
 wPlayerStats::
-wPlayerAttack:: dw
+wPlayerAttack::  dw
 wPlayerDefense:: dw
-wPlayerSpeed:: dw
-wPlayerSpAtk:: dw
-wPlayerSpDef:: dw
+wPlayerSpeed::   dw
+wPlayerSpAtk::   dw
+wPlayerSpDef::   dw
 	ds 1
 
 wEnemyStats::
-wEnemyAttack:: dw
+wEnemyAttack::  dw
 wEnemyDefense:: dw
-wEnemySpeed:: dw
-wEnemySpAtk:: dw
-wEnemySpDef:: dw
+wEnemySpeed::   dw
+wEnemySpAtk::   dw
+wEnemySpDef::   dw
 	ds 1
 
 wPlayerStatLevels::
-; 07 neutral
-wPlayerAtkLevel:: db
-wPlayerDefLevel:: db
-wPlayerSpdLevel:: db
+wPlayerAtkLevel::  db
+wPlayerDefLevel::  db
+wPlayerSpdLevel::  db
 wPlayerSAtkLevel:: db
 wPlayerSDefLevel:: db
-wPlayerAccLevel:: db
-wPlayerEvaLevel:: db
+wPlayerAccLevel::  db
+wPlayerEvaLevel::  db
 	ds 1
-wPlayerStatLevelsEnd::
 
 wEnemyStatLevels::
-; 07 neutral
-wEnemyAtkLevel:: db
-wEnemyDefLevel:: db
-wEnemySpdLevel:: db
+wEnemyAtkLevel::  db
+wEnemyDefLevel::  db
+wEnemySpdLevel::  db
 wEnemySAtkLevel:: db
 wEnemySDefLevel:: db
-wEnemyAccLevel:: db
-wEnemyEvaLevel:: db
+wEnemyAccLevel::  db
+wEnemyEvaLevel::  db
 	ds 1
 
-wEnemyTurnsTaken:: db
+wEnemyTurnsTaken::  db
 wPlayerTurnsTaken:: db
 	ds 1
 
 wPlayerSubstituteHP:: db
-wEnemySubstituteHP:: db
+wEnemySubstituteHP::  db
 
 wUnusedPlayerLockedMove:: db
 	ds 1
 
 wCurPlayerMove:: db
-wCurEnemyMove:: db
+wCurEnemyMove::  db
 
 wLinkBattleRNCount::
 ; how far through the prng stream
@@ -605,7 +541,7 @@
 wEnemyHPAtTimeOfPlayerSwitch:: dw
 wPayDayMoney:: ds 3
 
-wSafariMonAngerCount:: db
+wSafariMonAngerCount:: db ; unreferenced
 wSafariMonEating:: db
 	ds 1
 wEnemyBackupDVs:: dw ; used when enemy is transformed
@@ -703,7 +639,7 @@
 
 wGivingExperienceToExpShareHolders:: db
 
-wBackupEnemyMonBaseStats:: ds 5
+wBackupEnemyMonBaseStats:: ds NUM_EXP_STATS
 wBackupEnemyMonCatchRate:: db
 wBackupEnemyMonBaseExp:: db
 
@@ -859,7 +795,6 @@
 wTrademons::
 wPlayerTrademon:: trademon wPlayerTrademon
 wOTTrademon::     trademon wOTTrademon
-wTrademonsEnd::
 wTradeAnimAddress:: dw
 wLinkPlayer1Name:: ds NAME_LENGTH
 wLinkPlayer2Name:: ds NAME_LENGTH
@@ -902,18 +837,15 @@
 
 NEXTU
 ; card flip
-wCardFlip::
-wDeck:: ds 24
+wDeck:: ds 4 * 6
 wDeckEnd::
 wCardFlipNumCardsPlayed:: db
 wCardFlipFaceUpCard:: db
-wDiscardPile:: ds 24
+wDiscardPile:: ds 4 * 6
 wDiscardPileEnd::
-wCardFlipEnd::
 
 NEXTU
 ; dummy game
-wDummyGame::
 wDummyGameCards:: ds 9 * 5
 wDummyGameCardsEnd::
 wDummyGameLastCardPicked:: db
@@ -925,7 +857,6 @@
 wDummyGameLastMatches:: ds 5
 wDummyGameCounter:: db
 wDummyGameNumCardsMatched:: db
-wDummyGameEnd::
 
 NEXTU
 ; mobile data
@@ -950,8 +881,7 @@
 wc7d0:: ds 1
 wc7d1:: ds 1
 wc7d2:: ds 1
-wc7d3:: ds 1
-wc7d4:: ds 1
+wc7d3:: ds 2
 ENDU
 
 ENDU
@@ -970,16 +900,11 @@
 wOverworldMapBlocksEnd::
 
 NEXTU
-; GB Printer screen RAM
-wGameboyPrinterRAM::
-wGameboyPrinterScreen:: ds SCREEN_HEIGHT * SCREEN_WIDTH
-wGameboyPrinterScreenEnd::
-
-NEXTU
 ; GB Printer data
+wGameboyPrinterRAM::
 wGameboyPrinter2bppSource:: ds 40 tiles
 wGameboyPrinter2bppSourceEnd::
-wca80:: db
+wUnusedGameboyPrinterSafeCancelFlag:: db
 wPrinterRowIndex:: db
 
 ; Printer data
@@ -1000,7 +925,6 @@
 
 ; tilemap backup?
 wPrinterTilemapBuffer:: ds SCREEN_HEIGHT * SCREEN_WIDTH
-wPrinterTilemapBufferEnd::
 wPrinterStatus:: db
 	ds 1
 ; High nibble is for margin before the image, low nibble is for after.
@@ -1060,7 +984,6 @@
 wTimeCapsulePartyMon6:: red_party_struct wTimeCapsulePartyMon6
 wTimeCapsulePartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH
 wTimeCapsulePartyMonNicks:: ds PARTY_LENGTH * MON_NAME_LENGTH
-wTimeCapsulePlayerDataEnd::
 
 NEXTU
 ; link player data
@@ -1073,58 +996,28 @@
 wLinkPlayerPartyMon6:: party_struct wLinkPlayerPartyMon6
 wLinkPlayerPartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH
 wLinkPlayerPartyMonNicks:: ds PARTY_LENGTH * MON_NAME_LENGTH
-wLinkPlayerDataEnd::
 ENDU
 
 NEXTU
 ; mystery gift data
+wMysteryGiftStaging:: ds 80
+
 UNION
-wMysteryGiftPartyTemp:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH
+wMysteryGiftTrainer:: ds 1 + (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 1
+wMysteryGiftTrainerEnd::
 
 NEXTU
-wMysteryGiftStaging:: ds 80
+wNameCardData:: ds NAME_LENGTH + 2 + 2 + 1 + 8 + 12
+wNameCardDataEnd::
 
 NEXTU
-wc800:: ds 1
-wc801:: ds 1
-wc802:: ds 1
-wc803:: ds 4
-wc807:: ds 7
-wc80e:: ds 1
-wc80f:: ds 1
-wc810:: ds 1
-wc811:: ds 1
-wMobileSDK_PacketChecksum:: dw
-wc814:: ds 4
-wMobileSDK_AdapterType:: db
-	ds 5
-wMobileSDK_SendCommandID:: db
-	ds 1
-wc820:: ds 1
-wc821:: ds 1
-wc822:: ds 46
+wMysteryGiftCardHolderName:: ds PLAYER_NAME_LENGTH
 ENDU
 
-UNION
-wMysteryGiftTrainerData:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 2
-wMysteryGiftTrainerDataEnd::
+	ds 138
 
-NEXTU
-wc850:: ds 16
-wc860:: ds 16
-wc870:: ds 16
-wc880:: ds 16
-wc890:: ds 16
-wc8a0:: ds 16
-wc8b0:: ds 16
-wc8c0:: ds 16
-wc8d0:: ds 16
-wc8e0:: ds 16
-wc8f0:: ds 16
-ENDU
-
 wMysteryGiftPartnerData::
-wc900:: db
+wMysteryGiftGameVersion:: db
 wMysteryGiftPartnerID:: dw
 wMysteryGiftPartnerName:: ds NAME_LENGTH
 wMysteryGiftPartnerDexCaught:: db
@@ -1162,9 +1055,9 @@
 
 NEXTU
 ; mystery gift data
-wca00:: db
-wca01:: db
-wca02:: db
+wUnusedMysteryGiftStagedDataLength:: db
+wMysteryGiftMessageCount:: db
+wMysteryGiftStagedDataLength:: db
 
 NEXTU
 ; link data
@@ -1181,12 +1074,8 @@
 
 	ds 14
 wcb0e:: ds 5
-wcb13:: ds 50
-wcb45:: ds 2
-wMobileSDK_PacketBuffer:: ds 18
-wcb59:: ds 20
-wcb6d:: ds 1
-wcb6e:: ds 22
+wcb13:: ds 52
+wMobileSDK_PacketBuffer:: ds 61
 wcb84:: ds 100
 wcbe8:: dw
 wLinkOTPartyMonTypes:: ds 2 * PARTY_LENGTH
@@ -1205,6 +1094,20 @@
 wccb9:: ds 1
 wccba:: ds 102
 
+NEXTU
+; mobile
+	ds 7
+wc807:: ds 1
+	ds 10
+wMobileSDK_PacketChecksum:: dw
+	ds 4
+wMobileSDK_AdapterType:: db
+	ds 5
+wMobileSDK_SendCommandID:: db
+	ds 2
+wc821:: ds 1
+wc822:: ds 46
+
 if DEF(_DEBUG)
 NEXTU
 ; debug room
@@ -1442,7 +1345,7 @@
 wcf57:: db
 	ds 3
 wLinkTimeoutFrames:: dw
-wcf5d:: dw
+wLinkByteTimeout:: dw
 
 wMonType:: db
 
@@ -1457,12 +1360,6 @@
 	db
 
 UNION
-; unidentified
-wcf64:: db
-wcf65:: db
-wcf66:: db
-
-NEXTU
 ; intro data
 wIntroSceneFrameCounter:: db
 wIntroSceneTimer:: db
@@ -1487,11 +1384,13 @@
 wPrevDexEntryBackup::
 wPokedexStatus:: db
 endc
+wUnusedPokedexByte:: db
 
 NEXTU
 ; pokegear
 wPokegearCard:: db
 wPokegearMapRegion:: db
+wUnusedPokegearByte:: db
 
 NEXTU
 ; pack
@@ -1506,12 +1405,22 @@
 wTrainerCardBadgeAttributes:: db
 
 NEXTU
-; card flip data
+; slot machine
+wSlotsDelay:: db
+	ds 1
+wUnusedSlotReelIconDelay:: db
+
+NEXTU
+; card flip
 wCardFlipCursorY:: db
 wCardFlipCursorX:: db
 wCardFlipWhichCard:: db
 
 NEXTU
+; dummy game
+wDummyGameCardChoice:: db
+
+NEXTU
 ; magnet train
 wMagnetTrainOffset:: db
 wMagnetTrainPosition:: db
@@ -1524,6 +1433,16 @@
 wUnownPuzzleHeldPiece:: db
 
 NEXTU
+; battle transitions
+wBattleTransitionCounter:: db
+wBattleTransitionSineWaveOffset::
+wBattleTransitionSpinQuadrant:: db
+
+NEXTU
+; bill's pc
+wUnusedBillsPCData:: ds 3
+
+NEXTU
 ; debug mon color picker
 wDebugColorRGBJumptableIndex:: db
 wDebugColorCurColor:: db
@@ -1536,29 +1455,40 @@
 wDebugTilesetCurColor:: db
 
 NEXTU
+; stats screen
+wStatsScreenFlags:: db
+
+NEXTU
 ; battle tower
-	ds $2
+wNrOfBeatenBattleTowerTrainers:: db
+	ds 1
 wBattleTowerRoomMenuJumptableIndex:: db
 
 NEXTU
 ; miscellaneous
 wFrameCounter::
-wNrOfBeatenBattleTowerTrainers::
 wMomBankDigitCursorPosition::
 wNamingScreenLetterCase::
 wHallOfFameMonCounter::
-wSlotsDelay::
+wTradeDialog::
 	db
+wFrameCounter2::
 wPrinterQueueLength::
+wUnusedSGB1eColorOffset::
 	db
+wUnusedTradeAnimPlayEvolutionMusic:: db
+
+NEXTU
+; mobile
+wcf64:: db
+wcf65:: db
+wcf66:: db
 ENDU
 
-wRequested2bpp::
 wRequested2bppSize:: db
 wRequested2bppSource:: dw
 wRequested2bppDest:: dw
 
-wRequested1bpp::
 wRequested1bppSize:: db
 wRequested1bppSource:: dw
 wRequested1bppDest:: dw
@@ -1654,9 +1584,9 @@
 wPredefAddress:: dw
 wFarCallBCBuffer:: dw
 
-wcfbb:: db
+wUnusedLinkCommunicationByte:: db
 
-wGameTimerPause::
+wGameTimerPaused::
 ; bit 0: game timer paused
 ; bit 7: something mobile
 	db
@@ -1663,11 +1593,11 @@
 
 	ds 1
 
-wcfbe::
+wJoypadDisable::
 ; bits 4, 6, or 7 can be used to disable joypad input
 ; bit 4
-; bit 6: mon fainted?
-; bit 7: SGB flag?
+; bit 6: ongoing mon faint animation
+; bit 7: ongoing sgb data transfer
 	db
 
 	ds 1
@@ -1738,13 +1668,19 @@
 
 wGBCOnlyDecompressBuffer:: ; a $540-byte buffer that continues past this SECTION
 
-wd000:: db
+wBetaTitleSequenceOpeningType::
+; This selected the title screen animation (fire/notes) in pokegold-spaceworld.
+	db
 
 wDefaultSpawnpoint:: db
 
 UNION
-; mail temp storage
-wTempMail:: mailmsg wTempMail
+; mon buffer
+wBufferMonNick:: ds MON_NAME_LENGTH
+wBufferMonOT:: ds NAME_LENGTH
+wBufferMon:: party_struct wBufferMon
+	ds 8
+wMonOrItemNameBuffer:: ds 22
 
 NEXTU
 ; poke seer
@@ -1760,12 +1696,8 @@
 wSeerCaughtGender:: db
 
 NEXTU
-; mon buffer
-wBufferMonNick:: ds MON_NAME_LENGTH
-wBufferMonOT:: ds NAME_LENGTH
-wBufferMon:: party_struct wBufferMon
-	ds 8
-wMonOrItemNameBuffer::
+; mail temp storage
+wTempMail:: mailmsg wTempMail
 
 NEXTU
 ; bug-catching contest
@@ -1799,6 +1731,8 @@
 wTownMapCursorObjectPointer:: dw
 NEXTU
 wTownMapCursorCoordinates:: dw
+wStartFlypoint:: db
+wEndFlypoint:: db
 ENDU
 
 NEXTU
@@ -1815,7 +1749,6 @@
 wOaksPKMNTalkSegmentCounter:: db
 	ds 5
 wRadioText:: ds 2 * SCREEN_WIDTH
-wRadioTextEnd::
 
 NEXTU
 ; lucky number show
@@ -1838,6 +1771,11 @@
 wWhichBoxToPrint:: db
 
 NEXTU
+; Unown printing
+wPrintedUnownTileSource:: ds 1 tiles
+wPrintedUnownTileDest:: ds 1 tiles
+
+NEXTU
 ; trainer HUD data
 	ds 1
 wPlaceBallsDirection:: db
@@ -1851,6 +1789,10 @@
 wMobileParticipant3Nickname:: ds NAME_LENGTH_JAPANESE
 
 NEXTU
+; battle exp gain
+wExperienceGained:: ds 3
+
+NEXTU
 ; earthquake data buffer
 wEarthquakeMovementDataBuffer:: ds 5
 
@@ -1859,15 +1801,64 @@
 wSwitchItemBuffer:: ds 2 ; may store 1 or 2 bytes
 
 NEXTU
+; switching pokemon in party
+; may store NAME_LENGTH, PARTYMON_STRUCT_LENGTH, or MAIL_STRUCT_LENGTH bytes
+wSwitchMonBuffer:: ds 48
+
+NEXTU
+; giving pokemon mail
+wMonMailMessageBuffer:: ds MAIL_MSG_LENGTH + 1
+
+NEXTU
+; bill's pc
+UNION
+wBoxNameBuffer:: ds BOX_NAME_LENGTH
+NEXTU
+	ds 1
+wBillsPCTempListIndex:: db
+wBillsPCTempBoxCount:: db
+ENDU
+
+NEXTU
+; prof. oak's pc
+wTempPokedexSeenCount:: db
+wTempPokedexCaughtCount:: db
+
+NEXTU
+; player's room pc
+UNION
+wDecoNameBuffer:: ds ITEM_NAME_LENGTH
+NEXTU
+wNumOwnedDecoCategories:: db
+wOwnedDecoCategories:: ds 16
+ENDU
+
+NEXTU
+; trade
+wCurTradePartyMon:: db
+wCurOTTradePartyMon:: db
+wBufferTrademonNick:: ds MON_NAME_LENGTH
+
+NEXTU
+; link battle record data
+wLinkBattleRecordBuffer::
+wLinkBattleRecordName::   ds NAME_LENGTH
+wLinkBattleRecordWins::   dw
+wLinkBattleRecordLosses:: dw
+wLinkBattleRecordDraws::  dw
+
+NEXTU
 ; miscellaneous
 wTempDayOfWeek::
+wPrevPartyLevel::
+wCurBeatUpPartyMon::
+wUnownPuzzleCornerTile::
+wKeepSevenBiasChance::
+wPokeFluteCuredSleep::
+wTempRestorePPItem::
 wApricorns::
-wKeepSevenBiasChance:: ; used in the slots to handle the favoring of 7 symbol streaks
 wSuicuneFrame::
 	db
-	ds 2
-wStartFlypoint:: db
-wEndFlypoint:: db
 
 NEXTU
 ; debug color picker
@@ -1876,21 +1867,11 @@
 wDebugColorCurTMHM:: db
 
 NEXTU
-; link battle record data
-wLinkBattleRecordName::   ds NAME_LENGTH
-wLinkBattleRecordWins::   dw
-wLinkBattleRecordLosses:: dw
-wLinkBattleRecordDraws::  dw
-
-NEXTU
-; unidentified
-wd002:: db
-wd003:: db
-wd004:: db
-
 ; mobile?
-	ds 1
-	ds 2
+wd002:: ds 1
+wd003:: ds 1
+wd004:: ds 1
+	ds 3
 wd008:: ds 2
 	ds 6
 wd010:: ds 1
@@ -1912,8 +1893,12 @@
 wd033:: ds 1
 wd034:: ds 2
 wd036:: ds 2
-	ds 6
 
+NEXTU
+; Every previous NEXTU takes up 60 or fewer bytes,
+; except the initial "mon buffer" UNION.
+	ds 60
+
 UNION
 ; trainer data
 wSeenTrainerBank:: db
@@ -2060,7 +2045,7 @@
 wTMHMPocketCursor::     db
 
 wPCItemsScrollPosition::        db
-wPartyMenuScrollPosition::      db ; unused
+	ds 1
 wItemsPocketScrollPosition::    db
 wKeyItemsPocketScrollPosition:: db
 wBallsPocketScrollPosition::    db
@@ -2118,11 +2103,11 @@
 wCurMessageIndex:: db
 wMailboxCount:: db
 wMailboxItems:: ds MAILBOX_CAPACITY
-wMailboxEnd::
 ENDU
 
 wListPointer:: dw
-wUnusedD102:: dw
+wUnusedNamesPointer:: dw
+
 wItemAttributesPtr:: dw
 
 wCurItem:: db
@@ -2303,7 +2288,7 @@
 wTempBattleMonSpecies:: db
 
 wEnemyMon:: battle_struct wEnemyMon
-wEnemyMonBaseStats:: ds 5
+wEnemyMonBaseStats:: ds NUM_EXP_STATS
 wEnemyMonCatchRate:: db
 wEnemyMonBaseExp::   db
 wEnemyMonEnd::
@@ -2443,25 +2428,21 @@
 wOTPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH
 wOTPartyMonNicknames:: ds MON_NAME_LENGTH * PARTY_LENGTH
 wOTPartyDataEnd::
-	ds 4
 
 NEXTU
 ; catch tutorial dude pack
-wDudeBag::
 wDudeNumItems:: db
-wDudeItems:: ds 2 * 4
-wDudeItemsEnd:: db
+wDudeItems:: ds 2 * 4 + 1
 
 wDudeNumKeyItems:: db
-wDudeKeyItems:: ds 18
-wDudeKeyItemsEnd:: db
+wDudeKeyItems:: ds 18 + 1
 
 wDudeNumBalls:: db
-wDudeBalls:: ds 2 * 4
-wDudeBallsEnd:: db
-wDudeBagEnd::
+wDudeBalls:: ds 2 * 4 + 1
 ENDU
 
+	ds 4
+
 wd430:: ; mobile
 wBattleAction:: db
 
@@ -2472,9 +2453,8 @@
 wScriptFlags::
 ; bit 3: priority jump
 	db
+	ds 1
 wScriptFlags2::
-	db
-wScriptFlags3::
 ; bit 0: count steps
 ; bit 1: coord events
 ; bit 2: warps and connections
@@ -2565,8 +2545,8 @@
 wSpawnAfterChampion:: db
 
 ; init time set at newgame
-wStartDay:: db
-wStartHour:: db
+wStartDay::    db
+wStartHour::   db
 wStartMinute:: db
 wStartSecond:: db
 
@@ -2611,7 +2591,6 @@
 wObject10Struct:: object_struct wObject10
 wObject11Struct:: object_struct wObject11
 wObject12Struct:: object_struct wObject12
-wObjectStructsEnd::
 
 wCmdQueue:: ds CMDQUEUE_CAPACITY * CMDQUEUE_ENTRY_SIZE
 
@@ -2634,7 +2613,6 @@
 wMap13Object::  map_object wMap13
 wMap14Object::  map_object wMap14
 wMap15Object::  map_object wMap15
-wMapObjectsEnd::
 
 wObjectMasks:: ds NUM_OBJECTS
 
@@ -2690,23 +2668,18 @@
 wKantoBadges:: flag_array NUM_KANTO_BADGES
 
 wTMsHMs:: ds NUM_TMS + NUM_HMS
-wTMsHMsEnd::
 
 wNumItems:: db
 wItems:: ds MAX_ITEMS * 2 + 1
-wItemsEnd::
 
 wNumKeyItems:: db
 wKeyItems:: ds MAX_KEY_ITEMS + 1
-wKeyItemsEnd::
 
 wNumBalls:: db
 wBalls:: ds MAX_BALLS * 2 + 1
-wBallsEnd::
 
 wNumPCItems:: db
 wPCItems:: ds MAX_PC_ITEMS * 2 + 1
-wPCItemsEnd::
 
 wPokegearFlags::
 ; bit 0: map
@@ -2818,7 +2791,7 @@
 
 ; fight counts
 wJackFightCount::    db
-wBeverlyFightCount:: db ; unused
+wBeverlyFightCount:: db ; unreferenced
 wHueyFightCount::    db
 wGavenFightCount::   db
 wBethFightCount::    db
@@ -2831,18 +2804,18 @@
 wAnthonyFightCount:: db
 wToddFightCount::    db
 wGinaFightCount::    db
-wIrwinFightCount::   db ; unused
+wIrwinFightCount::   db ; unreferenced
 wArnieFightCount::   db
 wAlanFightCount::    db
 wDanaFightCount::    db
 wChadFightCount::    db
-wDerekFightCount::   db ; unused
+wDerekFightCount::   db ; unreferenced
 wTullyFightCount::   db
 wBrentFightCount::   db
 wTiffanyFightCount:: db
 wVanceFightCount::   db
 wWiltonFightCount::  db
-wKenjiFightCount::   db ; unused
+wKenjiFightCount::   db ; unreferenced
 wParryFightCount::   db
 wErinFightCount::    db
 
@@ -3034,10 +3007,9 @@
 ; bit 0: monster 1 in day-care
 	db
 
-wBreedMon1::
-wBreedMon1Nick::  ds MON_NAME_LENGTH
-wBreedMon1OT::    ds NAME_LENGTH
-wBreedMon1Stats:: box_struct wBreedMon1
+wBreedMon1Nick:: ds MON_NAME_LENGTH
+wBreedMon1OT::   ds NAME_LENGTH
+wBreedMon1::     box_struct wBreedMon1
 
 wDayCareLady::
 ; bit 7: active
@@ -3051,10 +3023,9 @@
 ; nz: no
 	db
 
-wBreedMon2::
-wBreedMon2Nick::  ds MON_NAME_LENGTH
-wBreedMon2OT::    ds NAME_LENGTH
-wBreedMon2Stats:: box_struct wBreedMon2
+wBreedMon2Nick:: ds MON_NAME_LENGTH
+wBreedMon2OT::   ds NAME_LENGTH
+wBreedMon2::     box_struct wBreedMon2
 
 wEggNick:: ds MON_NAME_LENGTH
 wEggOT::   ds NAME_LENGTH
@@ -3237,7 +3208,6 @@
 wAnimObject08:: battle_anim_struct wAnimObject08
 wAnimObject09:: battle_anim_struct wAnimObject09
 wAnimObject10:: battle_anim_struct wAnimObject10
-wActiveAnimObjectsEnd::
 
 wActiveBGEffects::
 wBGEffect1:: battle_bg_effect wBGEffect1
@@ -3245,7 +3215,6 @@
 wBGEffect3:: battle_bg_effect wBGEffect3
 wBGEffect4:: battle_bg_effect wBGEffect4
 wBGEffect5:: battle_bg_effect wBGEffect5
-wActiveBGEffectsEnd::
 
 wLastAnimObjectIndex:: db