The Final Fantasy Legend/RAM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a RAM map for The Final Fantasy Legend.

This RAM map documents the memory layout of The Final Fantasy Legend (USA version). All addresses are CPU addresses in hexadecimal within the Game Boy memory space. The game uses standard DMG (monochrome) memory layout, with GBC-specific WRAM banks only used in colorization patches.

External RAM (A000-BFFF) - Save Data

Start End Size Description Notes
A000 BFFF 8 KiB Save Slot Single save slot: party data, inventory, progress flags
A000 A03F 64 B Party Slot 1 Character data (64 bytes per slot)
A040 A07F 64 B Party Slot 2 Character data
A080 A0BF 64 B Party Slot 3 Character data
A0C0 A0FF 64 B Party Slot 4 Character data
A100 A1FF 256 B Inventory Item data
A200 AFFF 3.5 KiB Progress Data Event flags, world state, etc.

Work RAM Bank 0 (C000-CFFF) - Runtime Data

Start End Size Description Notes
C000 C09F 160 B OAM Copy 1 wOAM1 (saga1dx) - OAM copy/metasprite buffer
C100 C19F 160 B OAM Copy 2 wOAM2 (saga1dx) - OAM copy/character animation
C300 C37F 128 B RNG Seeds wRandSeeds (saga1dx) - Each address used for specific RNG
C309 C309 1 B Mutant HP Growth RNG TASVideos semantics
C30B C30B 1 B Mutant Bonus Type RNG Ability/HP/Mana/Agl/Str/Def/shuffle/none
C30E C30E 1 B Mutant Ability-Uses Shuffler TASVideos semantics
C31B C31B 1 B HP Potion RNG TASVideos semantics
C323 C323 1 B Run Away RNG 0-126 can't run, 127-255 can run
C33B C33B 1 B Random Battle Trigger RNG Terrain-based encounters
C343 C343 1 B Encounter Monster Group RNG TASVideos semantics
C34B C34B 1 B Mutant Ability Gained/Growth RNG TASVideos semantics
C358 C358 1 B Potion/X-Potion Recovery RNG TASVideos semantics
C36F C36F 1 B Mutant Ability Slot RNG 1-4 (TASVideos semantics)
C38A C399 16 B Far-Call Template wFarCall (saga1dx) - Init copies code from ROM $00E7..$00EF
C39A C39C 3 B VBlank Call Stub wVBlank (saga1dx)
C425 C426 2 B Soft Reset Sentinel wSoftResetSentinel (saga1dx) - Value 0xE41B
C427 C427 1 B Boot Flag wBooted (saga1dx) - Set to 1 on first boot
CB00 CBFF 256 B RNG Lookup Table wRandTable (saga1dx) - 256-byte period, two-byte index → rolled value
CC0B CC0B 1 B Current Mutant Strength Used in post-battle effect path (Gain S handler at $545A)
CC8E CC8F 2 B Runtime Gold Packed BCD (verified: 416 GP trace, save +0x11C/+0x11E)

Work RAM Bank 1 (D000-DFFF) - Scene-Dependent

Start End Size Description Notes
D000 DFFF 4 KiB Scene Buffer Content varies by scene (saga1dx vanilla wram1.asm)
D000 DFFF 4 KiB Overworld Tilemap wTilemap (saga1dx) - 4 KiB when in overworld
D000 D3E8 1001 B Battle States wBattleStates (saga1dx) - $3E9 bytes when in battle
D3E9 D3EE 6 B Battle Enemy ID wBattleEnemyID (saga1dx) - 6 bytes
DE00 DEFF 256 B Text Source Buffer Message building buffer (verified: meat-eating message trace)

Text Buffers

Start End Size Description Notes
C600 C6FF 256 B Textbox Buffer WRAM textbox buffer (saga1dx menu.asm) - Source for window tilemap
DE00 DEFF 256 B Text Source Buffer Message building buffer - Copied to $C600 by routine $6008

VRAM (8000-9FFF) - Video RAM

Start End Size Description Notes
8000 8FFF 4 KiB Tile Data Character tiles, sprites
9000 97FF 2 KiB Background Tilemap BG tilemap
9800 9BFF 1 KiB Background Tilemap Alt Alternative BG tilemap
9900 99E7 232 B Textbox Tilemap 20×10 textbox (used by $63DE routine)
9C00 9FFF 1 KiB Window Tilemap Window tilemap (used by menu load hook)

OAM (FE00-FE9F) - Sprite Attributes

Start End Size Description Notes
FE00 FE9F 160 B OAM Sprite attributes (hardware)

I/O Registers (FF00-FF7F)

Start End Size Description Notes
FF00 FF00 1 B JOYPAD Input register
FF01 FF02 2 B SERIAL Link cable
FF04 FF07 4 B TIMER/DIVIDER Timer and divider registers
FF0F FF0F 1 B INTERRUPT FLAG IF register
FF10 FF26 23 B SOUND Audio registers
FF30 FF3F 16 B WAVE PATTERN RAM Audio wave data
FF40 FF4B 12 B LCD/SCROLL/PALETTES Display control registers
FF46 FF46 1 B OAM DMA OAM DMA transfer
FF4F FF4F 1 B VRAM Bank Select GBC only

High RAM (FF80-FFFE)

Start End Size Description Notes
FF80 FFFE 127 B HRAM Fast access RAM

Interrupt Enable (FFFF)

Start End Size Description Notes
FFFF FFFF 1 B IE Interrupt Enable register

GBC WRAM Banks (saga1dx patch-only)

These banks are only used in the colorization patch and are not present in the original DMG version.

WRAMX Bank 2 (D000-DFFF when selected)

Start End Size Description Notes
D000 D4FF 1.3 KiB Metatile Attributes wMetatileAttr (saga1dx) - $500 bytes
D500 D7FF 768 B Metatile Buffer wMetatileBuffer (saga1dx) - $300 bytes

WRAMX Bank 3 (D000-DFFF when selected)

Start End Size Description Notes
D000 D03F 64 B BG Palettes wPalettes BG (saga1dx) - $40 bytes
D040 D07F 64 B OBJ Palettes wPalettes OBJ (saga1dx) - $40 bytes
D080 D0BF 64 B Battle Palettes wPalettes Battle (saga1dx) - $40 bytes
D0C0 D0FF 64 B Title Palettes wPalettes Title (saga1dx) - $40 bytes
D300 D3FF 256 B Palette Lookup wPaletteLookup (saga1dx) - 256 bytes
DFFD DFFF 3 B Palette State wRequestedPalette, wLastFadeValue, wIsTitle (saga1dx)

WRAMX Bank 5 (D000-DFFF when selected)

Start End Size Description Notes
D000 D1FF 512 B Sprite IDs wSpriteIDs (saga1dx) - 512 bytes
D200 D3FF 512 B Sprite Attributes wSpriteAttr (saga1dx) - 576 bytes (overlaps)

Notes

  • All addresses are CPU addresses (hex) in Game Boy memory space
  • External RAM (A000-BFFF) is battery-backed for save data
  • Work RAM Bank 0 (C000-CFFF) is always accessible
  • Work RAM Bank 1 (D000-DFFF) content varies by scene (overworld vs battle)
  • GBC WRAM banks are only used in colorization patch (saga1dx)
  • Text buffers: $DE00 (source) → $C600 (textbox) → VRAM $9900 (textbox tilemap) or $9C00 (window tilemap)
  • RNG seeds at $C300-$C37F are consumed in fixed order, causing deterministic behavior on fresh saves
  • Battle states structure at $D000-$D3E8 when in battle (wBattleStates, $3E9 bytes)
  • Save file structure: 64 bytes per party slot × 4 slots = 256 bytes, plus inventory and progress data

Sources

  • saga1dx vanilla wram0.asm, wram1.asm (GitHub: akatsuki105/saga1dx)
  • TASVideos GameResources/GB/FinalFantasyLegend (RNG semantics)
  • Traced execution (meat-eating message, post-battle effects)
  • Save file dumps (docs/saves/fflsave-world1)