SD2IEC

Introduction

Even though disk drives are more reliable than cassette players they are still prone to failures and getting your hands nowadays on an original or third party disk drive can set you back a lot along with the cost of the floppy disks. There are, however, modern emulated disk drives, with the SD2IEC being a good example, a replacement for the Commodore 1541 disk drive, which comes in different versions - various PCBS, different enclosures, with and without buttons (some only having a next and home button, others also have a previous button) and some have an LCD, and/or different firmware with different features. The SD2IEC is open source hardware and firmware, so anyone can build it, and it supports the C64, VIC-20, C128, C16 and +4.

Please read on to learn more about the SD2IEC and how to use it.

Overview

Instead of using floppy disks the SD2IEC uses an SD card to store virtual disk images, and loads can be saved to a single SD card, which is a lot more reliable than a floppy disk, and files can easily be transferred to a computer by simply putting the SD card into a PC and copying them over (which can be used as a form of backup) and disk images can easily be copied to the SD card. The SD2IEC supports D64/D71/D81 disk image file formats as well as PRG and P00 files, folders are also supported, but it's not advised to use capital letters in file and folder names to ensure names are displayed correctly on the C64.

The SD2IEC is faster than using an original floppy disk drive without a fastloader but you can also use the SD2IEC with a fastloader (the ones that are supported) in which case it will be quicker than the same fastloader used with a real disk drive. Most software should run from the SD2IEC without problems but there may be the odd compatibility issue since the SD2IEC isn't emulating a disk drive to the very low level.

The SD2IEC I bought requires a full size SD card but I used a TDK 4GB microSD card in an adapter formatted as FAT32; if you have problems with using the SD2IEC try a lower capacity or different brand card.

The SD2IEC I purchased can be seen below:

Note: I added the label myself.

And here is the SD2IEC on top of my C64C, helping to give a sense of scale:

As you can probably tell, the SD2IEC I bought is not the most professional looking product but it gets the job done.

The SD2IEC has two push buttons on the top, with the green button performing the 'next' function and the red button performing a 'home', which unmounts and returns to root but as mentioned there are many variations so your SD2IEC may vary. The microSD card in the adapter can be seen peeking out of the front and there is a ribbon cable escaping from the rear, which terminates in a serial connector and datassette connector (just for power).

With the C64 powered off, the serial connector is plugged into the C64's serial port and the datassette connector of course goes into the C64's datassette port, so, you cannot use a datassette at the same time, unless you provide power by another means. Then, when the C64 is powered on will you will see a red and green LED light on the SD2IEC. You can then use the SD2IEC like an original C64 disk drive, and here is a simple example of getting a directory listing, the syntax of which is a little unusual if you're not used to using disks with a C64:

LOAD"$",8

LIST

The green LED briefly lights on the SD2IEC when the LOAD command is issued as to show 'disk' access. If there are no files then it will just give the title of the SD card and the number of blocks remaining (65535) but if there are files on the SD card then they will be listed. If don't have an SD card inserted or it's not formatted correctly then the red led will flash constantly until the issue is rectified, emulating the lights on a 1541 disk drive.

Since the directory listing is treated as if it were a BASIC program loaded into memory don't forget to use the NEW keyword if you want to write a BASIC program after doing a directory listing.

We can also use the usual methods to save and load files to disk but you can't just create a virtual disk image from the C64, you have to create one on a PC, such as using the D64 editor to create blank disk images. For more information and download see:

http://www.d64editor.com/

An alternative to creating a blank disk image is to use the VICE emulator:

https://www.stevencombs.com/pi1541-2

To save a BASIC program use :

SAVE"FILENAME",8

Replacing FILENAME with the actual name of the file you want to use. While saving the red and green LEDs of the SD2IEC will light.

Now, if you do a directory listing you will see your BASIC program has been saved, which will have the PRG identifier.

Note that to overwrite a previously saved file with the same name you cannot just save again specifying the same file name, you must either delete the file and save it again or precede the file name with '@:' such as:

SAVE"@:FILENAME",8

This is normal 1541 behaviour.

If you wanted to load the file use:

LOAD"FILENAME",8

Replace FILENAME with the name of the file you want to load. The green LED on the SD2IEC will light.

Disk images can be downloaded and copied to the SD card and you can also copy any of your own files saved from the SD card to somewhere to backup. As is, the SD card will effectively be just one disk image and the buttons won't do anything (pressing the red button does cause the lights to flash, however). To be able to have multiple disk images on the SD card and for the buttons to function a swap list file called autoswap.lst is required, which is a text file populated with a list of each disk image file in the order you want them to be selected using the previous/next buttons. As well as for individual disk images it can also be useful for multi disk games, and some SD2IEC devices support automatically creating the list through a certain button combination.

With the swap list file on the SD card, when you do a directory listing it will list the files on the SD card including the autoswap file. You can then press the next/previous button to mount the next or previous disk image (and unmount the prior mounted one if any) in the order determined by the autoswap file, which wraps around. The autoswap file must be in the same directory as the disk images and this is useful for games or other software that use multiple disks.

If you have multiple disk drives daisy chained, such as an SD2IEC and a real 1541, you will need to change the device number of one of the drives, which can be done temporary in software; if you power cycle the drive it will revert back to its default drive number. While a real 1541 can have its device number changed permanently (not so easy to do on an original model 1541), it's easier to change on the SD2IEC and have it store the setting in its EEPROM so that the change becomes the default at power on. Since I wanted to test having both the SD2IEC and 1541 accessible from a single C64 I first connected up just the SD2IEC to the C64 to change its device number.

To temporary change the device number of an attached disk drive use the OPEN command, the following example changes device 8 to become device 9:

OPEN1,8,15,"U0>"+CHR$(9):CLOSE1

To store the setting in the SD2IEC's EEPROM you can then use:

OPEN1,9,15,"XW":CLOSE1

You will see no LED activity from the SD2IEC but if you power cycle the C64 and then try to access the SD2IEC it should only respond to the new device number (9) you set it to.

Because the SD2IEC only has one serial port, unlike an actual 1541 which has two serial ports, the SD2IEC must be connected to the 1541's serial port and the 1541 connected to the C64's serial port. Then the 1541 can be powered up followed by the C64 (also powering the SD2IEC) and you should find that the 1541 responds as device 8 (assuming that's what it defaults to) and the SD2IEC behaves as device 9. In my testing I found no issue with using both a real 1541 and an SD2IEC together with one C64.

Teardown

There is just one screw located at the bottom of the case that holds the two pieces of the case together which can be separated with the removal of the screw but be aware that the two switches are attached to the main board via wires, so don't pull too hard. The PCB is held to the case with a sticky pad as can be seen in the photo below:

The main board has the following notable components:

Two LEDs (red and green)

SD card connector

8MHz crystal

ATmega644P 8-bit AVR microcontroller

There are also a number of unused connections.

Technical

For much more information about the SD2IEC please look at the following links:

SD2IEC User's Manual:

http://www.c64os.com/post/sd2iecdocumentation

SD2IEC wiki:

https://www.c64-wiki.com/wiki/SD2IEC

There are links on the page in the Features section for downloading schematics and PCB design files.

SD2IEC quick command reference (includes sending commands to the SD2IEC):

https://wpguru.co.uk/2014/08/how-to-use-sd2iec-a-quick-command-reference/

There is also a good amount of information about using the SD2IEC at:

https://www.thefuturewas8bit.com/sd2iec-info

The following site has lots of in depth information about the SD2IEC:

http://www.c64os.com/post/sd2iecdocumentation

All content of this and related pages is copyright (c) James S. 2022