USB-64 -
Turning Commodore 64 into a USB host for Mass Storage DrivesForewordOver time USB-64 has been criticised in favour of IP network-based solutions. I honestly don't think these two belong to the same subject. I mean, USB-64 is a hack put together in 2 weeks and during my free time (that means evenings and mainly nights) in August 2010. I learned a big deal of things while working at this project, including the CBM BASIC interpreter and Kernel code style, which was great.For me, USB-64 is more of a proof that with some motivation, enthusiasm and the right information one can achieve things that were not thought of up to that point. |
From an idea to a prototypeBack in April I was attending Breakpoint 2010 in Bingen Am Rhein, Germany. There, among several modern PCs one could easily spot a few Commodore computers with people actually developing some code, pixellating some picture, and the Metalvotze guys watching a pron movie on a Commodore 64.Long story short: there are people who keep using their Commodore 64 for all sorts of creative work. Nice, isn't it? Over time several guys have designed and made all sorts of add-ons for the Commodore 64 to make using it a more enjoyable experience nowadays. That's 25+ years after it first came out. I've probably been a voice out of the chorus with my DC2N project: something that can play back tape ROMs at the same painfully low speed as the original ones did. That's great nostalgic stuff for those who enjoy sitting back and watching a game load, listening to its load music, and so on. Not much of interest for people in the development area though. Well, DC2N made the task of creating tape ROMs a very straightforward one; that was the original purpose anyway. I personally also used my DC2N to transfer files from PC, where my cross-development toolchain runs, to the Commodore 64. That occurred quite a few times during the devolopment I did for this project, of course. So that, after Breakpoint I felt I had been lingering for too long and had to move on, explore the available options in order to add some new "nice-to-have" feature to my Commodore 64: I personally always felt the need to have file transfer using simple, fast, and cheap means. It was a rainy day in August when I had the idea: turn the C64 into a USB host and load/save files directly from/to a USB drive: the idea of USB-64 was born. It took a few days to arrange the hardware and write a driver in assembly. The first properly assembled prototype was going to appear on the 24th of August. Nobody had been informed about the progress, but a few close friends. This is what it looked like: |
![]() USB-64 prototype (serial transfer version) |
User interfaceOne of the first things I realized was: I need this to be hassle free. It also needs to look and feel like a genuine device from the 80's for what concerns the user experience. With a few "must have" enchancements, of course.So what does that mean? Well, to me it meant writing a superset of the CBM BASIC interpreter with new commands: USB-BASIC. Examples of new commands would include:
ULOAD UVERIFY etc. The error messages had to look and feel like the original ones too. E.g.:
?DISK FULL ERROR Of course, the superset would need to be available in a simple way, possibly having it on a cartridge so that it's ready to use at startup, as enthusi suggested. It was at that time that I started the BASIC-Plus project: a complete framework to extend the Commodore BASIC V2 with new commands and, why not, functions. It took a while to check around what was already available. Thanks to Fungus I came across the Transactor magazines which indeed presented an interesting framework for doing exactly what I needed. However, it showed a few features that I thought I could not live with: non BASIC-style tokens, and redefinition of IF (with the added bonus of ELSE, though). So that, I started working my way through the BASIC and Kernel ROMs and looking for other software here and there. I eventually came to the solution I knew I would have liked. On the 28th of August I did my biggest CVS commit of the whole framework, which included by default two new BASIC commands: COMMANDS and QUIT. Everything else is up to the programmer who wants to extend the CBM BASIC, including myself when working at USB-BASIC. |
![]() BASIC-Plus: my framework to extend CBM BASIC |
The USB Kernel written in assemblyAt the same time I worked at BASIC-Plus, I wrote most of the USB Kernel sitting on the device driver and on which the new BASIC commands were going to sit themselves. A first proof of concept for USAVE was already available on the 20th of August (USB-64 was still almost entirely on an evaluation kit at that time), therefore not yet integrated in USB-BASIC:
I went back one step and designed a parallel interface. Unfortunately, this meant more I/O lines required on the Commodore 64 side; so that I had to borrow three from its Serial Port. |
Parallel transferWhen I finally got the missing components I built the test device for parallel transfer. It looks like it is fast enough now:
Is there room for improvement? Yes, there is. The driver and the software that sits on top of it are far from being heavily optimized. This could be pushed a little bit more, if wanted. |
![]() USB-64 prototype (parallel transfer version) ![]() USB-64 connected to a Commodore 64 USB-64 demo program loading from a USB drive |
Cartridge DIYI flashed the cartridge version of the handling software on my blank EEPROM, thanks to Dirk, a colleague from which I borrowed an UV eraser and an EPROM programmer. Other users will be able to flash the new ROM into their preferred cart, e.g. EasyFlash. |
![]() USB-64 software on a cartridge ![]() USB-64 selection menu USB-64 oldskool cartridge (EPROM based!) ![]() USB-BASIC with a few new USB-related commands USB-BASIC in action |
SoftwareThe USB-64 software consists of ALL of the following components:
In this way, I can keep the two Kernels distinct and I don't have to give custom ROMs to users in order to change their CBM Kernel ($E000-$FFFF) into something that understands new device numbers; nor I need to change system vectors to point to code that wraps CBM Kernel routines. |
Supported USB Mass Storage DevicesTheoretically USB-64 supports all those devices that implement the standard USB mass-storage device class:
I personally tried USB-64 with a card reader and with 2 external hard drives without issues. |
What next
|
ContactComments? Feedback? If you are interested in a USB-64 device, let me know: if enough people are interested I might consider producing a batch. The total cost could be around 25 GBP - 30 euros, for an average batch of the parallel version (that does NOT include the cartridge: you would only get the .CRT file to use with your existing cartridge).Just e-mail me. Back to my C64 Section. |
Comers since area creation: - Best viewed at 1024x768