SID 6581/8580 (Sound Interface Device) reference

SID register set:
|  | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
$D400 (W) | FREQLO1 | Channel 1 Frequency Low-Byte
$D401 (W) | FREQHI1 | Channel 1 Frequency High-Byte
$D402 (W) | PWLO1 | Channel 1 Pulse Width (PW7-0)
$D403 (W) | PWHI1 | unused | Channel 1 Pulse Width (PW11-8)
$D404 (W) | CR1 | NOISE | PULSE | SAW | TRI | TEST | RING | SYNC | GATE
$D405 (W) | AD1 | Channel 1 Attack | Channel 1 Decay
$D406 (W) | SR1 | Channel 1 Sustain | Channel 1 Release
$D407 (W) | FREQLO2 | Channel 2 Frequency Low-Byte
$D408 (W) | FREQHI2 | Channel 2 Frequency High-Byte
$D409 (W) | PWLO2 | Channel 2 Pulse Width (PW7-0)
$D40A (W) | PWHI2 | unused | Channel 2 Pulse Width (PW11-8)
$D40B (W) | CR2 | NOISE | PULSE | SAW | TRI | TEST | RING | SYNC | GATE
$D40C (W) | AD2 | Channel 2 Attack | Channel 2 Decay
$D40D (W) | SR2 | Channel 2 Sustain | Channel 2 Release
$D40E (W) | FREQLO3 | Channel 3 Frequency Low-Byte
$D40F (W) | FREQHI3 | Channel 3 Frequency High-Byte
$D410 (W) | PWLO3 | Channel 3 Pulse Width (PW7-0)
$D411 (W) | PWHI3 | unused | Channel 3 Pulse Width (PW11-8)
$D412 (W) | CR3 | NOISE | PULSE | SAW | TRI | TEST | RING | SYNC | GATE
$D413 (W) | AD3 | Channel 3 Attack | Channel 3 Decay
$D414 (W) | SR3 | Channel 3 Sustain | Channel 3 Release
$D415 (W) | FCLO | unused | Filter Cutoff Low (FC2-FC0)
$D416 (W) | FCHI | Filter Cutoff High (FC10-FC3)
$D417 (W) | Res/Filt | Filter Resonance | Filt Ex | Filt 3 | Filt 2 | Filt 1
$D418 (W) | Mode/Vol | Chan 3 Off | High Pass | Band Pass | Low Pass | Volume
$D419 (R) | POTX | Potentiometer X
$D41A (R) | POTY | Potentiometer Y
$D41B (R) | OSC3 | Channel 3 Oscillator
$D41C (R) | ENV3 | Channel 3 Envelope

Frequency:
The frequency registers of the SID are written with a 16 bit value which is added to the oscillator every clock cycle. Calculating a frequency register value for a given frequency can be done using these formulas:
`PAL: x = f * (18*2^24)/17734475` (0 - 3848 Hz)
`NTSC: x = f * (14*2^24)/14318318` (0 - 3995 Hz)
Waveforms:
The SID offers four basic waveforms which can be selected by the control register of each channel.

Triangle: |
Sawtooth: |
Pulse: |
Noise: |

Pulse width:
The pulse waveform offers additional control via the 12 bit pulse width registers which are available for every channel. A value of $800 will result in a square wave.

$400 |
$800 |
$C00 |

Noise waveform LFSR:
The noise waveform of the SID is generated by a simple 23 bit LFSR. On shifting, bit 0 is filled with bit 22 EXOR bit 17.
Unlike the other waveforms, the noise waveform does not use the topmost 8 bits for output. The 8 bits of the noise waveform are assembled from bits 20, 18, 14, 11, 9, 5, 2 and 0 of the oscillator.
Playing a sound:
1. Set frequency and ADSR, and in case you use the pulse wave also set the pulse width.
2. Set the waveform and the GATE bit in the control register. Setting the gate bit will start the ADSR envelope generator.
3. Wait for as long as you wish the note to be played.
4. Clear gate bit. This will start the release phase of the ADSR.
© 2009-2012 Graham