The SID could play sampled sound by poking a click into the chip at an appropriate frequency, and some Commodore 64 games like Ghostbusters and Impossible Mission did this (though only for a few seconds, of course; it wouldn't take much sampled sound to exceed 64K).

This would seem to involve a tight loop whose timing would depend on the exact speed of the CPU.

But when tile-mode graphics are being displayed, as is usual for games, the CPU is locked out for one in eight scan lines ('bad lines'). This would seem to have the potential to alter the timing, thereby messing up the sound.

How did games playing sampled sound, solve this problem?

1 Answer 1


One might select sampling rate to be half the display lines rate (around 7.8 kHz) and arrange things so, that CPU always gets interrupted to play digital at odd lines, not interfering with bad lines.

  • Okay, 7.8 kHz may be enough for lo-fi sound. But what happens during vertical blank? Do raster interrupts happen then?
    – rwallace
    Jan 20, 2020 at 9:42
  • 2
    C64 has a bunch of timers in its CIA 6526 (or 8520) peripheral IO chips. Those timers can generate interrupts.
    – lvd
    Jan 20, 2020 at 9:53
  • There are no bad lines in the upper/lower border/during vertical retrace. Raster interrupts, if set, can still happen.
    – user6576
    Mar 21, 2020 at 23:43

You must log in to answer this question.

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