Introduction
A .md or .gen file is a copy of the ROM in a cartridge for
Sega’s Mega Drive, sold in North America as the Genesis, for playing in an emulator.
Like a Game Boy ROM, it is the cartridge’s contents exactly, with no header added by the
dumping tool. Many files are also simply named .bin.
An older form, .smd, comes from the Super Magic Drive copier: it adds a
512-byte header and stores the ROM in interleaved 16 KB blocks, so it must be converted
before most tools can read it.
Structure
The console’s 68000 processor starts by reading the first 256 bytes, its vector table:
the initial stack pointer, the address to start running at, and the handlers for
interrupts and errors. The cartridge header follows at 0x100, written as
text padded with spaces. It begins with the console name, SEGA MEGA DRIVE
or SEGA GENESIS ; later models of the console check for
SEGA there before running a game. All numbers are big-endian. Every vector
and header field, with the device, region and save-memory codes, is on
vectors and ROM header; the
SMD copier files page explains the
.smd header and interleaving.
0x00068000 vector table: stack pointer, start address, interrupts256 bytes0x100console name16 bytes0x110copyright and release date16 bytes0x120domestic title, then overseas title96 bytes0x180serial number and version14 bytes0x18Echecksum2 bytes0x190supported controllers and devices16 bytes0x1A0ROM and RAM address ranges, save RAM details28 bytes0x1BCmodem details and notes52 bytes0x1F0region codes16 bytes0x200the game’s code and datavaries
In the explorer
Drop a .md, .gen, .smd or .mdx file on the explorer. A .md file is opened as a Mega Drive ROM only when
it has a signature (SEGA at 0x100, ESAG in a byte-swapped dump at 0x100 or 0x80100, an interleaved SEGA after 512 bytes, or the
whole-file interleave’s EA at 0x80) and the Mega Drive reader accepts the file; otherwise it is read as
Markdown. A .bin file (many other kinds of file use that name) is opened as a Mega Drive ROM by the same signatures and the same strict check, and otherwise keeps whatever it was taken for before (an ELF or Mach-O file, say). The viewer reads
the plain ROM and four wrappers around it: the SMD copier file, the whole-file interleave, the
MDX file and the byte-swapped dump. It shows:
- the 64 vectors by name, with the first instruction at each handler decoded (the V-blank handler is vector 30, the H-blank handler vector 28);
- every header field, with the checksum verified (the sum of the big-endian words from
0x200to the end) and the ROM range checked against the file; - an
.smdfile de-interleaved: the 512-byte header and each 16 KB block with its odd bytes first and its even bytes second; a whole-file interleave and an.mdxfile decoded (their trees show the container, the sections show the ROM); - tables of the memory map, the hardware registers and the VDP registers (each described on its page), and the SSF2 bank option;
- the program disassembled with the 68000 decoder, with the reset and interrupt targets labelled and the hardware named
(
vdp_controlfor$C00004,z80_busreqfor$A11100,tmss_segafor$A14000); - options: container (auto, plain, SMD), byte order (auto, as stored, swapped), the SSF2 bank to show for a ROM over 4 MiB and the window it appears in, the register names and syntax of the 68000 text, and an optional Z80 sound program at a ROM offset and length that you enter: the ROM does not say where it is, so nothing is guessed, and it is disassembled with the Z80 decoder.
Not described
Known, not yet covered
- Viewer, real files: checked against seven public homebrew cartridge ROMs (no commercial dump was available) and against ROMs built for the tests; the SMD container,
the whole-file interleave,
.mdxand the byte-swapped form were tested only on files converted from those ROMs by rules taken from Genesis Plus GX and MAME, because no real file in those forms was found. The SSF2 bank option has not been run on a real over-4-MiB cartridge; the Z80 sound program is disassembled only where you give its offset and length (nothing is guessed); Sega CD, 32X and Pico programs are not decoded; no browser check of the new pages and options has been made. - Reference, sources: every page rests on community sources (Plutiedev, emulator source code, a 2000 text on the SSF2 mapper); Sega’s own manuals (the Genesis technical overview and software manual) were not read.
- Reference, hardware: the pages do not describe the VDP’s drawing (tile, plane, sprite and colour formats, priorities, shadow and highlight, DMA timing, the HV counter’s values), the YM2612 and PSG registers, the controller protocols (3-button and 6-button reading), the Z80 side in detail, the $A11000 memory-mode register, the other bytes of the TMSS range, the registers of the Mega CD, 32X and SVP chips, or any mapper other than the Sega (SSF2) one, the SRAM switch and the multi-game mapper (the SF-001/002/004, T-5740, Realtec, Radica, flash and lock-on mappers are only named).
Unknown
- Reference: what the modem codes 80 and 90 mean, the SMD copier header bytes other than 0, 2 and 8 to 10, the 4 header bytes of an
.mdxfile and whether it has a trailing byte, where the whole-file interleave comes from, what bits 4 to 0 of the version register count on real consoles, and whether the TMSS acceptsSEGAat0x101: none of these is stated in the sources read, and Sega’s own manuals were not among them (header, SMD, MDX, registers).
Also used for
- Markdown – Readable plain text with light marks for headings, emphasis, lists and links.
Links
Software
- BlastEm – accurate Mega Drive emulator (Windows, macOS, Linux)
- Genesis Plus GX – Sega console emulator, mostly used as a RetroArch core (Windows, macOS, Linux)
- RetroArch – front end that plays them with a Mega Drive core (Windows, macOS, Linux, mobile)
Reference
- ROM header reference – Plutiedev’s field-by-field guide to the cartridge header
- Memory map, VDP registers, I/O ports, Going beyond 4MB – Plutiedev’s guides behind the memory map, VDP, register and mapper pages
- loadrom.c – Genesis Plus GX’s ROM loader: the rules for the SMD header, byte-swapped dumps and
.mdx - md_slot.cpp – MAME’s Mega Drive cartridge slot: the SMD and whole-file interleave loaders