BMOW title
Border

Build Your Own Floppy Emu

Floppy Emu is a prototype floppy disk drive emulator for vintage Macintosh computers. It emulates 400K, 800K, or 1.4 MB disks, and is compatible with everything from the original Macintosh 128K through the Mac II series and Power Macintosh line.

You can buy a pre-assembled and tested Floppy Emu, or if you’re comfortable with surface mount soldering and have an AVR programming tool, you can build a Floppy Emu at home. Be warned there are several SMD chips with fine-pitch 0.5 mm pin spacing. These can be soldered by hand, but it’s challenging work.

Floppy Emu is released under the Creative Commons Attribution-NonCommercial 3.0 license. You’re free to build one for personal use, or adapt and share the design for other non-commercial projects, but please don’t build a batch of Floppy Emus and sell them on eBay. Now with that out of the way, let’s get started!

Download the Floppy Emu source files

What You’ll Need

  • A Windows PC
  • AVR Studio 5 software from Atmel. This is free software. AVR Studio 6 probably works too, but I haven’t tried it. AVRDUDE should work as well.
  • An AVR programmer, such as the AVRISP mkII
  • An SD or SDHC card that’s fast when transferring small data blocks. Lower capacity cards tend to perform better at small transfers – try a card with 2GB capacity or less.
  • Soldering iron
  • Patience

Making a PCB

To begin building your Floppy Emu, you’ll need a printed circuit board. Send me an email to ask if I have any extra PCBs available. Otherwise, there are many on-line services that will make these for you, using a set of layout files called Gerbers. You’ll find the Floppy Emu Gerbers in the file archive, in the directory eagle\floppyemu\gerbers.zip. I recommend using the Dorkbot PDX PCB Order service to get the PCB manufactured. Send them the Gerber files, and they’ll make three copies of the PCB for about $30, with a turn-around time of a few weeks. The guy who runs the PCB service is very helpful if you have questions.

Getting the Parts

While you’re waiting for the PCB, you can locate all the other parts you’ll need to assemble the Floppy Emu. You’ll find a complete parts list in the file archive. The total parts cost (not including the PCB) should be about $40-$50 when ordering in single unit quantities, with taxes and shipping costs.

One of the required parts is a male DB-19 connector, which mates with the Mac’s external floppy port. These can be very difficult to find, and IEC is the only supplier I know that has them. If you can’t find a DB-19 solder type connector, you can still use the Floppy Emu with its alternate IDC20 connector, which is readily available from electronics suppliers. With the IDC20, there are several different connection options:

  • Connect the IDC20 to the internal floppy connector inside your Mac (you will need an IDC20 cable)
  • Connect the IDC20 to the circuitry inside a real external Apple floppy drive enclosure, after removing the old drive’s guts
  • Use an Apple II DB-19 to IDC20 cable

If you don’t already have one, you’ll also need an AVR programmer like the AVRISP mkII.

Assembly

Here’s where things get fun! Refer to the file board-layout.png for placement information, or check the schematics.

The first step is to solder and test the AVR.

  1. Solder the AVR chip. Pay attention to the orientation – the dot in the corner of the chip should match the dot on the silkscreen. I recommend using the drag solder technique. Begin by soldering two pins on opposite corners of the chip to tack it in place. Verify that the pins are perfectly aligned with the pads on the board before proceeding. Now goob an absurd amount of solder onto the remaining pins. You will probably bridge most of the pins together – that’s OK. Finally, go back with a solder wick and flux, and wick away all the excess solder. Surface tension will hold the solder onto the pins and pads where it belongs, while the excess is magically wicked away. Use a 10x jeweler’s loupe to visually inspect the pins for tiny bridges or gaps.
  2. Solder the crystal X1, the 18pF capacitors C12-C13, and the AVR decoupling capacitors C4-C7 (these are on the back of the board).
  3. Also solder the DB-19 connector. It fits along the edge of the board, with the thickness of the board fitting between the two rows of solder cups.

The AVR microcontroller should now be functional. You can use AVR Studio to test it out.

  1. Install the AVR Studio 5 software on your PC and run it.
  2. Connect the Floppy Emu board to your Mac, and turn on the Mac.
  3. Connect the AVRISP mkII programmer to your PC.
  4. Press the ISP connector into the board, but do not solder it yet. If it is soldered too soon, it will be in the way of your iron later.
  5. Connect the AVRISP’s programming cable to the ISP connector on the board.
  6. Click on the AVR Programming button in the toolbar. It looks like a chip with a lightning bolt.
  7. In the programming dialog, set Tool to AVRISP mkII, Device to ATmega1284P, and Interface to ISP
  8. Click the Apply button
  9. Where it says Device ID at the top, click the Read button. Push the ISP connector firmly sideways while you do this, to ensure its pins make electrical contact with the board.

If everything is working, the Device ID field should now display 0x1E 0×97 0×05. If it does not, or you encounter an error, review the steps above, then go back and carefully re-check all the solder connections. Do not proceed further until you are able to retrieve the AVR device ID.

The next step is to program the AVR with the Floppy Emu software and bootloader.

  1. Open the AVR Programming dialog again.
  2. From the list at the left, click Fuses to display fuse information.
  3. Set the fuses:
    • BODLEVEL – disabled
    • OCDEN – off
    • JTAGEN – off
    • SPIEN – on
    • WDTON – off
    • EESAVE – off
    • BOOTSZ – 2048W_F800
    • BOOTRST – on
    • CKDIV8 – off
    • CKOUT – on
    • SUT_CKSEL – EXTXOSC_8MHz_XX_16KCK_65MS

    These settings should result in the fuse bytes being Extended: 0xFF, High: 0xDA, Low: 0xBF.

  4. Click the Program button in the fuse panel. Push against the ISP connector with your finger while you do this.
  5. From the list at the left, click on Memories to display AVR memory information
  6. Under Flash, verify that “Erase device before programming” is checked
  7. For the Flash filename, choose AVR\release\merged.hex from the file archive
  8. Under Flash, click the Program button. Push against the ISP connector with your finger while you do this.
  9. Remove the ISP connector from the board.

Congratulations, the AVR setup is now complete! The next step is the Nokia LCD.

  1. Solder the voltage regulator, and the regulator capacitors C10 and C11. Important: C11 is a 33uF polarized tantalum capacitor. The positive side of the capacitor should be on the right, towards the upper LCD connector.
  2. Solder the level converter (the 74LVC244), its decoupling capacitor C8, and the 10K resistor R4.
  3. If you want backlighting for the LCD, solder the backlight resistor R5. Personally I think it looks better without backlighting, so I leave R5 empty.
  4. Solder the 8-pin male 0.1 inch header to the bottom of the Nokia LCD, and the 2-pin header to the two middle holes on the top of the LCD. The thicker part of the LCD bezel should be at the top.
  5. Solder the 8-pin female header to the bottom of the board, and the 2-pin female header to the top of the board.
  6. Connect the LCD to the Floppy Emu board.

The LCD should now be functional. Connect the Floppy Emu to your Mac, and turn the Mac on. If everything is working, the LCD should show a version number screen, followed by “SD Card init error”.

The SD card reader is next.

  1. Solder the SD connector, and its decoupling capacitor C9.
  2. Insert the SD card into your PC.
  3. Copy some Macintosh disk image files onto the SD card.
  4. Put the SD card into the Floppy Emu.

Connect the Floppy Emu to you Mac, and turn the Mac on. If everything is working, the LCD should show a menu listing of the disk images on the SD card.

The final assembly step is the CPLD.

  1. Solder the CPLD. Pay attention to the orientation – the dot in the corner of the chip should match the dot on the silkscreen. Use the same technique for soldering the CPLD that you used for the AVR.
  2. Solder the CPLD’s decoupling capacitors, C1-C3. These are on the back of the board.
  3. Solder the LEDs and their resistors, R1 and R3. The silkscreen shows the proper orientation for the LEDs.
  4. Solder the four tactile switches.
  5. Solder the remaining connectors into place.

Now it’s time to program the CPLD. The AVR programs the CPLD indirectly, using a firmware file stored on the SD card, so no JTAG tools are needed.

  1. Ensure the file firmware.xvf is on the SD card. This is part of the Floppy Emu source files archive.
  2. Put the SD card into the Floppy Emu.
  3. While your Mac is turned off, connect the Floppy Emu to the Mac.
  4. Hold down both the PREV and NEXT buttons, then turn on the Mac.
  5. Follow the instructions on the LCD to load the firmware file to the CPLD.

That’s it! Turn the Mac off, then on once more, and you’re done.

 

Using the Floppy Emu

When it’s turned on, the Floppy Emu scans the SD card for files with a .dsk, .img, or .image extension, and shows a menu of available disk images. Use the PREV/NEXT buttons to select a disk image file, then press the SELECT button to insert it into the emulated disk drive. After the disk is inserted, the LCD display shows the current track number and active side of the drive.

The Floppy Emu expects 400K, 800K, or 1.4MB disk images in either raw format (the .dsk images typically used with Macintosh emulators), or DiskCopy 4.2 .image format. Raw image files support reading and writing to the emulated floppy disk. DiskCopy 4.2 images are read-only.

Floppy Emu supports normal sector-by-sector writing, such as copying files in the Finder, or saving data from within a program. It does not support formatting the emulated floppy, or using it with format-and-write disk copy tools. If you need a blank disk image file, create one on your PC and then copy it to the SD card.

 

Extending Floppy Emu

The C source code for the microcontroller program is provided in the file archive. You can build it with AVR Studio, generate a new floppyemu.hex and merged.hex file, and load it to the microcontroller using the AVRISP mkII.

The Verilog source code for the CPLD is also provided. You’ll need Xilinx’s free ISE WebPACK to build it. Export an XSVF file, and rename it to firmware.xvf. Then copy the file to the SD card, and load it onto the CPLD as you did before.

Happy hacking!

Read 23 comments and join the conversation 

23 Comments so far

  1. bbraun December 16th, 2012 1:31 pm

    A huge thanks for this! I know it takes forever to do all the documentation to bring others up to speed. Thanks a bunch for doing all that.
    I’ve ordered PCBs and parts!

  2. jebug29 December 22nd, 2012 8:26 pm

    ._. Now I have to find someone who knows how to solder for me. Hopefully someone here will get permission to make and sell these on eBay, with credit and a portion of money to the guy who made it.

  3. petersieg December 23rd, 2012 3:44 pm

    Looks like I have to get some parts and pcb’s made ;-)

    Are the 74lcx244 also useable for 74lvc244:
    http://www.ebay.de/itm/25-ST-74LCX244-OCTAL-BUS-BUFFER-3-STATE-2-3-6Vcc-5V-IO-SOIC-20-SMD-SMT-74LVC244-/271117200766

    Thanks, Peter

  4. Steve Chamberlin December 23rd, 2012 4:27 pm

    I’ve never heard of 74lcx, but if it tolerates 5v inputs and produces 3.3v outputs then it should work.

  5. bbraun January 20th, 2013 7:59 pm

    All the parts arrived, and after one failed attempt, I was able to build a working floppyemu! I’ve got a 512ke booting from it now.
    My only problem is the LCD is all dark. With a light, and looking at it from an angle, I can read the display and using the next/prev/select buttons find a disk to boot. But clearly I’m doing something wrong with the LCD. Any suggestions on what I might have done to screw up the LCD like that? The LED backlight doesn’t come on (I’m not sure if it is supposed to), and looking at the LCD straight on looks like all pixels are “on”.
    Thanks, this is great!

  6. Steve Chamberlin January 21st, 2013 7:43 am

    Awesome, that is great news!! The backlight is not supposed to come on. Sounds like the problem is with the contrast. I found there is major variation among those LCD modules as to what contrast settings work – sometimes even major variation on the same LCD module from day to day, which seems hard to explain.

    In the file noklcd.cpp, in the function LcdReset(), try changing the bias and vop values. Read the comments at https://www.sparkfun.com/products/10168 for some discussion of what values have worked for people. Try bias values of 0×13, 0×14, or 0×15. Also read the comment from reozen, who mentions some knock-off LCDs are soldered incorrectly, and you have to press down on them hard from above to make them work.

    Let me know if you need more help. I think I may have a couple more of the Nokia LCD boards somewhere.

  7. bbraun January 21st, 2013 8:17 am

    I changed the lcd_vop value to 0xBF, and the LCD is working well!
    Thanks!

  8. Micki February 3rd, 2013 2:30 pm

    Hi – so great to see this Floppy Emu making such great progress!

    The build instructions, while detailed, are above my skill level. Wondering if anyone on the site would be willing to build one for me for parts+labor+reasonable markup.

    Please be in touch if so!

    Thanks,
    Micki

  9. petersieg September 30th, 2013 7:41 am

    Hi. I am at that point:

    Congratulations, the AVR setup is now complete! The next step is the Nokia LCD.

    1.Solder the level converter (the 74LVC244), its decoupling capacitor C8, and the 10K resistor R4.
    2.Solder the two 8-pin male 0.1 inch headers to the Nokia LCD.
    3.Solder the top 8-pin female 0.1 inch header to the board. Place the bottom header in the board, but do not solder it yet.
    4.Connect the LCD to the Floppy Emu board. The thicker part of the LCD bezel should be at the top.
    The LCD should now be functional. Connect the Floppy Emu to your Mac, and turn the Mac on. If everything is working, the LCD should show “SD Card init error”.

    –> but my LCD is also just black (sort of dark bue = all pixels on).
    Problem: I don’t have AVR Studio 6 installed (yet) but have V4.18.
    Could someone send my an avr flopyemu.hex with:
    In the file noklcd.cpp, in the function LcdReset(), change the lcd_vop value to 0xBF

    To: peter.sieg1@gmx.de

    If that was not the issue.. any other hints?

    Many thanks, Peter

  10. Steve Chamberlin September 30th, 2013 8:04 am

    You don’t really need AVR Studio 6 – older or newer versions should also work, or avrgcc.

    Those LCD modules seem to have wildly-changing contrast depending on the temperature, voltage, phase of the moon, etc. Try pressing down on the LCD bezel with your finger – this often fixes it for me.

  11. petersieg September 30th, 2013 8:38 am

    No. I get between 18 to 37 warnings and errors.. I assume the build in C++ compiler in V6 is a lot different than win avr-gcc from V4.

    Peter

  12. Steve Chamberlin September 30th, 2013 12:29 pm

    Did anything change when you pressed on the bezel? Are you sure the LCD isn’t upside down? The widest part of the bezel should be at the top of the Floppy Emu board.

    What errors are you getting with AVR Studio 4? If you just want to test your LCD, you could try the “hello world” example code at http://playground.arduino.cc/Code/PCD8544

  13. petersieg October 1st, 2013 3:14 am

    Thanks for sending me the hex with cd_vop value set to 0xBF. That works!
    I recomment to update your files with this value.

    Now I am at the point, that the LCD works and dsk images are shown and I can scroll up and down. The LCD is not soldered in yet.

    CPLD and c1-c3 are soldered now.
    I am pressing prev + next at power on and get to the firmware update menu.
    I press next to update the cpld and I get error 3..?

    I checked solderings already twice on cpld.

    I have NOT soldered the 220 ohm resistors and the smd led yet.
    I also work with a 19-pin sub-d attached.

    So what does error 3 means? I do not have tools ready to flash the cpld via jtag.
    I have an altera usb blaster..

    Peter

  14. Steve Chamberlin October 1st, 2013 9:52 am

    Those error codes are defined in micro.h. I didn’t write that code, so unfortunately I can’t tell you much about it. It looks like error 3 is XSVF_ERROR_MAXRETRIES “TDO mismatch after max retries”. Did you remember to set JTAGEN to OFF when you programmed the fuses? Are you getting 3.3V from the regulator?

  15. petersieg October 2nd, 2013 1:36 am

    Hi. hfuse is d9, according to avr fuse calculator, that is enable JTAGEN=OFF
    (99 would be JTAGEN = on)
    http://www.engbedded.com/fusecalc

    Yes, 3.3V is fine. Otherwise I should have problems working with the sd card..

    So, do I have to find another way of programming the cpld?

    Peter

  16. petersieg October 2nd, 2013 3:13 am

    HURRAY!!
    It works! I resoldered the CPLD and could than flash the firmware.
    I bootet from sys608.dsk

    Some pictures:
    http://petersieg.bplaced.net/?Mac_Floppyemu

    MANY Thanks!!
    BTW: Is the PWR button a reset button? For what do I need that?
    Is the software capable to handle 1440k images?

    (0805 smd parts are really to small for me and my soldering iron!)

    Thanks, Peter

  17. Steve Chamberlin October 2nd, 2013 4:41 am

    Congratulations! Yes, the PWR button is a reset. It’s helpful for debugging, otherwise you don’t really need it.

    The emulator supports 400K and 800K disk images. 1.4MB floppy disks work differently, so they’re not supported. Maybe someday!

  18. Steve Chamberlin October 2nd, 2013 4:43 am

    Your photo shows it took 304 ms to write a single sector. Ouch! Are you using a class 10 high speed card? On mine it takes about 9 ms.

  19. petersieg October 2nd, 2013 7:28 pm

    Thanks again for your great invention and support. Its not a class 10 sd card.. I have to order one..

    Thanks Peter

  20. makerimages October 8th, 2013 6:17 am

    Is the nokia display by any chance avaialbe in Elfa Distrelect or Velleman?

  21. makerimages October 8th, 2013 6:28 am

    sorry, meant Farnell instead of velleman

  22. Steve Chamberlin October 8th, 2013 6:55 am

    No, but you can find the Nokia 5110 displays fairly readily on eBay.

  23. makerimages October 9th, 2013 3:55 am

    On that case, Sparkfun has those-does Sparkfun deliver to Estonia?

Leave a reply. Comments may take a few minutes to appear.