# The SID (6581, 8580) Three voices (16-bit frequency, 0-4 kHz; triangle, sawtooth, variable pulse, noise; ring modulation and hard sync), three envelope generators (attack 2 ms-8 s, decay and release 6 ms-24 s, "exponential response"), one programmable filter (low, band, high pass, notch; cutoff 30 Hz-12 kHz; 12 dB/octave; resonance), master volume, two pot (paddle) inputs, an external audio input, and OSC3/ENV3 read-back (DOC: PRG appendix O, p. 457 onward; SIDDS). Registers at $D400-$D41C, mirrored every 32 bytes to $D7FF (memory-pla.md). Clocked by phi2. ## Where the difficulty is - **The digital part** (phase accumulators, the noise LFSR, waveform selection, the envelope's rate counters and exponential counter, pulse comparison, sync and ring, the register bus) is deterministic logic and can be cycle exact. Corners: the combined waveforms (two or more waveform bits set: the outputs are wired together and the result is chip-specific), the noise LFSR's write-back when combined with other waveforms (VICE `SID/noisewriteback`, `noiselfsrinit`), the envelope's "ADSR delay bug" (a rate counter that must wrap; VICE `SID/envelope`, `env_test`, `exp_counter_reset`), the test bit, the floating data bus on reads of write-only registers and how long it holds (`SID/busvalue`, `bitfade`), oscillator 3's top bit (`osc_topbit`), and what reads see one cycle after a write (`writedelay`). - **The analogue part** (the filter, the DAC non-linearity of the 6581's waveform and envelope DACs, the output stage and its DC offset that makes $D418 writes audible: "digis") is where 6581 and 8580 differ most and where individual chips differ from each other. The filter uses two external capacitors (CAP1A/B, CAP2A/B pins: PRG appendix O pin list); the capacitor values on each board revision are to be read from SM (U5). This is the part the family's rule "sound may be less exact than pictures" (Aubrey, 2026-11-13) applies to. ## Evidence | Tier | Source | Decides | Notes | | --- | --- | --- | --- | | 1 (provenance unclear) | libsidplayfp/perfect6581 (MIT licence file naming only the perfect6502 authors; netlist from Lempinen's die layouts, no stated licence) and libsidplayfp/SID_schematics (no licence) | the digital logic at transistor level | facts only and run only until the netlist's provenance and its author's wishes are established (open decision); not fetched | | 1 | die photographs of the 6581 and 8580 (Michael Huth, retronn.de; no licence stated) | layout reading | not fetched | | 2 | PRG appendix O, SIDDS (6581 data sheet scans) | registers, ranges, pins | nothing about combined waveforms or the filter's real curve | | 3 | VICE `SID/*` tests (26 directories, 191 test-list entries); hardware notes found by keyword in `bitfade`, `env_test`, `noiselfsrinit`, `wb_testsuite`, `wf12nsr` | digital corners read back through OSC3/ENV3 | the analogue output is not readable by the CPU, so these tests judge only the digital half | | 3 | captures from real chips | the analogue half | **none pinned**: no permissively licensed recordings of 6581/8580 output found in this Phase 0 (U6) | | 5 | reSID, reSIDfp (GPL-2.0+), VICE, MAME | detectors (closed box; never opened) | the de-facto "reference" sound of the scene is reSID's model: an emulator's verdict, not the chip's | Chip-to-chip variation of the 6581's filter is large (the scene's tools ship per-chip filter curves); a single "6581" curve is a FITTED compromise and must be called one. ## Proposal for the specification 1. Digital part at cycle level, every phi2 cycle, judged by the VICE SID tests that read back OSC3/ENV3 and by the data sheet. 2. Combined waveforms as tables per chip type, but only from a source we may use: our own reasoning from the netlist (if decision allows) or measurements (U6). Until then: the plain waveforms ANDed, marked HYPOTHESIS (known to be wrong in detail). 3. The analogue filter and output as a parameterised model per type (6581, 8580), FITTED, run per cycle in the specification; a pure producer (sound from register writes over time) in the Rust tiers ([domains-and-speed.md](domains-and-speed.md)). 4. The `$D418` volume DAC path (digis) modelled through the output stage's offset, per type (8580 needs the "digi boost" trick; documented in the scene: to source). ## The chip rule | Family board | Uses a SID? | | --- | --- | | c64-python (all rows: C64, C64C, SX-64, C64GS, MAX) | yes | | a future c128-python | yes (and the C128 is not in the family) | | VIC-20, Plus/4, PET, any arcade board in the family | no | So the SID **stays in the board** (`c64_python/sid.py`) behind a pin-shaped class with no C64 names inside, and is extracted to `sid-python` with history if a C128 board (or any other consumer) appears. Open decision 4.