User Tools

Site Tools


return_of_samus:data_locations:ram_map

This is an old revision of the document!


Return of Samus: RAM Map

An in-progress RAM map to aid in custom assembly and ROM disassembly.

Overview

0000-3FFF - 16KB ROM Bank (fixed - bank 0)
4000-7FFF - 16KB ROM Bank (swappable)
8000-9FFF - 8KB Video RAM
A000-BFFF - 8KB Save RAM
C000-DFFF - 8KB Work RAM
E000-FDFF - Echo RAM (unused)
FE00-FE9F - OAM
FEA0-FEFF - Not usable
FF00-FF7F - I/O Ports
FF80-FFFE - High RAM
FFFF      - Interrupt enable register

VRAM

8000-97FF: VRAM tiles
    8000-87AF: Samus
    8B00-8EFF: Enemies
        0x8C00-8E2F: Characters if room has message box (probably loaded with chozo?)
    9000-97FF: Background
9800-9FFF: VRAM tilemap
    0000-03FF: Background
    0400-07FF: Window
        0400: Status bar
        0420: Message

SRAM

A000-A03F - File 1
    + 00-07: 0123456789ABCDEF
    + 08-0B: [$FFC0-C3]
    + 0C-0F: [$FFC8-CB]
    + 10-1C: [$D808-14]
    + 1D: [$D045]
    + 1E: [$D055]
    + 1F: [$D050]
    + 20: [$D051]
    + 21: [$D052]
    + 22: [$D081]
    + 23: [$D082]
    + 24: [$D053]
    + 25: [$D054]
    + 26: [$D02B]
    + 27: [$D077]
    + 28: [$D078]
    + 29: [$D089]
    + 2A: [$D092]
    + 2B: [$D098]
    + 2C: [$D099]
    + 2D: [$D09A]
A040-A07F - File 2
A080-A0BF - File 3
A0C0      - Last used save slot

A800-ACE2 - Written to in credits [$6:7920..7E02]

B000-B1BF - File 1 Item/Metroid data (0x40 bytes per map)

B200-B3BF - File 2 Item/Metroid data (verify)

B400-B5BF - File 3 Item/Metroid data

WRAM

C000-9F - OAM buffer (gets copied by the sprite DMA)
    + 0: Y position
    + 1: X position
    + 2: Tile number
    + 3: Attributes
         10: Palette
         20: X flip
         40: Y flip
         80: Priority (set: behind background)

C205 - Mirror of SCY ($FF42)
C206 - Mirror of SCX ($FF43)

C3AA-AB - Pointer to LCD interrupt data

C500-FE - Offscreen enemy bytes (for current map)
    C540-C57F - Item/Metroid data bytes (for current map, gets copied to $C900 when switching maps)

C600-C7FF - Enemy Slots (0x10 slots, 0x20 bytes each)

C900-CABF - Item/Metroid data bytes (0x40 per map, gets saved to SRAM)

CEC0-CFFF - Music RAM
    CEDC - Song Enqueued (poking this causes the song to change the next frame)
    CEDD - Song Playing (poking this does nothing)
    
    CF10 - Mirror of NR10
    CF11 - Mirror of NR11
    CF12 - Mirror of NR12
    CF13 - Mirror of NR13
    CF14 - Mirror of NR14
    CF16 - Mirror of NR16
    CF17 - Mirror of NR17
    CF18 - Mirror of NR18
    CF19 - Mirror of NR19
    CF1A - Mirror of NR30
    CF1B - Mirror of NR31
    CF1C - Mirror of NR32
    CF1D - Mirror of NR33
    CF1E - Mirror of NR34

D00E - Disable buttons flag

D020 - Samus' pose
        00: Standing
        01: Jumping
        02: Spin-jumping
        03: Running (set to 83h when turning)
        04: Crouching
        05: Morphball
        06: Morphball jumping
        07: Falling
        08: Morphball falling
        09: Starting to jump
        0A: Starting to spin-jump
        0B: Spider ball rolling
        0C: Spider ball falling
        0D: Spider ball jumping
        0E: Spider ball
        0F: Knockback
        10: Morphball knockback
        11: Standing bombed
        12: Morphball bombed
        13: Facing screen
        18: Being eaten by Metroid Queen
        19: In Metroid Queen's mouth
        1A: Being swallowed by Metroid Queen
        1B: In Metroid Queen's stomach
        1C: Escaping Metroid Queen
        1D: Escaped Metroid Queen

D023 - Direction of Samus' movement
        10: Right
        20: Left
        40: Up
        80: Down

D027-28 - Samus X position
D029-2A - Samus Y position
D02B - Direction Samus is facing
        0: Left
        1: Right
D02C - Samus turning animation counter

D045 - Item Bits

D047 - Tiles update flag (see $FFB1..B6, $2BA3, $27BA)

D04D - Weapon selected
D04E - Current ROM bank loaded

D050 - Current e-tanks owned
D051 - Current energy [BCD]
D052 - Current e-tanks filled
D053 - Current missile count, lo byte [BCD]
D054 - Current missile count, hi byte [BCD]
D055 - Current beam Samus has
D056 - Samus' solidity index

D058 - Current level bank loaded
D059 - Death sequence timer. Used as index into offset table for dest address in $2FE1

D065 - VRAM DMA bank (see $FFB1..B6, $2BA3)

D069 - Enemy Solidity Index

D06E - Highest OAM stack pointer

D077 - Damage done by acid [BCD?]
D078 - Damage done by spikes [BCD?]

D07A - Save slot option selected
        0: Start
        1: Clear

D07E - Mirror of BGP ($FF47)
D07F - Mirror of OBP0 ($FF48)
D080 - Mirror of OBP1 ($FF49)
D081 - Max missile count, lo byte [BCD]
D082 - Max missile count, hi byte [BCD]

D084 - Samus' health for display
D085 - Number of non-empty energy tanks
D086 - Samus' missiles for display

D089 - Metroids remaining (real) [BDC]
D08A - Weapon solidity index

D08E - Screen Transition index, lo byte
D08F - Screen Transition index, hi byte

D092 - Song to resume (upon defeating a Metroid, reloading a save)

D096 - Metroids remaining shuffle timer

D098 - In-game timer, minutes
D099 - In-game timer, hours
D09A - Metroids remaining (HUD display) [BCD]

D09F: Flag to display in-game time in credits

D0A2 - In-game timer, 256-frame periods (roughly 14ths of a minute)
D0A3 - Save File Selected
D0A4 - Show clear save slot option flag

D0A7 - Metroids remaining in area

D700-D73F - Door Transition Data Buffer

D800-D825 - Savegame data buffer

DA00-DBFF - Metatile data buffer
DC00-FF - Collision data buffer
DD00-FF - Projectile RAM
DE00-FF - Entries to update tilemap. [word] [byte] [byte] [byte] [byte] = dest address, TL, TR, BL, BR
    + 0: Dest. address
    + 2: Top-left tile
    + 3: Top-right tile
    + 4: Bottom-left tile
    + 5: Bottom-right tile
DF00-FF - Stack

HRAM

FF80 - Buttons being held
        01: A
        02: B
        04: Select
        08: Start
        10: Right
        20: Left
        40: Up
        80: Down
FF81 - New buttons just pressed
FF82 - V-blank handled flag

FF8D - OAM offset (beginning of first unused entry)

FF97 - Frame counter
FF98 - Sprite tile number (see $5:4015)
FF99 - Two sprite tile numbers (see $5:4000)

FF9B - Game mode
        0: Boot
        1: Title screen
        2: Loading save 2
        3: Loading save 3
        4: In-game
        5: Dead
        6: Dying
        7: Game over
        8: Paused
        9: Save to SRAM
        Ah: Unused
        Bh: Start new game
        Ch: Load from save
        Dh: RET
        Eh: RET
        Fh: Unused. Identical to 7, set by game mode Ah
        10h: Unused. Game cleared
        11h: Unused. Functionally identical to 7, set by game mode 10h
        12h: Reached the gunship
        13h: Credits

FFA0-FFA9 - Sprite DMA Routine

FFB1-B2 - VRAM DMA source address
FFB3-B4 - VRAM DMA dest address, also source offset from $CE20 when [$D08C] is set
FFB5-B6 - VRAM DMA size
FFB7-BB - Energy tank graphics

FFC0 - Samus Y pos (pixels)
FFC1 - Samus Y pos (screens)
FFC2 - Samus X pos (pixels)
FFC3 - Samus X pos (screens)
FFC4 - temp sprite Y position
FFC5 - temp sprite X position
FFC6 - temp sprite frame/tile (depends on the subroutine using it)
FFC7 - temp sprite attributes
FFC8 - Camera Y position (pixels)
FFC9 - Camera Y position (screens)
FFCA - Camera X position (pixels)
FFCB - Camera X position (screens)

FFE0-FFF5 - Used by active enemies (??)

FFFE - Counts every other in-game frame
return_of_samus/data_locations/ram_map.1466628531.txt.gz · Last modified: 2016/06/22 20:48 by p.jboy