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

Three primary steps are required to open the trackdisk device:

   *  Create a message port by calling CreatePort(). Reply messages from
      the device must be directed to a message port.

   *  Create an extended I/O request structure of type IOExtTD.  The
      IOExtTD structure is created by the CreateExtIO() function.

   *  Open the trackdisk device.  Call OpenDevice(), passing it the
      extended I/O request.

For the trackdisk device, the flags parameter of the OpenDevice() function
specifies whether you are opening a 3.5" drive (flags=0) or a 5.25" drive
(flags=1).  With flags set to 0 trackdisk will only open a 3.5" drive.  To
tell the device to open any drive it understands, set the flags parameter
to TDF_ALLOW_NON_3_5.  (See the include file devices/trackdisk.h for more
information.)

   #include <devices/trackdisk.h>

   struct MsgPort *TrackMP;         /* Pointer for message port */
   struct IOExtTD *TrackIO;         /* Pointer for IORequest */

   if (TrackMP=CreatePort(0,0) )
       if (TrackIO=(struct IOExtTD *)
              CreateExtIO(TrackMP,sizeof(struct IOExtTD)) )
           if (OpenDevice(TD_NAME,0L,(struct IORequest *)TrackIO,Flags) )
               printf("%s did not open\n",TD_NAME);

   Disk Drive Unit Numbers.
   ------------------------
   The unit number - second parameter of the OpenDevice() call - can be
   any value from 0 to 3.  Unit 0 is the built-in 3.5" disk drive.
   Units 1 through 3 represent additional disk drives that may be
   connected to an Amiga system.


[Back to Amiga Developer Docs]