• Published on | Aug 04, 2013 | by Chris Osborn

Video demo of the Pi acting as a disk drive

I've made some more progress on my software that allows the Raspberry Pi to act as a Commodore 64 disk drive. I was amazed at how much more of the IEC protocol was missing from the documents I have. One of the things that I found a little strange about the IEC protocol was there was no way to specify how much of the data you want. Once you say go, the sender is just going to send it all. It turns out that when ATN is asserted it doesn't mean abort, it just means pause.

Took quite a bit of doing to not miss any signaling that was happening when the Raspberry Pi was in the middle of sending data. It was tricky because I had to disable interrupts for timing issues during sending bytes, and of course that caused me to miss the ATN and CLK signals that the C64 wanted to send. I've got it worked out now, and things seem to be working quite reliably.

Other improvements are directory listings and wildcard matching now work. You can get a list of all the files, file sizes, it handles conversion of some filename extensions, and see free blocks. Of course free blocks is probably always going to be 65535 since the Pi has far more free space than a puny little floppy disk. Wild cards can be used so that you don't have to type out long names, plus a few of the programs I've been running seem to have wildcard naming built-in for loading their files.

I think the next thing to work on is .d64 support, at least for reading.

As before, the source is available on Github.

Join The Discussion

+1  Posted by Phil • Aug.06.2013 at 16.33 • Reply

This is just epic. I remember that the C64 had a "fastload" mode (either through a cartridge or a pre-loaded piece of software) that dramatically sped up the disk drive. See, for example: http://en.wikipedia.org/wiki/Epyx_Fast_Load. There was also some super optimized copy software like http://en.wikipedia.org/wiki/Fast_Hack%27em. which could copy 170k from drive to drive in just 35 seconds. Did any of these do anything clever with the I2C bus to step up the speed?

+1  Posted by Richard • Aug.07.2013 at 14.29 • Reply

Did you port a 1541 emulator to the Raspberry Pi or write IEC emulation code from scratch?

+1  Posted by Franky • Aug.08.2013 at 11.03 • Reply

Very cool indeed. Would it be too much to hope for JiffyDOS support in the future?

+1  Posted by pcollins • Aug.28.2013 at 06.09 • Reply

Is there SEQ/REL/USR Support?

And do you know XD2031 (http://xd2031.petsd.net/) It works fine at the Raspberry Pi, too.

+1  Posted by Holger Morgen • Aug.31.2013 at 01.50 • Reply

Very cool! I have been thing of building something like this (using Microchip PIC), but never thought of using the Raspberry. Definitive the way to go. A few questions: Why not use the SPI interface to send Bytes? Could that make 'mucking around with kernel modules' obsolete? Is there a link to schmatics? (other than VoltageDivider.png, which looks wrong? :-) Any plans for a PCB?

+1  Posted by Jim Steichen • Sep.28.2013 at 13.15 • Reply

There is no '/dev/iec8' in my raspberryPi '/dev' directory. Care to explain how you created it?

+1  Posted by Juan Castro • Oct.23.2013 at 20.56 • Reply

Have you seen this? Maybe it can help with the IEC stuff you haven't got yet? http://www.c64-wiki.com/index.php/sd2iec_%28firmware%29

+1  Posted by Robert • Nov.16.2014 at 14.03 • Reply

Hello Chris Osborn!

I have a question! I built your circuit with 2 x 74HCT245, but I have troubles with communction with my C64. I guess it's a timing problem, because I always receive different commands for LOAD "$",8 on the Pi. What Linux did you use for your Pi? Did you use a RT patch? I use standard Rasbian, but I have troubles with it. Maybe I have to disable other modues which effect the timing behaviour? regards, Robert

+1  Posted by porga • Jan.02.2015 at 13.12 • Reply

Why no progress yet? rPI would be better solution than SD2IEC

+1  Posted by smayo • Mar.27.2015 at 22.24 • Reply

Chris, This looks like a great project. Do you have any plans to release a schematic to wire it up?

+1  Posted by Tony • Apr.27.2015 at 19.33 • Reply

This is soo neat. I have my old C-128. Will this work for the 128? I'm gathering the parts needed. can I use a breadboard to make this? My solder skills are bad.

+1  Posted by Jim Agla • Sep.01.2015 at 13.45 • Reply

Got my parts in today... Everything is compiled and ready to go. Wish me luck! :)