shithub: pokered

Download patch

ref: 3e554e1d5206f0ede60f7e99e68637b7f13bc683
parent: 0177688ad4d923c4970009fa87df48605bb43ed6
parent: 69788c536b70060c58136b07fb3a615b285de99c
author: Rangi <35663410+Rangi42@users.noreply.github.com>
date: Mon Jul 20 09:22:32 EDT 2020

Merge pull request #281 from Rangi42/master

Add comments associating constants with data, and identify some more data

--- a/constants/battle_constants.asm
+++ b/constants/battle_constants.asm
@@ -8,7 +8,7 @@
 ; D733 flags
 BIT_TEST_BATTLE EQU 0
 
-; battle type constants
+; battle type constants (wBattleType values)
 	const_def
 	const BATTLE_TYPE_NORMAL  ; 0
 	const BATTLE_TYPE_OLD_MAN ; 1
@@ -43,7 +43,7 @@
 ATKDEFDV_TRAINER EQU $98
 SPDSPCDV_TRAINER EQU $88
 
-; volatile statuses 1
+; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags
 	const_def
 	const STORING_ENERGY           ; 0 ; Bide
 	const THRASHING_ABOUT          ; 1 ; e.g. Thrash
@@ -54,7 +54,7 @@
 	const INVULNERABLE             ; 6 ; charging up Fly/Dig
 	const CONFUSED                 ; 7
 
-; volatile statuses 2
+; wPlayerBattleStatus2 or wEnemyBattleStatus2 bit flags
 	const_def
 	const USING_X_ACCURACY    ; 0
 	const PROTECTED_BY_MIST   ; 1
@@ -65,7 +65,7 @@
 	const USING_RAGE          ; 6
 	const SEEDED              ; 7
 
-; volatile statuses 3
+; wPlayerBattleStatus3 or wEnemyBattleStatus3 bit flags
 	const_def
 	const BADLY_POISONED      ; 0
 	const HAS_LIGHT_SCREEN_UP ; 1
--- a/constants/credits_constants.asm
+++ b/constants/credits_constants.asm
@@ -1,3 +1,4 @@
+; CreditsTextPointers indexes (see data/credits/credits_text.asm)
 	const_def
 	const CRED_VERSION        ; $00
 	const CRED_TAJIRI         ; $01
--- a/constants/event_constants.asm
+++ b/constants/event_constants.asm
@@ -1,3 +1,5 @@
+; wEventFlags bit flags
+
 ; Pallet Town events
 	const_def
 	const EVENT_FOLLOWED_OAK_INTO_LAB
--- a/constants/gfx_constants.asm
+++ b/constants/gfx_constants.asm
@@ -31,6 +31,7 @@
 REDRAW_ROW EQU 2
 
 ; tile list ids
+; TileIDListPointerTable indexes (see data/tilemaps.asm)
 	const_def
 	const TILEMAP_MON_PIC
 	const TILEMAP_SLIDE_DOWN_MON_PIC_7X5
--- a/constants/hide_show_constants.asm
+++ b/constants/hide_show_constants.asm
@@ -1,6 +1,7 @@
 HIDE EQU $11
 SHOW EQU $15
 
+; MissableObjects indexes (see data/maps/hide_show_data.asm)
 ; this is a list of the sprites that can be enabled/disabled during the game
 ; sprites marked with an X are constants that are never used
 ; because those sprites are not (de)activated in a map's script
--- a/constants/icon_constants.asm
+++ b/constants/icon_constants.asm
@@ -1,4 +1,5 @@
 ; party menu icons
+; used in MonPartySpritePointers (see data/icon_pointers.asm)
 	const_def
 	const ICON_MON       ; $0
 	const ICON_BALL      ; $1
@@ -10,3 +11,7 @@
 	const ICON_GRASS     ; $7
 	const ICON_SNAKE     ; $8
 	const ICON_QUADRUPED ; $9
+
+ICON_TRADEBUBBLE EQU $e
+
+ICONOFFSET EQU $40 ; difference between alternating icon frames' tile IDs
--- a/constants/input_constants.asm
+++ b/constants/input_constants.asm
@@ -1,3 +1,4 @@
+; joypad buttons
 	const_def
 	const BIT_A_BUTTON
 	const BIT_B_BUTTON
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -1,3 +1,10 @@
+; item ids
+; indexes for:
+; - ItemNames (see data/items/names.asm)
+; - ItemPrices (see data/items/prices.asm)
+; - TechnicalMachinePrices (see data/items/tm_prices.asm)
+; - KeyItemBitfield (see data/items/key_items.asm)
+; - ItemUsePtrTable (see engine/items/item_effects.asm)
 	const_def
 	const NO_ITEM       ; $00
 	const MASTER_BALL   ; $01
--- a/constants/list_constants.asm
+++ b/constants/list_constants.asm
@@ -6,6 +6,7 @@
 	const ITEMLISTMENU       ; $03 ; Start menu Item menu / Pokemart sell menu
 	const SPECIALLISTMENU    ; $04 ; list of special "items" e.g. floor list in elevators / list of badges
 
+; NamePointers indexes (see home/names2.asm)
 	const_def 1
 	const MONSTER_NAME  ; 1
 	const MOVE_NAME     ; 2
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -4,6 +4,15 @@
 \1_WIDTH EQU \3
 ENDM
 
+; map ids
+; indexes for:
+; - MapHeaderBanks (see data/maps/map_header_banks.asm)
+; - MapHeaderPointers (see data/maps/map_header_pointers.asm)
+; - MapSongBanks (see data/maps/songs.asm)
+; - MapHSPointers (see data/maps/hide_show_data.asm)
+; - MapSpriteSets (see data/maps/sprite_sets.asm)
+; - ExternalMapEntries (see data/maps/town_map_entries.asm)
+; Each map also has associated data in maps.asm.
 	const_def
 	mapconst PALLET_TOWN,                    9, 10 ; $00
 	mapconst VIRIDIAN_CITY,                 18, 20 ; $01
--- a/constants/menu_constants.asm
+++ b/constants/menu_constants.asm
@@ -5,11 +5,11 @@
 	const_def 1
 	const MESSAGE_BOX                       ; $01
 	const_skip                              ; $02
-	const_skip                              ; $03
+	const MENU_TEMPLATE_03                  ; $03 unused
 	const FIELD_MOVE_MON_MENU               ; $04
 	const JP_MOCHIMONO_MENU_TEMPLATE        ; $05
 	const USE_TOSS_MENU_TEMPLATE            ; $06
-	const_skip                              ; $07
+	const MENU_TEMPLATE_07                  ; $07 unused
 	const JP_SAVE_MESSAGE_MENU_TEMPLATE     ; $08
 	const JP_SPEED_OPTIONS_MENU_TEMPLATE    ; $09
 	const_skip                              ; $0a
@@ -18,7 +18,7 @@
 	const LIST_MENU_BOX                     ; $0d
 	const BUY_SELL_QUIT_MENU_TEMPLATE       ; $0e
 	const MONEY_BOX_TEMPLATE                ; $0f
-	const_skip                              ; $10
+	const MENU_TEMPLATE_10                  ; $10 unused
 	const MON_SPRITE_POPUP                  ; $11
 	const JP_AH_MENU_TEMPLATE               ; $12
 	const MONEY_BOX                         ; $13
@@ -32,6 +32,7 @@
 	const SAFARI_BATTLE_MENU_TEMPLATE       ; $1b
 
 ; two option menu constants
+; TwoOptionMenuStrings indexes (see data/yes_no_menu_strings.asm)
 	const_def
 	const YES_NO_MENU       ; 0
 	const NORTH_WEST_MENU   ; 1
@@ -58,7 +59,7 @@
 	const PARTY_TO_DAYCARE ; 3
 
 ; party menu types
-; PartyMenuMessagePointers indexes
+; PartyMenuMessagePointers indexes (see engine/menus/party_menu.asm)
 	const_def
 	const NORMAL_PARTY_MENU    ; $00
 	const USE_ITEM_PARTY_MENU  ; $01
@@ -67,7 +68,7 @@
 	const SWAP_MONS_PARTY_MENU ; $04
 	const EVO_STONE_PARTY_MENU ; $05
 ; party menu message IDs
-; PartyMenuItemUseMessagePointers indexes
+; PartyMenuItemUseMessagePointers indexes (see engine/menus/party_menu.asm)
 	const_next $F0
 FIRST_PARTY_MENU_TEXT_ID EQU const_value
 	const ANTIDOTE_MSG         ; $F0
--- a/constants/move_animation_constants.asm
+++ b/constants/move_animation_constants.asm
@@ -1,4 +1,5 @@
 ; special effects that are part of move animations
+; SpecialEffectPointers associates them with effect routines (see data/battle_anims/special_effect_pointers.asm)
 	const_def $C0
 FIRST_SE_ID EQU const_value
 	const_skip $18
@@ -43,6 +44,7 @@
 	const SE_DARK_SCREEN_FLASH         ; $FE used in Cut/Take Down/etc.
 
 ; subanimations that are part of move animations
+; SubanimationPointers indexes (see data/battle_anims/subanimations.asm)
 	const_def
 	const SUBANIM_00
 	const SUBANIM_01
@@ -141,6 +143,7 @@
 	const SUBANIMTYPE_ENEMY
 
 ; frame blocks that are part of subanimations
+; FrameBlockPointers indexes (see data/battle_anims/frame_blocks.asm)
 	const_def
 	const FRAMEBLOCK_00
 	const FRAMEBLOCK_01
@@ -266,6 +269,7 @@
 	const FRAMEBLOCK_79
 
 ; base coordinates that are part of subanimations
+; FrameBlockBaseCoords indexes (see data/battle_anims/base_coords.asm)
 	const_def
 	const BASECOORD_00
 	const BASECOORD_01
--- a/constants/move_constants.asm
+++ b/constants/move_constants.asm
@@ -1,3 +1,9 @@
+; move ids
+; indexes for:
+; - Moves (see data/moves/moves.asm)
+; - MoveNames (see data/moves/names.asm)
+; - AttackAnimationPointers (see data/moves/animations.asm)
+; - MoveSoundTable (see data/moves/sfx.asm)
 	const_def
 	const NO_MOVE      ; 00
 	const POUND        ; 01
--- a/constants/move_effect_constants.asm
+++ b/constants/move_effect_constants.asm
@@ -1,8 +1,8 @@
-; tentative move effect constants
 ; {stat}_(UP|DOWN)(1|2) means that the move raises the user's (or lowers the target's) corresponding stat modifier by 1 (or 2) stages
-; {status condition}_side_effect means that the move has a side chance of causing that condition
-; {status condition}_effect means that the move causes the status condition every time it hits the target
+; {status condition}_SIDE_EFFECT means that the move has a side chance of causing that condition
+; {status condition}_EFFECT means that the move causes the status condition every time it hits the target
 
+; MoveEffectPointerTable indexes (see data/moves/effects_pointers.asm)
 	const_def
 	const NO_ADDITIONAL_EFFECT       ; $00
 	const EFFECT_01                  ; $01 unused
--- a/constants/music_constants.asm
+++ b/constants/music_constants.asm
@@ -1,4 +1,5 @@
 ; Song ids are calculated by address to save space.
+; SFX_Headers_(1|2|3) indexes (see audio/headers/*.asm)
 
 music_const: MACRO
 \1 EQUS "((\2 - SFX_Headers_1) / 3)"
--- a/constants/palette_constants.asm
+++ b/constants/palette_constants.asm
@@ -6,6 +6,7 @@
 	const BLACK
 
 ; pal/blk packets
+; SetPalFunctions indexes (see engine/gfx/palettes.asm)
 	const_def
 	const SET_PAL_BATTLE_BLACK         ; $00
 	const SET_PAL_BATTLE               ; $01
@@ -26,6 +27,7 @@
 SET_PAL_DEFAULT EQU $ff
 
 ; sgb palettes
+; SuperPalettes indexes (see data/sgb/sgb_palettes.asm)
 	const_def
 	const PAL_ROUTE     ; $00
 	const PAL_PALLET    ; $01
--- a/constants/pokedex_constants.asm
+++ b/constants/pokedex_constants.asm
@@ -1,3 +1,8 @@
+; pokedex ids
+; indexes for:
+; - BaseStats (see data/pokemon/base_stats.asm)
+; - MonPartyData (see data/pokemon/menu_icons.asm)
+; - MonsterPalettes (see data/pokemon/palettes.asm)
 	const_def 1
 	const DEX_BULBASAUR  ; 1
 	const DEX_IVYSAUR    ; 2
--- a/constants/pokemon_constants.asm
+++ b/constants/pokemon_constants.asm
@@ -1,3 +1,10 @@
+; pokemon ids
+; indexes for:
+; - MonsterNames (see data/pokemon/names.asm)
+; - EvosMovesPointerTable (see data/pokemon/evos_moves.asm)
+; - CryData (see data/pokemon/cries.asm)
+; - PokedexOrder (see data/pokemon/dex_order.asm)
+; - PokedexEntryPointers (see data/pokemon/dex_entries.asm)
 	const_def
 	const NO_MON       ; $00
 	const RHYDON       ; $01
--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -1,4 +1,4 @@
-; emotion bubbles
+; EmotionBubblesPointerTable indexes (see engine/overworld/emotion_bubbles.asm)
 	const_def
 	const EXCLAMATION_BUBBLE ; 0
 	const QUESTION_BUBBLE    ; 1
@@ -13,6 +13,7 @@
 SLOTSMOUSE  EQU $1614
 
 ; in game trades
+; TradeMons indexes (see data/events/trades.asm)
 	const_def
 	const TRADE_FOR_TERRY
 	const TRADE_FOR_MARCEL
@@ -26,6 +27,7 @@
 	const TRADE_FOR_SPOT
 
 ; in game trade dialog sets
+; InGameTradeTextPointers indexes (see engine/events/in_game_trades.asm)
 	const_def
 	const TRADE_DIALOGSET_CASUAL
 	const TRADE_DIALOGSET_POLITE
--- a/constants/sprite_constants.asm
+++ b/constants/sprite_constants.asm
@@ -1,4 +1,5 @@
 ; overworld sprites
+; SpriteSheetPointerTable indexes (see data/sprites/sprites.asm)
 	const_def
 	const SPRITE_NONE                    ; $00
 	const SPRITE_RED                     ; $01
--- a/constants/tileset_constants.asm
+++ b/constants/tileset_constants.asm
@@ -1,3 +1,5 @@
+; tileset ids
+; Tilesets indexes (see data/tilesets/tileset_headers.asm)
 	const_def
 	const OVERWORLD    ; 0
 	const REDS_HOUSE_1 ; 1
--- a/constants/trainer_constants.asm
+++ b/constants/trainer_constants.asm
@@ -5,6 +5,14 @@
 OPP_\1 EQU OPP_ID_OFFSET + \1
 ENDM
 
+; trainer class ids
+; indexes for:
+; - TrainerNames (see data/trainers/names.asm)
+; - TrainerNamePointers (see data/trainers/name_pointers.asm)
+; - TrainerDataPointers (see data/trainers/parties.asm)
+; - TrainerPicAndMoneyPointers (see data/trainers/pic_pointers_money.asm)
+; - TrainerAIPointers (see data/trainers/ai_pointers.asm)
+; - TrainerClassMoveChoiceModifications (see data/trainers/move_choices.asm)
 	const_def
 	trainer_const NOBODY         ; $00
 	trainer_const YOUNGSTER      ; $01
--- a/constants/type_constants.asm
+++ b/constants/type_constants.asm
@@ -1,3 +1,4 @@
+; TypeNames indexes (see data/types/names.asm)
 	const_def
 
 PHYSICAL EQU const_value
--- a/data/credits/credits_text.asm
+++ b/data/credits/credits_text.asm
@@ -1,4 +1,5 @@
 CreditsTextPointers:
+; entries correspond to CRED_* constants
 	dw CredVersion
 	dw CredTajiri
 	dw CredTaOota
--- a/data/events/trades.asm
+++ b/data/events/trades.asm
@@ -1,4 +1,5 @@
 TradeMons:
+; entries correspond to TRADE_FOR_* constants
 	; give mon, get mon, dialog id, nickname
 	db NIDORINO,   NIDORINA,  TRADE_DIALOGSET_CASUAL, "TERRY@@@@@@"
 	db ABRA,       MR_MIME,   TRADE_DIALOGSET_CASUAL, "MARCEL@@@@@"
--- a/data/icon_pointers.asm
+++ b/data/icon_pointers.asm
@@ -2,36 +2,36 @@
 	dw \1 tile \2
 	db \3
 	db BANK(\1)
-	dw vSprites tile \4
+	dw vSprites tile (\4)
 ENDM
 
 MonPartySpritePointers:
 	; gfx pointer, gfx tile offset, # tiles, vSprites tile offset
-	mon_icon_header MonsterSprite,       12, 4, $00
-	mon_icon_header PokeBallSprite,       0, 8, $04
-	mon_icon_header FairySprite,         12, 4, $0c
-	mon_icon_header BirdSprite,          12, 4, $10
-	mon_icon_header SeelSprite,           0, 4, $14
-	mon_icon_header BugIconFrame2,        0, 1, $18
-	mon_icon_header BugIconFrame2,        1, 1, $1a
-	mon_icon_header PlantIconFrame2,      0, 1, $1c
-	mon_icon_header PlantIconFrame2,      1, 1, $1e
-	mon_icon_header SnakeIconFrame1,      0, 1, $20
-	mon_icon_header SnakeIconFrame1,      1, 1, $22
-	mon_icon_header QuadrupedIconFrame1,  0, 1, $24
-	mon_icon_header QuadrupedIconFrame1,  1, 1, $26
-	mon_icon_header TradeBubbleIconGFX,   0, 4, $38
-	mon_icon_header MonsterSprite,        0, 4, $40
-	mon_icon_header PokeBallSprite,       0, 8, $44
-	mon_icon_header FairySprite,          0, 4, $4c
-	mon_icon_header BirdSprite,           0, 4, $50
-	mon_icon_header SeelSprite,          12, 4, $54
-	mon_icon_header BugIconFrame1,        0, 1, $58
-	mon_icon_header BugIconFrame1,        1, 1, $5a
-	mon_icon_header PlantIconFrame1,      0, 1, $5c
-	mon_icon_header PlantIconFrame1,      1, 1, $5e
-	mon_icon_header SnakeIconFrame2,      0, 1, $60
-	mon_icon_header SnakeIconFrame2,      1, 1, $62
-	mon_icon_header QuadrupedIconFrame2,  0, 1, $64
-	mon_icon_header QuadrupedIconFrame2,  1, 1, $66
-	mon_icon_header TradeBubbleIconGFX,   4, 4, $78
+	mon_icon_header MonsterSprite,       12, 4, ICON_MON << 2
+	mon_icon_header PokeBallSprite,       0, 8, ICON_BALL << 2
+	mon_icon_header FairySprite,         12, 4, ICON_FAIRY << 2
+	mon_icon_header BirdSprite,          12, 4, ICON_BIRD << 2
+	mon_icon_header SeelSprite,           0, 4, ICON_WATER << 2
+	mon_icon_header BugIconFrame2,        0, 1, ICON_BUG << 2
+	mon_icon_header BugIconFrame2,        1, 1, ICON_BUG << 2 + 2
+	mon_icon_header PlantIconFrame2,      0, 1, ICON_GRASS << 2
+	mon_icon_header PlantIconFrame2,      1, 1, ICON_GRASS << 2 + 2
+	mon_icon_header SnakeIconFrame1,      0, 1, ICON_SNAKE << 2
+	mon_icon_header SnakeIconFrame1,      1, 1, ICON_SNAKE << 2 + 2
+	mon_icon_header QuadrupedIconFrame1,  0, 1, ICON_QUADRUPED << 2
+	mon_icon_header QuadrupedIconFrame1,  1, 1, ICON_QUADRUPED << 2 + 2
+	mon_icon_header TradeBubbleIconGFX,   0, 4, ICON_TRADEBUBBLE << 2
+	mon_icon_header MonsterSprite,        0, 4, ICONOFFSET + ICON_MON << 2
+	mon_icon_header PokeBallSprite,       0, 8, ICONOFFSET + ICON_BALL << 2
+	mon_icon_header FairySprite,          0, 4, ICONOFFSET + ICON_FAIRY << 2
+	mon_icon_header BirdSprite,           0, 4, ICONOFFSET + ICON_BIRD << 2
+	mon_icon_header SeelSprite,          12, 4, ICONOFFSET + ICON_WATER << 2
+	mon_icon_header BugIconFrame1,        0, 1, ICONOFFSET + ICON_BUG << 2
+	mon_icon_header BugIconFrame1,        1, 1, ICONOFFSET + ICON_BUG << 2 + 2
+	mon_icon_header PlantIconFrame1,      0, 1, ICONOFFSET + ICON_GRASS << 2
+	mon_icon_header PlantIconFrame1,      1, 1, ICONOFFSET + ICON_GRASS << 2 + 2
+	mon_icon_header SnakeIconFrame2,      0, 1, ICONOFFSET + ICON_SNAKE << 2
+	mon_icon_header SnakeIconFrame2,      1, 1, ICONOFFSET + ICON_SNAKE << 2 + 2
+	mon_icon_header QuadrupedIconFrame2,  0, 1, ICONOFFSET + ICON_QUADRUPED << 2
+	mon_icon_header QuadrupedIconFrame2,  1, 1, ICONOFFSET + ICON_QUADRUPED << 2 + 2
+	mon_icon_header TradeBubbleIconGFX,   4, 4, ICONOFFSET + ICON_TRADEBUBBLE << 2
--- a/data/maps/hide_show_data.asm
+++ b/data/maps/hide_show_data.asm
@@ -256,7 +256,7 @@
 	db $FF, $FF, $FF
 
 MissableObjects:
-; entries correspond to HS_* constants
+; entries correspond to HS_* constants (see constants/hide_show_constants)
 ; format: map id, object id, HIDE/SHOW
 
 PalletTownHS:
--- a/data/moves/effects_pointers.asm
+++ b/data/moves/effects_pointers.asm
@@ -1,4 +1,5 @@
 MoveEffectPointerTable:
+; entries correspond to *_EFFECT constants
 	dw SleepEffect               ; EFFECT_01
 	dw PoisonEffect              ; POISON_SIDE_EFFECT1
 	dw DrainHPEffect             ; DRAIN_HP_EFFECT
--- /dev/null
+++ b/data/moves/field_move_names.asm
@@ -1,0 +1,10 @@
+FieldMoveNames:
+	db "CUT@"
+	db "FLY@"
+	db "@"
+	db "SURF@"
+	db "STRENGTH@"
+	db "FLASH@"
+	db "DIG@"
+	db "TELEPORT@"
+	db "SOFTBOILED@"
--- /dev/null
+++ b/data/moves/field_moves.asm
@@ -1,0 +1,14 @@
+FieldMoveDisplayData:
+	; move id, FieldMoveNames index, leftmost tile
+	; (leftmost tile = -1 + tile column in which the first
+	;  letter of the move's name should be displayed)
+	db CUT,        1, $0C
+	db FLY,        2, $0C
+	db ANIM_B4,    3, $0C ; unused
+	db SURF,       4, $0C
+	db STRENGTH,   5, $0A
+	db FLASH,      6, $0C
+	db DIG,        7, $0C
+	db TELEPORT,   8, $0A
+	db SOFTBOILED, 9, $08
+	db -1 ; end
--- a/data/sgb/sgb_palettes.asm
+++ b/data/sgb/sgb_palettes.asm
@@ -1,4 +1,5 @@
 SuperPalettes:
+; entries correspond to PAL_* constants
 	RGB 31,29,31, 21,28,11, 20,26,31, 03,02,02 ; PAL_ROUTE
 	RGB 31,29,31, 25,28,27, 20,26,31, 03,02,02 ; PAL_PALLET
 	RGB 31,29,31, 17,26,03, 20,26,31, 03,02,02 ; PAL_VIRIDIAN
--- /dev/null
+++ b/data/text_boxes.asm
@@ -1,0 +1,88 @@
+TextBoxFunctionTable:
+	; text box ID, function address
+	dbw MONEY_BOX,           DisplayMoneyBox
+	dbw BUY_SELL_QUIT_MENU,  DoBuySellQuitMenu
+	dbw FIELD_MOVE_MON_MENU, DisplayFieldMoveMonMenu
+	db -1 ; end
+
+TextBoxCoordTable:
+	; text box ID, upper-left X, upper-left Y, lower-right X, lower-right Y
+	db MESSAGE_BOX,       0, 12, 19, 17
+	db MENU_TEMPLATE_03,  0,  0, 19, 14
+	db MENU_TEMPLATE_07,  0,  0, 11,  6
+	db LIST_MENU_BOX,     4,  2, 19, 12
+	db MENU_TEMPLATE_10,  7,  0, 19, 17
+	db MON_SPRITE_POPUP,  6,  4, 14, 13
+	db -1 ; end
+
+text_box_text: MACRO
+	db \1 ; text box ID
+	db \2, \3, \4, \5 ; text box coordinates
+	dw \6 ; text pointer
+	db \7, \8 ; text coordinates
+ENDM
+
+TextBoxTextAndCoordTable:
+	; text box ID, upper-left X, upper-left Y, lower-right X, lower-right Y, text pointer, text X, text Y
+	text_box_text JP_MOCHIMONO_MENU_TEMPLATE,         0,  0, 14, 17, JapaneseMochimonoText,    3,  0
+	text_box_text USE_TOSS_MENU_TEMPLATE,            13, 10, 19, 14, UseTossText,             15, 11
+	text_box_text JP_SAVE_MESSAGE_MENU_TEMPLATE,      0,  0,  7,  5, JapaneseSaveMessageText,  2,  2
+	text_box_text JP_SPEED_OPTIONS_MENU_TEMPLATE,     0,  6,  5, 10, JapaneseSpeedOptionsText, 2,  7
+	text_box_text BATTLE_MENU_TEMPLATE,               8, 12, 19, 17, BattleMenuText,          10, 14
+	text_box_text SAFARI_BATTLE_MENU_TEMPLATE,        0, 12, 19, 17, SafariZoneBattleMenuText, 2, 14
+	text_box_text SWITCH_STATS_CANCEL_MENU_TEMPLATE, 11, 11, 19, 17, SwitchStatsCancelText,   13, 12
+	text_box_text BUY_SELL_QUIT_MENU_TEMPLATE,        0,  0, 10,  6, BuySellQuitText,          2,  1
+	text_box_text MONEY_BOX_TEMPLATE,                11,  0, 19,  2, MoneyText,               13,  0
+	text_box_text JP_AH_MENU_TEMPLATE,                7,  6, 11, 10, JapaneseAhText,           8,  8
+	text_box_text JP_POKEDEX_MENU_TEMPLATE,          11,  8, 19, 17, JapanesePokedexMenu,     12, 10
+
+BuySellQuitText:
+	db   "BUY"
+	next "SELL"
+	next "QUIT@"
+
+	db "@" ; unused
+
+UseTossText:
+	db   "USE"
+	next "TOSS@"
+
+JapaneseSaveMessageText:
+	db   "きろく"
+	next "メッセージ@"
+
+JapaneseSpeedOptionsText:
+	db   "はやい"
+	next "おそい@"
+
+MoneyText:
+	db "MONEY@"
+
+JapaneseMochimonoText:
+	db "もちもの@"
+
+JapaneseMainMenuText:
+	db   "つづきから"
+	next "さいしょから@"
+
+BattleMenuText:
+	db   "FIGHT <PK><MN>"
+	next "ITEM  RUN@"
+
+SafariZoneBattleMenuText:
+	db   "BALL×       BAIT"
+	next "THROW ROCK  RUN@"
+
+SwitchStatsCancelText:
+	db   "SWITCH"
+	next "STATS"
+	next "CANCEL@"
+
+JapaneseAhText:
+	db "アッ!@"
+
+JapanesePokedexMenu:
+	db   "データをみる"
+	next "なきごえ"
+	next "ぶんぷをみる"
+	next "キャンセル@"
--- /dev/null
+++ b/data/yes_no_menu_strings.asm
@@ -1,0 +1,44 @@
+two_option_menu: MACRO
+	db \1, \2, \3
+	dw \4
+ENDM
+
+TwoOptionMenuStrings:
+; entries correspond to *_MENU constants
+	; width, height, blank line before first menu item?, text pointer
+	two_option_menu 4, 3, FALSE, .YesNoMenu
+	two_option_menu 6, 3, FALSE, .NorthWestMenu
+	two_option_menu 6, 3, FALSE, .SouthEastMenu
+	two_option_menu 6, 3, FALSE, .YesNoMenu
+	two_option_menu 6, 3, FALSE, .NorthEastMenu
+	two_option_menu 7, 3, FALSE, .TradeCancelMenu
+	two_option_menu 7, 4, TRUE,  .HealCancelMenu
+	two_option_menu 4, 3, FALSE, .NoYesMenu
+
+.NoYesMenu:
+	db   "NO"
+	next "YES@"
+
+.YesNoMenu:
+	db   "YES"
+	next "NO@"
+
+.NorthWestMenu:
+	db   "NORTH"
+	next "WEST@"
+
+.SouthEastMenu:
+	db   "SOUTH"
+	next "EAST@"
+
+.NorthEastMenu:
+	db   "NORTH"
+	next "EAST@"
+
+.TradeCancelMenu:
+	db   "TRADE"
+	next "CANCEL@"
+
+.HealCancelMenu:
+	db   "HEAL"
+	next "CANCEL@"
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -848,8 +848,8 @@
 	jp PlaySound
 
 BallMoveDistances1:
-	db -12,-12,-8
-	db $ff ; terminator
+	db -12, -12, -8
+	db -1 ; end
 
 ; function to make the pokeball jump up
 TradeJumpPokeball:
@@ -889,8 +889,8 @@
 	jr .loop
 
 BallMoveDistances2:
-	db 11,12,-12,-7,7,12,-8,8
-	db $ff ; terminator
+	db 11, 12, -12, -7, 7, 12, -8, 8
+	db -1 ; end
 
 ; this function copies the current musical note graphic
 ; so that there are two musical notes flying towards the defending pokemon
@@ -1522,7 +1522,7 @@
 	db $58, $28
 	db $50, $30
 	db $50, $28
-	db $FF ; list terminator
+	db -1 ; end
 
 AnimationSquishMonPic:
 ; Squishes the mon's sprite horizontally making it
@@ -1677,13 +1677,13 @@
 ; List of x coordinates for each pillar of "energy" balls in the
 ; AnimationShootManyBallsUpward animation. It's unused in the game.
 	db $10, $40, $28, $18, $38, $30
-	db $FF ; list terminator
+	db -1 ; end
 
 UpwardBallsAnimXCoordinatesEnemyTurn:
 ; List of x coordinates for each pillar of "energy" balls in the
 ; AnimationShootManyBallsUpward animation. It's unused in the game.
 	db $60, $90, $78, $68, $88, $80
-	db $FF ; list terminator
+	db -1 ; end
 
 AnimationMinimizeMon:
 ; Changes the mon's sprite to a mini black sprite. Used by the
--- a/engine/events/in_game_trades.asm
+++ b/engine/events/in_game_trades.asm
@@ -233,6 +233,7 @@
 	db "<TRAINER>@@@@@@@@@@"
 
 InGameTradeTextPointers:
+; entries correspond to TRADE_DIALOGSET_* constants
 	dw TradeTextPointers1
 	dw TradeTextPointers2
 	dw TradeTextPointers3
--- a/engine/gfx/mon_icons.asm
+++ b/engine/gfx/mon_icons.asm
@@ -55,11 +55,11 @@
 	ld bc, $10
 	ld a, [wCurrentMenuItem]
 	call AddNTimes
-	ld c, $40 ; amount to increase the tile id by
+	ld c, ICONOFFSET
 	ld a, [hl]
-	cp $4 ; tile ID for ICON_BALL
+	cp ICON_BALL << 2
 	jr z, .editCoords
-	cp $8 ; tile ID for ICON_HELIX
+	cp ICON_HELIX << 2
 	jr nz, .editTileIDS
 ; ICON_BALL and ICON_HELIX only shake up and down
 .editCoords
@@ -274,7 +274,7 @@
 	swap a ; use lower nybble if pokedex num is even
 .skipSwap
 	and $f0
-	srl a
+	srl a ; value == ICON constant << 2
 	srl a
 	ret
 
--- a/engine/gfx/palettes.asm
+++ b/engine/gfx/palettes.asm
@@ -241,6 +241,7 @@
 	ret
 
 SetPalFunctions:
+; entries correspond to SET_PAL_* constants
 	dw SetPal_BattleBlack
 	dw SetPal_Battle
 	dw SetPal_TownMap
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -16,6 +16,7 @@
 	jp hl
 
 ItemUsePtrTable:
+; entries correspond to item ids
 	dw ItemUseBall       ; MASTER_BALL
 	dw ItemUseBall       ; ULTRA_BALL
 	dw ItemUseBall       ; GREAT_BALL
@@ -1808,23 +1809,17 @@
 	jr nz, .loop
 	ret
 
-; Format:
-; 00: Y
-; 01: X
 Route12SnorlaxFluteCoords:
-	db 62,9  ; one space West of Snorlax
-	db 61,10 ; one space North of Snorlax
-	db 63,10 ; one space South of Snorlax
-	db 62,11 ; one space East of Snorlax
-	db $ff ; terminator
+	dbmapcoord  9, 62 ; one space West of Snorlax
+	dbmapcoord 10, 61 ; one space North of Snorlax
+	dbmapcoord 10, 63 ; one space South of Snorlax
+	dbmapcoord 11, 62 ; one space East of Snorlax
+	db -1 ; end
 
-; Format:
-; 00: Y
-; 01: X
 Route16SnorlaxFluteCoords:
-	db 10,27 ; one space East of Snorlax
-	db 10,25 ; one space West of Snorlax
-	db $ff ; terminator
+	dbmapcoord 27, 10 ; one space East of Snorlax
+	dbmapcoord 25, 10 ; one space West of Snorlax
+	db -1 ; end
 
 PlayedFluteNoEffectText:
 	text_far _PlayedFluteNoEffectText
--- a/engine/menus/main_menu.asm
+++ b/engine/menus/main_menu.asm
@@ -678,11 +678,11 @@
 ; 00: X coordinate of menu cursor
 ; 01: delay after printing a letter (in frames)
 TextSpeedOptionData:
-	db 14,5 ; Slow
-	db  7,3 ; Medium
-	db  1,1 ; Fast
+	db 14, 5 ; Slow
+	db  7, 3 ; Medium
+	db  1, 1 ; Fast
 	db 7 ; default X coordinate (Medium)
-	db $ff ; terminator
+	db -1 ; end
 
 CheckForPlayerNameInSRAM:
 ; Check if the player name data in SRAM has a string terminator character
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -231,10 +231,10 @@
 	ld [wNamingScreenLetter], a
 	call CalcStringLength
 	ld a, [wNamingScreenLetter]
-	cp $e5
+	cp "゙"
 	ld de, Dakutens
 	jr z, .dakutensAndHandakutens
-	cp $e4
+	cp "゚"
 	ld de, Handakutens
 	jr z, .dakutensAndHandakutens
 	ld a, [wNamingScreenType]
--- a/engine/menus/text_box.asm
+++ b/engine/menus/text_box.asm
@@ -125,149 +125,8 @@
 	add hl, de
 	ret
 
-; Format:
-; 00: text box ID
-; 01-02: function address
-TextBoxFunctionTable:
-	dbw MONEY_BOX, DisplayMoneyBox
-	dbw BUY_SELL_QUIT_MENU, DoBuySellQuitMenu
-	dbw FIELD_MOVE_MON_MENU, DisplayFieldMoveMonMenu
-	db $ff ; terminator
+INCLUDE "data/text_boxes.asm"
 
-; Format:
-; 00: text box ID
-; 01: column of upper left corner
-; 02: row of upper left corner
-; 03: column of lower right corner
-; 04: row of lower right corner
-TextBoxCoordTable:
-	db MESSAGE_BOX,       0, 12, 19, 17
-	db $03,               0,  0, 19, 14
-	db $07,               0,  0, 11,  6
-	db LIST_MENU_BOX,     4,  2, 19, 12
-	db $10,               7,  0, 19, 17
-	db MON_SPRITE_POPUP,  6,  4, 14, 13
-	db $ff ; terminator
-
-; Format:
-; 00: text box ID
-; 01: column of upper left corner
-; 02: row of upper left corner
-; 03: column of lower right corner
-; 04: row of lower right corner
-; 05-06: address of text
-; 07: column of beginning of text
-; 08: row of beginning of text
-; table of window positions and corresponding text [key, start column, start row, end column, end row, text pointer [2 bytes], text column, text row]
-TextBoxTextAndCoordTable:
-	db JP_MOCHIMONO_MENU_TEMPLATE
-	db 0,0,14,17   ; text box coordinates
-	dw JapaneseMochimonoText
-	db 3,0   ; text coordinates
-
-	db USE_TOSS_MENU_TEMPLATE
-	db 13,10,19,14 ; text box coordinates
-	dw UseTossText
-	db 15,11 ; text coordinates
-
-	db JP_SAVE_MESSAGE_MENU_TEMPLATE
-	db 0,0,7,5     ; text box coordinates
-	dw JapaneseSaveMessageText
-	db 2,2   ; text coordinates
-
-	db JP_SPEED_OPTIONS_MENU_TEMPLATE
-	db 0,6,5,10    ; text box coordinates
-	dw JapaneseSpeedOptionsText
-	db 2,7   ; text coordinates
-
-	db BATTLE_MENU_TEMPLATE
-	db 8,12,19,17  ; text box coordinates
-	dw BattleMenuText
-	db 10,14 ; text coordinates
-
-	db SAFARI_BATTLE_MENU_TEMPLATE
-	db 0,12,19,17  ; text box coordinates
-	dw SafariZoneBattleMenuText
-	db 2,14  ; text coordinates
-
-	db SWITCH_STATS_CANCEL_MENU_TEMPLATE
-	db 11,11,19,17 ; text box coordinates
-	dw SwitchStatsCancelText
-	db 13,12 ; text coordinates
-
-	db BUY_SELL_QUIT_MENU_TEMPLATE
-	db 0,0,10,6    ; text box coordinates
-	dw BuySellQuitText
-	db 2,1   ; text coordinates
-
-	db MONEY_BOX_TEMPLATE
-	db 11,0,19,2   ; text box coordinates
-	dw MoneyText
-	db 13,0  ; text coordinates
-
-	db JP_AH_MENU_TEMPLATE
-	db 7,6,11,10   ; text box coordinates
-	dw JapaneseAhText
-	db 8,8   ; text coordinates
-
-	db JP_POKEDEX_MENU_TEMPLATE
-	db 11,8,19,17  ; text box coordinates
-	dw JapanesePokedexMenu
-	db 12,10 ; text coordinates
-
-; note that there is no terminator
-
-BuySellQuitText:
-	db   "BUY"
-	next "SELL"
-	next "QUIT@"
-
-	db "@" ; unused
-
-UseTossText:
-	db   "USE"
-	next "TOSS@"
-
-JapaneseSaveMessageText:
-	db   "きろく"
-	next "メッセージ@"
-
-JapaneseSpeedOptionsText:
-	db   "はやい"
-	next "おそい@"
-
-MoneyText:
-	db "MONEY@"
-
-JapaneseMochimonoText:
-	db "もちもの@"
-
-JapaneseMainMenuText:
-	db   "つづきから"
-	next "さいしょから@"
-
-BattleMenuText:
-	db   "FIGHT <PK><MN>"
-	next "ITEM  RUN@"
-
-SafariZoneBattleMenuText:
-	db   "BALL×       BAIT"
-	next "THROW ROCK  RUN@"
-
-SwitchStatsCancelText:
-	db   "SWITCH"
-	next "STATS"
-	next "CANCEL@"
-
-JapaneseAhText:
-	db "アッ!@"
-
-JapanesePokedexMenu:
-	db   "データをみる"
-	next "なきごえ"
-	next "ぶんぷをみる"
-	next "キャンセル@"
-
 DisplayMoneyBox:
 	ld hl, wd730
 	set 6, [hl]
@@ -518,51 +377,8 @@
 	call UpdateSprites
 	ret
 
-; Format:
-; 00: byte width
-; 01: byte height
-; 02: byte put blank line before first menu item
-; 03: word text pointer
-TwoOptionMenuStrings:
-	db 4,3,0
-	dw .YesNoMenu
-	db 6,3,0
-	dw .NorthWestMenu
-	db 6,3,0
-	dw .SouthEastMenu
-	db 6,3,0
-	dw .YesNoMenu
-	db 6,3,0
-	dw .NorthEastMenu
-	db 7,3,0
-	dw .TradeCancelMenu
-	db 7,4,1
-	dw .HealCancelMenu
-	db 4,3,0
-	dw .NoYesMenu
+INCLUDE "data/yes_no_menu_strings.asm"
 
-.NoYesMenu
-	db   "NO"
-	next "YES@"
-.YesNoMenu
-	db   "YES"
-	next "NO@"
-.NorthWestMenu
-	db   "NORTH"
-	next "WEST@"
-.SouthEastMenu
-	db   "SOUTH"
-	next "EAST@"
-.NorthEastMenu
-	db   "NORTH"
-	next "EAST@"
-.TradeCancelMenu
-	db   "TRADE"
-	next "CANCEL@"
-.HealCancelMenu
-	db   "HEAL"
-	next "CANCEL@"
-
 DisplayFieldMoveMonMenu:
 	xor a
 	ld hl, wFieldMoves
@@ -683,16 +499,7 @@
 	ld de, PokemonMenuEntries
 	jp PlaceString
 
-FieldMoveNames:
-	db "CUT@"
-	db "FLY@"
-	db "@"
-	db "SURF@"
-	db "STRENGTH@"
-	db "FLASH@"
-	db "DIG@"
-	db "TELEPORT@"
-	db "SOFTBOILED@"
+INCLUDE "data/moves/field_move_names.asm"
 
 PokemonMenuEntries:
 	db   "STATS"
@@ -751,19 +558,4 @@
 	pop hl
 	ret
 
-; Format: [Move id], [name index], [leftmost tile]
-; Move id = id of move
-; Name index = index of name in FieldMoveNames
-; Leftmost tile = -1 + tile column in which the first letter of the move's name should be displayed
-;                 "SOFTBOILED" is $08 because it has 4 more letters than "SURF", for example, whose value is $0C
-FieldMoveDisplayData:
-	db CUT, $01, $0C
-	db FLY, $02, $0C
-	db $B4, $03, $0C ; unused field move
-	db SURF, $04, $0C
-	db STRENGTH, $05, $0A
-	db FLASH, $06, $0C
-	db DIG, $07, $0C
-	db TELEPORT, $08, $0A
-	db SOFTBOILED, $09, $08
-	db $ff ; list terminator
+INCLUDE "data/moves/field_moves.asm"
--- a/engine/movie/trade.asm
+++ b/engine/movie/trade.asm
@@ -604,7 +604,7 @@
 	ld c, $14
 .loop
 	ld a, [hl]
-	xor $40
+	xor ICONOFFSET
 	ld [hl], a
 	add hl, de
 	dec c
@@ -710,20 +710,20 @@
 	trade_circle_oam Trade_CircleOAM3, $18, $18
 
 Trade_CircleOAM0:
-	dbsprite  2,  7,  0,  0, $39, OAM_OBP1
-	dbsprite  2,  7,  0,  2, $3b, OAM_OBP1
+	dbsprite  2,  7,  0,  0, ICON_TRADEBUBBLE << 2 + 1, OAM_OBP1
+	dbsprite  2,  7,  0,  2, ICON_TRADEBUBBLE << 2 + 3, OAM_OBP1
 
 Trade_CircleOAM1:
-	dbsprite  6,  7,  0,  1, $38, OAM_OBP1 | OAM_HFLIP
-	dbsprite  6,  7,  0,  3, $3a, OAM_OBP1 | OAM_HFLIP
+	dbsprite  6,  7,  0,  1, ICON_TRADEBUBBLE << 2 + 0, OAM_OBP1 | OAM_HFLIP
+	dbsprite  6,  7,  0,  3, ICON_TRADEBUBBLE << 2 + 2, OAM_OBP1 | OAM_HFLIP
 
 Trade_CircleOAM2:
-	dbsprite 10,  7,  0,  2, $3b, OAM_OBP1 | OAM_VFLIP
-	dbsprite 10,  7,  0,  0, $39, OAM_OBP1 | OAM_VFLIP
+	dbsprite 10,  7,  0,  2, ICON_TRADEBUBBLE << 2 + 3, OAM_OBP1 | OAM_VFLIP
+	dbsprite 10,  7,  0,  0, ICON_TRADEBUBBLE << 2 + 1, OAM_OBP1 | OAM_VFLIP
 
 Trade_CircleOAM3:
-	dbsprite 14,  7,  0,  3, $3a, OAM_OBP1 | OAM_HFLIP | OAM_VFLIP
-	dbsprite 14,  7,  0,  1, $38, OAM_OBP1 | OAM_HFLIP | OAM_VFLIP
+	dbsprite 14,  7,  0,  3, ICON_TRADEBUBBLE << 2 + 2, OAM_OBP1 | OAM_HFLIP | OAM_VFLIP
+	dbsprite 14,  7,  0,  1, ICON_TRADEBUBBLE << 2 + 0, OAM_OBP1 | OAM_HFLIP | OAM_VFLIP
 
 ; a = species
 Trade_LoadMonSprite:
--- a/engine/overworld/emotion_bubbles.asm
+++ b/engine/overworld/emotion_bubbles.asm
@@ -62,6 +62,7 @@
 	jp UpdateSprites
 
 EmotionBubblesPointerTable:
+; entries correspond to *_BUBBLE constants
 	dw ShockEmote
 	dw QuestionEmote
 	dw HappyEmote
--- a/home/list_menu.asm
+++ b/home/list_menu.asm
@@ -34,7 +34,7 @@
 	hlcoord 4, 2 ; coordinates of upper left corner of menu text box
 	lb de, 9, 14 ; height and width of menu text box
 	ld a, [wListMenuID]
-	and a ; is it a PC pokemon list?
+	and a ; PCPOKEMONLISTMENU?
 	jr nz, .skipMovingSprites
 	call UpdateSprites
 .skipMovingSprites
@@ -126,7 +126,7 @@
 	ld a, [hl]
 	ld [wcf91], a
 	ld a, [wListMenuID]
-	and a ; is it a PC pokemon list?
+	and a ; PCPOKEMONLISTMENU?
 	jr z, .pokemonList
 	push hl
 	call GetItemPrice
@@ -374,7 +374,7 @@
 	push hl
 	push de
 	ld a, [wListMenuID]
-	and a
+	and a ; PCPOKEMONLISTMENU?
 	jr z, .pokemonPCMenu
 	cp MOVESLISTMENU
 	jr z, .movesMenu
@@ -422,7 +422,7 @@
 	call PrintBCDNumber
 .skipPrintingItemPrice
 	ld a, [wListMenuID]
-	and a
+	and a ; PCPOKEMONLISTMENU?
 	jr nz, .skipPrintingPokemonLevel
 .printPokemonLevel
 	ld a, [wd11e]
--- a/home/names2.asm
+++ b/home/names2.asm
@@ -1,4 +1,5 @@
 NamePointers::
+; entries correspond to *_NAME constants
 	dw MonsterNames
 	dw MoveNames
 	dw UnusedNames