# Start here ## The chip on one page The OKI MSM6295 (1987 and later; QFP44 MSM6295GS, DIP42 MSM6295VRS) plays up to four ADPCM phrases at once from an external ROM of up to 256 KB. A CPU talks to it through one write port and one read port. - **Play**: two bytes. `1ppppppp` (phrase 1-127), then `cccc aaaa`: one channel bit (bit 4 = channel 1 ... bit 7 = channel 4) and an attenuation code 0-8 (0 dB to -24 dB in about 3 dB steps). - **Stop**: one byte `0cccc xxx`, channel 1 = bit 3; several channels at once. - **Status**: the low four bits are BUSY, bit 0 = channel 1. Bits 7-4 are not driven by the chip. - **ROM**: phrase *p*'s entry at 8p: 18-bit start, 18-bit end (big-endian, end inclusive), two spare bytes. Data two nibbles a byte, high nibble first. - **Decoder** per nibble: magnitude = step·B2 + step/2·B1 + step/4·B0 + step/8 (each term truncated), negated if B3; a 12-bit signal limited to -2048..2047 (by every implementation; the chip is not documented); the step index moves -1, -1, -1, -1, +2, +4, +6, +8 within 0..48 over the 49 steps floor(16 x 1.1^n). Each phrase starts at signal 0 (MAME; -1 and -2 elsewhere) and step index 0. - **Attenuation**: multiply by 32, 22, 16, 11, 8, 6, 4, 3, 2 over 32; codes 9-15 not in the data sheet. - **Rate**: one sample = 33 x n input clocks, n = 4 with SS (pin 7) high, 5 with it low: clock/132 or clock/165. CPS-1: 1 MHz, 7,575.76 or 6,060.61 Hz. Pin 7 is often driven by the board at run time. - **Timing** (data sheet): BUSY rises 15 x n clocks after the second byte; the voice is heard 48 x n clocks after it; a stop acts at the next sample. - **Output**: one 12-bit D/A, no filter inside. How four channels share it is not documented. Filters are the board's (CPS-1, as jotego fitted them to recordings: a 770 Hz pole on the 88617A board, a 4 kHz second-order filter on the 89626A). - **Banking**: the board's, through the ROM read; 648 of 1,249 local sample regions are larger than 256 KB. ## What is settled, and by what - By OKI's data sheet: the commands, the table, nibble order, inclusive end, the two divisors, BUSY and start delays, the nine attenuation figures, no internal filter, the DIP's missing A17 and /RD. - By OKI's general literature and Dialogic's note: the decoder formula and the step table (for the algorithm, not stated for this chip). - By measurement on real boards (second-hand, analogue): attenuation codes 0-7. - By emulator agreement only: clamping, ignoring a play on a busy channel, silence for codes 9-15, the start value (where they do not even agree). - **Nothing hardware-tier judges the decoder's values.** No die analysis was found; nobody has compared decoded values with a chip. ## Reading order 1. [handoff-brief.md](handoff-brief.md): what to build, the contract, the rungs. 2. [bus.md](bus.md), [rom.md](rom.md), [decoder.md](decoder.md): the chip. 3. [validation.md](validation.md): how strongly each fact is known. 4. [mame-oracle.md](mame-oracle.md) and [census.md](census.md): the tools and the material for rungs 2 and 4. Commands to reproduce Phase 0: python3 -I scripts/fetch_references.py --verify python3 -I scripts/mame_census.py && python3 -I scripts/mame_census.py --summary python3 -I scripts/rom_census.py --family capcom/cps1.cpp # several minutes of I/O python3 -I scripts/mame_oki_tap.py ffight --seconds 40 The data sheet is a scan: read its pages as images (`reference/docs/png/ds-NN.png`, made by the fetch script; NN 01-16 are printed pages 53-68).