Professional Documents
Culture Documents
by creaothceann
1. Content
1. Content
2. Disclaimer
3. Revisions
4. Conventions
5. Savestates
6. File blocks
7. Unstructured file blocks
8.
Structured file blocks
9. Variables
2. Disclaimer
The information herein is provided as-is for anything you want. I tried to make it as accurate
as possible, but that might not mean much. And specifications can change at any time, too.
Nevertheless this document should be helpful, unless the savestate file format was _completely_
revamped since the last revision.
3. Revisions
4. Conventions
unsigned
=
unsigned 16-bit integer: $00..$000000000000FFFF
Demo Version
- ExpertPDF Software Components
=
unsigned 32-bit integer: $00..$00000000FFFFFFFF
=
=
=
=
"Array[x] of y" simply means: "x variables of type y without any padding bytes between them".
The structures listed here also have no empty space between their variables.
5. Savestates
SNES9x savestates (also called "freeze files" or "snapshots") have the filename extension
'.00x', with 'x' being a decimal digit ('0'..'9'). The files are usually compressed with GZIP;
they can be decompressed with tools like WinRAR. The GZIP library (and hence SNES9x) can also
handle uncompressed files.
At the beginning of the file there's a file header:
Signature
Colon
Version
LineFeed
:
:
:
:
Array[8] of Char
Char
Array[4] of Char
Char
"Signature" must be the string '#!snes9x', "Colon" must be ':', and "LineFeed" should be the
ASCII character #10. "Version" should be the decimal number string '0001'; otherwise the file
format itself would be a newer one.
The rest of the savestate is structured into file blocks of variable size.
6. File blocks
:
:
:
Array[3] of Char
Char
Array[6] of Char
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 1 / 19
Separator2
Data
:
:
Char
Array[Size] of Byte
"Name" identifies the file block type. "Separator1" and "Separator2" contain the ASCII character
#58 (colon ':'). "Size" is a decimal number string describing the number of bytes in the "Data"
part.
The standard file block order is like this:
block
block
block
block
block
block
block
block
block
block
block
block
block
block
block
block
block
01:
02:
03:
04:
05:
06:
07:
08:
09:
10:
11:
12:
13:
14:
15:
16:
17:
NAM
CPU
REG
PPU
DMA
VRA
RAM
SRA
FIL
APU
ARE
ARA
SOU
SA1
SAR
SP7
RTC
(if
(if
(if
(if
(if
(if
(if
(if
emulating
emulating
emulating
emulating
emulating
emulating
emulating
emulating
the
the
the
the
the
the
the
the
APU)
APU)
APU)
APU)
SA-1)
SA-1)
SPC7110)
SPC7110 RTC)
File readers should accept the blocks in any order though, even several blocks of the same type.
================================================================================================
ARA
FIL
NAM
RAM
SRA
VRA
(APU RAM)
(FillRAM)
(cartridge name)
(WRAM data)
(SRAM data)
(VRAM data)
7.1 ARA
=
Array[65536] of Byte
The "audio processing unit" (APU) RAM, which stores BRR-encoded samples and the program to play
them.
Note that read accesses to $FFC0..$FFFF can return either RAM as normal, or they can access the
content of the 64-byte "IPL ROM" that is responsible for data communications after a reset.
SNES9x handles that by defining a variable called "ExtraRAM" (see the APU file block), which is
used when RAM is selected.
7.2 FIL
=
Array[$0000..$7FFF] of Byte
In the SNES9x code, "FillRAM" is a pointer to 32 KB of scratch memory. Whenever the 65c816 does
a write access to addresses $xx:0000..$xx:7FFF, the value is also written into this array. With
"FillRAM" the developers can access registers by address rather than by name.
7.3 NAM
=
Array[?] of Char
A null-terminated string storing the filename of the cartridge ROM, as returned by the OS. The
block size is the length of the string plus the terminating byte (ASCII #0).
The string should not be treated as readable since there's no encoding. It's just used to detect
if the previously loaded ROM matches the currently loaded one.
7.4 RAM
=
Array[65536 * 2] of Byte
The "work RAM" (WRAM) data, usually accessed via banks $7E and $7F.
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 2 / 19
7.5 SRA
=
Array[65536] of Byte
7.6 VRA
=
Array[65536] of Byte
The "video RAM" (VRAM) data, which the SNES stores in two RAM chips.
In this savestate block the even-numbered bytes (0, 2, 4, ...) are from the first memory chip;
the odd-numbered bytes are from the second one. This is also how most other emulators, e.g.
ZSNES, do it. (The exception is Super Sleuth, which stores the content of the two chips in two
separate arrays.)
================================================================================================
The following block types contain variables, like a Pascal "record" or a C/C++ "struct":
8.01
8.02
8.03
8.04
8.05
8.06
8.07
8.08
8.09
8.10
8.11
APU
ARE
CPU
DMA
PPU
REG
RTC
SA1
SAR
SP7
SOU
(APU status)
(APU registers)
(CPU status)
(DMA/HDMA channels)
(PPU status)
(CPU registers)
(SPC7110 RTC status)
(SA-1 status)
(SA-1 registers)
(SPC7110 status)
(sound data)
Variables consisting of multiple bytes must be stored in big-endian format. (Just for the
record, the x86/Windows platform is little-endian.)
:
:
:
:
:
:
:
:
:
:
:
DWord
Boolean
Byte
Byte
Array[ 4]
Array[128]
Array[ 64]
Array[ 3]
Array[ 3]
Array[ 3]
Array[ 3]
of
of
of
of
of
of
of
Byte
Byte
Byte
Word
Word
Boolean
Boolean
8.2 ARE
The "APU registers", i.e. the registers of the Sony "SPC700" audio processor.
P
YA
X
S
PC
:
:
:
:
:
Byte
Word
Byte
Byte
Word
8.3 CPU
The status of the main processor "Ricoh 5A22", which is based on WDC/GTE's "65c816" core.
Flags
BranchSkip
:
:
DWord
Boolean
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 3 / 19
NMIActive
IRQActive
WaitingForInterrupt
WhichEvent
Cycles
NextEvent
V_Counter
MemSpeed
MemSpeedx2
FastROMSpeed
:
:
:
:
:
:
:
:
:
:
Boolean
Boolean
Boolean
Byte
DWord
DWord
DWord
DWord
DWord
DWord
8.4 DMA
The "DMA" file block consists of 8 sub-structures, one for each DMA/HDMA channel. They look like
this:
TransferDirection
AAddressFixed
AAddressDecrement
TransferMode
ABank
AAddress
Address
BAddress
TransferBytes
HDMAIndirectAddressing
IndirectAddress
IndirectBank
Repeat
LineCount
FirstLine
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
Boolean
Boolean
Boolean
Byte
Byte
Word
Word
Byte
Word
Boolean
Word
Byte
Byte
Byte
Byte
8.5 PPU
The status of the two PPU (picture-processing unit) chips, and some joypad and mouse data.
BGMode
BG3Priority
Brightness
VMA
BG
CGFLIP
CGDATA
FirstSprite
OBJ
OAMPriorityRotation
OAMAddr
OAMFlip
OAMTileAddress
IRQVBeamPos
IRQHBeamPos
VBeamPosLatched
HBeamPosLatched
HBeamFlip
VBeamFlip
HVBeamCounterLatched
MatrixA
MatrixB
MatrixC
MatrixD
CentreX
CentreY
Joypad1ButtonReadPos
Joypad2ButtonReadPos
Joypad3ButtonReadPos
CGADD
FixedColourRed
FixedColourGreen
FixedColourBlue
SavedOAMAddr
ScreenHeight
WRAM
ForcedBlanking
OBJNameSelect
OBJSizeSelect
OBJNameBase
OAMReadFlip
VTimerEnabled
:
Byte
Demo Version
- ExpertPDF Software Components
:
Boolean
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
Byte
1 "VMA" structure
4 "BG" structures
Boolean
Array[256] of Word
Byte
128 "OBJ" structures
Boolean
Word
Boolean
Word
Word
Word
Word
Word
Byte
Byte
Boolean
Word
Word
Word
Word
Word
Word
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Word
Word
DWord
Boolean
Word
Byte
Word
Boolean
Boolean
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 4 / 19
HTimerEnabled
HTimerPosition
Mosaic
Mode7HFlip
Mode7VFlip
Mode7Repeat
Window1Left
Window1Right
Window2Left
Window2Right
ClipWindowOverlapLogic
ClipWindow1Enable
ClipWindow2Enable
ClipWindow1Inside
ClipWindow2Inside
CGFLIPRead
Need16x8Mulitply
BGMosaic
OAMData
Need16x8Mulitply_2
MouseSpeed
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
Boolean
Word
Byte
Boolean
Boolean
Boolean
Byte
Byte
Byte
Byte
Array[6] of Byte
Array[6] of Boolean
Array[6] of Boolean
Array[6] of Boolean
Array[6] of Boolean
Boolean
Boolean
Array[4] of Boolean
Array[544] of Byte
Boolean
Array[2] of Byte
8.6 REG
:
:
:
:
:
:
:
:
:
Byte
Byte
Word
Word
Word
Word
Word
Word
Word
8.7 RTC
reg
index
control
init
last_used
:
:
:
:
:
Array[16] of Byte
Word
Byte
Boolean
DWord
8.8 SA1
:
:
:
:
:
:
:
:
:
DWord
Boolean
Boolean
Boolean
Word
Word
DWord
Int64
Boolean
8.9 SAR
:
:
:
:
:
:
Byte
Byte
Word
Word
Word
Word
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 5 / 19
X
Y
PC
:
:
:
Word
Word
Word
8.10 SP7
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
DWord
DWord
DWord
Array[65536] of Byte
8.11 SOU
The status of the APU's DSP. On the SNES, these settings are accessed by the SPC700 by writing
to address $00F2 (selects a DSP address) and reading/writing $00F3 (reads/writes a DSP register
value).
master_volume_left
master_volume_right
echo_volume_left
echo_volume_right
echo_enable
echo_feedback
echo_ptr
echo_buffer_size
echo_write_enabled
echo_channel_enable
pitch_mod
:
:
:
:
:
:
:
:
:
:
:
Word
Word
Word
Word
DWord
DWord
DWord
DWord
DWord
DWord
DWord
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 6 / 19
dummy
channel
:
:
Array[3] of DWord
8 "SoundChn" structures
================================================================================================
9. Variables
9.2 [ARE] P
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 7 / 19
9.2 [ARE] YA
9.2 [ARE] X
9.2 [ARE] S
9.2 [ARE] PC
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 8 / 19
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 9 / 19
9.5 [PPU] BG
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 10 / 19
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 11 / 19
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 12 / 19
9.6 [REG] PB
9.6 [REG] DB
9.6 [REG] P
9.6 [REG] A
9.6 [REG] D
9.6 [REG] S
9.6 [REG] X
9.6 [REG] Y
9.6 [REG] PC
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 13 / 19
9.9 [SAR] PB
9.9 [SAR] DB
9.9 [SAR] P
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 14 / 19
9.9 [SAR] A
9.9 [SAR] D
9.9 [SAR] S
9.9 [SAR] X
9.9 [SAR] Y
9.9 [SAR] PC
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 15 / 19
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 16 / 19
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 17 / 19
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 18 / 19
0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
Sample footer: http://vsnes.aep-emu.de/SNES9x savestate file format.htm. You can change color, font and other options
Page 19 / 19