Commodore 64 Programmer's Reference Guide

The official Commodore / Howard W. Sams manual for the commodore-64 (1982). For music its parts are chapter 4, "Programming Sound and Music on Your Commodore 64" (pages 183–208: introduction, volume control, frequencies, multiple voices, waveforms, the envelope generator, filtering, advanced techniques, synchronization and ring modulation — ten BASIC example programs with line-by-line explanations), Appendix E (the note table for eight octaves the chapter refers to) and Appendix O, "6581 Sound Interface Device (SID) Chip Specifications", which reprints the MOS datasheet (source: s-c64-prg-chapter-4-sound; the datasheet text is summarised in s-mos-6581-datasheet). Chapter 4 works entirely in decimal POKE values into locations 54272–54296, i.e. $D400 + 0–24 — the same 25 registers the trackers' effect commands write (sid).

What the wiki takes from it#

  • The ADSR rate table on page 198, identical to the datasheet's Table 2 — the official source for the timings on adsr-envelope — and four envelope presets (violin, xylophone, piano, "synthesizer").
  • Register-level descriptions of pulse width (PWn/40.95 %), the filter registers 21–24 and the oscillator-3/envelope-3 readbacks used for vibrato, sirens and a filtered-noise hand clap (pulse-width-modulation, filter-programming, vibrato).
  • A BASIC "player": per-sixteenth activity arrays and notes packed as ((D×8)+O)×16+N (sid-player-routine).
  • Two slips worth knowing: the ring-modulation paragraph says "bit 3 of register 4" while its own value 21 sets bit 2 (the datasheet: ring mod = bit 2, test = bit 3), and sync is described as "basically a logical ANDing of two wave forms" where the datasheet speaks of synchronising the fundamental (ring-modulation-and-sync). linus-walleij adds, about a note table, that "the numbers in the C64 hardware reference manual are simply WRONG" and publishes his own (source: s-walleij-sid-player-routine; he does not say which edition or table he means).
  • The chapter closes by announcing a book, Making Music on Your Commodore Computer.

Why the SID specification is wrong in places#

bob-yannes wrote the SID spec sheet "before SID prototypes even existed", and "the specs were not accurate": Japanese developers who coded strictly to it shipped C64 games with out-of-tune sounds and "filter settings that produced only quiet, muffled sound" (source: s-sidmusic-yannes-interview). Christer Rindeblad's column says the specification "written while the chip was developed accidentally got incorrect", so that "the real capacity of the SID-chip is not fully known even today — not even by its constructors"; his examples are the statement that the chip "can perform a logical AND on different waveforms" and an error "in the filter-function" — though Yannes and the datasheet both describe combined waveforms as exactly a logical AND of the waveform bits, so only the filter example stands (sources: s-sidmusic-creation-of-the-sid-chip, s-sidmusic-yannes-interview). Newman draws the practical conclusion: the composer-programmers ignored the warnings — rob-hubbard: "don't set this bit whatever you do and we'd say 'OK, I don't care, I'm going to try setting the bit and see if it does anything'" (source: s-newman-driving-the-sid-chip). Read Appendix O as the designer's intention; read the trackers' manuals and the wiki's technique pages for what the silicon does.

How to use it today#

On Lemon64 in 2020 the guide was the recommended first step in learning SID sound design — Tobias: "work through the examples in the C64 manual, that gives you a good understanding of the core features of the SID. Once you know these, the numbers in those trackers start making sense"; commodorejohn's caveat is that the official documentation describes ring modulation and oscillator sync poorly (source: s-lemon64-learning-sid-sound-design); see tracking-workflow.

Editions online#

The wiki's copy is Sami Rautiainen's HTML transcription at devili.iki.fi (last updated 2002-02-10): chapter 4 without page 188 (a figure page) and without Appendix O, which is why the datasheet itself was fetched from 6502.org (source: s-c64-prg-chapter-4-sound). andreas-varga's sid-homepage also carries a transcription of Appendix O (sidtech1–3.html, the same text; not saved separately — see the fetch notes in raw/sources.md).

sid · commodore-64 · adsr-envelope · filter-programming · ring-modulation-and-sync · sid-player-routine

Sources#

s-c64-prg-chapter-4-sound · s-mos-6581-datasheet · s-walleij-sid-player-routine · s-sidmusic-yannes-interview · s-sidmusic-creation-of-the-sid-chip · s-newman-driving-the-sid-chip · s-lemon64-learning-sid-sound-design

source file wiki/entities/c64-programmers-reference-guide.md · graph