# SCSI and the CD ## The parts - Controller: AMD 33C93A-16, a second source of the Western Digital WD33C93A `[mame]`. The data book is pinned (`reference/docs/wd33c93a-1991.pdf`, tier 2). Read in this phase: the register map (section 6.1), the address register and indirect addressing (6.2.2), the clock divisor (6.2.3). The command set (section 7 onward) is the CD milestone's reading. - Drive: a Panasonic/Matsushita CR504 4× SCSI CD-ROM `[mame]`, on the 50-pin connector CN6. - MAME puts the CD at SCSI ID 1 and the controller at ID 7, clocked at 10 MHz (the real clock source was not traced: U10). ## CPU interface `05140000-05140003`, odd bytes only `[mame]`: the WD33C93's indirect mode. | Address | Read | Write | | --- | --- | --- | | `05140001` | auxiliary status | register address | | `05140003` | the addressed register | the addressed register | `[WD]` 6.2.2: with ALE grounded (indirect addressing) a write with A0 = 0 loads the address register, a read with A0 = 0 returns the auxiliary status, and an access with A0 = 1 reaches the addressed register; **after every A0 = 1 access the address register increments, except at the auxiliary status, data (`19`) and command (`18`) registers**. Reading an undefined register returns all ones. Registers `00`-`19` as in the data book's table 6.1 (own ID/CDB size, control, timeout, the CDB bytes `03`-`0E`, target LUN, command phase, synchronous transfer, transfer count `12`-`14`, destination ID, source ID, SCSI status `17`, command `18`, data `19`). Clock: the Own ID register's FS1-FS0 select a divisor for an 8-10 MHz (/2), 12-15 MHz (/3) or 16 MHz (/4) input `[WD]`. MAME clocks the device at 10 MHz; the board's source is not traced. The value the BIOS writes to register `00` before its reset command names the range it expects (U10; visible in a MAME run with `wd33c9x` logging). No interrupt line from the controller is wired in MAME's driver; the BIOS polls the auxiliary status register. Whether the chip's INT or DRQ reach the CPU on the board is U10. MAME's own model is a full `wd33c9x` device on its `nscsi` bus. JTCPS3's WD33C93 is a stub: the FPGA core runs NO CD sets only (its README says so; the stub itself `[jt]`, HYPOTHESIS). ## What the BIOS asks of the drive `[rom]` From its messages: test unit ready ("DRIVE NOT READY", "SCSI DEVICE IS NOT CONNECTED"), inquiry ("DEVICE INFORMATION"), read TOC or capacity, read sectors ("READING DISK...", "READING DIRECTORIES..."), and start/stop with eject ("Now ejecting the CD-ROM"). The exact command bytes were not traced; a MAME run with `wd33c9x` logging turned on would list them (planned in the CD milestone, not run here). ## The disc One data track, ISO 9660, no audio tracks `[ran]` (`cap-sf3-3`: 22,792 frames). The file layout is in [boot.md](boot.md). 19 CHDs are in the local MAME CHD tree: 11 game discs and 8 bootleg discs ([census.md](census.md)). All are CHD version 5 with one data track. Nine game discs store MODE1_RAW (2,352-byte) sectors, two (`cap-jjk-3`, `cap-jjm-0`) cooked MODE1 (2,048-byte). The hunk map (`chdman info -v`) shows **CD-FLAC-coded hunks in two game discs (one each) and in all eight bootleg discs**, and hunks stored as copies of other hunks. A CHD reader built on Python's standard library (LZMA, Deflate) would fail on those discs; it needs a FLAC decoder too (U11, answered). ## How the family reads discs today `segacd-python` (`src/segacd_python/disc.py`, at `86460e5`): a CUE + BIN reader for Redump's one-file-per-track images, raw sectors, a zip unpacked once under its `runs/`. No CHD: that is still an open decision there. `pcenginecd-python` has the same need. None of that code may be copied; a shared reader is open decision 6. Until that is decided, this board reads **BIN/CUE made by `chdman extractcd`** into a git-ignored directory (which removes the codec question and gives one sector format), and (better, see [boot.md](boot.md)) usually needs no disc at all.