USBhost-64: what is it?USBhost-64 is a hardware interface that adds USB host capabilities to the Commodore 64, thus making it possible to access USB flash drives at up to 16.42 kB/s for file read/write purposes. The other good news are that FAT-16 and FAT-32 are both supported.
ChangesLast updated on the 21st of February 2015.
SoftwareThe USBhost-64 software consists of ALL of the following components and comes in both assembly and C language (excluding USB-BASIC which is written in assembly only):
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 USBhost-64 supports all those devices that implement the standard USB mass-storage device class through the SCSI interface (not the IDE/ATAPI one):
I personally tried USBhost-64 with a card reader and with 3 flash drives without issues.
USB-BASICUSB-BASIC is the easy way to take advantage of the USBhost-64 interface. It integrates into the standard CBM BASIC seamlessly and new commands are available both in program and direct mode.
There are tape, disk, and cartridge versions available so users can take their pick. I personally enjoy running USB-BASIC from my EasyFlash cartridge, but sometimes I have to load it from a TAP file using DC2N especially when I need to use my Action replay VI cartridge at the same time.
USB-BASIC on an EasyFlash cartridge
Example applications developed by myself
ContactComments? Feedback? If you are interested in a USBhost-64 device, let me know: if enough people are interested I might consider producing a batch. The total cost could be around 45 GBP - 60 Euro, for an average batch of the parallel version with a nice enclosure (that does NOT include the cartridge: you would only get the .CRT file to use with your existing cartridge, e.g. EasyFlash).
Just e-mail me.
Pre-ordering will be soon available at this page, so keep checking for updates if interested!
Back to my C64 Section.
History of making
From an idea to a prototypeBack in April 2010 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 was later renamed to USBhost-64).
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:
USBhost-64 prototype (serial transfer version)
BASIC User interfaceOne of the first things I realized was: I need this to be hassle free also for unexperience users. 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:
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
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 the saving routine was already available on the 20th of August 2010:
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:
USBhost-64 prototype (parallel transfer version)
USBhost-64 connected to a Commodore 64
USB-BASIC load/save testsQuickly enough I wrote the code to get a whole BASIC extension that was offering basic disk access capabilities seamlessly.
USB-BASIC with a few new USB-related commands
USAVE test (from 2010)
ULOAD test (update to my similar 2010 video)
OptimizationsA few years after the above speed measurement, I decided to set up a proper tool for throughput measurements. The simplest thing I could think of doing was to measure times on the Commodore 64 itself, thus interfering slightly with the test, but not a big deal.
After coding such performance meter tool I did the tests, and this was the outcome:
USBhost-64 becnhmark test results: 16.42 kB/s
That's 16.42 kB/s. 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.
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.
USBhost-64 software on a cartridge (2010)
USBhost-64 selection menu (2010)
USB-BASIC oldskool cartridge (2010 - EPROM based!)
Closing noteOver time USBhost-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, USBhost-64 is a proof of concept 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, USBhost-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.
Comers since area creation: - Best viewed at 1024x768