# The CD subsystem and audio: CDIC (Mono-I), and its successors Sources: cdichips `ims66490cdic.md` (CD-i Fan; no licence: facts only), cdinotes (Ryan Holtz, MIT: the system ROM's CDIC/DMA driver reconstructed), the Green Book chapters III (disc format, data retrieval) and IV (audio) (facts only, never quoted at length), CDi_MiSTer `doc/cdic.md` (GPL-3.0 repository; prose read for facts, no code opened), and MAME's access census (closed box, OBSERVED). **No data sheet of the IMS66490 CDIC exists in public** (cdichips). This is the least documented chip on the board. ## The parts (DOC: cdichips) - **CDIC, Philips IMS66490** (JNMS, Maxi-/Mini-MMC, Mono-I): takes the serial data stream from the CD drive's decoder, splits it into 1/75 s frames of 2,340 bytes of main channel plus 84 bytes of subchannel (12 each for Q-W), filters Mode 2 sectors by file and channel, delivers data sectors to two DATA buffers and audio sectors to two ADPCM buffers, decodes CD-i ADPCM (from disc or from memory), mixes, and outputs audio. It does **not** control the drive: the slave MCU does (slave-and-input.md). It may hold the CPU with a late DTACK ("exact timing dependencies are not currently known"). - **PCB5010 DSP** (Philips, on-chip microcode, not on the CPU bus): always paired with the CDIC; part of the drive's decoding chain. - Mono-II replaces the pair with a **DSP56001 "DRVDSP"** (microcode from the `drvdsp` ROM module) and a LEMM interface chip; Mono-III/IV use the **MCD221 CIAP** (microcode from ROM modules `ciap15_mc0..2`; technical summary only). Later rows. ## Memory and registers (DOC: cdichips; OBSERVED: MAME census) Base `300000` on every player with a CDIC. Word device, no A0: word accesses only (`TIME` and `CHAN` by long accesses in the driver). | Offset | What | | --- | --- | | `0000-09FF` | DATA buffer 0 | | `0A00-13FF` | DATA buffer 1 | | `2800-31FF` | ADPCM buffer 0 | | `3200-3BFF` | ADPCM buffer 1 | | `3C00` CMD, `3C02` TIME, `3C06` FILE, `3C08` CHAN, `3C0C` ACHAN, `3C80` DSEL | command, disc time (MSF), file select, channel mask, audio channel mask, data select | | `3FF4` ABUF, `3FF6` XBUF, `3FF8` DMACTL, `3FFA` AUDCTL, `3FFC` IVEC, `3FFE` DBUF | audio buffer, extra buffer, DMA control, audio control, interrupt vector, data buffer | The CDIC's low-level test reads memory up to `3C7F` (cdichips), so some "registers" are memory the PCB5010 microcode implements. MAME's census at boot (no disc) shows CPU writes to `301400-301402`, `303C00`, `303FFA-303FFE` (IVEC written `2480`, DBUF `8000`) and reads of `301400` and `303Fxx` (OBSERVED, mame-oracle.md). Commands seen in the drivers: `23`/`24` "reset mode 1/2" (read one sector), `2E` abort (cdinotes); the bit meanings are largely unknown ("TBA" in cdichips). Sector delivery: by **SCC68070 DMA channel 1** (device to memory, word operands, the CDIC's DMACTL started after the DMA channel; cdinotes `cdicDmaTransfer`), or by the CPU reading the buffer window. The DBUF register's low bit says which buffer filled (CDi_MiSTer, from MAME's behaviour: a detector's claim, U11). ## CD-i audio codings (DOC: Green Book chapter IV) | Level | Sample rate | Bits | Bandwidth | Sector interval (stereo) | | --- | --- | --- | --- | --- | | A | 37.8 kHz | 8 | 17 kHz | every 2nd sector | | B | 37.8 kHz | 4 | 17 kHz | every 4th | | C | 18.9 kHz | 4 | 8.5 kHz | every 8th (mono every 16th) | - An audio sector carries 18 **sound groups** of 128 bytes (SG00-SG17); each group a 16-byte sound-parameter area (range and filter per sound unit, stored twice) and 112 bytes of samples: four sound units at level A, eight at levels B and C. - Decoding: per sound unit a range (shift) and one of four filters; the decoder output is the shifted sample plus K0 x the previous output plus K1 x the one before (first- and second-order prediction, Green Book IV.4.3; the coefficient values are in that section). The sample format is the XA ADPCM of CD-ROM XA (the same family the PlayStation's SPU decodes for XA; psx-python's spu.md can be read for the shared shape, never its code). - The submode and coding bytes of each Mode 2 subheader say audio/video/data, Form 2, real-time, level and mono/stereo, emphasis. - CD-DA (Red Book) plays through the CDIC too: 293 discs in the census carry CD-DA tracks. CDi_MiSTer's notes: CD-DA sectors go to the DATA buffers, not the ADPCM ones (from MAME's behaviour, U11). ADPCM buffer durations (CDi_MiSTer, from the Green Book's rates): level A stereo 26.67 ms, level B stereo 53.33 ms, level C stereo 106.67 ms, level C mono 213.33 ms per buffer. ## Audio output (OBSERVED: MAME lists two DMA-driven DACs; DOC: Green Book) Stereo output with attenuation per channel; the slave carries the mute and attenuation commands on Mono-I (cdinotes `SLAVE_CMD_MUTE 0x82`, `UNMUTE 0x83` on channel 2; opencdi's README describes channel-2 attenuation commands `C0..CF` with mute bits: an MIT emulator's claim, lineage unchecked, a detector only). Early Mono-II players have swapped stereo channels (Philips's own "MONO II Player Status" memo; CDi_MiSTer `doc/quirks.md`). ## What to model, and at what level - **Disc and drive** (a separate domain): the Redump `.cue`/`.bin` image (track type `CDI/2352`, CD-i Ready pre-gaps: census.md), a sector clock of 75/s (single speed: every CD-i player is 1x), seek and spin-up times FITTED until measured (the MiSTer core's author notes "a real CDIC always ensures" a 20-sector seek delay: OBSERVED there, U12). - **CDIC**: register level (transaction), with its buffer RAM as a shared-memory channel to the CPU, its interrupt on IN4, its DMA REQ to the SCC68070. The ADPCM decoder at sample level (exact integer arithmetic once the rounding is known: U13). - No high-level CD-RTOS driver replacement: the system ROM's `cdapdriv` runs as itself. ## The chip rule The CDIC is CD-i only (one family). It stays in the board. The ADPCM decoder shape is shared with CD-ROM XA (PlayStation, Saturn) but each board owns its decoder; extracting an "XA ADPCM" core would only pay if a third board needed it (no proposal).