[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

The Disk resource obtains exclusive access to the floppy disk hardware
There are four disk/MFM units available, units 0-3.

Six functions are available for dealing with the floppy disk hardware.

                      Disk Resource Functions
                      -----------------------
     AllocUnit()      Allocate one of the units of the disk
                      resource.

     FreeUnit()       Deallocate an allocated disk unit.

     GetUnit()        Allocate the disk for a driver.

     GetUnitID()      Return the drive ID of a specified drive
                      unit.

     GiveUnit()       Free the disk.

     ReadUnitID()     Reread and return the drive ID of a
                      specified unit.

The disk resource provides both a gross and a fine unit allocation scheme.
AllocUnit() and FreeUnit() are used to claim a unit for long term use, and
GetUnit() and GiveUnit() are used to claim a unit and the disk hardware
for shorter periods.

The trackdisk device uses and abides by both allocation schemes.  Because
a trackdisk unit is never closed for Amiga 3.5" drives (the file system
keeps them open) the associated resource units will always be allocated
for these drives.  GetUnit() and GiveUnit() can still be used, however, by
other applications that have not succeeded with AllocUnit().

You must not change the state of of a disk that the trackdisk device is
using unless you either

   a) force its removal before giving it up, or

   b) return it to the original track (with no changes to the track), or

   c) CMD_STOP the unit before GetUnit(), update the current track number
      and CMD_START it after GiveUnit().  This option is only available
      under V36 and higher versions of the operating system.

ReadUnitID() is provided to handle drives which use the unit number in a
dynamic manner.  Subsequent GetUnit() calls will return the value obtained
by ReadUnitID().

It is therefore possible to prevent the trackdisk device from using units
that have not yet been mounted by successfully performing an AllocUnit()
for that unit.  It is also possible to starve trackdisk usage by
performing a GetUnit(). The appropriate companion routine (FreeUnit() or
GiveUnit()) should be called to restore the resource at the end of its use.

     Get_Disk_Unit_ID.c 

Additional programming information on the disk resource can be found in
the include files and the Autodocs for the disk resource.

                       Disk Resource Information
                    --------------------------------
                    INCLUDES        resources/disk.h
                                    resources/disk.i

                    AUTODOCS        disk.doc