• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Floppy Drive Interface: PH0 to PH3

onlyonemac

Well-known member
Hi!

I've been trying to decipher how the Mac interfaces with the Suprdrive floppy drive through the ISM part of the SWIM chip. I've almost got it, but I don't understand what the PH0 to PH3 lines are trying to do.

In particular, when the drive is idle, they emit very brief pulses at a rate of about once a second. Why is this?

Thanks,

speedcuber50

 

bbraun

Well-known member
By default, in System 7.1 (and probably others), the .Sony driver's VBL task is scheduled every half-second.

One of the things it does is check for disk insertion or ejection via the eject pinhole, which involves addressing the drive, putting it into sense mode, reading status, and switching back to read mode. Which involves toggling PH0-PH3.

 

onlyonemac

Well-known member
What are all these modes and stuff? I don't get it...

Is there some sort of detailed, plain-english (no assembler) explanation as to how to use this thing?

 

Gorgonops

Moderator
Staff member
Search the forum. We have had several excruciatingly long conversations about how the Mac floppy drive interface works and said threads are chock full of links.

 

Gorgonops

Moderator
Staff member
The SWIM is a superset of the IWM and the drives are (mostly) plug compatible, I guarantee that if you can understand conceptually what the lines do with an IWM you'll answer 90+% of your own question.

 

Gorgonops

Moderator
Staff member
You know, it would be a lot easier to help you if you'd be less oblique about what it is you're trying to do.

Maybe something here will help you. Unless you supply more information there's just no where else for this thread to go, pretty much.

ftp://ftp.netbsd.org/pub/NetBSD/misc/wrstuden/Apple_PDFs/

I would attempt to help explain what PH0-3 are for but I'm just stumped at what level to go to in order to reply to a statement like: "What are all these modes and stuff? I don't get it...". To really oversimplify, when you're using a "smart" floppy drive like the ones in a Macintosh (vs. the old raw stepper motor interface drives like the Disk II) they're essentially address lines for selecting a which bit to read or write in the drives' status/control register. (Does that help, or is that just gibberish?) Granted that description in based on the *IWM* documentation, but: The only difference apparent from scanning the SWIM documentation is in ISM mode it's possible to set the Phase0-3 lines to be inputs as well as outputs, but at no point I could find in the document does it explain *why* you would set them as inputs. Whether that functionality is actually used or if it's just something the hardware can do (possibly to allow the use of "dumber" floppy drives without status registers?) might be something someone could answer if you'd be more clear about *WHY YOU WANT TO KNOW*.

(If you could find a technical manual for an Apple Superdrive floppy that would also probably answer the "output only or R/W" answer as well. I'm sure it's out there, but I know it's not worth my time looking for it at this juncture.)

 

onlyonemac

Well-known member
I understand about registers and stuff; I just don't know why they're called "phase" lines.

The reason why I ask is because I want to get a PC floppy drive and link it to the Mac via some custom interfacing circuitry.

 

Gorgonops

Moderator
Staff member
I understand about registers and stuff; I just don't know why they're called "phase" lines.
They're called "phase" lines because the IWM (which, again, the SWIM is a superset of) was originally designed to work with drive mechanisms like that used in the Apple II and behave as an enhanced superset of the original Disk][ controller. With the Disk ][ in order to cut costs Apple ordered "bare" drive mechanisms from the OEM which lacked the circuitry to comply with the defacto-standard Shugart Associates floppy drive interface and instead designed the controller to directly drive the phase lines on the stepper motor that positions the drive heads. Which is why those are called phase lines on the IWM and its descendants. Ironically they are never actually used to directly drive stepper motors in the Macintosh (because Macintosh drives have a more-complicated-than-Shugart controller board that uses the inputs from the phase line in a completely different way) but they retain their original names on schematics. Just because.

(Offhandedly the Apple IIgs is the only IWM-equipped Apple machine I can think of that supports *both* raw stepper motor drives and the enhanced Macintosh style ones on the same floppy port.)

The reason why I ask is because I want to get a PC floppy drive and link it to the Mac via some custom interfacing circuitry.
You do understand that in addition to the problem of having to recreate the status/control register layout of the Mac drive and translating commands to it into Shugart-style head positioning commands you'll have to deal with additional problem that Apple drives use a variable speed drive spindle? This is a problem you *cannot* fix with a "simple" wiring adapter ("simple" is in quotes because realistically you'll probably need to use a microcontroller to track the amount of state involved), you'll have to modify (read: replace) the controller board on the drive itself to include new PWM circuitry to drive the spindle up to almost twice as fast as it ran originally.(* see edit) Was this on your radar?

I suspect you'll be able to buy several spare Macintosh drives for the price of the parts alone for your adapter.

(*EDIT: Okay, so according to this Apple KB article the Superdrive *does* run at a fixed 300 RPM when dealing with 1.44MB floppies. So I guess in principle if you don't mind your adapted floppy drive completely failing to work with 400/800k disks then *perhaps* you could get away with leaving the spindle speed alone. The rest of the comments about the complexities of replicating the status/control registers still apply.)

 

onlyonemac

Well-known member
I'm fully prepared. In fact, I've got just the microcontroller I need. Plus I know it's not going to work with the 400/800k disks.

So now where is some documentation on all these registers and control signals involved in the operation of this floppy drive interface?

 

James1095

Well-known member
Wasn't there a 3rd party Macintosh clone (early laptop?) that used a standard PC drive modified for variable spindle speed? That might turn out to be fairly straightforward depending on how the spindle motor speed is regulated, but you'd have to consult the datasheet for the motor control chip used in the particular drive you wanted to modify.

That said, if I were undertaking a project like this, I would definitely stick to fixed speed 1.44 disks to begin with. I suspect there will be timing difficulties and a lot of screwing around required to get anything working reliably. Bigmessowires' Mac floppy emulator would be a good starting point to look at.

 

NJRoadfan

Well-known member
Standard PC floppy drives can run at variable spindle rates. The problem is the drives vary in quality and some can't reliably do it (TEACs and naturally Sony were the best at this). The Central Point Copy II PC Deluxe Option Board was an add-on disk controller that could read and write 400k and 800k GCR formatted disks using a standard PC drive. The Amiga could also read/write the GCR disks using an add-on called "Sybil" and used a trick that altered the clock speed of the "Paula" chip that controlled the floppy drives. Amiga double density floppy drives were lightly modified PC drives for the most part (the only platform I've seen with disk insert notification AND manual eject!).

 

Gorgonops

Moderator
Staff member
What is your evidence that an (unmodified) pc floppy drive can run at variable spindle speeds? The interface defines simply a "motor on" signal and it's not a PWM line. Devices like the Catweasel and the old Central Point boards can read Mac GCR disks because their data seperator circuitry supports multiple bitrates with a *fixed* spindle speed. (If you want to do the trick Apple did with cramming more data into the "longer" tracks you can do it equally well by varying the speed at which you clock the data. Better, in fact, because you don't have to wait for the disk to speed up or slow down after stepping the head. Old Commodore floppy drives like the 8050 use this technique. )

 

onlyonemac

Well-known member
So either they're clocking the data at a different rate or they're rapidly switching the "motor on" line to produce the effect of differing spindle speed. But I'm gonna stick to fixed speed!

But anyway I need some documentation on this!

 

NJRoadfan

Well-known member
I'd have to look for documentation on how they did it. Commodore did resort to drive speed tricks to get HD floppies working on the Amiga, but it required a custom modified 3.5" drive. The Paula controller couldn't handle the data rate of HD floppy drives, so they modded the drives to run at half speed when it detected a HD disk. Needless to say it was slow reading/writing with HD disks.

 

Gorgonops

Moderator
Staff member
they're rapidly switching the "motor on" line to produce the effect of differing spindle speed.
You would probably damage a normal floppy drive attempting to do this. Many (most?) PC drives activate a "head load" mechanism which slightly squeezes the heads closer to the disk from a neutral position *after* the drive has achieved "READY" status, IE, hit the target RPM; on such a drive rapidly diddling the motor-on signal could A: damage that mechanism, and B: the heads wouldn't be in a position to read or write anyway, so you'd be wasting your time.

(8" floppy drives and early "Shugart Standard" interface 5 1/4 drives had a separate "Head Load" signal that the controller could use to engage head loading independent of the motor on signal; this was useful to save disk wear on 8" floppy drives powered by AC motors that ran continuously as long as a disk was inserted. PC interface drives are set up to do it automatically.)

required a custom modified 3.5" drive
Yes, that being my point. It's not "plug and play". If you're willing to cut some traces or otherwise pirate control of the spindle motor it's "easy" enough to spin it at some other speed. Ancient floppy drives usually just controlled their drive speed with a variable resistor but modern ones generally use a PWM/tachometer feedback system. If you were to try modifying a PC drive to act like a Mac drive it would by necessity be more complicated because:

A: You need to support multiple speeds, not just one that's an even 1/2 division of the normal speed, and:

B: You will have to force the drive to spin quite a lot faster than normal rather than slower. Determining whether a given mechanism only designed for 300 RPM (or 360RPM in some cases, as there's a Japanese 3 1/2 floppy drive standard that spins at that and quite a few drives "secretly" support as well) will handle 590RPM without blowing up might take some empirical testing.

 

onlyonemac

Well-known member
Well, I'm not going to do that. But I can't continue until:

a) The guy who was going to give me the floppy drives finally gets back to me

B) Someone finds the documentation on all the different registers and the interface used between them and the Mac.

 

techknight

Well-known member
Look at BMOW floppy emu source code, its published, and it explains everything if you can read the code wrapped around the comments.

 
Top