BMOW title
Floppy Emu banner

An SD-card Floppy Emulator for Classic Compact Macs

While working on the “Plus Too” Mac Plus clone, I’ve started thinking further about a semi-related side project: a floppy drive emulator that works with actual classic compact Mac hardware (the Mac 128K, 512K/e, and Plus). These machines all have 400K or 800K floppy drives, and modern floppy drives are physically incapable of using disks in 400K/800K format. That means if you’ve got one of these classic Macs, you also need a second, slightly newer Mac with a high density floppy drive (Apple called them FDHD) so you can copy data back and forth between standard 1.4MB disks and 400K/800K disks. To get Mac software onto your Mac Plus, you need to download it from the web using a modern PC, copy it to a 1.4MB floppy, move that floppy to the FDHD-equipped Mac, use that Mac to copy the software to a 400K or 800K floppy, then finally move that floppy to the Plus. What a pain.

You could also use a modem, null-modem connection, or LocalTalk networking to get software onto the Plus, but the average hobbyist is even less likely to have the equipment necessary for those methods than for the floppy disk chain transfer.

The idea of a floppy emulator for compact Macs (using SD cards or similar media) has been discussed before in the Mac hobbyist community, but as far as I know, none exists. Maybe that means I’m the guy who should design one. I’ve spent a fair bit of time studying the details of the IWM controller chip and the floppy disk data encoding, and I understand enough to think that the project is feasible. Here are a couple of thoughts on what such an emulator would look like and how it would work.

DB-19

The emulator would be a small PCB with a DB-19 connector, that plugs directly into the floppy port. No cables required. It looks like finding a source for DB-19 connectors will be very difficult, though, so it might be necessary to make one somehow. None of the usual electronics supplies like Digi-Key have DB-19 connectors, and the few places on the web that do advertise them only have solder cup terminated connectors intended for making cables. And even those places look old and out of date, making me question whether they actually still have DB-19 connectors in stock.

Storage

My original idea was to put an SD card socket on the emulator, so you could fill the card with disk images using your PC, then put the card into the emulator. The main drawback is that not everyone has an SD card reader on their PC. Better would be a USB connector, and when connected to the PC the emulator would appear as a generic mass storage device. In that case, the actual storage still might be an SD card, or it could be generic flash ROM, or battery-backed RAM. I’m unsure if this would require worrying about wear-leveling and making a flash driver, though.

Supported Formats

The emulator would support 400K and 800K disk images in raw or DiskCopy 4.2 format. Maybe later it could also support 1.4MB formats, but that would require studying the SWIM design instead of IWM. And anyway if your Mac supports 1.4MB disks, it’s probably easier to just make them on a modern PC or Mac. The emulator would not support “super disks” larger than a real physical disk, because the floppy driver in the Mac’s ROM would not be able to use them. Although maybe this could be worked around with some kind of custom init that replaces the ROM floppy driver…

Number of Disks

The emulator would only emulate a single external disk drive. This is a bummer, but the floppy connector is only designed to connect to a single drive, and there are no pins for the Mac to select a specific drive or give a unique ID to a drive. Again, maybe this could be worked around with a custom floppy driver replacement and some non-standard use of the floppy data lines…

Read/Write

Both read and write operations would be supported. Read would probably be a lot easier to implement first, so the initial prototype would likely be read-only.

Variable Speed

The Mac 400K/800K drive was a variable speed drive, unlike PC floppy drives. This is why PC floppy drives are physically unable to read/write 400K or 800K floppies. For the purposes of emulation, though, I don’t think this matters at all. The emulator would ignore the drive RPM control signal coming from the Mac. The actual data rate is still constant, I believe. And even if it’s not constant, I think I can still work with it.

Implementation

The emulator would consist of an Atmel AVR microcontroller and SD card socket. The AVR would need about 12KB of internal RAM. The ATmega1284P looks good. A pre-existing SD-card FAT-reader library would be used to search the card for files with the .dsk extension, and read data chunks from them.

The AVR would use the 9 control/data lines on the floppy connector (documented by Apple) to communicate with the Mac, acting like a normal floppy drive. It would internally maintain the position of a virtual disk head, defined by the current track number and rotational position within the track. Track-to-track in/out movement of the virtual head would be performed by the Mac, using the control lines. When the emulator was instructed to step to a new track, it would load the data for the corresponding sectors from the SD card into a RAM buffer. This data would be GCR-encoded on the fly, and appropriate sector headers, lead-ins, lead-outs, checksums, and sync bytes would also be generated. The result would be a byte-for-byte replica of the low-level data format for that track on a real floppy disk.

Virtual rotational movement through the track would happen automatically, at a fixed rate (I think it’s 1 bit per 2 microseconds). When the Mac requested a read, the emulator would return the data at whatever rotational position was current. The Mac software would keep reading data until the sector it wanted came into position, just like for a real floppy. When the Mac requested a write, the emulator would overwrite data at whatever rotational position was current. This data would be GCR-decoded on the fly, headers/checksums/etc thrown-away, and the actual sector data written back to the SD card.

Read 10 comments and join the conversation 

10 Comments so far

  1. Erik Petrich - September 2nd, 2011 5:12 pm

    A typical 1/16th inch (62 mil) thick PCB fits snugly between the two rows of the solder cup side of a D-sub connector. So if you can’t find a better option, you can route the PCB as if you are going to use a card edge connection and then solder a D-sub connector that’s intended for wires and not a PCB to the edge of the PCB. This would not work well for mass production because the gap between the pins (as opposed to the center-to-center pitch) and the exact thickness of the PCB are not well controlled dimensions, but has worked okay for me for simple widgets for my own use.

    Otherwise, it looks like your best option is to choose a DB-25 connector in which you can easily remove the 6 pins on the end (so the mounting jack screw on that side ends up in the resulting gap inside the connector).

  2. Steve - September 2nd, 2011 5:21 pm

    That’s a pretty good idea! The other idea I had was to make a small PCB that’s mounted at a right angle to the main PCB, attached with some right-angle male header. Then solder the solder-cup end of the DB-19 into that right angle board, as if it had regular sized pins. This would require making the holes in the board pretty wide, to accomodate the solder cup.

  3. Bartosz - September 3rd, 2011 7:15 am
  4. David - September 3rd, 2011 12:06 pm

    The Host Control Tool on the link that Bartosz posted is an interesting idea. You could have the first “disk” available have a program that could list a menu of the available disks on the card. When the user selects one, this program could “write” the selection to a specific track on this disk. The floppy emulator could then interpret this “write” to select the specified disk image and switch to it once the disk access has ceased. This would allow multiple disk images w/o having to patch the floppy routines.

  5. hiroshi - September 16th, 2011 1:59 pm

    I think this project is great! I have an old Mac SE, but I’ve lost any way to communicate with it. I did have a slightly newer Macintosh with HD floppy, and I was able to sneakernet files to it like you said, then use AppleTalk to send to the SE. But, then the newer Macintosh gave the chime of death. I would buy an SD floppy emulator in a heartbeat.

  6. andrea - October 2nd, 2011 1:06 pm

    I’m very intrested in your project.
    In my room there are a couple of mac (512k and plus) that are full of desire to get some new softwares.
    Last year I’ve bought on ebay the Macintosh Family Hardware Reference book (that explain details of IWM implementation on macintosh) and I’ve started to design (on paper) a board with an STM32 and an SDCARD.
    Unfortunately I haven’t enough time to develop this very intresting project.
    Do you have yet started to develop the board?

  7. Steve - October 2nd, 2011 4:39 pm

    No I’ve not started development yet, since I’m still focusing on Plus Too.

  8. Gavo - October 28th, 2011 12:55 pm

    Hi, I love your Plus Too idea, but as I own a 128k and 512k Mac, love the idea of the Floppy emulator even more 🙂 One thing I was thinking about when reading your description was if it would be possible to have support for large (aka hard drive size) volumes. Back in the day Apple had a hard drive called the HD20 that connected to the Mac via the standard floppy drive port (not the SCSI port that appeared on Mac’s from the Plus up). I’ve never owned a HD20, but I believe it also had an external port to allow a floppy drive to be daisy chained to it. I’m pretty sure it also only worked on the 512k and up as it required HFS and Apple shipped it with the “HD20 init” (to add HFS support to 64k ROM Macs) but this needed more RAM to run than the 128k Mac had. Google will probably have the answers 🙂

    Anyway, its great to see this kind of work going on – all the best and I look forward to seeing how you get on!

    Cheers,

  9. Steve - October 29th, 2011 8:12 am

    Theoretically it’s possible, but it’s probably not something I’ll attempt. The HD20 interface is undocumented. It would probably be easier to just invent something new than try to reverse-engineer the HD20. But that would face the same problem the HD20 had– you couldn’t use it until you’d loaded its drivers from another another disk first, but how are you going to do that if you don’t have another disk? Maybe there is a solution, but I’ll worry about that once normal floppy emulation is working.

  10. Big Mess o' Wires » Macintosh Floppy Emu - November 18th, 2011 11:27 pm

    […] computers. I’ve been tinkering with this project for a while now, and wrote about it here several times before. Today I finally got read-only floppy emulation working from an SD card, in a rough […]

Leave a reply. For customer support issues, please use the Customer Support link instead of writing comments.