Many early Mega Drive dumps are in the form written by the Super Magic Drive, a game
copier, usually with the extension .smd. No specification of the copier’s
format was found. What follows is what emulator loaders (DGen’s) and the
file command’s magic rules rely on, which is enough to convert such a file
to a plain ROM; the meaning of most header bytes is unknown.
Layout
0header512 bytes0x200block 0: ROM bytes0x0000–0x3FFF, interleaved16 KiB0x4200block 1: ROM bytes0x4000–0x7FFF16 KiB…one block per 16 KiB of ROM16 KiB each
Header
| Offset | Size | Meaning |
|---|---|---|
0 | 1 | Number of 16 KiB blocks in this file. (DGen does not rely on it and works the count out as (file size − 512) ÷ 16384.) |
2 | 1 | Split flag: 0 for a standalone file or the last of a series; non-zero for a part of a split ROM. (A note on the copier’s BIOS calls bit 6 of a header status byte the multi-file flag.) |
8 | 2 | AA BB, the marker that identifies the header. |
10 | 1 | Image type, shared with other copiers of the same family: 0x06 Sega Magic Drive image, 0x07 Sega Magic Drive save RAM (and 0x02–0x05 for Magic Griffon and Super Wild Card files). |
| others | — | Unknown. |
How the parts of a split ROM fit together is not described in the sources read for this page.
Interleaving
The copier stored each 16 KiB block as two halves: the first 8 KiB holds the bytes at odd addresses and the second 8 KiB the bytes at even addresses. For byte j (0 to 8191) of block n:
rom[n × 16384 + 2j + 1] = block[j] first half → odd addresses
rom[n × 16384 + 2j] = block[8192 + j] second half → even addresses
This is why the text SEGA GENESIS at ROM address 0x100
shows up in an SMD file as EAGN at offset 0x280 (512 for the
header plus 0x80, the odd bytes 0x101, 0x103,
0x105, 0x107), and SEGA MEGA DRIVE as
EAMG. Together with AA BB at offset 8, that is how the
file command recognises an SMD image.
Converting to a plain ROM
- Check for
AA BBat offset 8 (and, if wanted,EAGNorEAMGat0x280). - Drop the first 512 bytes.
- For each 16 KiB block, interleave its two halves as above.
- The result is an ordinary
.md/.binimage whose header is at0x100.
A plain ROM is told apart by finding SEGA at 0x100, where
an SMD file has header bytes.
Sources
- romload.c – DGen’s ROM loader: the
AA BBtest at offset 8, the block count and the de-interleaving loop - Magdir/console – the
filecommand’s magic rules: block count, split flag,EAGN/EAMGat0x280 - Super Magic Drive BIOS notes – Spritesmind: the multi-file bit
- SWC header – Archaic Ruins’ notes on the Super Wild Card header, which list the image types of the Magic Drive and related copiers