# The GD-ROM drive: high level or low level Sources: Comstedt *gdrom*, *ip.bin*, *ip0000.bin*, *cdr*, *syscalls* (tier 3); KOS `g1ata.c`, `g1ata.h`, `cdrom.c`, `cdrom.h`, `syscalls.h` (tier 3); the Redump set's cue sheets and IP.BIN headers (census.md); MAME's `gdrom` device (tier 5). ## The disc A GD-ROM has two regions separated by a ring: an inner single-density area readable in any CD drive (Redump's cues show a Mode 1 data track and an audio track there), and the outer **high-density area** with the game's data and CD-DA tracks (Comstedt *gdrom*). Redump writes the two areas into one cue sheet with `REM SINGLE-DENSITY AREA` and `REM HIGH-DENSITY AREA` lines (census.md); where the high-density area starts on the disc (a fixed sector address the drive reports in its TOC) is U17, since Redump's bin files carry no absolute addresses. The boot strap **IP.BIN** is the first 16 sectors of the last data track (the high-density area's first data track on a GD-ROM; the last session's data track on a MIL-CD) and the boot ROM loads it to 8C008000, then the boot file (1ST_READ.BIN or as named) to 8C010000 (Comstedt *ip.bin*). MIL-CDs (89 of the 1,509 Redump discs) are multi-session CD-ROMs whose boot file the boot ROM descrambles (Comstedt *ip.bin*: "scatter-loaded in a pseudo-random manner"). ## The drive as the console sees it KOS `g1ata.c`: "the GD-ROM drive is actually just an ATA device that implements a different packet command set than the normal ATAPI set". Its ATA registers are at 005F7000 (G1), its data goes by PIO through the data register or by G1 DMA into system RAM, with event 0100h (command status) and 000Eh (DMA done). The packet command set (Sega calls it SPI; KOS's comment names "my own SPI CD Player program") is not in any document we hold in full (U18). Games do not drive it themselves: they call the boot ROM's GD-ROM system calls (KOS `cdrom.c` uses `syscall_gdrom_send_command`, `syscall_gdrom_exec_server`, `syscall_gdrom_check_command`), and the boot ROM's driver ("the gdc server") talks ATA packets to the drive. Before that, the boot ROM unlocks the G1 ATA bus (KOS's `G1_ATA_BUS_PROTECTION` registers; MAME logs "Unlocking GD-ROM" in the first frame). ## The three levels | Level | What runs | What is modelled | Cost | Evidence available | | --- | --- | --- | --- | --- | | **BIOS HLE** | not the boot ROM's GD-ROM code: the emulator answers the system calls itself | the syscall interface (command queue, status, read into RAM) | a re-implementation of part of Sega's firmware; games that bypass the syscalls (some do their own ATA) fail | KOS's syscall wrapper, Comstedt *syscalls*: the interface, not the behaviour | | **Drive HLE** (recommended) | the player's boot ROM, unchanged, including its gdc server and its G1 unlock | the drive's ATA registers, its packet commands as functions (status, mode, TOC, session info, read sectors by PIO or DMA, CD-DA play, the security/authentication exchange), and its timing as FITTED seek and transfer tables | moderate: the packet set has a few dozen commands | the boot ROM itself as the test (it must accept the disc); MAME as detector; KOS and Comstedt for registers | | **Drive LLE** | the drive's own microcontroller and its firmware | the drive's CPU, servo, decoder | a dump of the drive firmware, its CPU's core, and a model of the mechanics | none we know of: no drive firmware dump in MAME's sets or our library (U19) | **Recommendation (open decision 4): drive HLE.** It keeps the console's own software running end to end (the boot ROM is the program that judges the board, as the System Card does for pcenginecd-python), keeps the board's boundary at a real hardware interface (ATA registers and G1 DMA), and needs no firmware we do not have. BIOS HLE stays out of the specification (it would put Sega's firmware behaviour into our code without evidence); it could exist later as a named concession in a turbo tier for players without a boot ROM, which is a policy question for Aubrey. Drive LLE is not possible on current evidence. A socket (`GdromPort`) at the ATA register level lets a later model replace the HLE drive without touching the board, the shape pcenginecd-python and saturn-python use for their CD subsystems. ## What the disc census says about formats All 1,509 Redump Dreamcast discs are bin/cue with raw 2,352-byte sectors; the GD-ROMs' boot tracks are MODE1/2352, the MIL-CDs' MODE2/2352 (census.md). GDI files (the common emulator format) and CHD are other packagings of the same tracks; the board reads Redump bin/cue first, GDI and CHD through readers later (pcenginecd-python and segacd-python read CHD). ## Unknowns U17 the high-density area's start sector and its sector layout; U18 the packet command set in full; U19 a drive firmware dump; U20 seek, spin-up and transfer timing (FITTED, one table); U21 the security check's exchange (what the boot ROM asks the drive, and what a GD-ROM answers that a CD-R does not).