My FlatPress blog
Assembling another project
Thursday, December 19, 2019
Another project? Does that mean I’ve given up on my other project?
Nope, but I’m currently blessed with a lot of time to think about projects, and very little time to work on them, so I’m churning through ideas, taking as far as I can take them before I have to begin working on them and figuring out more problems. By writing them down (here and elsewhere) I am able to work out some of the problems which I cannot do by just thinking about them, and perhaps get some feedback from people.
So, what is it today?
Well, this week, I’ve been playing with my Commodore 64…
Something I should probably explain at this point is, one thing I like, is for any of the systems I own, having a development environment set up for them. Not that I have time to do development on all of the systems, but knowing that I can at some point is enough most of the time.
Of course, Commodore 64 comes with BASIC in the ROM, so I could just use that, I am not one to shun BASIC. It was my first programming language, and I wrote a bunch of basic (heh) text adventures when I was younger in it. But, if I’m going to write any games for any of the systems, I want to be as close to the metal as possible, just because, as mentioned previously, I have a bit of a masochistic streak when it comes to personal projects. So of course, I want to be able to write my C64 in 6502 assembly. I hear a lot of you saying that’s simple, many very mature cross assemblers exist, and C64 emulation is now very solid. I would refer you back to the aforementioned masochism. As with my Atari Jaguar development project I don’t want to cross compile. I want to do this on proper hardware.
So, looking at the kit I have, a Commodore 64C, a VIC-1541 floppy drive, and a μXUM1541 to be able to write floppy disks from a PC over USB. Much as I would like to get genuine floppies for development environments, they tend to be crazily expensive. So I’ll keep an eye out for them, but for now, I’ll find free downloads for things such as Turbo Macro Pro and copy them to floppy.
So, that’s it then. Not anywhere near as complex as my previous post. Write an assembler to some floppy disks, and we’re good to go.
As if I would make things that simple.
When playing around with the C64 like this, with both TMP, and the C64 Macro Assembler, I noticed a thing. It would be much much simpler with a second 1541 floppy drive. I could use one for the assembler, and then one for my project. That way I don’t need to keep swapping disks. This isn’t a cheap solution, 1541 drives seem to be going from £60-150 on ebay at the moment. The one I currently have is a VIC-1541, so it looks like the ‘breadbin’ C64, while I currently only have a newer C64C. I am, of course, on the lookout for a breadbin at a decent price, so maybe I should also pick up a 1541C, or 1541-II to more closely match the styling of my C64C. I might do this. I might also just get another plain 1541 because quite honestly I prefer the look.
But again, this isn’t quite enough for me. While this might be more like how it was done ‘back in the day’, it feels like it might annoy me, and I think we could do better.
The 1541 is actually a whole computer. It has a MOS 6502 CPU in it, with some RAM, and a ROM, it communicates with the C64 over a simple serial protocol. But why does it have to be a floppy drive controller? Why couldn’t we put a hard drive there for example?
It’s generally at this point that people suggest just using an SD2IEC adapter to use an SD card, but this goes against my new-tech to solve problems thing.
So, what I’m going to need is a serial device, which presents as a drive, similar to a 1541, but contains a hard drive and controller. I will break my previous rule a little and start off saying that (assuming I ever work on this) I will be using IDE. This is obviously not period accurate, but it’s done for a few simple reasons. I don’t want to put gigabytes of storage onto a C64, and small capacity IDE drives (10-60MB) are already very expensive, going for something earlier is going to be far more difficult to source, and expensive. While this project is hypothetical, cost is not important, in practice, if I’m going to be able to make this, I cannot really justify the amount of money that anything other than an IDE drive would cost. The second reason is that someone has already made an 8-bit IDE interface (albeit for Z80 not 6502), so I can ’stand on the shoulders of giants’ and learn from that. The final reason is that Compact Flash is trivial to use on IDE and while I will not be using it in my final setup, for developing this system, it seems like a good idea to use that, rather than potentially more delicate and expensive spinning rust. There is a SCSI driver for 6502 which is very tempting, as SCSI is certainly more period correct than IDE, so it remains an option, but doesn’t allow the development and testing of the device with a Compact Flash. We shall see.
An IDE harddrive, with a 6502 communicating over serial to the C64. Some supporting ROM and RAM to control it. Power supply. All sorted. The addressing is even easy, the C64 can support up to 4 drives, at address 8, 9, 10, 11, with the 1541 defaulting to 8. Later 1541 drives have some DIP switches to select the drive number. It would be trivial to do a similar thing.
And then there would be the case. If it was to communicate like a 1541, then it should look like one. I have most of the materials to make a mold and cast a resin case, although I’ve never tried colour matching resin, so that would be interesting. The rest of the project all seems relatively easy. This bit, while still doable, is something that would take me longer, and I’d have more problems, as it is far further from my everyday experience.
I think, finally, I’ve managed to get to the end of this project idea. With this, I could have a ‘permanent storage’ for my C64, that I could ‘install’ (copy) an assembler to, and store my project files, along with the assembled programs I generate, and the system would treat it just like a floppy disk, albeit a large one.
Because I know that, if I don’t mention it, someone else will say “hard drives exist” and I am aware of this. There are things like the Lt. Kernal and others, but none of these fit the same aesthetic as the C64 (any version) and I have not seen any of them come up on ebay so I’m not holding out hope that I’ll be able to get one. One other, more feasible option, is an IDE64 but this connects to the C64 via the expansion port, so I don’t think I will be able to use it interchangeably with a 1541 drive (although that does mean it has faster communication). If I go for a hard drive, I may end up getting one of these to try it out, but I do like my idea, so I’ll be dreaming of that.
Edit: I should point out that I have little experience with or understanding of C64 DOS. What I’m proposing is based on what I have observed in other devices so what I believe is theoretically possible. I’m more than open for people to say that it won’t work because of X, Y or even Z, as I’m expecting to come across speed bumps down the road at some point if I ever get time to work on this at all.