This article describes a project to create a CompactFlash / IDE Interface card for Apple II computers (//e enhanced or later). The card is ProDOS 8, GS/OS and Apple /// (SOS) compatible. With an additional driver, GS/OS users get additional partitions and speed. I did the original wire-wrap prototype over the span of several months. This project is very much a case of old technology (the Apple II computer) meets new (CompactFlash cards and Altera CPLDs). My reasoning for this project was simple: I wanted to be able to pull out my old Apple II and use it from time to time to reminisce about the early days of personal computers. I also wanted a reliable way to store my Apple II programs and data files for many years to come.
Due to the long-term reliability prospects of floppy drives, and my general laziness, I decided a mass storage device is what I needed. The Apple II was an excellent example of an open system, with unheard-of-today documentation like system schematics, firmware listings, and peripheral design tips. In the spirit of the Apple II this project is also an open project. You can download all of the software and hardware schematics for the project in the downloads section. Also the manual, in PDF format, is available.
Every once in a while, I find myself reminiscing about the good old days of personal computing. The good old days for me were high school, circa 1981, when the Apple II+ was the computer to have and the computer I wanted. Unashamedly I begged my mother until she got one for me. It was not until years later that I found out she had taken a loan to do so. Bless her heart! It was a good investment, if I do say so myself.
Top View of the CFFA Apple II card. The IDE and CF connectors are at the left.
Sometime in October 2001 I found myself in one of those moods and pulled out my Apple II+ to play with. It had been many years since I used it last. I found a note taped to the computer that stated it didn't work and that I believed there was a problem with the language card. The computer would boot, most of the time, but would crash, breaking into monitor at seemingly random locations. Sometimes it would just hang. This was disheartening, and I decided that I was going to fix it no matter what. Even if it meant buying another one, which wouldn't be much of a fix.
I located an Apple II diagnostic disk that was used by Apple service centers and it immediately found the root of the problem. I had a bad D8 ROM chip. I was able to replace this chip with a standard 2716 EPROM and a simple converter socket. To save money, I am sure, Apple used 9316B ROM chips instead of the industry standard pinout chips. This means that you cannot just plug a 2716 EPROM into an Apple ROM socket, but must fashion a converter socket first. See the section called "ROM MEMORY" in the Apple II Reference Manual, pg. 94 for 9316B pinouts.
After borrowing someone else's Apple II+ I was able to copy his D8 ROM and copy its data into a 2716. I put the EPROM into my Apple II+ and presto, it was again working fine! As it turned out the language card was never the source of the problem, it worked fine.
Great, I had my Apple working again, so it was time to reminisce about the good old days. I wanted to show my wife Sherry some of the programs my friends and I had written so many years ago. She had saved one of her Apple diskettes from her high schools days as an Apple II hacker. Things were going along great when one of the programs I had written tried to write a file to the diskette, and trashed it. Ouch!
Because of an unfortunate mix up years earlier, I had thrown away most of my Apple II diskettes by accident. It was not until recently that I had found a friend who had copied about ten of them to use with an Apple II+ he had found in the garbage. Thanks Mike!
So it was one of these very precious diskettes that Mike had saved for me, that I had just scrambled while trying to check out one of my old programs. I soon realized that my floppy drive, made by RANA, was scrambling data on the diskettes every time it wrote to them. I don't know what is wrong with it yet, so I switched to another set of drives from the same Apple II+ I had copied the D8 ROM from.
I spent the next three days trying to recover that scrambled diskette. After downloading several Apple II emulators and disk transfer utilities, I was able to make a disk with the "Bag of Tricks" utilities by Quality Software. These are the utilities that were described in the Book Beneath Apple DOS by Don Worth and Pieter Lechner. Since the damage to the diskette's data was limited to the catalog track: $11, I was able to recover the disk. The reason it took so long was mainly due to the time spent finding all of the necessary tools to get software downloads off the Internet onto my PC and then onto an Apple II diskette.
It was after this episode that I realized that the reliability of diskettes might become a serious impediment to future reminiscing sessions years down the road. The first thing I did was create image files for every diskette that I could and store them on my PC. I made copies of the disks that could not be read by the ADT transfer software. These were mainly games. I realized that I could simply use an Apple emulator for my retreats into computer history, but I feel it is just not the same, and if I ever have children, I would want them to see and touch one of the very first "real" personal computers, not some simulation of an Apple in a window on a Pentium VIII running Windows 2012. It would be meaningless. So I decided I wanted a hard drive for my Apple, and started looking for one of the old SCSI solutions for the Apple II. They did exist, but were pretty rare, and even if I could find one I figured it would also be unreliable.
In my search I stumbled on several web pages where someone had interfaced an IDE hard drive with an Apple II and other old 8 bit machines. Struck by the relative simplicity of the project I figured it would take two weekends to build one. The project I used as a model most closely was Stéphane Guillard - Apple II IDE/ATA interface project. His project was unique in that he wrote code for the Apple II that understands the FAT16 format, or at least is headed in that direction.
The problems started very soon. I was not using the LSI chips that Stéphane had used, but instead an Altera EPM7064S series CPLD. I discovered several things about these chips that proved to be a problem. Mainly the problem was my lack of experience with this CPLD. Between hardware and software, my two weekends had turned into two months. During that time though, several good changes to the project's design resulted. The main change was the decision to use CompactFlash cards instead from IDE hard drives.
Realizing that it may be some time before Stéphane was able to integrate his OSS code into either ProDOS or DOS 3.3, I decided to abandon building a duplicate of his project and set off in another direction. I wanted only ProDOS support. ProDOS is the DOS that Apple released around the time of the introduction of the Apple IIe (and is based on the Apple ///'s SOS operating system). Then after the release of the 16 bit Apple IIgs, they renamed the 8-bit version of ProDOS to ProDOS 8 to differentiate it from the new 16-bit version. Because ProDOS 8 only supports two 32 Mbytes drives per device, I decided that an IDE hard drive would be a waste, in many ways. Instead I changed the project to support CompactFlash cards in "true IDE" mode. Although an IDE hard drive would still work.
I ask a friend and ProDOS hacker from way back, Chris Schumann, to help me develop a ProDOS 8 driver that would work with ATA devices, specifically the SanDisk 64 Meg CompactFlash Memory Card. We spent several days coding with marginally working hardware and roughed out the ProDOS driver, complete with debug code that would output via an Apple Super Serial card back to my PC. He had written ProDOS drivers in the past that allowed a file on a PC to appear as a hard drive on the Apple linked via a RS232 serial connection.
After much struggling with a glitch in my Apple II+ that made my hardware work unreliably, and nearly giving up, I tried the card in the Apple IIe platinum I purchased via Ebay, and it worked great. Special Thanks to Jeff Pagel for his help and the loan of test equipment. "...it's probably a timing issue..."
Side View of the CFFA Apple II card. Note the 64 mb CF card at the left.
To better answer any of your questions, I've put together a FAQ file that should explain the card and what it can do:
A: Why Not? OK, a better answer: To learn how to interface IDE-ATA devices to 8 bit micros. The 6502 may be long gone, but 8 and 16 bit microcontrollers, by Microchip, Motorola, and others are still excellent platforms for embedded products.
Q: How much does the current card cost?
A: Assembled and tested with a User's manual: US$105 + Shipping Charges for second run boards. This board includes the EPROM Ejector socket. Which was $110 + ship during the board first run. (Does not include a CompactFlash card.)
Shipping to any location in the lower 48 states is a flat US$5. If you live overseas, please contact me or fill out the order form, and I will contact you with the shipping charges to your location. If you agree with the extra shipping charges, you can then send your payment.
Q: Are you taking orders yet?
Q: What payments methods will you accept?
A: I will accept:
• PayPal: My PayPal ID is: firstname.lastname@example.org. Fastest way to get order processed
• Money order: Typically faster than a personal check.
• Personal Check: Once your check clears the bank, I will process your order.
Payments can be sent to me at the following address:
5102 Blazing Star St.
Wausau, WI 54401
All payments must be in US funds.
Q: What kind of return policy and guarantee will you offer?
A: You may return the product undamaged for any reason within 90 days of receiving it. I warranty the product to be free from defects for 1 year. Warranty returns will be repaired, replaced, or refunded based on my discretion. If you want to return something, please contact me via Email: email@example.com
Q: Can I use a IBM microdrive in place of a CompactFlash memory card with
A: Yes! They have worked fine for me.
Q: How fast is the board. Will it support DMA and Interrupts?
A: Here are the results of a simple test written in BASIC. This test was run on my Apple IIe Platinum @ 1Mhz:
Write 32k bytes ten times to a file: 28 seconds or 11.4 kBytes/sec
Read 32k ten times from a file: 9 seconds or 35.5 kBytes/sec
No, this project does not use DMA or Interrupts. If you need those features you will have to look elsewhere.
Q: What support does your hardware have for hard drives?
A: The CFFA board has support for IDE hard drives that support ATA mode 1 and LBA.(Logical Block Addressing). That means that many of the early small IDE drives that only supported CHS (Cylinder/Head/Sector) addressing will not be supported. Typically drives that are larger that 528 MB will support LBA. Also, the board will have mounting holes for standard 2.5" hard drives to be mounted right to the board (using standoffs). There is also a power connector to supply +5v, +12v, and GND for the IDE drive. It will be up to the user to determine whether or not the drive they want to use will exceed the Apple power supply ratings. Use caution!
Because other high-speed IDE interface cards exist for the Apple II, I am expecting most people will be using the CompactFlash memory cards with my board. To my knowledge, everyone who has tried using a hard drive has been successful. I have been using my hardware with an IBM 1.6 GB 2.5" hard drive model, DDLA-21620, and it has been working fine.
Q: So, what size devices can I use?
A: Depends: The default firmware selected on the card supports four 32MB drives, for a 128MB total. A second user selectable version of the firmware will support eight 32MB drives for a total of 256MB. The reason for not going with the 8 drive version is that ProDOS 8 only supports 13 total volumes, including the floppies, etc. So if I take up 8 drives, I may cut off access to some other hardware you already have, like a SCSI drive. That is why I will have two versions of firmware that are user selectable. This is all documented in the CFFA user's manual.
Note: If you are going to use Dave Lyons' GS/OS driver you should configure the CFFA to its default firmware that supports 4 drives. When the GS/OS driver loads, if it sees you have jumper-selected the 8 drive version of firmware, Dave driver will not load. In that case you will see all eight partitions via the GS/OS's "generated" drivers.
So, using Dave's GS/OS driver with the 4 drive firmware selected, you will have access to the same 4 drives listed above, plus two additional drives that are up to 1 GB each. This will only be possible with Dave Lyons' GS/OS driver, which you can download from this site or from Dave's site.
Q: If I use a flash memory, won't it wear out after a certain number of write
A: Flash based memory does have a finite number of write cycles. So yes, it is possible that after heavy usage, a flash card could become un-writable. I believe most users will never run into this situation unless they are running software that is writing data with a very high frequency. The SanDisk brand flash card has a sector write endurance equal or greater than 300,000 writes. It also features error detection and correction that automatically implements advanced wear leveling. Drivers/firmware no longer have to worry about doing manual wear leveling any more, at least with SanDisk CF products. Sectors that wear out are automatically detected and removed and replaced from the pool of reserve sectors.
Q: Which model Apple II does this project currently work in?
A: Using Version 1.3 of my firmware...
Model Type -- Compatibility Comment
Apple IIgs ROM3 -- Working. No problems with on-board firmare or Dave Lyons' GS/OS driver
Apple IIgs ROM1 -- Working. No problems with on-board firmare or Dave Lyons' GS/OS driver
Apple IIe Platinum w/ 8Mhz ZipChip -- Working. No problems
Apple IIe Platinum -- Working. No problems
Apple IIe Enhanced -- Working. No problems
Apple IIe -- Working. Requires V1.3 EPROM and v1.3 CPLD. Works with regular 6502. Use ProDOS v1.9 or earlier
Apple II+ -- Working. Requires V1.3 EPROM and v1.3 CPLD. Works with regular 6502 or later
Apple II -- Vince Briel reports: Does not work. Not sure why. I don't have an Apple ][ to test with.
Apple /// -- You'll need the free CF/IDE driver available from the file downloads area of the R&D Automation web site.
• Native Apple /// SOS driver written in 6502 code.
• Up to 8 user definable partitions - up to 32mb each.
• Can manage up to 2 devices - master & slave.
• Master (device 0) can be either CompactFlash memory installed in the built-in socket on the interface card or an IDE hard drive attached to the 40pin IDE connector and configured as master.
• Slave (device 1) can be either CompactFlash (you will need an adapter that can be connected to a 40pin IDE connector and slave configurable) or an IDE hard drive configured as slave.
• Although any size of device can be attached and successfully used, the maximum usable capacity is limited to 16,711,680 blocks.
Q: Will it work with ProDOS
A: Yes. I have used it extensively with ProDOS version 2.0.3, without a single problem.
Q: Will it work with Apple DOS 3.3?
A: No. This is ProDOS only. But that doesn't mean it could not be made to work by some crafty hacker... but it would be a serious hack.
NOTE: I have been using the late Glen Bredon's DOS.MASTER software and have been able to copy a version of RobotWar on to a DOS 3.3 partition on a ProDOS disk. Check out DOS.MASTER if you want to have DOS 3.3 volumes on ProDOS formatted disks. Very cool.
Q: Can I load up the CompactFlash / hard drive with all of my old Games and
run them from there?
A: Probably not. Most of the old cool games were DOS 3.3 based and had some form of copy protection. So unless it is a ProDOS compatible game, you can probably forget it. But also see "Will it work with Apple DOS 3.3?” above.
Q: Will it work with GS/OS?
A:Yes. It has been tested on both a ROM1 IIgs and a ROM3 IIgs. It has been tested with both ProDOS 8 2.x.x and GS/OS. If you use ProDOS 8 you will get four 32MB drives. If you use it with the GS/OS driver, you will get four 32MB drives plus, up to two 1 GB drives. These last two drives have been limited to 1 GB each due to limitations in the HFS file systems' cluster size. At 1 GB, the cluster size is 16384 bytes, therefore a 1 byte file would consume 16384 bytes of disk space.
Q: Will it work in a //c?
A: No. There are no expansion slots in an Apple //c to place my hardware in. It will not work with the SmartPort on the back of the //c. It needs an expansion bus slot, like the Laser 128 had.
Q: Do you need to format the CompactFlash or HardDrive before use?
A: Yes. Once connected to the interface, I have found Apple System Utilities 3.1 or later (I think that was the last one) to be the best choice for formatting. When formatting the partitions 3 and 4 in certain slots, you may run into a bug that exists in both Apple System Utilities 3.1 and Copy II+ (all versions I believe). See the post in my forum for more details on working around this problem.
Q: Can I take the CompactFlash out of my Apple II and read it with my Mac?
A: Yes! Using a CF card reader you should be able to mount the CF card on your Mac and access your data. But please note that the Mac will probably not see the multiple partitions on your device and may treat it as one large partition. So be careful to only write to the first 32 MB from your Mac, or better yet not at all from the Mac.
Q: Can I take the CompactFlash out of my Apple II and read it with my Windows/DOS
A: No (or maybe). No you can't just read the files off of the drive, because the format is not a Microsoft FATxx standard. But you can back up the CompactFlash to an image file using programs like Ghost or Drive Image Pro. Note: you will need a way to attach your CompactFlash to your computer; I used a converter board by: Adtron part# SDDA-03, available from EMJ Embedded.
Q: What about the Apple II+ and the un-enhanced IIe? Do you have to use 65C02
specific instructions in your firmware?
A: Yes. The current firmware does use 65C02 specific instructions. Some of the C02 instructions make coding much easier. I won't be supporting the 6502. But that doesn't mean you couldn't do it yourself :)
Q: I took the CF card that I was using in my CFFA board and put it back in
to my Camera, PDA, Gizmo, etc. and it doesn't work. I can't format it and
nothing seems to work with it. Did the CFFA board hurt my CF card?
A: No!!!! The trouble you are having probably is due to the fact the MBR (master boot record) has been overwritten on the CF card. On the very first sector of any hard drive in the PC world resides the MBR. This is where the initial boot code and the main partition table is normally stored. The CFFA card has no use for this information and allows ProDOS or GS/OS to use that space as normal data storage for the file system. When you go back to using your CF card in another device, it may not like the fact that it can't find that MBR information, and refuse to work with that CF card. So you will have to re-write the MBR back to the CF card and then you will be able to re-format the card using your favorite camera, or whatever device has that capability.
How you go about getting the MBR back onto a flash card can be quite tricky. I may not know the easiest way, but I have done it. I used a CF to IDE convert board and hooked up the CF card to a PC as Master drive 0. I removed all other hard drives so that there was no chance I would blow away the MBR on another drive. I then into booted into MS-DOS from a DOS floppy and at the A:> prompt I typed:
This action will cause fdisk to write a new MBR to drive 0 (C:) and quit back to DOS. It will not write the MBR to another drive no matter what other parameters you specify. So don't think you can say something like FDISK X: /MBR and it will affect the X: drive. It will not. It will rewrite the C: drives MBR, potentially causing massive loss of your data.
How you would do this on a Mac, I have no idea. If someone knows, drop me a note.
As of May 22, 2004, The CFFA is a universal Apple ][ card. It should work in ]['s and ][+ machines that only have a 6502 CPU. When new firmware/logic files are ready, you will be able to download them from the R&D Automation site at:
Since most people don't have CPLD burners, a new EPROM and CPLD will be offered to existing customers, at my cost+shipping.