sd2iec (firmware)
This page describes the functionality of the sd2iec firmware. For hardware projects using this firmware, see MMC2IEC, SD2IEC, µIEC, and arm2iec.
The most prominent use of sd2iec is emulation/replacement of a Commodore-1541 disk drive for a C64 using Atmel AVR-based hardware. Sd2iec is available as open source (GPL).
To distinguish the firmware from the hardware design that shares the same name, the firmware should always be referenced in lowercase, while the hardware should be denoted in uppercase.
History[edit | edit source]
The sd2iec firmware started as a set of modifications to the MMC2IEC firmware, but quickly morphed into a complete rewrite. Initially, it targeted only the MMC2IEC boards, but was later enhanced to support other hardware as well. Originally, it ran on an ATmega32, but later versions of the firmware are too large and need an ATmega644 or 1284/1281. Most recently, ARM support has been added - for the corresponding device, see arm2iec.
- 2012-02-26 – release 0.10.3
- Bugfix: Un-break I2C display communication.
- 2011-12-18 - release 0.10.2
- Bugfix: End of generated raw directory was incorrect
- Bugfix: Various compilation fixes when fastloaders are disabled
- ULoad M3 automatically exits when ATN becomes active
- Minor code space improvements
- New fastloader: ELoad Version 1 (EasyProg)
- 2010-12-25: sd2iec 0.10.1 release including support for GEOS.
- 2009-05-20: sd2iec 0.8.1 release (mostly bugfixes)
- 2009-03-08: sd2iec 0.8 release including support for DreamLoad, Exos, FC3 freezes, D71/D81 images, direct SD card sector access, and many other small changes.
- 2008-05-02: sd2iec 0.7 release including support for the Final Cartridge 3 fastloader among many other small changes.
- 2008-02-20: sd2iec 0.6 release including support for long filenames, B-R, B-W, M-R, writing configuration to EEPROM, and several bugfixes.
For a complete and detailed firmware version history, see the git web interface.
Features[edit | edit source]
- D64/D71/D81/M2I support (both reading and writing for Dxx, even with direct sector access using U1/U2)
- T64 is not supported
- PRG/P00 etc. support
- Limited REL support
- Subdirectory support (CMD command syntax).
- Support for Turbo Disk AKA Fast Load AKA Speeddisk fastloader
- Supports the JiffyDOS fast serial bus protocol, the Final Cartridge 3 fastloader/fastsaver, DreamLoad, Exos, GEOS
- Supports an external "disk change" button
- Supports FAT long file names
- Supports FAT12/FAT16/FAT32 formatted SD and SDHC cards
- Supports sector access of SD cards from C64 side
- Good standard IEC compatibility
Usage[edit | edit source]
These are just some examples for drive commands. For a complete reference, read the README. See Drive command for information on how to send drive commands in general.
- Changing directories (CMD syntax):
OPEN1,8,15,"CD/SOMEDIR/":CLOSE1
- change to SOMEDIR (relative)OPEN1,8,15,"CD//":CLOSE1
- change to root directoryOPEN1,8,15,"CD//SOMEDIR/":CLOSE1
- change to SOMEDIR (in root)OPEN1,8,15,"CD:←":CLOSE1
- go to parent directory
- Using M2Is or D64s
OPEN1,8,15,"CD//SOMEDIR/:SOMEGAME.M2I":CLOSE1
- change to/mount SOMEGAME.M2IOPEN1,8,15,"CD//SOMEDIR/:SOMEGAME.D64":CLOSE1
- change to/mount SOMEGAME.D64OPEN1,8,15,"CD:←":CLOSE1
- leave M2I/D64- TAKE CARE - the m2i-support has ended with firmware V0.10.3 and these files will not work in newer firmware versions anymore. If you have a big m2i-archiv and still want to use it, you must convert all the files into the p00-format, or back into d64 files. This can be done with tools like for example "64Copy V4.46b", "DirMaster" or the commandline-tool "m2itopc64".
- Loading files:
LOAD"//SOMEDIR/:SOMEFILE"
- load SOMEFILE in SOMEDIR (filename gets separated from path using colon)
- Create a new image:
OPEN1,8,15,"N:SOMENAME":CLOSE1
- image is created and opened.
- Change device address:
OPEN1,current address,15,"U0>"+CHR$(new address):CLOSE1
- change sd2iec device number to new addressOPEN1,device address,15,"XW":CLOSE1
- this will save settings to eeprom (required if you want to set new device address as default)
FAQ[edit | edit source]
Are fastloaders supported?[edit | edit source]
In general, no. That said, sd2iec does have special support for a few well-known fastloaders.
Longer explanation: Fastloaders consist of a code portion running on the C64 and of code running on the floppy. sd2iec cannot emulate a complete 1541 since this would imply emulating a whole 6502 processor, several additional circuits, and the floppy's mechanism. A microcontroller's resources are just not enough for that (it's not only about processing power and timing but also memory requirements). This can be done using an FPGA though - see 1541 Ultimate. For sd2iec, it is possible to add special support for individual fastloaders to the firmware only (which basically means reimplementing the fastloader's code formerly running on the floppy for the ATMega controller). This has been done for a few well-known fastloaders (see feature list above).
What about compatibility?[edit | edit source]
sd2iec is quite compatible concerning standard CBM IEC routines. Expect almost all software that runs in VICE without exact floppy emulation to work (at least in D64 mode). Note that in Gamebase64 Advanced Search you can explicitely search for "No true drive emulation needed".
Many recent releases of games and applications let you choose to disable built-in fastloaders. See znarF's M2I list for a list of games known to work with MMC2IEC/SD2IEC. Onefilers are okay, too - for a onefiler compilation see here (login required). Also most applications that have been fixed for IDE64 should work.
Why the new M2I format? How do I create M2I files?[edit | edit source]
Don't. The M2I format exists mostly for historical reasons. The original MMC2IEC firmware was not able to write to D64 files, but a container format capable of handling PETSCII filenames and large capacities was needed. Instead of adding D64 or D81 write support, the M2I format was invented, writing normal FAT files to the SD card, but using a mapping file (.M2I) to map PETSCII filenames to ASCII/FAT filenames.
Since a large number of MMC2IEC/sd2iec compatible games have been converted to the M2I format, support for the M2I format has been kept in sd2iec since firmware version V0.10.3. In all the newer firmware, the m2i-support has ended. If you still want to use your m2i-archiv, these files must be converted into p00 files or back into d64 format. This can be done with tools like for example "64Copy V4.46b", "DirMaster" or the commandline-tool "m2itopc64". With D64/D81 read/write support in sd2iec, there is no reason to create new M2I containers these days unless you need 'disks' bigger than 800k (D81).
You can create M2I files using the M2I maker (Forum64 thread ). M2I is file-based and in contrast to D64 does not support sector access. Games (Maniac Mansion...) and applications (GEOS...) that need sector access do not work with M2I.
Is GEOS supported?[edit | edit source]
Firmware 0.10.1 an up is compatible with the GEOS 2.0 Fastloader.
How does sd2iec compare with the 1541-III firmware and the 1541 Ultimate firmware?[edit | edit source]
- 1541 Ultimate vs. SD2IEC
- sd2iec-based designs are much cheaper.
- since the 1541 Ultimate completely emulates a 1541, it's much more compatible (supports all fastloaders). But there exists versions of nearly all games, that are compatible to sd2iec. The user must only search and try different versions of a game sometimes, to find a compatible one. When it comes to demos, then it looks bad with sd2iec, cause demos nearly all have their special loaders and the most of them, will not load with sd2iec. when you are a big demo-fan, you better buy a complete floppy-emulator (for example "1541 Ultimate", "Turbo Chameleon 64"). when you are more interested in gaming, like it's written before, you can be satisfied with sd2iec.
- sd2iec does not provide any extra functionality the 1541 Ultimate provides (cartridge/network/REU emulation).
- sd2iec is faster than 1541 Ultimate when it comes to Kernal functions: All IEC operations are emulated at (optimized) protocol level, not hardware/original ROM level. No slow mechanics.
- 1541-III vs. SD2IEC
- sd2iec does not yet support a display. Exchanging disks is possible using the disk switch button though.
- sd2iec-based designs usually feature a bootloader that fetches firmware from the SD card at startup.
- sd2iec uses the Atmel AVR microcontroller (open source C compilers are available for this platform).
- sd2iec supports more fastloaders.
How to copy files from/to floppy-discs with a sd2iec?[edit | edit source]
Using the C64, you can use for example FCOPY (from the HD Utilities Disk available here) or DraCopy for copying files. Alternatively Fast Back'em seems to work, but has an annoying reset-protection.
To write D64 files to a 'real' floppy (1541, 1571...) use gunzip.c64; for creating a D64 from a floppy use PuZip. These tools are slow and can be sped up by using JiffyDOS. Both tools do copying on a per-file basis. For writing images sector by sector, use for example DCOPY.PRG.
A new program called CBM-Command (project site) is available to provides file copying, directory navigation, D64 to/from disk and text file viewing.
To write D81 files can use cbmcmd22.d64 (site).
What file/directory browsers can I use?[edit | edit source]
- SD2IEC DIRPLUS - Browser for C64 and Plus4 which include file operations such as rename, delete, copy files, extract file from d64 etc.)
- CBM FileBrowser - sd2iec browser for C16/plus4, C64/C64DTV, C128 and Vic-20 (unexpanded, +3K RAM, +8K RAM or plus and with Mega-Cart)
- Vic20 Disk Menu - Browser for Vic-20 with built in soft jiffydos.)
- sd2brwse - lightweight sd2iec browser (discontinued).
- FIBR - general-purpose C64 file browser supporting sd2iec, too. Forum64 thread .
- DraBrowse
- CBM-Command (project site) - Norton Commander style application that provides directory browsing, file copying, etc.
- NAV (project site) - A File Browser for the C64
- C64 OS: File Manager (User's Guide) - C64 OS is a commercial product with extensive SD2IEC support.
Why is LOAD"IMAGE.D64",8,1 to mount D64 files not supported?[edit | edit source]
This was supported in the sd2iec predecessor MMC2IEC firmware. However, this is basically an ugly hack and has some side effects; for example, copying or writing to D64 files using the C64 is not possible then (i.e., creating a D64 file from a 1541 disk using the C64 as described above does not work). This is why this 'feature' was never implemented in sd2iec and will not be considered for inclusion.
Do I really need to type OPEN... to change dirs/mount image files?[edit | edit source]
No you don't. One alternative is using a file/directory browser like sd2browse or FIBR for navigating dirs, mounting image files, and starting programs. Just copy one of them as the first file on an empty SD-CARD and load it with LOAD":*",8
.
If you do not want to use a browser, there is a helper program for assigning commands to F-keys (see this page, download section).
With JiffyDOS or cartridges such as Final Cartridge 3 or Action Replay, shortcuts exist for sending commands to the floppy.
What is sd2iec's speed?[edit | edit source]
The test is a continuous 193 blocks file. Times are measured manually including initial seeks and, thus, give just a rough guess.
Note these are LOAD times. Multiload games typically do not use LOAD but CHRIN when loading additional parts. This can get accelerated with kernal extensions only.
Speeder | C64+1541 | C64+sd2iec | ||
---|---|---|---|---|
relative speed | absolute speed | relative speed | absolute speed | |
No speeder | 1.0x | 400 Bytes/Sec | 1.6x | 650 Bytes/Sec |
Turbo Disk | 5.7x | 2280 Bytes/Sec | 12.6x | 5050 Bytes/Sec |
Jiffy (*1) | 6.0x | 2400 Bytes/Sec | 21.5x | 8600 Bytes/Sec |
FC3 | 10.4x | 4150 Bytes/Sec | 20x | 8000 Bytes/Sec |
AR6 | 14.3x | 5700 Bytes/Sec | (*2) | (*2) |
SJLOAD (*3) | 25x | 10000 Bytes/Sec | ||
Proof-of-concept speeder | 38x | 15300 Bytes/Sec |
(*1) Also accelerates EE13/CHRIN used by many multiload applications. On a 1541, about 10x speed if file saved using Jiffy.
sd2iec is a typical sd2iec-based device (an SD2IEC 1.2 in this case).
(*2) The fastloader of the AR6-module is not compatible with the SD2IEC until now.
(*3) By using SJLOAD, the user can not only fastload files, but also directories, which then opens alot quicker, especially when many files are inside.
As you can see, sd2iec speed is quite a bit faster even without any fastloader since no mechanic latency exists and sd2iec data processing is much faster. Note that speeders that do all processing in the floppy are limited to about 6x speed. These speeders run much faster with the sd2iec since computing power is not an issue there. The theoretical maximum speed of the CBM bus with a floppy that does not let the C64 wait ever is estimated at about 20-25k/Sec.
Can I use a parallel cable with sd2iec-based devices ?[edit | edit source]
Some designs can accommodate a parallel cable. DolphinDOS parallel support was added to the firmware on 2012-06-03.
Software[edit | edit source]
Bootloader[edit | edit source]
On selected devices, a bootloader is present that will read firmware binary files from the mass storage device (FAT12/16/32 supported) and updates the AVR flash if needed
- On powerup, bootloader scans root directory of priary mass storage device and checks each file size and file signature (which includes version, checksum, and firmware type)
- If a suitable file is found and the version of the file is 0 or greater than the version installed on the AVR, the flash is reprogrammed with the updated firmware.
Firmware[edit | edit source]
See the sd2iec firmware page. The source code can be found in the Git repository[1].
Media Support[edit | edit source]
Below lists the various media options known (not) to work with the SD2IEC. Please add "OK" only to the boot loader column if you could update your firmware from this card. "DOS" means the normal operation from the computer.
SD and MMC cards tested[edit | edit source]
Brand | Type | Capacity (MB) | Product code | Tester | Tested with version | Boot Loader | DOS |
---|---|---|---|---|---|---|---|
BlueMedia | SD | 128 | ? | Shadowolf | 0.6.4 | OK | OK |
Canon | MMC | 16 | ? | Shadowolf | 0.6.4 | OK | OK |
Canon | SD | 32 | ? | Shadowolf | 0.6.4 | NOK | OK |
EMTEC | SD | 2048 | ? | Retrostyle | 0.6.3a | OK | OK |
Formel1 | SD | 512 | 6451AE | skoe | 0.6.4 | OK | OK |
Hama | SD | 1024 | ? | ogf | 0.6.4 | NOK | OK |
Hynix orig | microSD (with adapter) | 512 | HY71UG512M-MP, C20FY0810011 | Muarane | 0.10.3 | ? | OK |
Kingmax | miniSD (with adapter) | 256 | ? | BlowFish | ? | NOK | NOK |
Kingston | SD | 1024 | SD-M01G/TR4924U | 1570 | 0.6.4 | OK | OK |
Kingston | SD | 128 | 30352-003.A00 | JMP$FCE2 | 0.8.2 | OK | OK |
Kingston | SDHC | 16484 | ? | QUS | 0.8.1 | OK | OK |
Panasonic | SD | 16 | ? | Shadowolf | 0.6.4 | OK | OK |
Philips | SD | 16384 | ? | BlowFish | ? | OK | OK |
Platinum | SD | 1024 | ? | cbmhardware | petSD | ? | OK |
Platinum | SD | 2048 | ? | Shadowolf | 0.6.4 | OK | OK |
PNY | SD | 2048 | ? | Asterion | 0.10.1 | NOK | NOK |
SanDisk | SD | 1024 | SDSDH-1024-902 | Shadowolf | 0.6.4 | OK | OK |
SanDisk | SD | 512 | ? | ogf | 0.6.4 | OK | OK |
SanDisk | microSD | 1024 | SDSDQ-1024-E10M | Shadowolf | 0.6.4 | OK | ? |
SanDisk | microSD | 2048 | SDSDQ-2048-E10M | Shadowolf | 0.6.4 | OK | ? |
SanDisk | microSDHC | 4096 | SDSDQ-4096-E11M | Shadowolf | 0.6.4 | NOK | OK |
SanDisk | mini-SD | 2048 | SDSDM-2048 | Tatsujin | 0.93 | OK | OK |
SanDisk | mini-SD | 512 | SDSDM-512-E10M | Shadowolf | 0.6.4 | OK | OK |
SanDisk | microSDHC with Adapter | 32GB | n/a | Cyberad/RPG | SD2IEC V1.0.0ATENTDEAD0-24 | OK | ? |
Transcend | microSD with Adapter | 1024 | n/a | Nilsman80 | 0.9.3 | OK | OK |
Traxdata | SD | 2048 | I3M2G | skoe | 0.6.4 | OK | OK |
Verbatim | SD | 2048 | ? | LooZee | 0.8.1 | OK | OK |
(Example entry) | MMC/SD/SDHC | 512 | 1234/? | me | 0.6.4 | OK/NOK/? | OK/NOK |
CF cards tested[edit | edit source]
Brand | Type | Capacity (MB) | Product code | Tester | Tested with version | Boot Loader | DOS |
---|---|---|---|---|---|---|---|
AData | CF | 1024 | ? | Brain | 0.7.2 | OK | OK |
AData "Speedy" | CF | 4096 | ? | Rittwage | 0.7.2 | ? | OK |
Canon | CF | 16 | FC-16M | Vanessa E. | 0.8.2, 0.8.3 | OK | OK |
Lexar | CF | 128 | P/N 2250, Rev. A | Vanessa E. | 0.8.3 | OK | OK |
Lexar | CF | 128 | P/N 2175, Rev. A | Vanessa E. | 0.8.2, 0.8.3 | OK | OK |
Nikon | CF | 8 [sic!] | EC-8CF | ik | 0.7.2 | NOK | NOK |
PNY | CF | 64 | ? | Brain | 0.7.2 | OK | OK |
PQI | CF | 512 | ? | saehn | 0.8.0 | OK | OK |
SanDisk | CF | 32 | FC-32MH | Brain | 0.7.2 | OK | OK |
SanDisk | CF | 4096 | SDCFH-004G-A11 | Naberezny | 0.7.2 | OK | OK |
(Example entry) | CF/IDE | 512 | 1234/? | me | 0.6.4 | OK/NOK/? | OK/NOK |
See also[edit | edit source]
Links[edit | edit source]
- SD2IEC/MMC2IEC forum at forum64.de
- M2I Forum64 thread
- HOWTO-SD-FAT16 - how to format your SD card using FAT16 (using live Linux)
- Panasonic SD Memory Card Formatting Software (Windows)
- Unofficial SD2IEC User's Manual
References[edit | edit source]
- ↑ git clone http://sd2iec.de/sd2iec.git, the directory is hidden, but readable.