[comp.sys.amiga.unix] Minix 1.5 on the Amiga 1000

peter@stca77.stc.oz (Peter Jeremy) (01/19/91)

In article <1193@stca77.stc.oz>, I wrote:
 [ description of problem deleted ]
>I have checked amhardware.h against the Hardware manual, and it appears
>error-free.  I am currently looking through the code in floppy.c &
>floppy_conv.s to try and see if I can see an incompatability, but this will
>take a fair amount of time.
I found the problem.  floppy.c does not check for the head being at track 0
(*PRAA & DSK_TRACK0) [I guessed my A1000 wasn't from the noise it made -
it is in the software though].  It appears that, on some types of floppy
drives, attempting to step beyond track zero results in the heads no longer
being at track 0.  The problem does not exist in my [3rd party] external
drive.

This is a bug in floppy.c - it should check for the drive being at track 0
and not attempt to step down from there.  I will post a bugfix when I manage
to work out some way of cross-compiling the kernel.  An code approximation is:
(about 9 lines into flstep_int())
change:
	else if (seek_offset < 0)
to:
	else if (seek_offset < 0 && !(*PRAA & DSK_TRACK0))

The other oddity that my studies revealed is the usage of seek_delay in
flstep_int().  Why is there a 4 step delay _before_ the heads are moved?
From my (limited) knowledge of floppy drives, there is often a settling
delay _after_ the heads are positioned over the correct track.  Is that
what is intended and the code (or my reading of it) is not correct, or is
the delay needed before the seek for some reason.

I also suspect that there is a problem with the call to start_motor()
in seek().  The call is currently:
	start_motor(dp, (int) (MOTORON_DELAY - (long) ABS(seek_offset + 
		seek_delay) * stepdelay * HZ / 1000000L));
Should this be:
	start_motor(dp, (int) (MOTORON_DELAY - (long) (ABS(seek_offset) +
		seek_delay) * stepdelay * HZ / 1000000L));
-- 
Peter Jeremy (VK2PJ)         peter@stca77.stc.oz.AU
Alcatel STC Australia        ...!uunet!stca77.stc.oz!peter
240 Wyndham St               peter%stca77.stc.oz@uunet.UU.NET
ALEXANDRIA  NSW  2015

jesup@cbmvax.commodore.com (Randell Jesup) (01/22/91)

In article <1201@stca77.stc.oz> peter@stca77.stc.oz (Peter Jeremy) writes:
>I found the problem.  floppy.c does not check for the head being at track 0
>(*PRAA & DSK_TRACK0) [I guessed my A1000 wasn't from the noise it made -
>it is in the software though].  It appears that, on some types of floppy
>drives, attempting to step beyond track zero results in the heads no longer
>being at track 0.  The problem does not exist in my [3rd party] external
>drive.

	Some drives bang against the stop if you try to step past track 0.
The Commodore driver knows what track it on, and recalibrates on disk 
insertion (search for track 0, using 4ms stepping instead of the normal
3ms), and also on every 5th error.  the driver weeds out any requests for
read/write/seek before the beginning or after the end of the disk.

>The other oddity that my studies revealed is the usage of seek_delay in
>flstep_int().  Why is there a 4 step delay _before_ the heads are moved?
>From my (limited) knowledge of floppy drives, there is often a settling
>delay _after_ the heads are positioned over the correct track.  Is that
>what is intended and the code (or my reading of it) is not correct, or is
>the delay needed before the seek for some reason.

	The spec say 3ms step time, and 15ms settle time after seeking 
before read/write.  For 5.25" drives, use 6ms step time.  Drive type can
be read when the motor is off (see the hardware manual: note it's 32 bits,
not 16).

>I also suspect that there is a problem with the call to start_motor()
>in seek().  The call is currently:
>	start_motor(dp, (int) (MOTORON_DELAY - (long) ABS(seek_offset + 
>		seek_delay) * stepdelay * HZ / 1000000L));
>Should this be:
>	start_motor(dp, (int) (MOTORON_DELAY - (long) (ABS(seek_offset) +
>		seek_delay) * stepdelay * HZ / 1000000L));

	A point: for starting the motor, turn it on, then look for DSKRDY
until the maximum spec time of .5 seconds has gone by, at which point you
can assume it's up to speed.  Some drives some up to speed in <.5 seconds,
or you may just have turned it off.  The AmigaDos driver checks every .1
seconds until .5 have gone by.

	Side select time should be 1ms (1000us), and the post-write delay
should be 1.2ms (1200us) before reading or stepping or side-selecting, etc.

	BTW, I maintain the AmigaDos trackdisk.device.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com  BIX: rjesup  
The compiler runs
Like a swift-flowing river
I wait in silence.  (From "The Zen of Programming")  ;-)