Introduction
A .sms file is a copy of the ROM in a cartridge or card for Sega’s Master
System (and its Japanese forerunner, the Mark III), for playing in an emulator or writing to
a flash cartridge. Game Gear games are the same kind of file, named .gg, and
SG-1000 games, from the console before the Master System, are .sg. There is
no header added by the dumping tool: the file is the ROM, in 16 KB pages, and the program
it holds runs on a Zilog Z80. Some copiers put 512 bytes in front of the ROM, which readers
skip.
Many games also carry a 16-byte Sega header, which this site reads. The export Master System and later Game Gear BIOSes will not start a cartridge without it, but Japanese consoles and many homebrew programs have none, and neither does the SG-1000.
Structure
The Z80 sees the ROM through three 16 KB slots at 0x0000, 0x4000
and 0x8000; a ROM larger than 48 KB is switched in by a mapper chip on the
cartridge (see mappers). Execution starts at
0x0000, and the maskable interrupt and the non-maskable interrupt go to
0x0038 and 0x0066, so these always sit in the first page
(memory map). The Sega header is the last 16
bytes of the first 8, 16 or 32 KB: the BIOS looks for it at 0x7FF0, then
0x3FF0, then 0x1FF0, and only 0x7FF0 is seen in
known software. It holds the text TMR SEGA, a checksum, the product code, the
version, the region and the ROM size, all described on the
Sega header page.
0x0000entry, restart vectors, maskable interrupt at0x0038, NMI at0x0066first KB0x0400the program and datavaries0x7FF0“TMR SEGA”, reserved bytes10 bytes0x7FFAchecksum (little-endian)2 bytes0x7FFCproduct code and version2.5 bytes and 0.50x7FFFregion (high nibble) and ROM size (low nibble)1 byte0x8000the rest of the game, in 16 KB pagesvaries
Game Gear
A Game Gear ROM is the same format: the same Z80, the same header and checksum, the same
Sega mapper. The header’s region code says which console it is for (5 Game Gear
Japan, 6 Export, 7 International, against 3 and
4 for the Master System), and the Game Gear BIOS requires the
TMR SEGA text but, as far as SMS Power says, does not check the region or the
checksum. The differences that matter to a reader are the ports: ports
0x00 to 0x06 are Game Gear specific (the Start button, the serial
port and the stereo control), and the Game Gear screen is 160 × 144 pixels where the Master
System’s is 256 × 192 (the figures JSSMS uses). See ports.
For that reason Game Gear ROMs share these pages with the Master System instead of having
their own, as .gbc shares the Game Boy pages.
SG-1000 and SC-3000
The SG-1000 (and the SC-3000 computer built on it) has the same Z80, VDP and sound chip but
no Sega header and no standard mapper in the common case. A .sg file is read as
plain ROM from 0x0000. SMS Power’s pages give its port map only in part and no
RAM size, and the SC-3000’s keyboard ports not at all, so these pages do not describe them.
.sc files (SC-3000) are not read here: the extension is used by other formats.
Not described
The Sega header, the mappers, the memory map and the ports and VDP registers are written. What remains:
- Viewer: the explorer opens
.sms,.ggand.sgfiles: the header found where the BIOS looks, its fields, the checksum computed the BIOS’s way, the 16 KB pages, the vectors, the mapper registers, the ports, and the code of the three slots disassembled for the Z80 with the mapper registers and the ports named. The mapper (Sega, Codemasters or Korean) and the page in each slot are your choice in the options bar; the file does not say, and nothing is guessed. It does not follow code from the entry point (all bytes are decoded as instructions), does not separate code from data, and shows one page per slot, not the pages a running program would map. It was tested on built ROMs and on six homebrew files (one with a real header), not on a commercial ROM, and has not been run in a browser by its author. - Reference: the bits of the Game Gear ports
0x00to0x05, the SG-1000 and SC-3000 RAM and keyboard ports, the PSG and the VDP’s drawing, the 3-D glasses registers, light phaser and the other mappers (the MSX and Nemesis, the Janggun mapper are named on the mapper page but not modelled in the viewer), and the 512-byte copier header, whose rule here is the common convention and is not taken from a specification.
Links
Software
Reference
- ROM Header – SMS Power, the Sega header
- BIOSes – SMS Power, where each BIOS looks for the header and how it checks the checksum
- Mappers – SMS Power
- Memory Map – SMS Power