Advertisement
Meneer_Jansen

Part 6. The SID chip

Jul 3rd, 2020 (edited)
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.66 KB | None | 0 0
  1. .-----------------------------------.
  2. ( P A R T 6 . T H E S I D C H I P )
  3. `-----------------------------------ยด
  4. general contents: pastebin.com/hmpJmurr
  5.  
  6.  
  7. o==========o
  8. | Contents |
  9. o==========o
  10.  
  11. A. Introduction
  12. 1. General
  13. 2. Music
  14. 3. Samples
  15.  
  16. B. SID models
  17.  
  18. C. Input/output
  19. 1. How to play
  20. 2. Use voice 3 as modulator
  21.  
  22. X. References
  23.  
  24. -<>-<>-<>-<>-<>-<>-
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. o=================o
  32. | A. Introduction |
  33. o=================o
  34.  
  35. The SID chip produces the sound in the C64. It is a synthesizer in a chip. To read this document you already have to be familiar with the following general synthesizer terms:
  36.  
  37. - Synthesizer
  38. - Oscillator & frequency
  39. - Oscillator synchronization
  40. - Subtractive synthesis
  41. - ADSR envelope
  42. - Filter: low pass, high pass, band pass, dB/octave
  43. - Filter: cutoff- & resonance frequency
  44. - Waveforms: sinusoid, pulse, square, triangle
  45. - Pulse-with
  46. - LFO (low frequency oscillator)
  47. - Noise: pink, white
  48. - Monophonic, polyphonic
  49. - Synth voices
  50. - Samples
  51. - What is an octave on a (piano) keyboard
  52.  
  53. 1. General
  54. ~~~~~~~~~~
  55. Use Table 1 from the manual [2] on page 3: it's the clearest one. One accesses the SID's settings (29 registers) from D400_hex to D41C.
  56.  
  57. The SID has 3 channels/voices. Oscillator waveforms are: sawtooth, triangle, square w/ pulse-width modulation and (white) noise [1]. Each channel has an envelope generator (ADSR). Set the individual volumes of the osc's via sustain level (4 bits = 16 volume steps). Attack time ranges from 2 milliseconds to 8 ms; decay 6 ms - 24 s; release 6 ms - 24 s. One can activate multiple waveforms at once per oscillator (!).
  58.  
  59. The osc's can be synch'd and there is a ring modulator.
  60.  
  61. The overall volume is set via register 18_hex (24_dec) from the filter in 16 steps (4 bit).
  62.  
  63. The filter is multi mode: high-, low-, band-, and notch pass and has variable resonance. It has no ADSR generator (use the one from osc. 3, see further-on). The low- and high pass filters are 12 dB/oct, the band pass is 6 dB/oct [3]. For comparison: most synths' filters nowadays are 12 dB, the MiniMoog's famous beefy filter is 24 dB. Throughput through the filter can be set on/off for each osc. separately (unlike the Minimoog).
  64.  
  65. The noise generator from osc. 3 is also the random generator for the C64 (i.e. read register number 27 (= D41B_hex)).
  66.  
  67. Oscillator 3 can be used as a "modifier" (e.g. LFO), just like on a Mini Moog. One has to set it's sound output to "off" with bit 7 from register number 24 (= D418_hex) and read its volume from register number 28 (D41C_hex). This value must be added to, for instance, filter freq for wah-wah.
  68.  
  69. Oscillator 3 must also used as the ADSR generator for the filter. Read the output of register number 28 (D41C_hex) for this (see page 7 from [2]), probably by setting osc. 3 freq. to zero and adding reg. D41C_hex to cutoff freq (reg. D4_hex).
  70.  
  71. 2. Music
  72. ~~~~~~~~
  73. Even though the SID has only 3 channels one can make a music track that sounds like it has more than 3 instruments. Per channel one can switch back and forth between settings to alternate between a sawtooth base line and a white noise snare drum for instance. It's like having 2 instruments (base and snare) on one channel.
  74.  
  75. 3. Samples
  76. ~~~~~~~~~~
  77. The C64 is not designed and is "not supposed" to play samples. But clever programmers can playback samples via the SID. The best known example of this is the sample in the game "Ghostbusters". Rob Hubbard (the most famous SID composer for games) used samples for some instruments in his later SID tracks. See [3] for an explanation of how it was done (roughly). It uses a glitch in the (early) SID.
  78.  
  79.  
  80.  
  81. o===============o
  82. | B. SID models |
  83. o===============o
  84.  
  85. There are roughly two models of the SID chip. The 6581 chip was used in the original C64's. Later on, Commodore developed the 8580 chip for the C128 [1]. Unfortunately some game music and effects do not sound like they should on the later 8580 chip. This is because the filter in the latter version is more like it was meant to be according to the specifications (see [3] for description linear/log cutoff slope). The aforementioned glitch that made sampling possible was (mostly) fixed causing samples to play too quit.
  86.  
  87. The filter of the old chip produces strong distortion that is sometimes used to produce simulation of instruments such as a distorted electric guitar [3].
  88.  
  89. The number on the chip below the revision number appears to be the week and year in which the chip was manufactured (e.g. "1783" means week 17 in 1983).
  90.  
  91.  
  92.  
  93. o=================o
  94. | C. Input/output |
  95. o=================o
  96.  
  97. Access for the CPU to the I/O registers inside the SID chip starts at D400_hex in RAM. There are 29 registers (bytes) that control the SID. So the SID is accessed from D400 to D41C_hex [4]. Wat the function is of every bit in the control registers is explained quite well in the official Manual [2]. The registers are repeated to D800_hex (i.e. just like for the VIC chip).
  98.  
  99. 1. How to play
  100. ~~~~~~~~~~~~~~
  101. From [4]:
  102. 1. Set frequency and ADSR, and in case you use the pulse wave also set
  103. the pulse width.
  104. 2. Set the waveform and the GATE bit in the control register. Setting the gate bit
  105. will start the envelope generator.
  106. 3. Wait for as long as you wish the note to be played.
  107. 4. Clear gate bit (bit 0 from D404_hex). This will start the release phase of
  108. the ADSR.
  109.  
  110. The frequency of the oscillator wave determines the pitch of the note like in appendix A in [2]. In that appendix is also written how to save memory if one realizes that each note in an octave is half the frequency of that note in the next octave.
  111.  
  112. 2. Use voice 3 as modulator
  113. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  114. Osc 3 generates an 8 bit number as a function of time in register D41B_hex. These numbers must be added, via software, to osc. freq., filter freq. or pulse with in real time to modify them as an LFO [2]. "Sample and Hold" effects can be produced by adding the noise output of osc. 3 to the filter frequency control registers.
  115.  
  116. Voice 3's ADSR generator also generates an 8 bit number as a function of time to use. It's in register D41C_hex. One may use it as an ADSR for the filter.
  117.  
  118.  
  119.  
  120. o===============o
  121. | X. References |
  122. o===============o
  123.  
  124. [1] C64 Wiki on SID:
  125. www.c64-wiki.com/wiki/SID
  126.  
  127. [2] Data sheet from the 6582 (click on: "Files"), aka Official Manual:
  128. http://sid.kubarth.com
  129. http://archive.6502.org/datasheets/mos_6581_sid.pdf
  130.  
  131. [3] Wikipedia:
  132. https://en.wikipedia.org/wiki/MOS_Technology_6581
  133.  
  134. [4] How to play the SID:
  135. http://www.oxyron.de/html/registers_sid.html
  136.  
  137.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement