Overview
Pokémon Red and Blue are organized into ROM banks, with code and data carefully distributed across 45 banks (Banks 0-44). Understanding this structure is essential for navigating and modifying the disassembly.ROM Bank Layout
Fromlayout.link, the ROM is organized as follows:
Bank 0 (ROM0): Home Bank - Always Accessible
Bank 0 (ROM0): Home Bank - Always Accessible
Bank 0 is special - it’s always mapped to
$0000-$3FFF and contains:- 0067: RST vectors and interrupt handlers
- 014F: ROM header (title, checksums, etc.)
- 3FFF: Core routines used throughout the game
Banks 1-3: Core Systems
Banks 1-3: Core Systems
Bank 1: Core game systems
- Sprite facing data
- Blackout handling
- Mew data
- Safari Zone logic
- Title screen
- Item data (prices, names)
- OAM and sprite management
- Sound effect headers
- Music headers
- Audio engine routines
- First set of music tracks
- Joypad handling
- Map songs and headers
- Player state management
- Wild Pokémon encounters
- Item effects and inventory
- Field moves (Cut, etc.)
Banks 4-5: Graphics and Battle
Banks 4-5: Graphics and Battle
Bank 4: NPC Sprites 1 + Font + Battle Engine 1Contains sprite graphics, font tiles, and initial battle routines.Bank 5: NPC Sprites 2 + Battle Engine 2
- Additional NPC sprite sets
- More battle engine code
- PC system functions
Banks 6-7: Maps and Data
Banks 6-7: Maps and Data
Bank 6: Maps and TimeBank 7: Maps and Names
Bank 8: Audio Engine 2
Bank 8: Audio Engine 2
Banks 9-13: Pokémon Graphics
Banks 9-13: Pokémon Graphics
Banks 9-13: Pokémon Sprite Data (“Pics”)Each bank contains compressed Pokémon sprites plus battle engine code.
Banks 14-15: Battle Core
Banks 14-15: Battle Core
Bank 14 ($E): Battle Engine 7The main battle execution engine.
- All move data (power, accuracy, PP, effects)
- Base stats for all 151 Pokémon
- Pokémon cries
- Trainer AI
- Evolution and move learning data
Banks 16-24: Maps and Events
Banks 16-24: Maps and Events
These banks contain the bulk of map data and event scripts:Each map section includes:
- Map layouts and connections
- NPC positions and scripts
- Hidden item locations
- Warp and sign data
Banks 25-27: Tilesets
Banks 25-27: Tilesets
- Overworld tilesets (houses, caves, cities)
- Building interiors
- Special locations (Pokémon Tower, Silph Co.)
Banks 28-31: Animations and Audio
Banks 28-31: Animations and Audio
Bank 28 ($1C): Animations and Graphics
- Hall of Fame
- Healing machine animations
- Battle transitions
- Trading animations
- Additional map data
- Itemfinder functionality
- Vending machines
- All move animation routines
- Animation subanimations
- Frame blocks
- Evolution animation
- Third set of music tracks
- Additional sound effects
Banks 32-44: Text
Banks 32-44: Text
The final 13 banks contain all game text:Includes:
- NPC dialogue
- Item descriptions
- Move descriptions
- Pokédex entries
- System messages
SECTION Directives
Frommain.asm, code is organized using SECTION directives:
- Has a unique name (e.g., “bank1”, “Battle Core”)
- Specifies a memory type (
ROM0orROMX) - Can optionally specify a bank number (
ROMX $1) - Contains code or data
The linker (
rgblink) uses layout.link to place sections in specific banks and addresses.Section Types
ROM0 Sections
Fixed sections that are always accessible:ROMX Sections
Bankable sections that get placed in specific banks:Bank Distribution Strategy
The game distributes code strategically:Key Data Structures
Move Data (Bank $E)
Base Stats (Bank $E)
Pokémon Names (Bank $7)
All 151 Pokémon names as null-terminated strings:Map Organization
Maps are distributed across multiple banks:- Map data (block layout)
- Warp definitions
- Sign/interaction points
- Trainer data
- Scripts
Text Bank Organization
Text is carefully organized for space efficiency:Bank Usage Statistics
| Bank Range | Content Type | Count |
|---|---|---|
| $00 | Home (always loaded) | 1 |
| 08 | Core systems + audio | 8 |
| 0D | Pokémon graphics | 5 |
| 0F | Battle engine | 2 |
| 1D | Maps, events, tilesets | 14 |
| 1F | Animations + audio | 2 |
| 2C | Text data | 13 |
| Total | 45 banks |
ROM Header (Bank 0, 014F)
The ROM header contains metadata:rgbfix during build:
Finding Code in the ROM
Example: Finding Pound Move Data
Bank Size Constraints
Space Optimization
The original developers used several techniques:- Compression: Pokémon sprites use custom RLE compression
- Shared Code: Common routines in Bank 0
- Text Encoding: Custom character encoding saves space
- Data Tables: Efficient lookup tables instead of code
Build Output
After building:.map file shows exactly where each section was placed:
Next Steps
Bank System
Learn how to switch banks and make far calls
Memory Layout
Understand RAM organization