home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / dev / oberon-a-1.4ß.lha / Oberon-A / source / amiga / Disk.mod < prev    next >
Text File  |  1994-08-08  |  4KB  |  181 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: Disk.mod $
  4.   Description: Interface to disk.resource
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.2 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 00:51:48 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. MODULE Disk;
  23.  
  24. (*
  25. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  26. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  27. ** $V- OvflChk       $Z- ZeroVars
  28. *)
  29.  
  30. IMPORT E := Exec;
  31.  
  32.  
  33. (*
  34. **      $VER: disk.h 27.11 (21.11.90)
  35. **
  36. **      disk.h -- external declarations for the disk resource
  37. *)
  38.  
  39.  
  40. (********************************************************************
  41. *
  42. * Resource structures
  43. *
  44. ********************************************************************)
  45.  
  46.  
  47. TYPE
  48.  
  49.   DiscResourceUnitPtr * = CPOINTER TO DiscResourceUnit;
  50.   DiscResourceUnit * = RECORD (E.Message)
  51.     discBlock * : E.Interrupt;
  52.     discSync *  : E.Interrupt;
  53.     index *     : E.Interrupt;
  54.   END; (* DiscResourceUnit *)
  55.  
  56.   DiscResourcePtr * = CPOINTER TO DiscResource;
  57.   DiscResource * = RECORD (E.Library)
  58.     current *     : DiscResourceUnitPtr;
  59.     drFlags *     : E.BSET;
  60.     drPad *       : E.UBYTE;
  61.     sysLib *      : E.LibraryPtr;
  62.     ciaResource * : E.LibraryPtr;
  63.     unitID *      : ARRAY 4 OF E.ULONG;
  64.     waiting *     : E.List;
  65.     discBlock *   : E.Interrupt;
  66.     discSync *    : E.Interrupt;
  67.     index *       : E.Interrupt;
  68.     currTask *    : E.TaskPtr;
  69.   END; (* DiscResource *)
  70.  
  71. CONST
  72.  
  73. (* DiscResource.drFlags entries *)
  74.   alloc0      * = 0;       (* unit zero is allocated *)
  75.   alloc1      * = 1;       (* unit one is allocated *)
  76.   alloc2      * = 2;       (* unit two is allocated *)
  77.   alloc3      * = 3;       (* unit three is allocated *)
  78.   active      * = 7;       (* is the disc currently busy? *)
  79.  
  80.  
  81. (********************************************************************
  82. *
  83. * Hardware Magic
  84. *
  85. ********************************************************************)
  86.  
  87. CONST
  88.  
  89.   dskDMAOff       * = 4000H;  (* idle command for dsklen register *)
  90.  
  91.  
  92. (********************************************************************
  93. *
  94. * Resource specific commands
  95. *
  96. ********************************************************************)
  97.  
  98. CONST
  99.  
  100.   name        * = "disk.resource";
  101.  
  102.   allocUnit  * = E.libBase - 0*E.libVectSize;
  103.   freeUnit   * = E.libBase - 1*E.libVectSize;
  104.   getUnit    * = E.libBase - 2*E.libVectSize;
  105.   giveUnit   * = E.libBase - 3*E.libVectSize;
  106.   getUnitId  * = E.libBase - 4*E.libVectSize;
  107.   readUnitId * = E.libBase - 5*E.libVectSize;
  108.  
  109.   lastComm * = readUnitId;
  110.  
  111. (********************************************************************
  112. *
  113. * drive types
  114. *
  115. ********************************************************************)
  116.  
  117. CONST
  118.  
  119.   drtAmiga    * = 00000000H;
  120.   drt37422D2S * = 55555555H;
  121.   drtEmpty    * = 0FFFFFFFFH;
  122.   drt150RPM   * = 0AAAAAAAAH;
  123.  
  124.  
  125. (**-- Resource Base variable --------------------------------------------*)
  126.  
  127.  
  128. VAR
  129.  
  130.   base * : DiscResourcePtr;
  131.  
  132.  
  133. (**-- Resource Functions ------------------------------------------------*)
  134.  
  135. (*
  136. **      $VER: disk_protos.h 36.1 (19.2.91)
  137. *)
  138.  
  139. LIBCALL (base : DiscResourcePtr) AllocUnit*
  140.   ( unitNum [0] : LONGINT )
  141.   : BOOLEAN;
  142.   -6;
  143. LIBCALL (base : DiscResourcePtr) FreeUnit*
  144.   ( unitNum [0] : LONGINT );
  145.   -12;
  146. LIBCALL (base : DiscResourcePtr) GetUnit*
  147.   ( unitPointer [8] : DiscResourceUnitPtr )
  148.   : DiscResourceUnitPtr;
  149.   -18;
  150. LIBCALL (base : DiscResourcePtr) GiveUnit* ();
  151.   -24;
  152. LIBCALL (base : DiscResourcePtr) GetUnitID*
  153.   ( unitNum [0] : LONGINT )
  154.   : LONGINT;
  155.   -30;
  156.  
  157. (* ------ new for V37 ------*)
  158.  
  159. LIBCALL (base : DiscResourcePtr) ReadUnitID*
  160.   ( unitNum [0] : LONGINT )
  161.   : LONGINT;
  162.   -36;
  163.  
  164.  
  165. (**-- Resource Base variable --------------------------------------------*)
  166. (** $L- Address globals through A4 *)
  167.  
  168.  
  169. (**-----------------------------------*)
  170. PROCEDURE OpenResource * (mustOpen : BOOLEAN);
  171.  
  172. BEGIN (* OpenResource *)
  173.   IF base = NIL THEN
  174.     base := E.base.OpenResource (name);
  175.     IF mustOpen & (base = NIL) THEN HALT (100) END;
  176.   END; (* IF *)
  177. END OpenResource;
  178.  
  179.  
  180. END Disk.
  181.