118 lines
4.6 KiB
Plaintext
118 lines
4.6 KiB
Plaintext
|
Disk Drives - what YOU are doing wrong!
|
|||
|
* Copyright 1988 Commodore-Amiga, Inc.
|
|||
|
* This information is provided "as is"; no warranties are made. All
|
|||
|
* use is at your own risk. No liability or responsibility is assumed.
|
|||
|
* Permission granted to reproduce, provided this notice remains.
|
|||
|
|
|||
|
|
|||
|
A distressing number of our third party hardware and software
|
|||
|
developers have been using the floppy disk drives in an incorrect
|
|||
|
manner. If you use the trackdisk.device you are safe. If you go
|
|||
|
directly to the hardware, or build hardware, then this article is
|
|||
|
for you.
|
|||
|
|
|||
|
|
|||
|
For Hardware types:
|
|||
|
|
|||
|
1> The disk drive light should not flash on and off during
|
|||
|
access. Our drive activity light reflects the state of the
|
|||
|
motor. Typically the LED signal is driven by IN_USE (pin 4).
|
|||
|
|
|||
|
2> For compatibility with future systems, we require that drives
|
|||
|
refuse to step past track zero. That is, if the head is already
|
|||
|
at zero, and an outward step is received, it should not move the
|
|||
|
head. The drive must still reset it's "DISKCHANGE" latch,
|
|||
|
however.
|
|||
|
|
|||
|
3> The critical specifications for our 90mm (3.5") drives are:
|
|||
|
3ms track-to-track. 15ms settling time. >80% radial alignment
|
|||
|
using a Dysan Alignment disk. 500ms motor spinup. 800ms maximum
|
|||
|
power on delay.
|
|||
|
|
|||
|
|
|||
|
For Software types:
|
|||
|
|
|||
|
This part is primarily directed at people who write custom
|
|||
|
boot-loaders for game software. Due to defective loaders, there
|
|||
|
are thousands of Amiga owners who can't load some games, and will
|
|||
|
NEVER BE ABLE TO BUY THEM.
|
|||
|
|
|||
|
The ultimate source for information on drive timing comes from
|
|||
|
the manufacturer's specifications. This article simply
|
|||
|
highlights the most misused points.
|
|||
|
|
|||
|
|
|||
|
1> Don't make bad assumptions. For example; if you depend on the
|
|||
|
motor being on, turn it on before use. Don't assume that your
|
|||
|
boot code will be entered with the disk drive or system in any
|
|||
|
reliable state.
|
|||
|
|
|||
|
|
|||
|
2> **NEVER** use a loop like this for timing:
|
|||
|
|
|||
|
move.w #$1000,D0
|
|||
|
busy_wait dbra d0,busy_wait
|
|||
|
|
|||
|
This fails to produce accurate timing under a large number of
|
|||
|
circumstances. The speed of the above loop depends on what CPU
|
|||
|
is installed in the system, what video mode is selected, whattype of memory
|
|||
|
the program is in, in what relation to vertical
|
|||
|
blank the code executes in, what the blitter is doing, what
|
|||
|
interrupts are enabled and more other factors than you want to
|
|||
|
think about.
|
|||
|
|
|||
|
The 8520 chip provides fast, easy timing. See the companion
|
|||
|
article entitled "How to waste time".
|
|||
|
|
|||
|
|
|||
|
3> The STEP line must be used as a low-going pulse. The
|
|||
|
direction must be set up FIRST, with a separate write to the
|
|||
|
register. A typical use would be:
|
|||
|
|
|||
|
or.b #%00000010,$bfd100 ;Set up direction
|
|||
|
and.b #%11111110,$bfd100 ;Pulse low
|
|||
|
nop ;Wait a bit
|
|||
|
nop ; " " "
|
|||
|
or.b #%00000001,$bfd100 ;Set it high again
|
|||
|
;-- now wait 3 miliseconds for the head to
|
|||
|
;-- get to the next track
|
|||
|
|
|||
|
We specify that our drives must get to the next track within 3
|
|||
|
miliseconds. Some drives will step considerably faster, others
|
|||
|
will fail at or before 2.8 miliseconds. When the direction of
|
|||
|
step is changed, the settling time must also be added (a total
|
|||
|
minimum delay of 18 miliseconds).
|
|||
|
|
|||
|
Note that the TRACK ZERO sensor will not be valid until the head
|
|||
|
actually reaches the track.
|
|||
|
|
|||
|
|
|||
|
4> When turning on the motor, wait for the READY signal to go low
|
|||
|
before reading or writing (steps are ok before then). Note that
|
|||
|
READY is only valid when the motor signal is ON.
|
|||
|
|
|||
|
|
|||
|
5> To determine if a disk is in the drive, look at the DISKCHANGE
|
|||
|
signal. If it is low,the disk has been removed (and possibly
|
|||
|
inserted again) since the last check. Step the head to reset the
|
|||
|
latch and examine the current state.
|
|||
|
|
|||
|
|
|||
|
6> Some code uses an extra track or two for storage or copy
|
|||
|
protection. We will not guarantee that our drives will have more
|
|||
|
than the normal 80 tracks. We will say that using one extra
|
|||
|
track is rather safe, two tracks is probably ok, and three tracks
|
|||
|
is a very bad idea.
|
|||
|
|
|||
|
|
|||
|
7> After a disk write DMA has finished, a delay of 1.2
|
|||
|
miliseconds is required before any other operations (drive
|
|||
|
select, step, head change, etc.). The type of disk drives we use
|
|||
|
have a gap between the erase head and the read-write head. The
|
|||
|
disk drive keeps the erase head enabled after the end of writegate to
|
|||
|
compensate for the gap. Failure wait out the delay may
|
|||
|
result in writing over innocent data on other tracks or sides.
|
|||
|
|
|||
|
-Bryce Nesbitt
|
|||
|
|