Migration to the new server completed.

Please add any new defect you notice here!


Die Migration auf den neuen Server ist abgeschlossen.

Bitte neue Defekte hier vermerken!

sd2iec (firmware)

From C64-Wiki
Jump to: navigation, search

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.

Contents

[edit] History

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.

[edit] Features

  • 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
    • Supports most typical IEC functions (LOAD, SAVE, OPEN, GET, PUT, CLOSE, ...)
    • 1571 ROM has been taken as reference for implementation
    • Many non-fastloader games run (see znarF's M2I list).

[edit] Usage

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 directory
    • OPEN1,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.M2I
    • OPEN1,8,15,"CD//SOMEDIR/:SOMEGAME.D64":CLOSE1 - change to/mount SOMEGAME.D64
    • OPEN1,8,15,"CD:←":CLOSE1 - leave M2I/D64
  • Loading files
    • LOAD"//SOMEDIR/:SOMEFILE" - load SOMEFILE in SOMEDIR (filename gets separated from path using colon)
  • Change device address
    • OPEN1,current address,15,"U0>"+CHR$(new address):CLOSE1 - change sd2iec device number to new address
    • OPEN1,device address,15,"XW":close1 - this will save settings to eeprom (required if you want to set new device address as default)

[edit] FAQ

[edit] Are fastloaders supported?

In general, no. 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).

[edit] What about compatibility?

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 Language German (login required). Also most applications that have been fixed for IDE64 should work.

[edit] Why the new M2I format? How do I create M2I files?

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. 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 Language German). 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.

[edit] Is GEOS supported?

Firmware 0.10.1 an up is compatible with the GEOS 2.0 Fastloader.

[edit] How does sd2iec compare with the 1541-III firmware and the 1541 Ultimate firmware?

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). Then again, of almost all games versions exist that are sd2iec compatible.
sd2iec does not provide any extra functionality the 1541 Ultimate provides (cartridge/network/REU emulation).
sd2iec is faster than 1541 Ultimate: 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.

[edit] How to copy files from/to sd2iec?

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.

[edit] What file/directory browsers can I use?

[edit] Why is LOAD"IMAGE.D64",8,1 to mount D64 files not supported?

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.

[edit] Do I really need to type OPEN... to change dirs/mount image files?

Consider using a file/directory browser like sd2browse or FIBR for navigating dirs, mounting image files, and starting programs. Just copy one of them as first file (empty SD-CARD) and call 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 for sending commands to the floppy exist.

[edit] What is sd2iec's speed?

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.

C64+1541 C64+sd2iec
Speeder RelSpeed AbsSpeed RelSpeed AbsSpeed
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
SJLOAD 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).

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. Speed between test 1 and test 2 on the sd2iec differs because of speedloader setup time.

[edit] Can I use a parallel cable with sd2iec-based devices ?

Some designs can accommodate a parallel cable. DolphinDOS parallel support was added to the firmware on 2012-06-03.

[edit] Software

[edit] Bootloader

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.

[edit] Firmware

See the sd2iec firmware page. The source code can be found in the Git repository[1].

[edit] Media Support

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.

[edit] SD and MMC cards tested

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
Kingston SD 1024 SD-M01G/TR4924U 1570 0.6.4 OK OK
Panasonic SD 16 ? Shadowolf 0.6.4 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 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 SD 1024 SDSDH-1024-902 Shadowolf 0.6.4 OK OK
SanDisk mini-SD 512 SDSDM-512-E10M Shadowolf 0.6.4 OK OK
SanDisk SD 512 ? ogf 0.6.4 OK OK
SanDisk mini-SD 2048 SDSDM-2048 Tatsujin 0.93 OK OK
Traxdata SD 2048 I3M2G skoe 0.6.4 OK OK
Transcend microSD with Adapter 1024 n/a Nilsman80 0.9.3 OK OK
Verbatim SD 2048 ? LooZee 0.8.1 OK OK
Kingston SDHC 16484 ? QUS 0.8.1 OK OK
(Example entry) MMC/SD/SDHC 512 1234/? me 0.6.4 OK/NOK/? OK/NOK
Kingston SD 128 30352-003.A00 JMP$FCE2 0.8.2 OK OK

[edit] CF cards tested

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
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
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
Canon CF 16 FC-16M Vanessa E. 0.8.2, 0.8.3 OK OK
(Example entry) CF/IDE 512 1234/? me 0.6.4 OK/NOK/? OK/NOK

[edit] See also

[edit] Weblinks

  1. git clone http://sd2iec.de/sd2iec.git, the directory is hidden, but readable.
Personal tools
Help and Feedback
In other languages