SD2IEC & IEC-2-SD Adapters
| Caption | A TFW8b SD2IEC v5B, a ready-built unit with OLED display, buttons and IEC pass-through |
|---|---|
| Type | SD-card mass-storage adapter for the Commodore serial bus |
| Designer | sd2iec firmware by Ingo Korb, 2007–2022, GPL version 2 only. JiffyDOS send code by M. Kiesel; FAT long-filename support by Jim Brain; Final Cartridge III fastloader support by Thomas Giesel; IEEE-488 support by Nils Eilers[1] |
| Manufacturer | Unknown |
| First released | Unknown |
| Latest revision | — |
| Operating voltage | +5 V, usually taken from the cassette port or a USB supply; the serial port carries no +5 V[2] |
| Layers / PCB | — |
| Compatibility | Commodore machines with an IEC serial bus; IEEE-488 builds also exist |
| Features | — |
| Model No. | — |
sd2iec is firmware that lets a Commodore 8-bit machine read and write removable storage (SD, MMC or CompactFlash) through the standard serial bus. It runs on several open hardware designs, among them MMC2IEC, SD2IEC and uIEC; ARM-based boards are sometimes sold as IEC-2-SD.[1]
Ingo Korb's README describes it as "a 1541 with a modern storage medium instead of disks", and adds: "Unless specifically noted, anything that tries to execute code on the 1541 will not work, this includes every software fastloader."[1] The project's release page says: "sd2iec is not a floppy emulator."[3]
Documentation
[edit | edit source]The firmware has no manual. Ingo Korb's release page says: "Unfortunately I have still not written a manual for the software, but there is a badly structured, very non-informative README included in the archive."[3] That README, which carries the note "FIXME: This file still needs to be expanded. A lot.", is the reference for how the firmware behaves.[1]
Versions and releases
[edit | edit source]sd2iec has no conventional version numbers. The release page states: "This is currently the only up-to-date release version of sd2iec, if you find any version named 0.something on this or any other web site, it is obsolete and only archived for historical preservation."[3]
The project publishes a single rolling release, sd2iec-current-binaries.zip and sd2iec-current-sources.tar.gz, rebuilt from the development tree, alongside a directory of automated nightly builds. The source tarball's directory name is a git description of the form sd2iec-1.0.0a…-n-ghash, which identifies a commit rather than a release.[3][1] Download the current binaries from the project site.
Hardware
[edit | edit source]The build configurations shipped with the source target these microcontrollers and clock frequencies:[4]
| Configuration | Hardware | Microcontroller | Clock |
|---|---|---|---|
config-larsp |
Lars Pontoppidan's MMC2IEC | ATmega1284P | 8.000 MHz |
config-sw1 |
Shadowolf MMC2IEC boards 1.0–1.9 | ATmega1284P | 8.000 MHz |
config-sw2 |
Shadowolf sd2iec boards 1.x | ATmega1284P | 8.000 MHz |
config-uIEC, config-uIEC3 |
uIEC | ATmega1281 | 8.000 MHz |
config-XS-1541 |
XS-1541 (marked "currently IEEE488-only") | ATmega644P | 14.7456 MHz |
config-petSD |
Nils Eilers' petSD (IEEE-488) | ATmega1284P | 18.432 MHz |
config-arm2iec1, config-mbed |
arm2iec V1.x, mbed | NXP LPC1768 (ARM Cortex-M3) | 100 MHz |
The ARM builds are for the NXP LPC1768. The source contains no STM32 target, so an STM32-based "IEC-2-SD" is not running a build from this source tree.[4]
Clock source
[edit | edit source]The README warns: "Using sd2iec without an external crystal or similiar precise clock source is not a supported configuration. If you try that anyway, be prepared to suffer from random data corruption." Some fastloaders refuse to run on an unsuitable clock source.[1] On a DIY board that behaves erratically, check the crystal first. The configuration for Shadowolf's MMC2IEC boards notes that Turbodisk needs a crystal, which is usually present only on revision 1.8 or later.[4]
Power
[edit | edit source]The Commodore serial port carries SRQ, ground, ATN, clock, data and reset, and no +5 V supply, so an adapter needs its own power. C64-Wiki shows units powered from the datasette port, which then cannot take a tape deck, and gives a consumption of about 15 mA idle and 30 to 80 mA busy; it also reports a unit that would not work while a power-hungry cartridge was connected.[2] The firmware README gives no power figures.
What the firmware supports
[edit | edit source]The README's command list opens: "Any command not listed below is currently not supported."[1]
Commands
[edit | edit source]| Command | Notes |
|---|---|
| Directory filters | =B and =D both show only directories; *=H includes hidden files, which sd2iec marks with an H after the lock mark. CMD-style short and long listings with timestamps ($=T) are supported, including timestamp filters
|
$=P |
CMD-style partition directory, with filters. All partitions are listed with type FAT |
CD, MD, RD |
CMD-compatible subdirectory syntax; drive and partition numbers are ignored. Wildcards work anywhere in the path. CD also mounts and unmounts images: change into the image as though it were a directory, and leave with CD:_ (left arrow)
|
CP, C<Shift-P> |
Change the current partition |
C: |
File copy, CMD-compatible, including appending several source files into one target. Copying REL files "should work, but isn't tested well" |
DI, DR, DW |
Direct sector access, an sd2iec extension. Needs a large buffer (512 bytes or more), except DI with page 0. A buffer that is too small returns the sd2iec-specific error "78,BUFFER TOO SMALL,00,00"
|
G-P |
Get partition info. The reported information is partly faked |
P |
Positioning works for REL files and for ordinary files on a FAT partition, seeking to a 32-bit byte offset |
N: |
Format. Works only if a disk image is mounted, and is ignored for DNP images unless the current directory is the image's root |
R |
Rename, as on CMD drives |
S: |
Scratch, with full name matching and multiple comma-separated names |
T-R, T-W |
Time read and write, only if the hardware has an RTC. Four formats: ASCII, BCD, Decimal and an ISO 8601 subset. No RTC returns "30,SYNTAX ERROR"; an RTC that is present but unset returns "31,SYNTAX ERROR" from T-R |
U0> |
Change device address: "U0>"+CHR$(new address). No other U0 command is implemented
|
U1, U2, B-R, B-W |
Block read and write, fully supported while a disk image is mounted |
B-P |
Supported, with a third parameter for the high byte of the buffer position |
UI+, UI- |
The slightly faster VIC-20 bus protocol, on and off |
UI, UJ |
Soft and hard reset. UJ closes buffers but does not reset the directory, the mounted image or the swap list |
U<Shift-J> |
Real hard reset: restarts the processor, skipping the bootloader |
X… |
The extended command set (see below) |
M-R, M-W, M-E |
Memory commands, used for drive detection and fastloader emulation (see below) |
VALIDATE and B-A (block allocate) are not in the list, so neither is supported.[1]
Configuration
[edit | edit source]Settings are not kept in a file. They are changed with the X commands and saved to the microcontroller's EEPROM with XW.[1]
| Command | Function | Default |
|---|---|---|
XEnum |
File extension mode, 0 to 4: whether files on FAT are written with x00 headers or with SEQ/USR/REL (and optionally PRG) extensions | 1 |
XE+, XE- |
Extension hiding | Off |
XInum |
How mountable files appear in the directory: normal type (0), as directories (1), or both (2) | 0 |
X*+, X*- |
1581-style * matching |
On |
XDdrv=val, XD? |
Drive slot configuration on multi-drive hardware | |
XS:name, XS |
Set or clear the swap list | |
XR:name, XR |
Set or clear the file used for M-R emulation | |
X |
Report all extended parameters on the error channel | |
X? |
Extended version query: version, processor type set at build time, and configuration-file suffix | |
XW |
Store the configuration in EEPROM |
For the device address the README gives a "hardware overrides software overrides hardware" rule. An address set in software survives power-off, but moving the address jumpers away from the setting that was active when the configuration was saved puts the jumpers back in control. Holding the disk-change (forward) button during power-on makes the firmware use default values instead of the stored configuration, which is the way out of a bad one.[1]
Fastloaders
[edit | edit source]Code that runs on the drive does not work unless it is specifically implemented. The README lists the implemented loaders with their limits:[1]
| Loader | What is supported |
|---|---|
| JiffyDOS | Supported. Its timing constraints are relaxed compared with Turbodisk, though not as relaxed as the standard IEC protocol |
| Turbodisk | Detected by the CRC of its 493-byte drive code and the M-E address 0x0303. The same code circulates as "Turbodisk" 2.1 and 2.2 and as "Fast-Load". The README says it is not known whether an NTSC-compatible version exists |
| Final Cartridge III | The fast loader and the fast saver, PAL and NTSC, plus the slightly different loader used for FC3-freezed files |
| EXOS V3 and The Beast System | Both supported; very similar to the FC3 loader |
| Action Replay 6 | Only the 1581 fast loader and fast saver. With file-based ROM emulation disabled, sd2iec returns a value intended to push the cartridge onto the standard kernal loader instead |
| Dreamload | Disk images only, since it uses direct track and sector access. A "captive" loader: sd2iec stays in Dreamload mode until told to quit, and it does not work with more than one device on the serial bus because of how it uses ATN |
| ULoad Model 3 | Disk images only. One variant is supported, the one used by Ultima 3 Gold |
| G.I. Joe loader | Supported, captive, file-name based rather than image based |
| Epyx FastLoad cartridge | The fast loader only, not the cartridge's disk editor or copier functions |
| ELoad version 1 | Detects and supports sd2iec natively |
| GEOS 2.0 | Boots from D64 images of original disks and from D41/D71/D81 images made with geoMakeBoot. Set up file-based M-R emulation, or GEOS may detect the wrong drive type and fail to boot. GEOS 1.3 boots but is not well tested |
| Wheels | Boots from any image type it supports, but the ROM emulation file must be set, especially for CMD HD emulation. Do not use the disk-change buttons under HD emulation, because Wheels does not check for disk changes on that drive |
| Maniac Mansion | The original's extra copy-protection check is not supported; a cracked version is needed. Captive loader: hold NEXT until the red LED lights to exit |
| Zak McKracken | As above, but the protection is a code list, so images of originals work |
| Sam's Journey | The loader expects a single drive on the bus at ID 8. Resetting the C64 while the busy LED is lit hangs sd2iec until it is reset or power-cycled |
Dolphin DOS is not in the list and is not supported.[1]
Drive detection, GEOS and M-R emulation
[edit | edit source]GEOS support depends on a setting.[1]
With no ROM file set up, M-R consults a small internal table of common drive-detection addresses and returns data that forces most supported fastloaders into a compatible mode. GEOS, however, reads large parts of the drive ROM with M-R, more than can be tabulated, so sd2iec has file-based M-R emulation. Point XR at a copy of a 1541, 1571 or 1581 ROM (a name of 16 characters or fewer) and its contents are returned for M-R reads in the $8000–$FFFF range. The file is looked for in the current directory, then the root of the current partition, then the root of the first partition.
Enabling it usually reduces compatibility with everything else, because most of the implemented fastloaders recognise only the 1541 variant. Turn it on for GEOS and Wheels and leave it off otherwise.[1]
Software that needs to detect sd2iec should not use M-R, the README says: send UI and check the reply for "sd2iec" or "uiec".[1]
Disk images
[edit | edit source]Images are recognised by extension and by exact file size:[1]
| Size in bytes | Format |
|---|---|
| 174,848 and 175,531 | D64 / D41, without and with an error info block |
| 349,696 and 351,062 | D71, without and with an error info block |
| 819,200 | D81 |
| Any multiple of 65,536 | DNP |
An appended error info block is used to simulate read errors; writing to a sector with an error works but does not clear the error. D81 images with error info blocks are not supported. Because images are detected only by extension and size, the firmware cannot tell whether a file is a valid image, so a mount can appear to succeed and then misbehave.[1]
The README warns that DirMaster v2.1/Style by THE WIZ generates broken DNP files, in which CD:_ out of a subdirectory lands on the wrong sector. Avoid creating DNP subdirectories with that version.[1]
REL files
[edit | edit source]REL support is partial. Existing files should work; creating new ones or appending records may fail. REL files inside disk images are not supported, only REL files on a FAT medium. With x00 support disabled, the first byte of a REL file is taken as the record length.[1]
x00 files, long names and the EEPROM file system
[edit | edit source]x00 files (P00, S00, U00, R00) are supported transparently and show their internal name in the directory; renaming changes the internal name. They are recognised by both extension and header signature, and they are always parsed even when writing them is turned off.[1]
Long file names work on FAT, but the 8.3 name is used if the long name is longer than 16 characters. sd2iec reads only the low byte of each UTF-16 character, so non-ASCII names come out oddly.[1]
Devices with at least 128 KB of flash have an EEPROM file system, on the last partition number and reachable as !: or $!. It holds 3.25 KB and at most 8 files on AVR devices, and 7 KB and at most 16 files on a2iec, with no subdirectories. The README says it is newly implemented and that the format may change, so do not keep anything there that you cannot lose.[1]
M2I support is deprecated and due for removal: convert the files to P00 and set extension mode 2 (XE2).[1]
Using the buttons
[edit | edit source]Two buttons, NEXT and PREV, step through a swap list; pressing both together is the HOME function, which jumps to the first entry.[1]
- A swap list is a plain text file with one image or directory path per line. Any style of line ending is accepted and blank lines are ignored. A first line of exactly
#PETSCIIswitches name parsing to PETSCII, and lines starting with a semicolon are comments. XS:filenameactivates a list untilXSdisables it.- If the buttons are used with no list active, sd2iec looks for
AUTOSWAP.LSTin the current directory. A list activated that way switches off on a CD command, so a different AUTOSWAP.LST can sit in each directory. - With no AUTOSWAP.LST present, HOME generates
AUTOSWAP.GENfrom all the disk images in the current directory and activates it. AUTOSWAP.GEN is never picked up automatically, so that a real AUTOSWAP.LST is never overwritten. If there are no images it leaves an empty AUTOSWAP.GEN behind. - Each action has its own LED pattern: both LEDs briefly, then green for NEXT, red for PREV and both for HOME.
Holding the disk-change button for two seconds puts sd2iec into sleep mode, in which it ignores the bus (red LED on, green off) until the button is held for two seconds again. This lets an adapter stay connected while a real drive is used with a fastloader that cannot tolerate a second device on the bus.[1]
Holding PREV during power-up starts a card-detect test: the red LED follows the card-detect switch and, on units with two LEDs, the green LED follows the write-protect switch. It tests the mechanical switches only, not communication with the card. Power-cycle or press NEXT to leave it.[1] On a unit that intermittently fails to see a card, run this test first.
Behaviour that looks like a fault
[edit | edit source]The README notes these:[1]
- File sizes in the directory are in blocks of 254 bytes, but the "blocks free" figure counts free clusters, so it will not agree with a real 1541. Ingo Korb calls this "a compromise of compatibility, accuracy and code size".
- Where known, the low byte of the next-line link pointer in a directory listing is set to (file size MOD 254) + 2, so the true file size can be recovered. The 2 is added so that it cannot be mistaken for an end marker.
- File overwrite (
@foo) deletes the file first. - On hardware with more than one card, changing either card resets the current partition to 1 and every partition's current directory to the root.
- Partition 0 is not a real partition. It points at the currently selected one, which defaults to partition 1 and is changed with
CP.
History
[edit | edit source]sd2iec was inspired by, and uses a few bits of code from, MMC2IEC by Lars Pontoppidan, and once ran on the same hardware before it grew too big for the ATmega32 used there. Ingo Korb's copyright notice runs from 2007 to 2022.[1]
The README says that GitHub copies are unofficial: "If you found this file on Github, you found an unofficial clone of the original repository. The original repository is available on https://www.sd2iec.de". The canonical source is git clone http://www.sd2iec.de/sd2iec.git.[1][3]
IEEE-488
[edit | edit source]IEEE-488 support, contributed by Nils Eilers, is in the firmware, and config-petSD is a shipped IEEE-488 configuration.[1][4] A PET can therefore use a native IEEE-488 build without an IEEE-to-IEC converter.
References
[edit | edit source]- ↑ 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.28 1.29 Ingo Korb, sd2iec README, shipped in
sd2iec-current-sources.tar.gzfrom sd2iec.de (source tree sd2iec-1.0.0atentdead0-38-g7d0be2e, retrieved 2026-10-01). The firmware's own documentation: contributor credits; the introduction; the supported-command list; the X commands and XW; address priority; fastloader notes; M-R emulation; disk image sizes; REL, x00, long-name and EEPROM file system notes; the M2I deprecation notice; disk-change buttons, swap lists, sleep mode and the card-detect test; the crystal warning; and the "Other important notes" section. - ↑ 2.0 2.1 C64-Wiki, Serial Port—link(accessed 2026-10-01) (pin assignment of the 6-pin DIN serial port: 1 SRQ, 2 GND, 3 ATN, 4 CLK, 5 DATA, 6 RESET) and SD2IEC—link(accessed 2026-10-01) (power from the datasette port; idle about 15 mA, busy 30-80 mA; a unit that did not work with a KCS Power Cartridge connected).
- ↑ 3.0 3.1 3.2 3.3 3.4 sd2iec.de, the project's own release page. Source for "sd2iec is not a floppy emulator", for the statement that any version named 0.something is obsolete and that the rolling
sd2iec-current-*files are the only up-to-date release, for the absence of a manual, for the nightly build directory, and for the canonical git URL. - ↑ 4.0 4.1 4.2 4.3 Build configuration files shipped in
sd2iec-current-sources.tar.gz(source tree sd2iec-1.0.0atentdead0-38-g7d0be2e, retrieved 2026-10-01):configs/config-larsp(MMC2IEC, atmega1284p, 8 MHz),config-sw1(Shadowolf MMC2IEC 1.0-1.9, atmega1284p, 8 MHz; "Turbodisk requires a crystal which is usually only present on 1.8 or later"),config-sw2(Shadowolf sd2iec 1.x, atmega1284p, 8 MHz),config-uIECandconfig-uIEC3(atmega1281, 8 MHz),config-XS-1541("currently IEEE488-only", atmega644p, 14,745,600 Hz),config-petSD(atmega1284p, 18,432,000 Hz),config-arm2iec1andconfig-mbed(lpc1768, 100,000,000 Hz) andconfig-example(atmega644p, 8 MHz). No STM32 target exists in the source.