OpenCBM on Mac
Introduction
OpenCBM is a library and a set of command line tools that allow to control old Commodore IEC devices like the famous 1541 floppy disk drive. You can transfer disk image to and from old discs. As modern computers do not provide a IEC connector, OpenCBM allows to control adapters that attach to your PC. Older PCs use parallel port cables (like the XA1541 or XS1541) and newer ones use a USB adapter (XU1541 or XUM1541).
This pages shows you how to use OpenCBM on your Mac. As modern Macs only support USB connectors and no parallel ones, we focus on setting up the XU1541 or XUM1541 devices.
Installation
As of now (19.12.2009), the OpenCBM version usable for Macs is only available in the CVS tree. It supports simple installation with MacPorts so setting up everything shouldn’t be that hard even for an unexperienced user.
- First you need to setup MacPorts (if you haven’t already done it). Download and follow the Installation instructions there.
- As OpenCBM is not integrated into MacPorts yet, you have to setup your own package repository where the OpenCBM package will reside:
> cd $HOME > mkdir -p ports/emulators/opencbm
Now we need the Portfile for OpenCBM. You can retrieve it directly from the CVS. Download Portfile and copy it into the opencbm directory you just created. Now update the ports index you created:
> portindex
You should see something like:
Creating software index in /Users/<cnvogelg>/ports Adding port emulators/opencbm
Total number of ports parsed: 1 Ports successfully parsed: 1 Ports failed: 0
Ok. Now the local ports repository is setup and the only step missing is to add it to MacPorts.
Open /opt/local/etc/macports/sources.conf in your editor:> sudo vi /opt/local/etc/macports/sources.conf
And add the following line (before the rsync:):
file:///Users/<username>/ports
Replace <username> with your login name.
- Ok. Now MacPorts knows about an opencbm package and we can simply install it:
> sudo /opt/local/bin/port install opencbm
This fetches the OpenCBM source code via CVS, builds it and installs everything into /opt/local/bin.
- You can check the installation by looking for the command line tools:
> ls -1 /opt/local/bin/cbm* /opt/local/bin/cbmcopy* /opt/local/bin/cbmctrl* /opt/local/bin/cbmformat* /opt/local/bin/cbmforng* /opt/local/bin/cbmread@ /opt/local/bin/cbmrpm41* /opt/local/bin/cbmwrite@
- OpenCBM is now installed!
Configuration
After installation you need to configure OpenCBM. The most important file is less /opt/local/etc/opencbm.conf. There you only need to set up the HW adapter you will use:
default=xum1541 or default=xu1541
That’s it!
USB Adapters
- XUM1541. This adapter was developed by Nate Lawson and is the most mature one. See the XUM1541 Homepage for details on how to build the HW. It works well with Macs and I use one myself. Currently there are no prebuild adapters available, so you have to build one yourself (adapting a USBkey development board available from Atmel).
If you want to flash the firmware onto your device you can use the dfu-programmer on your Mac to do so. Just install the dfu-programmer package from MacPorts:> sudo /opt/local/bin/port install dfu-programmer
Now download the XUM1541 prebuild firmware from OpenCBM’s CVS. Pick a *.hex file (e.g. xum1541-AT90USBKEY-v02.hex).
Enable the bootloader mode on your device by resetting it while holding the user button. Now you can flash the firmware with dfu-programmer:> dfu-programmer AT90USB1287 erase > dfu-programmer AT90USB1287 flash xum1541-c.hex
That’s it. Reset your device again and the new firmware should be up and running.
Here is a snapshot of my XUM1541 Adapter: - XU1541. This adapter was developed by Till Harbaum. He discontinued the project but Spiro Trikaliotis kept the information on the web. See his XU1541 Page for details. There you can find schematics to build your own device.
Running OpenCBM on Macs
Hook up your trusty 1541 or 1571 drive to your USB adapter and connect the adapter to your Mac. Now let’s check if the device was detected by OpenCBM:
> cbmctrl detect 8: 1571 (XP1541)
Ah! My 1571 was detected (even with parallel interface hence the P in XP). Let’s look at the drive status:
> cbmctrl status 8 00, ok,00,00
Fine, everything looks good! Let’s have a look at the contents of a disk:
> cbmctrl dir 8 0 ."test/demo 1/85 " 84 2a 14 "how to use" prg 8 "how part two" prg 7 "how part three" prg ... 8 "load address" prg 7 "unscratch" prg 5 "header change" prg 402 blocks free. 00, ok,00,00
You can copy files from the disk to your Mac with:
> cbmread 8 "how to use" [Info] reading HOW TO USE -> how to use.prg [Info] identified a 1571 drive ..../[Info] 00, OK,00,00
You can copy the whole disk as an image to a D64 image file with:
> d64copy 8 disk.d64 [Warning] growing image file to 683 blocks 1: ********************* 2: ********************* 3: ********************* ... 33: ***************** 34: ***************** 35: ***************** 100% 683/683 683 blocks copied.
The other way round: Copy an existing disk image onto a real disk:
> d64copy myimage.d64 8
So these are the most useful commands at a short glance. If you want to explore more of OpenCBM’s tools then you can call each cbm* binary with the –help switch to get more information on options and usage.
> cbmctrl --help
Furthermore, all commands have man pages with detailed descriptions. You call man:
> man cbmctrl
Now enjoy OpenCBM on your Mac!

Pingback from Lallafa’s Blog » XUM1541 and OpenCBM for Mac
Time 19. Dezember 2009 at 22:18
[...] OpenCBM on Mac [...]