(c) Copyright 1989-1999 Amiga, Inc. All rights reserved. The information contained herein is subject to change without notice, and is provided "as is" without warranty of any kind, either expressed or implied. The entire risk as to the use of this information is assumed by the user. Amiga Floppy Drives by Bryce Nesbitt Some Amiga products that make direct use of the floppy disk drive hardware do not work correctly. As a general rule, using the trackdisk.device is the best way to insure compatability. But if you need to use the drive hardware at a lower level, here are some pointers for correct usage. Hardware Hardware vendors that make floppy drives for the Amiga (or products that interact with the floppy drives) should follow these guidelines: 1> The disk drive light should not flash on and off during access. The Amiga drive activity light reflects the state of the motor. Typically the LED signal is driven by IN_USE (pin 4). 2> Second drives for the A2000 must take MOTOR_ON from pin 6 (normally DRIVE_SELECT_3). Most drives have a jumper block that allows DRIVE_SELECT_3 to control the motor and, in turn, the activity light. The current twisted ribbon cable used on the A2000 also connects the motor signal to IN_USE (pin 4). To convert an A2000 drive zero to drive one requires changing two jumpers. The drive must respond to DRIVE_SELECT_1 (instead of DRIVE_SELECT_0) and it must take it's motor from DRIVE_SELECT_3 (instead of MOTOR_ON). 3> For compatibility with future systems, disk drives MUST 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. 4> The critical specifications for Amiga 90mm (3.5") drives are: 3ms track-to-track, 15ms settling time, >80% radial alignment using a Dysan Alignment disk, 500ms motor spinup and 800ms maximum power on delay. Software This section of the article is for those of you who write custom boot-loaders for Amiga game software. Because of defective loaders, there are many Amiga owners unable to load certain games. This will lead some of these consumers to never again buy a program from that product line. Here are some tips to help you avoid problems with custom boot-loaders. 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 known state. 2> Never use a busy-wait 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, what type of memory the program is in, the position of the vertical blank at run time, what the blitter is doing, what interrupts are enabled and many other factors. Instead of a busy-wait loop, use the 8520 chip for timing as shown in the Amiga Mail article, "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 milliseconds for the head to ;-- get to the next track We specify that our drives must get to the next track within 3 milliseconds. Some drives will step considerably faster. Others will fail at or before 2.8 milliseconds. When the direction of step is changed, the settling time must also be added - a total minimum delay of 18 milliseconds. 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 okay 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 for copy protection. We do not guarantee that our drives will have more than the normal 80 tracks. We do guarantee however that using three extra tracks will fail. 7> After a disk write DMA has finished, a delay of 1.2 milliseconds 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 write gate to compensate for the gap. Failure to wait out the delay may result in writing over innocent data on other tracks or sides. The ultimate source for information on drive timing comes from the manufacturer's specifications. This article simply highlights the most misused points. Try to use the trackdisk.device software to avoid hardware dependencies but if you need more direct control of floppy hardware, follow the guidlines given here.