# The bus side: pins, commands, status, timing, clock and pin 7 Everything here that is marked **DS** is from OKI's MSM6295 data sheet, the '94 data book, fifth edition, printed pages 53-68 (`reference/docs/okim6295.pdf`, the copy kept in jt6295's `doc/`, the same pages as PDF pp. 64-79 of `reference/docs/1994_OKI_Voice_Synthesis_ICs.pdf`), read from the page images. **DS87** is the earlier sheet in the 1987 data book (PDF pp. 41-51, printed 36-46). Emulator behaviour is cited by file at the pins in [validation.md](validation.md): MAME 0.285 `okim6295.cpp`, FinalBurn Neo `msm6295.cpp` (FBNeo), libvgm `okim6295.c`, jotego's `jt6295` (Verilog). FBNeo and jt6295 were read under the old rule and are closed boxes from 2026-11-19: what this document says they do is a record, never a default. Numbered unknowns (U) and contradictions (C) are the brief's: [handoff-brief.md](handoff-brief.md). ## Pins (DS pp. 54-55, 58-59) | Pin (QFP44) | Name | What it does | | --- | --- | --- | | I0-I3 | data, bidirectional | command bits in; the four BUSY bits out on a status read | | I4-I7 | data, **input only** | command bits in; nothing is driven on a read | | /WR | write strobe | a byte is latched on the **rising** edge of /WR while /CS is low | | /RD | read strobe | /CS and /RD low: I0-I3 drive the BUSY bits | | /CS | chip select | | | SS (**pin 7** on the QFP44, pin 11 on the DIP42) | sample-rate select | high: clock/132, low: clock/165 | | /RESET | reset | | | XT, /XT | clock (oscillator or external clock) | "Clock frequency: 1 MHz to 5 MHz" (DS p. 53); tCYC min 200 ns (p. 57) | | A0-A17, D0-D7 | external ROM | 18-bit address, 8-bit data: 256 KB | | DAO | analogue output | the 12-bit D/A's voltage output, at rest about VDD/2 | "Pin 7" in MAME and in this repository means SS: it is pin 7 of the QFP44, which is the common package. **The DIP42 (MSM6295VRS) has no A17 and no /RD** (DS p. 55, the 42-pin drawing: pins 22-38 are A0-A16, and the only strobes are /WR and /CS). A DIP part can address 128 KB and its status cannot be read. MAME's header comment says the same; the drawing confirms it (this was U12 in the first draft, now closed). ## Commands (DS pp. 60-62) Every write is one byte. The chip keeps one bit of state between writes: whether the last byte opened a play command. **Play, two bytes.** 1. First byte: bit 7 = 1, bits 6-0 the phrase number, 1 to 127. "Phrases cannot be specified with all inputs = 0": the table row for phrase 0 says "Selection not valid" (DS p. 60). 2. Second byte: bits 7-4 select the channel, one bit each, **channel 1 = bit 4** (bit 5 channel 2, bit 6 channel 3, bit 7 channel 4); bits 3-0 the attenuation code (DS p. 61; values in [decoder.md](decoder.md)). "It is not possible to specify multiple channels at the same time. For example, it is not possible to specify channel 1 and channel 3 simultaneously." "Voice synthesis operation does not start till the second byte is fully latched" (DS p. 64). **Stop, one byte.** Bit 7 = 0, bits 6-3 select channels, **channel 1 = bit 3** (bit 4 channel 2, bit 5 channel 3, bit 6 channel 4), bits 2-0 don't care. "Channel suspension occurs even if multiple channels are selected": `78` stops all four (DS p. 62). "Synthesis operation is suspended right after the rising edge of /WR" (DS p. 66), and on p. 67: "voice playback stops at the next sample and BUSY becomes L". Note the asymmetry: a play selects a channel with bits 7-4 of the *second* byte, a stop with bits 6-3 of its only byte. A second byte is told from a stop only by what came before it. ### Edge cases, and what decides them > **Provenance note (2026-11-19).** The FinalBurn Neo and jt6295 columns were written by > reading those programs' source under the superseded rule "read, cite, never copy". > FBNeo (non-commercial licence) and jt6295 (GPL-3.0) are **closed boxes** from now on: > their source is not opened again. The columns stay as a record of what those detectors > do; none of them is a basis for any default (docs/provenance.md). | Case | Data sheet | MAME 0.285 | FBNeo | libvgm | jt6295 (HDL as read) | | --- | --- | --- | --- | --- | --- | | Phrase 0 (`80 xx`) | "not valid" | reads the table entry at address 0 like any other | the same | the same | the same | | Second byte with 0 channel bits | not described | the command is consumed, nothing starts | the same | the same | the same | | Second byte with several channel bits | "not possible" | every idle selected channel starts the phrase | the same | the same | all selected start | | Play on a busy channel | not described | **ignored** (comment: "fixes Got-cha and Steel Force") | ignored | ignored | README: ignored, "not verified"; the HDL, as read, restarts it whether or not the channel is busy | | Second byte with bit 7 set | not described: any byte after a first byte is a second byte | taken as the second byte | the same | the same | the same | | How long a first byte waits | not described | for ever, across `reset()` | for ever | for ever | until /RESET | | A stop byte between the two bytes | impossible to express: it would be read as the second byte | | | | | | Play then stop of the same channel in one sample | not described | stop wins (the order of writes) | the same | the same | stop wins in the same visit | | Restart after a stop | first byte "more than one sample" after the stop (DS p. 67) | no minimum | no minimum | no minimum | pipeline | The play-on-busy case is U5, the timeout U9, phrase 0 U4. The README/HDL split inside jt6295 is C9. ## Status read (DS p. 66) "While /CS is L and /RD is L, ... the busy state of channels 1-4 is output on I0-I3. 'H' is output during synthesized playback." Bit 0 is channel 1. I4-I7 are inputs, so **bits 7-4 of a status read are whatever the board's bus holds** (U11). MAME, libvgm and jt6295 return them as 1 (MAME: "naname expects bits 4-7 to be 1"), FBNeo as 0 (C8). A core returns four bits and lets the board supply the rest. ### When BUSY rises and falls From the two figures on DS p. 67 ("Busy (internally)"), with **n = 4 when SS is high and n = 5 when SS is low**, and one sample = 33 x n input clocks: - **Rises 15 x n clocks after the second byte** (60 or 75 clocks). - The voice is heard **48 x n clocks after the second byte** (192 or 240 clocks) for a channel started alone; DS p. 64 gives "approx. 227 µs" at 1.056 MHz, SS low, which is 240 clocks: the two pages agree. - When other channels are playing, the new voice is output "after a maximum 2 samples + 15 x n clocks from the preceding sample point", and BUSY becomes H "during the 48 x n clock time". - **Falls on a stop at the next sample** ("approx. 156 µs" on DS p. 66 at 1.056 MHz, SS low: 165 clocks, one sample). - **At a phrase's natural end: not stated.** U8. The emulators set BUSY at the second byte and clear it at once on a stop or with the last nibble decoded; none models 15n or 48n. Artemio Urbina wrote, on the CPS-1 test loop he ran on a real board, "MAME doesn't handle the Busy status properly. Tested on real hardware" (jtcores issue 559, 2024-02-22) and did not say how. That is the only hardware statement about BUSY found; it is part of U8. ## Write timing (DS pp. 57, 64; DS87 p. 43) | Quantity | DS ('94) | DS87 | | --- | --- | --- | | tCYC (clock period) | min 200 ns (5 MHz) | | | /WR low | min 200 ns | | | /RD low | min 300 ns | | | data set-up / hold | 80 ns each | | | first byte to second byte | **>= 500 ns** (figure) | **7,500 ns** (figure) | | interval "between phrases" | **75 tCYC (max.)** | **15 Tcyc (max.)** | | second byte to sound | approx. 227 µs (1.056 MHz, SS low) | approx. 216 µs | | ROM data valid after address | 5 tCYC + 90 ns | | The footnote marker for "an interval of 75 tCYC (max.) is needed between phrases" sits beside the >= 500 ns gap in the p. 64 figure, which is ambiguous, but the figure on DS p. 65 settles where it applies: "Approx. 71 µs" (75 clocks at 1.056 MHz, SS low) from the *second* byte of channel 1's command to the *first* byte of channel 2's. 75 = 15 x 5, the BUSY-rise delay at SS low: the chip needs 15 x n clocks to take a command in before the next one. The "(max.)" is OKI's. Final Fight's driver, under MAME, writes the second byte **4 to 13 µs** after the first (4-13 clocks at 1 MHz) and the next command at least 82 clocks after a play's second byte ([mame-oracle.md](mame-oracle.md)): inside the '94 figure's rules, outside DS87's 7,500 ns (C3). A core takes each write as an instant and need not enforce either. ## Clock and pin 7 DS p. 67 gives the rule in clocks: **one sample is 33 x n clocks, n = 4 with SS high, n = 5 with SS low: clock/132 and clock/165.** The pin table (DS p. 59) gives 8 and "6.5" kHz at 1.056 MHz and 32 and 25.6 kHz at 4.224 MHz; 1,056,000 / 165 is 6,400, which DS87 prints (C1). jt6295's timing module says "divides by 164" in a comment, but its counters (`base` 0..4 times `cnt` 0..32) make 165: the figure 6,097.5 Hz quoted from the jtcps sources for 1 MHz (1e6/164) comes from that comment, and the data sheet and the counters both say 6,060.6 Hz (C10). At CPS-1's 1 MHz: 7,575.76 Hz (pin 7 high) and 6,060.61 Hz (low). The 33 slots of a sample: jt6295's timing module raises a strobe on 32 of the 33 slots (`cen_sr32`) and visits the four channels at four of them (`cen_sr4`). That is its pipeline, not a measurement. The data sheet's note "phrase selection is from channel 1 to channel 4 continuously" (DS p. 64) is not an ordering rule for the program: p. 65 says "voice synthesis playback can be started from any channel, 1 to 4. The arrangement of each channel can be in any order." The order in which the chip serves its four channels inside a sample is not stated. **Run-time changes.** SS is a pin, and boards drive it from a latch: CPS-1 (Z80 writes `$F006` bit 0, `cps1.cpp` line 297), Atari's JSA boards (`atarijsa.cpp` lines 509 and 517, the same latch also resets the chip), Gottlieb's System 3 sound (`gottlieb_a.cpp` line 1162, beside a ROM bank). MAME changes the stream rate at once (`set_pin7`). What the divider does when SS changes inside a sample is not described (U10). No board in MAME changes the chip's clock at run time (the `set_clock` calls found are configuration); VGM files can (libvgm ports 8-11). A core counts input clocks and reads SS when it closes a sample, so either change is allowed at any time and its effect inside a sample is a documented choice. ## Reset /RESET is a pin. The data sheet's timing figure (DS p. 64) shows it pulsed with the clock running and DAO at VDD/2 with "No sound" afterwards; nothing else is said. MAME's `device_reset` stops the four voices and does not clear a pending first byte; jt6295 clears both. What /RESET does to a half-received command is U9.