home *** CD-ROM | disk | FTP | other *** search
- (***************************************************************************
-
- $RCSfile: Disk.mod $
- Description: Interface to disk.resource
-
- Created by: fjc (Frank Copeland)
- $Revision: 3.2 $
- $Author: fjc $
- $Date: 1994/08/08 00:51:48 $
-
- Includes Release 40.15
-
- (C) Copyright 1985-1993 Commodore-Amiga, Inc.
- All Rights Reserved
-
- Oberon-A interface Copyright © 1994, Frank Copeland.
- This file is part of the Oberon-A Interface.
- See Oberon-A.doc for conditions of use and distribution.
-
- ***************************************************************************)
-
- MODULE Disk;
-
- (*
- ** $C- CaseChk $I- IndexChk $L+ LongAdr $N- NilChk
- ** $P- PortableCode $R- RangeChk $S- StackChk $T- TypeChk
- ** $V- OvflChk $Z- ZeroVars
- *)
-
- IMPORT E := Exec;
-
-
- (*
- ** $VER: disk.h 27.11 (21.11.90)
- **
- ** disk.h -- external declarations for the disk resource
- *)
-
-
- (********************************************************************
- *
- * Resource structures
- *
- ********************************************************************)
-
-
- TYPE
-
- DiscResourceUnitPtr * = CPOINTER TO DiscResourceUnit;
- DiscResourceUnit * = RECORD (E.Message)
- discBlock * : E.Interrupt;
- discSync * : E.Interrupt;
- index * : E.Interrupt;
- END; (* DiscResourceUnit *)
-
- DiscResourcePtr * = CPOINTER TO DiscResource;
- DiscResource * = RECORD (E.Library)
- current * : DiscResourceUnitPtr;
- drFlags * : E.BSET;
- drPad * : E.UBYTE;
- sysLib * : E.LibraryPtr;
- ciaResource * : E.LibraryPtr;
- unitID * : ARRAY 4 OF E.ULONG;
- waiting * : E.List;
- discBlock * : E.Interrupt;
- discSync * : E.Interrupt;
- index * : E.Interrupt;
- currTask * : E.TaskPtr;
- END; (* DiscResource *)
-
- CONST
-
- (* DiscResource.drFlags entries *)
- alloc0 * = 0; (* unit zero is allocated *)
- alloc1 * = 1; (* unit one is allocated *)
- alloc2 * = 2; (* unit two is allocated *)
- alloc3 * = 3; (* unit three is allocated *)
- active * = 7; (* is the disc currently busy? *)
-
-
- (********************************************************************
- *
- * Hardware Magic
- *
- ********************************************************************)
-
- CONST
-
- dskDMAOff * = 4000H; (* idle command for dsklen register *)
-
-
- (********************************************************************
- *
- * Resource specific commands
- *
- ********************************************************************)
-
- CONST
-
- name * = "disk.resource";
-
- allocUnit * = E.libBase - 0*E.libVectSize;
- freeUnit * = E.libBase - 1*E.libVectSize;
- getUnit * = E.libBase - 2*E.libVectSize;
- giveUnit * = E.libBase - 3*E.libVectSize;
- getUnitId * = E.libBase - 4*E.libVectSize;
- readUnitId * = E.libBase - 5*E.libVectSize;
-
- lastComm * = readUnitId;
-
- (********************************************************************
- *
- * drive types
- *
- ********************************************************************)
-
- CONST
-
- drtAmiga * = 00000000H;
- drt37422D2S * = 55555555H;
- drtEmpty * = 0FFFFFFFFH;
- drt150RPM * = 0AAAAAAAAH;
-
-
- (**-- Resource Base variable --------------------------------------------*)
-
-
- VAR
-
- base * : DiscResourcePtr;
-
-
- (**-- Resource Functions ------------------------------------------------*)
-
- (*
- ** $VER: disk_protos.h 36.1 (19.2.91)
- *)
-
- LIBCALL (base : DiscResourcePtr) AllocUnit*
- ( unitNum [0] : LONGINT )
- : BOOLEAN;
- -6;
- LIBCALL (base : DiscResourcePtr) FreeUnit*
- ( unitNum [0] : LONGINT );
- -12;
- LIBCALL (base : DiscResourcePtr) GetUnit*
- ( unitPointer [8] : DiscResourceUnitPtr )
- : DiscResourceUnitPtr;
- -18;
- LIBCALL (base : DiscResourcePtr) GiveUnit* ();
- -24;
- LIBCALL (base : DiscResourcePtr) GetUnitID*
- ( unitNum [0] : LONGINT )
- : LONGINT;
- -30;
-
- (* ------ new for V37 ------*)
-
- LIBCALL (base : DiscResourcePtr) ReadUnitID*
- ( unitNum [0] : LONGINT )
- : LONGINT;
- -36;
-
-
- (**-- Resource Base variable --------------------------------------------*)
- (** $L- Address globals through A4 *)
-
-
- (**-----------------------------------*)
- PROCEDURE OpenResource * (mustOpen : BOOLEAN);
-
- BEGIN (* OpenResource *)
- IF base = NIL THEN
- base := E.base.OpenResource (name);
- IF mustOpen & (base = NIL) THEN HALT (100) END;
- END; (* IF *)
- END OpenResource;
-
-
- END Disk.
-