-
Notifications
You must be signed in to change notification settings - Fork 3
Memory Layout
black-sliver edited this page Sep 19, 2024
·
32 revisions
There are 2 addressing modes:
-
$800000-$BFFFFF
is used in scripts, because it allows accessing RAM, ROM and Hardware without switching banksROM
$xx0000-$xx7FFF
is inaccessible (memory-mapped hardware and WRAM) in this mode. -
$C0000-$FFFFFF
is used for data (or code)ROM
$FE0000-$FFFFFF
is inaccessible (mapped to WRAM)
and$xx8000-$xxFFFF
may be occupied by scripts (in 80-BF addressing)
This means in major portions of the ROM, we have interleaved data/code and scripts with 0x8000 block size.
see Data Crystal for existing ROM map
-
$b08000…$b0822a
: relocated alchemy drops (alchemy_rando_drops.txt) -
$b08280…$b082??
: trap item setup scripts (traps.txt) -
$b08300…$b0????
: jukebox (jukebox.txt) -
$b0ff00…$b0ff83
: sniffamizer drop setup scripts (1 per ingredient + iron bracer) -
$b18000…$b18950
: gourdomizer drop values (gourds.h) -
$b18951…$b1dfff
: gourdomizer added items/messages for looting (gourdomizer_drops.txt) -
$b1e000…$b1????
: re-enter colosseum holding room code (colosseum.txt) -
$f00000…$f07fff
: empty to allow 2p patch (code) -
$f10000…$f17fff
: patches to engine (code, call/jmp here from engine):-
$f10000
: weapon/attack experience modifier -
$??????
: update call bead flags (see RAM Layout)
-
-
$fd0000…2f
: 48B seed and settings (for auto-tracking), will be copied to$7e2600…2f
:- 8 bytes seed (64bit int in SNES byte order, so +0 is LSB, +7 is MSB)
- 3 bytes ASCII version (e.g.
040
) - 1 byte reserved
0
- 1 byte flags (
&1
= mystery,&0x80
= death link) - up to 35 bytes ASCII settings (null terminated)
-
$fd0030…3f
: reserved0
-
$fd0040…7f
: 64B multiworld seed and slot, will be copied to$7e2640…7f
:- 32 bytes UTF8 seed string (optional null termination)
- 32 byte UTF8 slot name (optional null termination)
-
$fd1000
: ASM code patched into$c084a3
to support multiworld -
$fd1100
: ASM for settings ROM->WRAM copy -
$fd8000
: Script scheduled by ASM above to support multiworld -
$fd8100
: Death Link script -
$fd8110
: Screen Shake script -
$fd8150
: Multiworld "clear state" script
see Data Crystal for existing RAM map
-
$7e2353
: 8 new loot flags ("Queen's Key on Boy" in vanilla)Gauge: &0x01 ^= 07d8 ← number to address in scripts Knight Basher: &0x02 ^= 07d9 First torso: &0x04 ^= 07da Second torso: &0x08 ^= 07db First arm prot: &0x10 ^= 07dc Second arm prot: &0x20 ^= 07dd First helmet: &0x40 ^= 07de Second hemlet: &0x80 ^= 07df
-
$7e225c
: 3 bits added (unused in vanilla?)Aquagoth defeated: &0x08 Volcano viper: &0x10 Monk defeated: &0x20
-
$7e227b
: 1 bit changedThird torso: &0x10 ^= 011c ← vanilla unreachable act3 chest
$7e2531…32
: will be used to extend market timer in v039 (unused trade good in vanilla)-
$7e2531…32
: reserved for energy core fragments -
$7e2533…56
: in use -
$7e2557…63
: free -
$7e2564…6b
: reserved (4 slot multiworld send queue; we'll most likely not use this) -
$7e256c…6d
: 4 4bit enums to determine which call bead spells should be visible in the auto-tracker; FIXME: chaos will still have to read the mapping -
$7e256e…6f
: will be used to extend market timer in v042? -
$7e2570…74
: 35 bits = 5 bytes for alchemy checks (set when checking alchemist, order of vanilla spells, required for multiworld) in v040 -
$7e2575…76
: multiworld "expected item index" for resync -
$7e2577…7f
: reserved for multiworld communication- 1B PC -> Game: Start transaction. Set to non-zero to schedule the script using the values below
- 2B PC -> Game: Received item index (Game should ignore the item if != expected and PC should resync)
- 2B PC -> Game: Amount
- 2B PC -> Game: In-game Item ID (Game clears this when ready for the next and increments "last received item index")
- 2B Game -> PC: reserved
-
$7e2600…2f
: will copy 48B from$fd0000…2f
: Game seed and settings (auto-tracking; for RA with snes9x core) -
$7e2630…3f
: 16B reserved -
$7e2640…7f
: will copy 64B from$fd0040…7f
: Multiworld seed and slot (for RA with snes9x core)
-
$7e2557
to$7e2833
seems to be unused - save file needs to grow by
7e2557-7e2533+whatever_we_need = 36+whatever_we_need
to be used for flags- 7e2531-32 are unused, but already part of SRAM save/load
- 36 bytes from 7e2533-56 are in use, but can probably be saved/restored to/from SRAM without side effects
- see above for how we map added bytes
- for now we reserve 32 bytes
$7e2557…76
, 19 bytes from the back occupied, 13 from front still free
-
$b08000…$b082ff
: alchemists' drops -
$b08300…$b80700
: jukebox (musicmizer) -
$b1d200…???
: special item drop setup scripts ("remote item") -
$b18951…???
: extended item drops (now includes alchemy and boss drops)
We allocate from back of the 8KB SRAM
-
$a07ffe…$a07fff
: Remote effect flag (1 = "DeathLink") (or$207ffe
, SRAM$1ffe
)