How to use SD2IEC: a quick command reference

Photo 28-08-2014 19 30 57
I’ve ordered an SD2IEC a few weeks ago from Nic over at It’s an SD card reader for Commodre computers and emulates many features of the 1541 Floppy Disk Drive.

I went for the Limited Edition made from authentic recycled C64 plastic – so this little critter used to be a real C64! This has to be one of the coolest gadgets for any Commodore fan in the 21st century.

Nic and several other sellers on eBay build the hardware, while the software was developed by Ingo Korb with contributions from others. In this article I’ll explain how you can get the most out of the SD2IEC.

Reading and Writing Files

The SD2IEC works out of the box with standard disk commands (such as LOAD and SAVE). This will save a BASIC programme as PRG just like your Commodore would save it to floppy disk.

You can create, switch into and remove directories on the SD card with your SD2IEC (or your “contemporary” computer of course). You can also read from and write to D64/D71/D81 image files and I’ll explain how this works further down.

When you’re in a subdirectory (or a disk image) all read/write operations are performed there until you switch images or directories. We can do this by communicating with the SD2IEC via the command channel, as if we’re speaking to a 1541.

Looks like the SD card is hot-swappable without the need to “safe-eject” as long as none of the lights are on, indicating read/write access.

Speaking to your SD2IEC

To issue commands on your SD2IEC we must open that trusty old command channel on the device (number 15), PRINT# the command and then optionally close the channel again. Here’s how to do that:

OPEN 15,8,15
PRINT#15,”your command here”

You can also write this on a single line:

OPEN 15,8,15,”your command”:CLOSE 15

You can also leave channel 15 open and issue more commands. Notice though that if you use any other disk command after opening channel 15 (such as LOAD or SAVE) all channels including 15 are closed automatically. Commands such as DIRECTORY do not close the channel.

I find it helpful to add these things to one my my programmable keys (C128 and Plus/4) via the KEY command:

// open command with trailing quotes
KEY 1,"OPEN 15,8,15,"+CHR$(34)

Hit F1, then type one of the commands below. If the channel is already open, simply issue the command via PRINT#15,”command”.


The CD command lets you navigate the directory structure much like you would in Linux and Windows from the command line.

// change into the root directory

// enter directory “mydir” (relative to where you are)

// enter directory “mydir” (absolute from root directory)

// navigate up one level (like the Linux cd .. command)

You can also create directories to start organised without the need for other tools. That’s where the MD command comes in handy:

// create directory in the current location

// create directory inside another directory

// create a directory absolute to root

When you’re done with a directory you can delete it with RD. Note that only empty directories can be deleted, otherwise you’ll get a FILE EXISTS error:

// remove in current directory

// remove directory absolute to root

Mounting Disk Images

The CD command can also be used to mount D64/D71/D81 image files, just as if they were standard directories. The same syntax applies as with switching directories:

// mount “myimage.d64” in current directory

// mount “myimage.d64” in subdirectory /mydir (relative)

// or absolute

// unmount a disk image (go back SD card directory in which the image resides)

You don’t have to mount disk images of course and can instead use a FAT or FAT32 formatted SD card just like it was a floppy disk. However, CBM DOS can only address a maximum of 144 files in a directory which means that a cheap 4GB SD card will be exhausted by this limitation before it’s anywhere near full.

Changing the Device Address

By default the SD2IEC is set to be drive number 8. But like its vintage counterpart you can change this to 9,10 or 11 using the following command:

// change from drive 8 to drive 9
OPEN 15,8,15

Replace the CHR$ value with the desired drive number. Just like a real 1541 drive, the SD2IEC will not remember this change upon reset. You can however save the above to its internal EEPROM which will survive subsequent reboots:

// save drive number to EEPROM
OPEN 15,9,15

Replace 9 with your actual drive number.


If you encounter flashing lights on your device, then the SD2IEC is trying to tell you something. On the C128 and Plus/4 you can read out the disk error channel by looking at the DS$ system variable:

// print disk error channel on C128 and Plus/4

This will show you what went wrong (FILE EXISTS, FILE NOT FOUND, etc). On the C64 this is a little harder and requires you to write a small programme to read those values out. This is necessary because the INPUT# command can not be used in direct mode:

// read disk error channel on C64
10 open 15,8,15
20 input#15,a,b$,c,d
30 print a;b$,c,d
40 close 15

You can leave a comment on my original post.