7

There are many stand-alone audio players (and plugins for general audio players) out there for many systems that play the music of the Commodore 64 that is famous for its SID chip.

I believe many of the sound chips of those old systems worked like stand-alone black boxes to which you could send a list of commands and parameters, i.e. they could be programmed "declaratively", and they would then do their job without the help of the CPU (except perhaps some kind of "buffer" that the programmer would have to care about, managing the timings that it is loaded with data at any given time).

However I remember when I was a kid I was also using BASIC commands like FOR loops to create repetitive sound patterns and modify certain aspects of the sound.

Such things would then be handled by the CPU I suppose. More sophisticated examples would be the ability to play back samples on a C64, which I guess also involves the CPU.

So am I right to assume the full Turing machine of the C64 is needed (minus, except, perhaps, the graphics subsystem) to be able play back any and all sounds that could be created on a C64?

Or is there some sort of "SID file standard" that is somewhat limited in that some sounds that the C64 would theoretically be able to generate are simply not defined and will not be able to be reproduced by the data in such SID files?

(These question may of course apply for other retro systems too. But as for example the Commodore Amiga's sound chip was more like a sample player, I expect that even more music made for it was defined in a "declarative" way, though there might be exceptions here too.)

2

1 Answer 1

10

SID files are music programs. They normally contain two 6502 ML routines- one for initializing the hardware, and another to serve as a periodic interrupt handler that will update the SID registers as the song progresses. The rest of the SID file is usually data containing the raw SID register values that the interrupt handler will use,

The timing is normally controlled by a hardware interrupt, like a CIA timer or the VIC-II VBLANK interrupt. Most SIDs are designed for the interrupt to fire at 50Hz (PAL VBLANK standard) or 60Hz (NTSC VBLANK standard).

So, you do not have to emulate an entire C64, but you do have to be able to emulate a 6502 and the SID itself, along with a timer to simulate the C64's interrupt generation. However, this works only for a large subset of SID music files usually available in the PSID format. Other files (usually the RSID format ones) include code that will only sound correct when played back with 100% cycle accuracy. This will be outside the ability of a simple emulator.

3
  • emulate the 6502 fully or just a greatly reduced subset for initialization and get the desired timing, as you say? or is this the very difference between the PSID (6502 subset) and RSID (full 6502 emulation) formats you mentioned? Apr 5, 2022 at 17:38
  • Emulate the full 6502, otherwise you artificially restrict the instructions that can be utilized in either the init or interrupt code. BUT, you can sacrifice CPU cycle accuracy, and still create reasonable sound, for a PSID. Stated differently: Mediocre CPU emul with good SID emul is "good enough" for PSID, but not for RSID.
    – Brian H
    Apr 5, 2022 at 18:29
  • thanks, that would answer my question with a yes (so even BASIC routines would work then), as opposed to mod players, that don't need to emulate a 68000. Apr 20, 2022 at 20:07

You must log in to answer this question.

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