Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Mega Drive ROM image

From ReverseEngineering.wiki
Format
Platforms Platform:Sega Mega Drive
Magic "SEGA" at 0x100 (e.g. "SEGA MEGA DRIVE " or "SEGA GENESIS ")
Extensions .md, .gen, .bin, .smd
Endianness big
On this wiki Facts · Code · Notes · Topics

Cartridge dump of the Sega Mega Drive / Genesis (.md, .gen, .bin): a 68000 vector table at 0x000-0x0FF followed by a 256-byte header at 0x100 whose console field starts with "SEGA" and which holds titles, serial, checksum, I/O support, ROM/RAM ranges, SRAM info and region codes.

Layout

All values are big endian (68000). 0x000-0x0FF is the vector table (initial SSP at 0x000, initial PC at 0x004, then the exception vectors; level 4/6 interrupts are horizontal and vertical blank). 0x100-0x1FF is the header (SGDK's ROMHeader struct, all fields ASCII, space padded):

Offset Size Field
0x100 16 console name: begins with SEGA; SEGA MEGA DRIVE , SEGA GENESIS , SEGA SSF (SSF mapper, bank switching), SEGA MEGAWIFI
0x110 16 copyright / release, e.g. (C)XXXX 2024.JAN
0x120 48 domestic (Japanese) title
0x150 48 overseas title
0x180 14 serial: type (GM game, AI educational), space, 8-character number, -, 2-digit revision
0x18E 2 checksum
0x190 16 I/O support (J 3-button pad, 6 6-button, M mouse ...)
0x1A0 4 ROM start (usually 0)
0x1A4 4 ROM end (last byte; 0x000FFFFF for 1 MiB; 0x003FFFFF with the 4 MiB SSF mapper)
0x1A8 4 RAM start (0xE0FF0000)
0x1AC 4 RAM end (0xE0FFFFFF)
0x1B0 2 RA if the cartridge has SRAM
0x1B2 2 SRAM type, 0xF820 = odd bytes (0xF020 even, 0xE840 16-bit EEPROM style)
0x1B4 4 SRAM start (normally 0x00200001)
0x1B8 4 SRAM end
0x1BC 12 modem support
0x1C8 40 notes
0x1F0 16 region: letters J, U, E (or a hex digit bit mask in newer dumps)

Checksum

The checksum at 0x18E is a 16-bit wrap-around sum of the big-endian words from 0x200 to the end of the ROM. Genesis Plus GX sums from 0x200 up to the size of the loaded file (not the ROM-end header field) and compares with the stored big-endian word (see Fact:Mega Drive ROM image/behavior/Checksum computed by Genesis Plus GX); it uses the result only to recognise a few games with wrong headers. Unverified: that the real console boot code compares it only in some regions (community knowledge, not read in a source). Pitfall: SGDK's sizebnd tool (-checksum, "SGDK checksum format") XORs all 32-bit words of the whole file (with the checksum bytes zeroed) and folds high into low half, so a checksum from an SGDK build will not equal the word sum.

Region, SRAM and variants: the region field at 0x1F0 is parsed as letters (J, U, E, K counts as Japan) or as a hex digit bit mask (1 Japan NTSC, 2 Japan PAL, 4 USA, 8 Europe), see Fact:Mega Drive ROM image/behavior/Region field parsing. The SRAM field at 0x1B0 is RA plus two flag bytes and start/end addresses, see Fact:Mega Drive ROM image/struct/Backup RAM header at 0x1B0. 32X cartridges are Mega Drive ROMs with SEGA 32X in the console field (Fact:Mega Drive ROM image/identification/32X cartridge identification); Sega CD discs are described on Format:Sega CD disc image. Interleaved .smd dumps and 512-byte copier headers: Fact:Mega Drive ROM image/behavior/Copier header and SMD deinterleave. PicoDrive's cartridge detector also accepts SEGA or SEG at 0x100 and otherwise falls back to the file extension or the reset vector (pico/media.c lines 105-175 at 63fa85c41821).

Identification

  • 53 45 47 41 ("SEGA") at 0x100 distinguishes the Mega Drive; interleaved .smd dumps (Super Magic Drive) have a 512-byte header and 16 KiB blocks with even and odd bytes split: the "SEGA" is then not visible at 0x100.
  • ROM end field minus start plus one gives the real ROM size for trimming overdumps.

Evidence and references

SGDK (MIT) inc/sys.h ROMHeader, project/template/src/rom_header.c, tools/sizebnd Launcher.java. The checksum word-sum rule and the interleaved .smd format are from general community knowledge, not verified in the repository here.

See Platform:Sega Mega Drive.

Code & repositories

  • https://github.com/Stephane-D/SGDK @ ee6870a6010b1e341ca36078f581a68a26c9a543 · license: MIT
    Sega Mega Drive SDK (MIT): ROMHeader struct, rom_header.c template, sizebnd checksum tool
    Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-10-18; Note: the latest release ships binaries; the wiki links only the source, never the binaries
  • https://github.com/ekeeke/Genesis-Plus-GX @ 49c584764893b0505ac7f768a754f97330fa4392 · license: LicenseRef-Genesis-Plus-GX-NonCommercial (declared by the contributor; GitHub's detector did not recognize LICENSE.txt)
    Mega Drive/Master System/Sega CD emulator (non-commercial licence): core/loadrom.c header parsing, core/cart_hw/sram.c, core/cd_hw/cdd.c
    Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-06
  • https://github.com/irixxxx/picodrive @ 63fa85c41821b395f4d06cb9b751570c6b17a331 · license: LicenseRef-PicoDrive-NonCommercial (declared by the contributor; GitHub's detector did not recognize COPYING)
    PicoDrive emulator (non-commercial licence): media.c cart type detection, 32X registers, Sega CD detection
    Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-16; Note: the latest release ships binaries; the wiki links only the source, never the binaries