Subject: Re: Floppy driver (was: Re: This week's NetBSD/amiga changes)
To: Ty Sarna <>
From: Brad Pepers <>
List: amiga-dev
Date: 04/11/1994 16:36:51
> Cc'ing the list since this is of interest... hope you don't mind Bill.
> William J Coldwell wrote:
> > 
> > Got 2.04 RKM:Devices?  Pg. 337
> > 
> > 	Amiga: $00000000
> > 	5.25": $55555555
> > 	Amiga: $00000000 (high density)
> > 	None : $FFFFFFFF
> Interesting! These are inverted from the values RKM:Hardware
> gives. (see page 371)
> > Dunno how you're supposed to tell an HD from a normal 3.5"... sigh.. could be  
> > a screw up in the manual.

The four drive types are 00000000, 55555555, AAAAAAAA, and FFFFFFFF. The
problem or source of confusing is that this is retrieved using the RDY
line which is active low. In at least one place in the manual it says to
invert what you get. Other parts of the manual seem to say it is not to
be inverted. So the 00000000/FFFFFFFF is for no drive and 880K drives
and the 55555555/AAAAAAAA is for 5 1/4 and 1760K drives. Which is which
depends on if you invert or not.

There is a bug in the current id code that causes it to give different
results on different machines. Really odd. I think its a problem with
gcc over-optimizing the code or maybe a timing thing. I have sent some
code from an operating system I wrote for the amiga that worked better.
It was in asm though so it may take Chris a while to get it in the

> It is and isn't apparently.  Since I have every kind of floppy drive on
> one machine or another, I typed in the program and tried it out.  The
> values above are what it reports.  the HD drive reports $00000000 for
> DD floppies, $AAAAAAAA for HD floppies.  If no floppy is inserted, it
> reports the value of the last floppy, or $00000000 if no floppy was ever
> inserted this boot. 
> RKM:Hardware reports the exact inverse values, so I guess disk.resource
> inverts the values before returning them...  dunno why... 

See above for why...

> So:
>  3.5" DD = ~00000000 = FFFFFFFF
>  3.5" HD = ~AAAAAAAA = 55555555	
>  5.25"   = ~55555555 = AAAAAAAA   (listed as reserved in RKM:Hardware)
>  None    = ~FFFFFFFF = 00000000   (   "   "     "      "       "     )
> Just clone the 3.5" DD entry in the id table, change the number of
> tracks to 40, set the id to $AAAAAAAA and change the name. Voila! 5.25"
> support! That's my theory, anyway... :-)

Could maybe work.... Tried to make everywhere use the table values. I
think the last place was in the ioctl stuff for labels. It is easy to

> Also, I'd have to look at the fd.c source again, but I don't think it
> does HD mode correctly right now. It needs to re-read the ID whenever
> the disk changes (which isn't detected, so I guess it has to be done on
> every track read or write? ewww... Actually, maybe it only needs to be
> checked on open. Hmm... yeah I think that would work.) Applogies if the
> driver already does that.

The code reads the id whenever the device is opened so it should work.
HD use crashes the system though and I never did figure out why! As for
disk changes - I didn't ever get around to trying to capture them. It
is left as an exercise to the user!

> -- 
> Ty Sarna                 "As you know, Joel, children have always looked
>        up to cowboys as role models. And vice versa."

+----------------------------Ren & Stimpy--------------------------------+
| "Psst. Hey Guido. It's all so clear to me now. I'm the keeper of the   |
| cheese. And you're the lemon merchant. Get it? And he knows it. That's |
| why he's gonna kill us. So we gotta beat it. Yeah. Before he lets      |
| loose the marmosets on us! Don't worry, little missy! I'll save you!"  |
+------------------ Brad Pepers -- -------------------+