Introduction
A .sfc file is a copy of the ROM in a cartridge for the Super Nintendo
Entertainment System, known in Japan as the Super Famicom, for playing in an emulator.
The older extension .smc comes from the Super Magicom, a 1990s copier that
loaded games from floppy disk. Copiers like it put a 512-byte header of their own in
front of the ROM, so .smc files often carry one, while .sfc
files are normally the plain ROM.
Structure
The ROM holds an internal header written by the game’s developer. Where it sits
depends on how the cartridge maps its ROM into the console’s memory: at
0x7FC0 in the file for LoROM games and 0xFFC0 for HiROM
games. Emulators find it by checking both places for a header that makes sense, and
detect a copier header when the file size divided by 1024 leaves 512.
+0x00title, in capitals, padded with spaces21 bytes+0x15map mode: LoROM, HiROM and speed1 byte+0x16cartridge type: RAM, battery and extra chips1 byte+0x17ROM size and RAM size, as powers of two in KB2 bytes+0x19region, developer ID, version3 bytes+0x1Cchecksum complement, then checksum4 bytes+0x20the processor’s interrupt and reset vectors32 bytes
The checksum is the 16-bit sum of every byte in the ROM, and the complement is that
value with all its bits flipped, so the two always add up to 0xFFFF. Every
field and code, the ExHiROM location and the interrupt vectors are on the
internal header page; detecting and reading
the 512-byte copier header is on copier
header. How the ROM appears to the processor is on the
memory map page, the register names the disassembly uses on
hardware registers, and the processor itself, the
65816, has its own reference.
Not described
Known, not yet covered
- Reference: the developer ID register (the publisher names behind each value), the vectors at
$FFE0–$FFE3and$FFF0–$FFF3(unused), SWC copier header bytes 3 to 7 and bits 0 and 3, the Pro Fighter and Game Doctor headers, and interleaved and split ROM formats, from the SNES documentation that covers them; see header and copier. The co-processor boards’ own memory maps (SA-1, Super FX, S-DD1, SPC7110) are not described: see the memory map. - Viewer: the explorer opens
.sfcand.smcfiles: the copier header (found from the size), which of the three header positions holds a believable header (scored, with the reasons shown; the Copier header and Map mode options override it), every header field, the checksum verified against the ROM (a ROM that is not a power of two is mirrored as the cartridge shows it), the native and emulation vectors with the first instruction each reaches, the banks, the hardware registers, and the code of the banks the reset, NMI and IRQ vectors lead into plus one chosen bank, disassembled for the 65816. The starting M and X widths cannot be known from the bytes, so they are options (emulation mode by default, as a reset); the disassembly followsrep,sepandxceas it goes and says where it cannot know (the M and X flags). It decodes every byte as code (no code and data separation), does not follow jumps, models no co-processor board, and does not know the extensions.swcand.fig(the first is also the Flash component file). It was checked on 12 real ROMs and built files, and against the LakeSnes emulator’s loader and memory map; two of the real ROMs have checksums that do not match their bytes, and are reported so. It has not been run in a browser by its author.
Links
Software
- Snes9x – long-standing SNES emulator (Windows, macOS, Linux)
- bsnes – accuracy-focused SNES emulator (Windows, macOS, Linux)
- Mesen – multi-system emulator with SNES support and debugging tools (Windows, macOS, Linux)
- RetroArch – front end that plays them with a SNES core (Windows, macOS, Linux, mobile)
Reference
- ROM header – SNESdev Wiki’s description of the internal header