Interface to a MOS 6581 (SID chip from a C64) so I can use it as synth

Hi all,

Since I am stuck inside; I thought I would clean up the attic and found my old C64; the keyboard was shot; few of the ram IC were gone and overall the board was rusted to the point where some traces were lifted; not worth fixing, but I collected the MOS 6581, which is known as SID chip.

Thought it was a good chance to learn something new; so I got the schematics and the data sheet for the 6581 and now I would like to make a synth out of it. Nothing fancy; I have a breadboard and all I want to do to start with, is to interface to it with the Arduino, since I do not have the skillset to make my own PIC and program it :)

Does anyone have some guidance for this project? I may find connections schematics to connect the chip, although the rest is all something I have to learn; including how to write the code to manipulate the registry on the 6501 to actually make sounds.

Any suggestion/pointer/guidance would be really appreciated. Thanks!

I used Z80 during the 1980:s... Find out what the 6501 needs, like chrystal oscillator etc. You probably need a ROM containiing some code, maybe RAM. That will call for quite som work to handle.

The Mega has an external memory port. You might be able to memory map the 6501 to some series of locations in the 2560's memory space. See chapter 9, "External Memory Interface" on page 27 of the Atmel spec sheet. Basically, ALE becomes phase2, and ~W becomes R/W.

Thanks; so from my understanding, it is not just a matter to get the IO from the arduino and connect them to the 6501 with some resistors and capacitors to stabilize the signal and filter; but it involve also to add a memory buffer?

This is the first time I attempt something like this; in the past I just used simple chips like multiplexers via I2C and sensors. The most complex thing I did was to use an AtSam21d out of a breakout board; in that case I just hooked up the signals to a LED and send and received data via serial

The biggest problem with the old style microprocessors is the parallel memory interface. It can not be emulated by an Arduino because it has not only to react quickly (100-200µs?) upon a new address and provide or receive the related data, but it also must not miss any single request. That restriction makes it hard to fetch code from an SD card or other external memory without shutting down the mircoprocessor for that time. A dual port memory also is not easy to build.

I built my first microprocessor systems with FORTH. A few bytes of manually translated assembler in an EPROM as bootstrap, then the remaining system could be entered from a teletype, eventually from paper tape if available. Nowadys an Arduino can implement the serial interface and also can provide the system source code from an SD card or PC file. Later on the FORTH system can be connected to any serial device, e.g. a terminal program on a PC. My favorite controllers were the 6502 and later the 6509, but I also built FORTH systems for 8085, Z80, 6802 and more processors.

There are a few projects on line that describe how to use the SID chip, start here: http://www.ucapps.de/midibox_sid_v1.html

It is not nearly so straightforward to use as modern chips, for one it needs a 1 MHz clock signal, and receives data only when the clock pulse is high.

shinyknight: Thanks; so from my understanding, it is not just a matter to get the IO from the arduino and connect them to the 6501 with some resistors and capacitors to stabilize the signal and filter; but it involve also to add a memory buffer?

This is the first time I attempt something like this; in the past I just used simple chips like multiplexers via I2C and sensors. The most complex thing I did was to use an AtSam21d out of a breakout board; in that case I just hooked up the signals to a LED and send and received data via serial

You sound very confused, wildly guessing about resistors and capacitors and stabilization right out of the gate. It is true, the old MOS chips do not have static CMOS logic, so have a minimum clock speed. I mention the Mega external memory interface because it's probably your only hope because of the difficulty of otherwise simulating the interface signals. Even that is speculative. Reading this, I'm pretty sure you can't do it at your level of knowledge. You could learn to do projects like this by working up to it with simpler projects, because I did. But you can expect a lot of pain and failures before you can get to the meaty stuff.

DrDiettrich: The biggest problem with the old style microprocessors is the parallel memory interface. It can not be emulated by an Arduino because it has not only to react quickly (100-200µs?) upon a new address and provide or receive the related data, but it also must not miss any single request. That restriction makes it hard to fetch code from an SD card or other external memory without shutting down the mircoprocessor for that time. A dual port memory also is not easy to build.

The C64 ran at 1 MHz. Using direct port reads I expect a 1284P might do the job but as aarg already pointed out the 2560 has external RAM/parallel interface port. I ran a quadram card on mine with zero wait states, 56K RAM (8 banks) and 8K heap.

If the 1284P can do it, it has 16K RAM and 128K flash to work with and cost $5.50 each just a year or two ago.

I built my first microprocessor systems with FORTH. A few bytes of manually translated assembler in an EPROM as bootstrap, then the remaining system could be entered from a teletype, eventually from paper tape if available. Nowadys an Arduino can implement the serial interface and also can provide the system source code from an SD card or PC file. Later on the FORTH system can be connected to any serial device, e.g. a terminal program on a PC. My favorite controllers were the 6502 and later the 6509, but I also built FORTH systems for 8085, Z80, 6802 and more processors.

Interested in an Arduino-Forth targeted for 1284P but may squeeze into an Uno? Send me a PM, I'm putting one together with the author of Pocket Forth, getting the interpreter pieces together now.

IMO Forth makes a better code learning platform than Basic or Pascal. One goal is to have a handheld that users can fiddle with at times they'd otherwise play trivial phone games.

I have no experience with FORTH for µC. Using flash instead of RAM for threaded code may work, but I never tried.

DrDiettrich: The biggest problem with the old style microprocessors is the parallel memory interface. It can not be emulated by an Arduino because it has not only to react quickly (100-200µs?) upon a new address and provide or receive the related data, but it also must not miss any single request. That restriction makes it hard to fetch code from an SD card or other external memory without shutting down the mircoprocessor for that time. A dual port memory also is not easy to build.

I built my first microprocessor systems with FORTH. A few bytes of manually translated assembler in an EPROM as bootstrap, then the remaining system could be entered from a teletype, eventually from paper tape if available. Nowadys an Arduino can implement the serial interface and also can provide the system source code from an SD card or PC file. Later on the FORTH system can be connected to any serial device, e.g. a terminal program on a PC. My favorite controllers were the 6502 and later the 6509, but I also built FORTH systems for 8085, Z80, 6802 and more processors.

Thanks for the clarification; I will look more into that!

jremington: There are a few projects on line that describe how to use the SID chip, start here: http://www.ucapps.de/midibox_sid_v1.html

It is not nearly so straightforward to use as modern chips, for one it needs a 1 MHz clock signal, and receives data only when the clock pulse is high.

Lots of nice info on that page; they use the PIC18F452 as main controller from what I can see, is that something ca be replaced by the ATmega on the arduino? Your remark on the clock signal means that I need to add the crystal and run everything at that speed, unless I can slow down the signal of the arduino but I doubt that it will work.

aarg: You sound very confused, wildly guessing about resistors and capacitors and stabilization right out of the gate. It is true, the old MOS chips do not have static CMOS logic, so have a minimum clock speed. I mention the Mega external memory interface because it's probably your only hope because of the difficulty of otherwise simulating the interface signals. Even that is speculative. Reading this, I'm pretty sure you can't do it at your level of knowledge. You could learn to do projects like this by working up to it with simpler projects, because I did. But you can expect a lot of pain and failures before you can get to the meaty stuff.

Well, as your intuition guided you, I can confirm that I am confused and that is because I am not a hardware engineer; I have a PhD in Biology and work as software engineer, so my medium is not in electronic components, but I try to learn, and this is why I post on forums where I can find competent people that can point me toward the right direction. If I knew I would not be posting and would just do it :)

Thanks for the confidence; once I am done with it I will be posting the results. Can't be harder than writing assembly at age 11; so I am moderately positive! Failures are where you learn stuff; I am familiar with the drill :)

Forget about the Mega parallel memory interface. It's a bus master interface, just like the 6501 implements, while for communication a bus slave interface were required. IOW it's easy to connect a peripheral circuit to a controller, but two controllers can not simply co-exist on a parallel bus.

DrDiettrich:
Forget about the Mega parallel memory interface. It’s a bus master interface, just like the 6501 implements, while for communication a bus slave interface were required. IOW it’s easy to connect a peripheral circuit to a controller, but two controllers can not simply co-exist on a parallel bus.

Are we getting chips mixed up? I searched on the 6501 and SID and came up with MOS6581 instead:
https://www.c64-wiki.com/wiki/SID
datasheet:
http://archive.6502.org/datasheets/mos_6582_sid.pdf
If we are talking about the 6581, it is a memory mapped bus slave device, just like most peripheral chips from that era, such as the MC6821 PIA and others.

Regardless of how it’s interfaced, Tcyc, the clock cycle time can’t be more than 20ms. so it would require additional refresh circuitry in addition to any static bus interface signals.

See reply #5 for info on the SID synthesizer chip.

jremington: There are a few projects on line that describe how to use the SID chip, start here: http://www.ucapps.de/midibox_sid_v1.html

It is not nearly so straightforward to use as modern chips, for one it needs a 1 MHz clock signal, and receives data only when the clock pulse is high.

IOW, the thing is slow but tricky.

There are pin replacements. One uses an FPGA, it's supposed to be spot-on. The SwinSID Nano uses an ATmega88.

Once in a while I wonder about running old PC/XT soundcards with Arduino. PC/XT bus was 4.77MHz (though the Turbo XT's ran up to 10 MHz) so maybe possible and I'll take the late-80's Yamaha cards over the SID.

so sorry; it seems that I wrote 6501 instead of 6581, which is clearly incorrect.

I was asking for the latter; which is a sound chip, while the former was the main CPU of the C64. Apologies for the mismatch. On a positive note, I discovered to have "left-right disorder", so I have to triple-check how do I write numbers.

My notes apply to the 6501, so forget it all with the 6581. The SID may be used as a peripheral with an Arduino, preferably Mega with nice byte-wide ports. The clock signal eventually has to be emulated by bit-banging, the data sheet says it's 1MHz max (1-20µs cycle time).

shinyknight:
so sorry; it seems that I wrote 6501 instead of 6581, which is clearly incorrect.

I was asking for the latter; which is a sound chip, while the former was the main CPU of the C64. Apologies for the mismatch. On a positive note, I discovered to have “left-right disorder”, so I have to triple-check how do I write numbers.

The C64 has a 6510 CPU.