Saturday 1 November 2014

USB to 1541 Adapter

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

Most 1980's home computers that had disk drive options used an internal disk controller with external drives attached under the control of the computer. The BBC, Spectrum and Apple were like this. Commodore and Atari disk drives are rather different. They are in fact computers in their own right, connected via a serial bus. So in modern terms, more like a network server that a USB hard drive.
The most popular of the Commodore drives is the 1541. These things are about the size and weight of a concrete breeze block, mainly due to the internal linear power supply.
Inside there is a 6502 processor, two 6522 VIA's, 2K RAM and 16K ROM. This has a custom drive controller chip, rather than the VID video and sound chip, but otherwise not for off the spec of the VIC20 computer. The serial bus connection has a rather useful benefit, without too much work, the serial protocol can be implemented on another computer, giving full access to the drive.
This was done many years ago on the PC, and simple parallel port adapters gave access to the drives. I've build a few versions of the X cables over the years. This is quite a nice little XA1541V2 board I picked up this one on ebay a few years ago. It has transistor drivers to boost the drive capabilities. The only problem with these is the lack of a parallel port on modern computers. I have an old XP laptop I keep for this sort of task, which has built in parallel and serial ports.
I have a few disk drive projects coming up, so I wanted to get this up and running again, ideally on my main development computer, without a parallel port. I looked at various options, including a pci express parallel card which didn't work too well, it seems the older the better for this task. I also looked at USB-parallel options, then thought why not cut out the middle man and drive it direct. Turns out, this too has already been done. xum1541 is a USB to 1541 interface, and ZoomFloppy is an nice implementation of that. I don't know if these are still current, these seem to date to 2011. All the information is there, so I set about building one.
This chip used, an ATmega32U2 is the same foorprint as the chip I used on my smaller USB keyboards, so I adapted one of my ZX81 boards for this purpose. It had all the USB interface and the crystal etc, so that was the USB side sorted. The firmware was loaded using the Atmel Flip interface, as I think was the plan with xum1541.
The IEC side is similar to the output stage of the Commodore computers it was designed to talk to, so in a slight change to the design, I used a 7406 chip. The red LED is activity, I later added a green power LED on the right.
Those two sandwich together to implement something like the xum1541. The design can also include a parallel connection to the 1541 drive to speed it up, I'm not adding that at this stage as I don't mind it running a little slower. There is also the option to talk to IEE488 drives, which is something I'm going to be looking at next, I have an 8250 drive to refurbish to go with the Pet.
That all fits nicely into a small box, firmly held in place with too much hot melt glue as usual
With that complete, the 6 pin IEC cable connects to the drive and the USB side to the PC. Time to fire it up. As usual with IEC devices, best to connect everything up, then power on, drive first then computer. A good way to fry the 7406 chips is to plug the drive into a Commodore 64 when powered on. In this case, connect to the drive, power on the drive, then plug in the USB.
The software I used with the parallel cable was a collection of command line utilities, opencbm. These are still there, and still work. This is cbmctrl, which is used for sending commands to the drive such as reset, status and directory.
But things have progressed, and there is now a nice user interface which uses these programs behind these scenes. This is CBMXfer.
Very nice to use, this also ties in a number of other tools such as d64 disk image creation (disk to image and image to disk). There are also tools to view source files, with the basic tokens correctly displayed.
And integration with vice, the commodore emulator, so you can run the files you have just transferred or are about to transfer to check them out.
There are a number of elements involved in this process, and this is the work of many different people. All credit to them, and I am grateful to them all for making it available, it's going to be very useful.