Skip to main content
Home Forums Interface information for 400KB Floppy drive Interface information for 400KB Floppy drive
Thread

Interface information for 400KB Floppy drive

Interface information for 400KB Floppy drive 68k 43 posts Nov 24, 2009 — Dec 11, 2009
Dude you just hit it out of the freaking park. That is the most concise explanation of the 400/800KB drive I have read. Even the biography is an excellent source of information.
Heh. No problem, I occasionally try to be useful. Funny thing was the only reason I opened up my PDF of the first-edition "Inside Macintosh" was I wanted to see if it said what the track-to-track stepping time of the Mac drive was. Once I started reading it I realized, uhm, oh, this might be useful to point out.

Now that I have a better understanding of the IWM I think it would be possible to attach a Disk II to a Mac. One would just need to write the appropriate driver. Of course if I had figured that out 20 years ago that might have been a useful thing to do.
There are all sorts of dire warnings about how hooking up an Apple II drive can "fry the IWM" in your Mac... I wonder if the Mac is missing some circuitry that the IIgs *does* have that would let it safely operate in the "control the stepper motor directly" mode (buffering/amplifiers/drivers external to the IWM? Or does an Apple II drive ground the PWM signal, causing a meltdown?), or if it's simply a software thing. (The Mac ROM defaults to incorrect assumptions about drive instead of trying to query it, and running in the wrong mode alone is enough to overdrive the chip? )

That also explains why they were able to attach the HD20 to a floppy controller also. The Disk II interface and the IWM are very impressive yet disturbing at the same time. It created a very flexible controller but it leaves the software very tightly coupled to the drive mechanism. In modern systems that would be a big no-no, but 30 years years with the high cost of hardware I would say that was the right thing to do.
Ironically, if you could find the appropriate documentation for the protocol used to communicate with the HD20 there's a good chance it would be substantially easier to emulate than a floppy drive. As H3NRY noted earlier, when running the HD20 the IWM would essentially behave like a high-speed UART. If it transfers data in neat sector-size chunks and dispenses with the data encoding/timing pulses a floppy drive needs then it would be fairly trivial to grab data sectors straight off a memory card as needed, and timing might be a lot less critical. If anyone has a link to a document chronicling the secret recipe for speaking to an HD-20 it might be an apropos time to trot it out.

(You could potentially figure it out, if no other way, by sicing a 68000 disassembler against the either the 128k Mac Plus ROM, which can boot one natively, or the HD-20 init. But trying to interpret such a thing would suck.)

If anyone has a link to a document chronicling the secret recipe for speaking to an HD-20 it might be an apropos time to trot it out.
We've been begging for this for years. I wonder if it is because Apple broke their own rules to developers and used the floppy port, rather than the serial port, which gave them a substantial speed edge over the competition, and therefore guarded the recipe like a state secret, that we do not have more information about it. I think only one or two other third party developers ignored Apple's rules and came up with a floppy port drive on their own, and Apple may have even bought into one of them, Quark, to build the HD-20.

As for the Disk II, definitely a valid question about the warnings of plugging one into a Macintosh. But I do wonder why, even 20 years ago, one would want less disk space than a 400K disk which barely contained a Mac System as it was. A Disk II held at most 140K, barely 1/3 of the Mac drive. I think Apple attempted something similar to this with their Twiggy FileWare drives, a 5.25" drive with 860K, which Apple could never get to work reliably, which may have had more to do with their double sided implementation than the variable speed control. But a 430K single sided-drive might have been just dandy. Still the hardware must be designed to take advantage of the speed adjustments. All in all, no great loss the drives may not be hardware compatible.

I did some research and found that the SWIM and pretty close to the IWM. I took a look at the Linux Mac floppy driver code and apparently a command is sent to the drive it switch it from GCR to MFM modes.

I still don't have a 800KB drive, but I do have a 1.4MB drive. In fact I picked up a LCIII today just for its floppy drive. I think it will be useful so I can do some experimenting with the drive and interface with out worrying about damaging my beloved IIsi or 512K Mac.

So my first course of business is to attach the drive to my Arduino and see if I can send the command to eject the disk.

Well about the time I pulled out the soldering iron I realized something. If I want to understand how the drive works it would be much better to spy on it while the Mac is using it.

So new plan. I have a good set of documentation on how to control the IWM and SWIM. So I am going to control the IWM manually and use the Arduino to spy on it. Then I try to capture those command and respond to them.

Just to make things interesting, Apple has a bunch of different floppy drives with different software interfaces which all plug into the floppy port / IWM / SWIM / IBM chips. There is the disk II which is a more or less standard Shugart drive. There is the early 800K 3.5" drive for the Apple II which has its own 6502, buffer RAM, and IWM chip inside and which talks to the host like a HD20. There is the 400K Sony drive in the early Mac, which is nearly as dumb as the disk II but uses step pulses instead of directly pulsing the stepper motor windings. There is the 800K drive without built-in intelligence as used on the Mac and IIgs, and lastly the 1.4M + 800K Super Drive, and the 1.4M only drive used in late model PPC Macs. The main reason you don't want to plug a DiskII into a Mac is the plugs are wired differently and 12V can get applied to 5V circuits.

The idea of running the HD20 init thru MacNosy or equivalent sounds intriguing. I wasn't the software engineer on the ProApp floppy port HD project, so my knowledge of how it worked is limited, but there were drivers for it for Apple IIs and Macs. It took a long time to get that drive debugged, and by the time it shipped the Mac Plus was out and SCSI drives were cheaper & faster. The ProApp drive found buyers in the Apple IIc community, for which it was the only choice on the market.

Something else which I haven't seen mentioned is the 3.5" disks read and write at about twice the bit rate of the 5.25" diskII, which is why the Apple IIe and previous required a smart drive. It takes a 2MHz 6502 to write a 3.5" disk. Way back when, I disassembled and commented the disk driver in the Mac ROMs. I wonder if I still have that.

There is the early 800K 3.5" drive for the Apple II which has its own 6502, buffer RAM, and IWM chip inside and which talks to the host like a HD20. There is the 400K Sony drive in the early Mac, which is nearly as dumb as the disk II but uses step pulses instead of directly pulsing the stepper motor windings. There is the 800K drive without built-in intelligence as used on the Mac and IIgs, and lastly the 1.4M + 800K Super Drive, and the 1.4M only drive used in late model PPC Macs.
Just to be clear on these points: The 800K 3.5" drive for Apple II (UniDisk) is identical to the drive mechanism used in the Macintosh. The only difference is that the Apple II version includes an added circuit board which can be easily removed allowing the drive to be used with a Mac. The Superdrive also used 400K disks, which presumably behaved identically to the 800K but only wrote one side. Also of note, an 800K & 1.4MB Superdrive will behave as a 400K or 800K drive when plugged into an IWM Mac depending on what the ROM supports (with appropriate cable blocking the PWM pin, otherwise the drive will malfunction). A 400K drive cannot be used on a Mac equipped with a SWIM chip because of the permanently high signal output by the PWM pin), but the 800K drive can be.

I was surprised to read from you that Apple ever dropped support for Superdrives in its PPCs which shipped with floppy disks. The last Apple supplied floppy was in the PowerBook G3 (Wallstreet) and will support all three formats. The last G3 Apple floppy disk equipped desktop counterparts were all discontinued prior to that and I always thought they included Superdrives as well. The subsequent PowerBook G3 (Lombard) would accept a floppydrive expansion bay module, but only supported 1.44MB – not sure if that was a hardware limitation of the third-party manufacturers or Apple dropping support for the Superdrive.

Well good news and bad news. I decided to take a look at the Developer Note for the LCIII and it states this.

The Macintosh LC III uses a new floppy disk controller circuit, SWIM2, that is part of the Sonora chip. Because the SWIM2 controller is different from the original SWIM, software that accesses the controller directly will not work with the Macintosh LC III. The only way for software to access the floppy disk is through driver calls documented in Inside Macintosh.For situations where direct access to the raw track data is required, use the Diagnostic Raw Track Dump call described in the Macintosh Technical Note M.DV.SonyDriver.
So the information I have for the SWIM and IWM is no good. But It looks like that might just be ok. Having access to the Raw Track data will be very useful going forward. So I am off to take a look at the M.DV.SonyDriver tech note. Even if it does not have the information to control the SWIM2, Linux runs on the LCIII so I am sure I can get the info from the floppy driver.

Just to be clear on these points: The 800K 3.5" drive for Apple II (UniDisk) is identical to the drive mechanism used in the Macintosh. The only difference is that the Apple II version includes an added circuit board which can be easily removed allowing the drive to be used with a Mac.
I connected a UniDisk up to the Classic a few months back when I was archiving disks and needed as many drives I could get. Now, it's been awhile and I don't remember if it worked or not. It ought to check again. It could be that the previous owner of the drive lobotomized it, though I doubt that.
The subsequent PowerBook G3 (Lombard) would accept a floppydrive expansion bay module, but only supported 1.44MB – not sure if that was a hardware limitation of the third-party manufacturers or Apple dropping support for the Superdrive.
That's likely. Apple probably got a different manufacturer to create the slimmer drive needed in the laptop. I noticed that the drive in the Quadra 605 (with dust flap and different head arm assembly) appears to have been made by a company other than Sony.

Dog Cow, there is no way the UniDisk will work on a Mac with it's "smart" circuitry intact. It's the equivalent of hooking an electrically compatible Disk II.

As for the Lombard PowerBook G3 drive, Apple did not even sell a floppy drive as OEM. It was totally up to third parties to supply the drive, in this case, VST comes to mind. Apple was out of the floppy drive business for good by that time. Apple had for some time prior been using more than Sony to manufacture its OEM drives. At one point Apple tried to walk away from the Sony partnership to save money in the mid-90s.

That's likely. Apple probably got a different manufacturer to create the slimmer drive needed in the laptop. I noticed that the drive in the Quadra 605 (with dust flap and different head arm assembly) appears to have been made by a company other than Sony.
i've never played around with a PowerBook G3, but odds are it'll be a Mitsubishi - all the manual-inject PowerBook drives I've seen have all been Mitsubishis. Desktop manual-inject drives were made by Mitsubishi, Panasonic and Sony. I'd assume that your Q605 uses a Mitsubishi, since a lot of manual-inject Macs from that era have Mitsubishis.

I'd assume that your Q605 uses a Mitsubishi, since a lot of manual-inject Macs from that era have Mitsubishis.
Yes, that does sound familiar. I haven't opened the Q605 in awhile to look.
@Mac128: the UniDisk probably didn't work, but I'm going to check again some time.

my original idea which i never started or attempted, but ill throw it out there for you if you want to do it this way:

My idea was to make an external floppy emulator that plugs into the floppy port, has some buttons, and a small 1 or 2 line character LCD which is cheap, and tons of C and BASIC AVR/PIC drivers out there for those 44780 modules. Then use either an SD card or USB stick to store apple floppy disk images, either disk copy format, or some other proprietary format for ease of use.

So you can push buttons on the drive itself to scroll through the list of images stored on the stick or SD card, pick one you want to use, then the floppy emulation loads it into RAM and takes over, mounts the disk as if it was a real floppy, and off and away the mac goes. Then when you eject, it takes the data stored out of the MCUs RAM, writes the changes back into the img file and dismounts it.

This way you can store multiples of floppy disk images onto 1 stick, and use either a C source of a mass storage driver for USB, or use a regular SD/MMC card. MMC drivers are already floating around for BASCOM on AVR/PIC but dont know about SDIO or SDHC. need to look around.

All this assuming you get floppy emulation working of course, or HD20 emulation. otherwise, replace the IWM chip with something of your own that emulates the IWM, and the backend uses your own protocals for AVR/PIC interfacing.

tons of options out there. just have to figure out how the macintosh ROM works with its IWM and the IWM standard in general, sounds like it would be much easier to write an IWM emulator than a drive emulator.

mp.ls