I read some related information in a SAM question but I want to know exactly how to write amplitudes directly to the DAC, sample by sample, like in a bytebeat formula. I understand it is possible on C64, is it? And if you know how to do the same on similars like VIC-20, it would be appreciate, thanks in advance!

  • What DAC are you talking about? There is none. Are you referring to Sound? That would be SID programming, but not really a DAC.
    – Raffzahn
    Aug 13, 2019 at 20:12
  • Maybe the CIA chip has some DAC, if this is what the OP has tought, then my answer is sub-optimal (but still can work).
    – peterh
    Aug 13, 2019 at 20:27
  • @peterh Nop, CIA is strict digital.No DAC. at least not within the chip.
    – Raffzahn
    Aug 13, 2019 at 20:41
  • The most amazing trick I know about is described here: livet.se/mahoney/c64-files/… Aug 14, 2019 at 7:17

1 Answer 1


DAC is a digital analog converter. There is no such periphery on C64, but the closest to it is the SID chip, for playing sound.

Also the SID chip was not designed for that. It can play ADSR (attack-decay-sustain-release) sounds with 4 pre-configured waveforms:

enter image description here

This can be hacked to work like a DAC. It can only 16 signal levels, but it is enough to produce recognizable sound (for example, human speech).

You can also set a master sound volume with the lower 4 bits of the register $D418. (The higher 4 bit configures the filters, best to leave them unmodified!)

The hack is the following:

  1. Start a sound with an short AD.
  2. The important thing is that you can make the "sustain" phase so long, as you wish! It requires a write to a SID register to start the "release" phase.
  3. On this way, you have a constant sound. Ideally, best if you set up a pulse waveform with the highest possible frequency (around 8kHz)1, and with a high duty level (to approximate a constant output level).
  4. Then, by regulating the master volume2, you effectively have the DAC.

The result will be only 4 bits and it will be contaminated with the original sound, but it will work: it is enough to make recognizable human speech, although only at some tens of seconds have place in the RAM.

The output will appear on the audio output (needless to say, this and requirement for the master volume control2 makes the play of other sounds impossible).

1Thanks @Janka the important fix.

2Comments (another thanks @Janka) suggest that it can be done with the sustain level, too, what gives yet another 4 bits. Combining these, we could have a nearly-logarithmic 8-bit signal output. As I can remember, the master volume control is a requirement for this trick, but I am not sure. This doc says that the sustain level can be set up for all the 3 sound channels independently.

  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Chenmunka
    Aug 14, 2019 at 8:07

Not the answer you're looking for? Browse other questions tagged .