I first heard about the Retrochallenge on the Retrocomputing Roundtable Podcast. It sounded like fun, and even though I’m not much of a “joiner”, I thought I should give it a try. The challenge runs during the month of July, and each participant picks their own particular retrocomputing project – there are some neat examples in this year’s list of projects.
I considered a few different projects, including writing a program for the C64 or Amiga, but ultimately I decided I wanted to work on my breadboard 6502 computer. Specifically, I want to add some persistent storage. So far, every time I turn it on, I have to use the built-in XMODEM routine to download the software I want to run. It’s time to add a real filesystem.
On my real C64, I’ve eschewed physical disks in favor of a 1541 Ultimate II, which loads disk images off of an SD card. I think that’s the simplest way to go here, as well. As cheap as SD cards are these days, I’ll have more storage space available than I’ll ever be able to use. SD cards are pretty complicated, but apparently you can talk to them with an SPI protocol, which I’ve got lots of practice with.
On the other hand, I don’t think I’m going to connect the SD card directly to my 6502 – at least not right away. A real disk drive like a 1541 would have a
microcontroller another 6502 on board to handle the grimy details of the disk format, and I’m going to start out doing the same. If I use an ATmega microcontroller for my “disk controller”, then I can prototype that part of the project with an Arduino, and I get a FAT32 filesystem library for free. (Though now that I type that, I wonder if it’d be possible to modify that library to compile with cc65 and use it directly. hm…).
The I/O in my Project:65 computer is done with a single 6522 VIA. Right now, it’s just using a bit-banged SPI implementation to talk to my Max3100 RS-232 serial chip. Using it to also communicate with the ATmega would be simple – although then my microcontroller would be both an SPI master and an SPI slave, which might get weird. On the other hand, I could use the VIA’s parallel port instead (though I would have to learn how its handshaking works).
The part of this project that’s really interesting to me is the software – I want to put together at least the very basics of a set of device drivers and implement file descriptors that I can use to read or write an arbitrary device. Ideally, it’d provide enough functionality that I could use it to get cc65’s stdio library ported over. I’ve been doing a little research – digging out my old Operating Systems and CprE textbooks to see what they have to say on the topic. I think it’s doable, though I’m going to be writing a lot of 6502 assembly.
The Retrochallenge starts July 1, and I hope to have regular updates once things are officially underway.