Project:Hardware SID Player

From London Hackspace Wiki
Jump to: navigation, search


April 17, 2011: The hardware SID is playing SID files! I've uploaded a couple here : It's not perfect, as files which have non-standard playback rates don't work (yet).


user:wzdd is creating a hardware SID player. It's my first major electronics project. If you're into 8-bit music, old computers, electronics, or if you're just a generally interested person, I gratefully welcome any and all collaboration and advice. :)

The SID is a sound chip used in the Commodore 64. It's very popular among people who still listen to 8-bit music because so much was written for it, and because it's got a very distinctive 8-bit sound. Here's an example, from the game Skate Or Die: [1].

Unlike the Amiga's MOD files, which are just data and can be played by anything, SID music is binary code, for the C64's 8-bit 6502 processor. SID players for PCs and Macs emulate as much of a Commodore 64 as necessary, which means at least emulating the 6502 processor, the C64's memory layout, the RAM, and, of course, the SID. More sophisticated SID players emulate a lot more as well, such as the C64's timer chips.

I want to make a SID player using actual chips, rather than emulation, but I don't want to have to rip apart a C64 to do it. So instead I am building as much of a C64 as necessary, from scratch, in order to play SID files. The only original component I am using is the SID chip itself.

Here's what I've got so far: Hardware Sid Player 6502-pic-full.jpg

The basic idea is that a microcontroller (a PIC 18f14k50, upper left) controls the 6502 processor (centre) by acting as a ROM. The PIC controls all the useful lines of the 6502, notably the reset and clock lines, and it is also connected (or will be) to the 6502's data bus. The upshot is that the PIC has complete control over what the 6502 can access.

Right now, the PIC can start the CPU, manually clock it, and read the CPU's requests for program code on the two low-order bits of the address bus. The next step is to supply code to the CPU. Ultimately I will supply code from the "rom" (i.e. the PIC) which will cause the CPU to write a complete SID player file into RAM (the large chip to the left of the 6502). The PIC will then reset the CPU and essentially disconnect itself, causing the CPU to boot from RAM. I have to do things this way because the PIC only has 768 bytes of RAM -- not enough for many SID tunes.

The cool part about using a PIC, rather than a dedicated ROM, is that it's really easy to get data into a PIC, and thus it's going to be easy to get SID tunes onto the board. Right now I'm using a serial port, but this particular PIC also supports USB natively (no extra chips required) so that's another option. MicroSD is a possibility. I'm also toying with the idea of giving it a cassette interface for that retro feel (and of course "cassette" just means "audio" -- if I did this you would be able to download SID tunes onto the thing by playing program code to it from your ipod or equivalent :).

There are some complications because I'm using such old hardware. One fun one is that the CPU can't be clocked lower than about 100 KHz, because it uses Dynamic RAM for its registers. This puts a lower bound on the speed at which the PIC can get respond to requests from the CPU. So far this hasn't been an issue.