Overview
Constants in the Pokémon Red/Blue disassembly provide symbolic names for game data, making the code more readable and maintainable. All constant definitions are located inconstants/*.asm files.
The disassembly uses the const_def macro system to automatically enumerate sequential values, reducing errors and making it easy to add or remove entries.
How Constants Work
Constants are defined using RGBDS assembler syntax with helper macros:const_def macro initializes a counter, and each const increments it automatically.
- Pokémon Constants
- Item Constants
- Move Constants
- Map Constants
- Battle Constants
- Type Constants
Pokémon IDs
File:constants/pokemon_constants.asmPokémon IDs index multiple data tables including names, evolutions, moves, cries, and Pokédex entries.Pokémon IDs in Red/Blue are in internal order, not Pokédex order. For example, Rhydon is 99.
Usage Examples
Checking Pokémon Species
Adding Item to Bag
Teaching a Move
Map Warps
Common Patterns
const_skip
Skips values in the enumeration (used for unused or reserved slots):const_next
Jumps to a specific value (cannot go backwards):shift_const
Creates bit flag constants:Reference Tables
Key Constant Files
| File | Purpose | Count |
|---|---|---|
pokemon_constants.asm | Pokémon species IDs | 190 |
item_constants.asm | Items, TMs, HMs | 250+ |
move_constants.asm | Move IDs | 165 |
map_constants.asm | Map IDs | 248 |
type_constants.asm | Type IDs | 16 |
battle_constants.asm | Battle mechanics | Many |
sprite_constants.asm | Sprite IDs | 100+ |
event_constants.asm | Event flags | Many |
text_constants.asm | Text IDs | 500+ |
Exported Constants
Best Practices
Use Symbolic Names
Always use constant names instead of hardcoded numbers for better readability and maintainability.
Check const_value
Use
const_value to get the current enumeration value for array sizing and validation.Document Skips
Add comments explaining why values are skipped with
const_skip.Group Related Constants
Keep related constants in the same file and section for easy reference.
Related Pages
- Macros Reference - Learn about the macro system
- Data Structures - Understand how constants index data
- Engine Modules - See constants in action