MMC2IEC
From C64-Wiki
The MMC2IEC is a hardware mass storage device using an SD/MMC card and interfacing with the IEC bus. It is based on the ATmega32 microcontroller from the Atmel AVR microcontroller family. The most prominent use of MMC2IEC is emulation/replacement of a Commodore-1541 disk drive for a C64. Hardware and the microcontroller's firmware is available as open source (GPL).
Contents |
[edit] History
The original MMC2IEC device was created by Lars Pontoppidan at the beginning of 2007. It started as a port of the PIC-based 1541-III to the Atmel microcontroller family. However, in the end the code of the 1541-III was used as inspiration only.
Enhanced hardware and firmware versions have been developed by the community. Shadowolf released a slighly modified version of the hardware in forum64 - this version is incompatible with the original MMC2IEC firmware. Also, several minor enhancements of the firmware have been done. Unseen works on a rewritten firmware (sd2iec) that is currently the only one under active development.
A redesigned hardware called sd2iec was released in march 2008. sd2iec is the successor project of MMC2IEC.
[edit] Firmware
- sd2iec firmware versions above 0.6.6 only work with sd2iec devices or MMC2IEC devices updated with an ATmega644.
- 2008-05-22: Unseen releases sd2iec 0.6.6 including support for the Final Cartridge 3 fastloader and sleep mode.
- 2008-02-20: Unseen releases sd2iec 0.6 including support for B-R, B-W, M-R, writing configuration to EEPROM, and several bugfixes.
- 2008-01-12: Unseen releases sd2iec 0.5 including read/write support for D64 format, full Jiffy support (no crystal needed), and a new "disk change" button feature.
- 2007-12-07: Unseen releases sd2iec 0.4 including support for M2I format.
- 2007-11-29: Unseen releases sd2iec 0.3 including Turbo Disk fastloader support (8 MHz crystal needed).
- 2007-10-16: Unseen releases sd2iec 0.1 featuring more exact IEC emulation.
[edit] Hardware
- 2008-03-15: sd2iec 1.2 PCB released (ATmega644, better IEC line drivers, disk swap button, I/O pads, mount holes).
- See the sd2iec page for up-to-date information.
- 2007-12-20: Shadowolf releases MMC2IEC 1.9 PCB layout (includes crystal).
- 2007-08-09: Shadowolf releases MMC2IEC 1.6 PCB layout (150 pieces made, no crystal).
- 2007-06-26: Shadowolf releases MMC2IEC 1.5 PCB layout (~10 pieces made, no crystal).
[edit] Features
[edit] sd2iec firmware 0.6.6
Complete rewrite by Unseen. Available for Shadowolf, LarsP, and NKC PCB. Like MMC2IEC 0.8/0.9 firmware but...
- No T64 support. D64/M2I are supported (both reading and writing for D64, even with direct sector access using U1/U2)
- Subdirectory support (CMD command syntax).
- Support for Turbo Disk AKA Fast Load AKA Speeddisk fastloader (only with 8MHz crystal installed).
- Supports the JiffyDos fast serial bus protocol (doesn't require a crystal - internal oscillator is accurate enough)
- Support for the Final Cartridge 3 fastloader (no crystal needed).
- Supports an external "disk change" button
- Supports FAT long file names
- Supports FAT12/FAT16/FAT32 formatted SD cards.
- Improved 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 now (see znarF's M2I list).
[edit] MMC2IEC firmware 0.9
Modified by Shadowolf.
- Modified for Shadowolf PCB layout.
- .bin format for use with a bootloader.
- bootloader needs to get flashed on the ATmega once and then updates/flashes the actual firmware from SD card.
[edit] MMC2IEC firmware 0.8
By LarsP.
- Supports C64 kernel LOAD and SAVE functions.
- Supports wildcards.
- Supports SD and MMC cards.
- Thorough FAT16 and FAT32 support.
- Directory listing and changing supported through LOAD commands.
- PRG file load and save.
- D64/T64 image readonly support.
- Support for proprietary M2I format. Uses a filename mapping file to map from files on the SD card to C64 files. Write support.
- Live configurable to be device 8 or 9, and works with other devices on the bus.
- SD card write protect switch works.
Limitations:
- No fast loader support.
- None of the Commodore DOS functions beside LOAD and SAVE works.
- Few D64 games with loaders work.
- No long filenames.
[edit] Usage
sd2iec
- 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 (left arrow)
- Using M2Is or D64s
- OPEN1,8,15,"CD//SOMEDIR/SOMEGAME.M2I":CLOSE1 - change to SOMEGAME.M2I
- OPEN1,8,15,"CD:<-":CLOSE1 - leave M2I (left arrow)
- Loading files
- LOAD"//SOMEDIR/:SOMEFILE" - load SOMEFILE in SOMEDIR (filename gets separated from path using colon)
- mkdir, rmdir see README (online)
[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. The MMC2IEC 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 the MMC2IEC, 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). So far support for one fastloader variant is present in the sd2iec firmware. Many applications are available as patched versions that are compatible with MMC2IEC though - see znarF's M2I list.
[edit] What about compatibility?
MMC2IEC using the sd2iec firmware is quite compatible concerning standard CBM IEC routines. Expect almost all software that runs in VICE without exact floppy emulation to work (in D64 mode).
The original MMC2IEC firmware by LarsP is by far less compatible. Only BASIC LOAD can be expected to work.
[edit] Is GEOS supported?
GEOS comes with an own fastloader that is currently not supported by MMC2IEC/sd2iec. A GEOS driver that uses standard IEC routines (that is compatible with MMC2IEC) is in development.
[edit] How does the MMC2IEC compare with the 1541-III?
- MMC2IEC does not feature a display or controls. Exchanging disks is possible using the host computer only.
- MMC2IEC PCB is even smaller than 1541-III-DTV PCB.
- MMC2IEC features a bootloader that fetches firmware from the SD card at startup.
- MMC2IEC uses ATmega32 microcontroller (open source C compilers are available for this platform).
- MMC2IEC supports subdirectories.
- sd2iec firmware currently supports the Turbo Disk fastloader.
[edit] What is MMC2IEC's speed?
Test 1 is a non-continuous 115 blocks file so seeks occur. Test 2 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.
| System | RelSpeed 1 | AbsSpeed 1 | RelSpeed 2 | AbsSpeed 2 |
|---|---|---|---|---|
| x64 (true drive emulation) | 1.0x | 380 Bytes/Sec | 1.0x | 400 Bytes/Sec |
| x64 with Turbo Disk | 4.6x | 1770 Bytes/Sec | 5.7x | 2280 Bytes/Sec |
| x64 with Jiffy | 5.5x | 2090 Bytes/Sec | 6.0x | 2400 Bytes/Sec |
| x64 with FC3 | 6.7x | 2540 Bytes/Sec | 10.4x | 4150 Bytes/Sec |
| x64 with AR6 | 10.5x | 4000 Bytes/Sec | 14.3x | 5700 Bytes/Sec |
| x64dtv with DTV Speed Load (1) | 9.4x | 3550 Bytes/Sec | 13.2x | 5270 Bytes/Sec |
| C64DTV with MMC2IEC (1) | 1.7x | 650 Bytes/Sec | 1.6x | 650 Bytes/Sec |
| C64DTV with MMC2IEC and Turbo Disk (1) | 11.5x | 4360 Bytes/Sec | 12.6x | 5050 Bytes/Sec |
| C64DTV with MMC2IEC and Jiffy (1) (2) (3) | 22.6x | 8600 Bytes/Sec | 21.5x | 8600 Bytes/Sec |
| C64DTV with MMC2IEC and experimental speeder (1) (4) | 40.3x | 15300 Bytes/Sec | 38.0x | 15300 Bytes/Sec |
(1) No speed enhancements of the C64DTV are used here so expect performance to be the same using a C64.
(2) Also accelerates EE13/CHRIN used by many multiload applications.
(3) supported in sd2iec 0.5 or later
(4) not released yet
VICE(plus)/x64(dtv) emulates the 1541 timing including mechanics. As you can see, MMC2IEC speed is quite a bit faster even without any fastloader since no mechanic latency exists and MMC2IEC 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 MMC2IEC 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 MMC2IEC differs because of speedloader setup time.
[edit] Can I use a parallel cable with the MMC2IEC?
No. Theoretically the hardware could be extended for that. However, note that the CBM bus seems quite fast already (see above).
[edit] Hardware
[edit] Shadowolf's version
- C64 and C64DTV compatible
- does not run with LarsP's firmware
- Power consumption: Idle ~15mA, busy 30-80mA
- mmc2iec_schematic_layout_1.9.zip
A redesigned hardware called sd2iec was released in march 2008. sd2iec is the successor project of MMC2IEC.
[edit] NKC version
- Sold by NKC Electronics
- Incompatible with LarsP and Shadowolf version (minor pin change)
- More information here
[edit] Software
[edit] Bootloader
- Only for Shadowolf layout
- Fuse settings: BOOTSZ = 01 (boot size 1024 words, start $3c00), BOOTRST = 0 (boot reset vector enabled)
- Reads firmware .bin file from SD card (FAT16 and FAT12 supported) and updates ATMega flash if needed
- On powerup, red LED is on. If an updated firmware is found on SD card, green light blinks for some seconds during flashing. If no updated firmware is found, green light flashes once. When complete, both LEDs turn off.
- Firmware (.bin) needs to reside in the SD card's root directory. Only file size and signature have to match.
- Flashing command:
- Without crystal: avrdude -p m32 -U flash:w:mmc2iec_bootloader.hex:i -U hfuse:w:0x9A:m -U lfuse:w:0xA4:m
- With crystal: avrdude -p m32 -U flash:w:mmc2iec_bootloader.hex:i -U hfuse:w:0x9A:m -U lfuse:w:0x9E:m
- bootloader_2008-01-05.zip
[edit] ATmega644 Bootloader
- For Shadowolf MMC2IEC layout, but populated with ATmega644 instead of ATmega32. The device supports the latest sd2iec firmware then (see sd2iec device).
- Fuse settings:
- Without crystal, only microcontroller replaced: avrdude -v -p m644 -U flash:w:mmc2iec_m644_bootloader.hex:i -U hfuse:w:0x92:m -U efuse:w:0xfd:m -U lfuse:w:0xe2:m
- With 8MHz crystal and two capacitors added: avrdude -v -p m644 -U flash:w:mmc2iec_m644_bootloader.hex:i -U hfuse:w:0x92:m -U efuse:w:0xfd:m -U lfuse:w:0xef:m
- bootloader firmware download, copy from this Forum64 posting.
- Updated bootloader archive for all architectures and population variants for MMC2IEC and SD2IEC was posted here.
[edit] Firmware
See Unseen's sd2iec firmware page. The correct firmware variant for the MMC2IEC is sw1/nkc/larsp-m32 (sw1/nkc/larsp-m644 for MMC2IEC devices updated to ATmega644).
[edit] See also
[edit] Links
- Original MMC2IEC project page by Lars Pontoppidan
- MMC2IEC forum at forum64.de
- HOWTO-SD-FAT16 - how to format your SD card using FAT16
- M2I Forum64 thread
