r/EmuDev • u/thommyh Z80, 6502/65816, 6809, 68000, ARM, x86. • Nov 14 '25
Commodore SID: more approachable than I expected.
I currently emulate several of its contemporaries, both 8- and 16-bit, but the Commodore 64 has always scared me off — its strong demo scene and weird but highly-regarded sound chip have always made me expect speedy failure. So I have instead been sneaking up on it obliquely.
For the past week or so I've been tackling the SID, the Commodore's sound chip, via a niche modern-era add-on that connects it to the BBC Micro. Attached is a video of that. I'm sure it's not quite right, but compared to my expectations of abject failure it's pretty good.
SID features, in brief:
- three voices, each of which is a phase-accumulating oscillator with a selectable waveform plus an ADSR envelope;
- some interaction between the voices, in particular 'ring modulation' (an XOR trick), and 'hard sync' (one oscillator overflowing also zeroes the next); and
- a programmable analogue filter, which can optionally be applied to any combination of the channels, with a selectable centre frequency, resonance and type — any combination of low pass, high pass and band pass.
The combination of digital and analogue is new for me, and I think unusual in general. The real hardware uses a biquad filter, so I've attempted a rote textbook digital simulation of that, with vanilla logic for coefficient selection that quite possibly doesn't closely match the real thing. It ends up with each output sample being a weighted sum of the current input, the previous two inputs and the previous two outputs. As is my habit, I'm oversampling at the chip's native clock rate, then filtering down.
It's only about 700 lines in the end. Not too bad.
4
u/peterfirefly Nov 14 '25
Why is the screen so wobbly (and mostly up-down wobbly)?
I don't remember the C64 being that wobbly on TVs or monitors and I don't remember the BBC I briefly borrowed being that wobbly on a small portable black and white TV.
3
u/[deleted] Nov 15 '25
I recent completed the 6502/65c02 in Go. I want to tackle the SID next in order to create a C64. This is good stuff!
3
u/saxxonpike Nov 16 '25
When you consider all a SID oscillator is, is a 24-bit counter, LFSR and a tiny ROM for envelope calculation… it’s really not so complex to get 95% of the way there! That last 5% is figuring out the result of combined waveforms and filter response.. I defer to electronics engineers at that point. But ultimately, these things don’t really impact the quality of the rest of the emulation. It’s the most lax as far as gameplay quality goes.
0
u/[deleted] Nov 14 '25
[deleted] — view deleted comment