home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
oberon-a-1.4ß.lha
/
Oberon-A
/
source
/
amiga
/
Expansion.mod
< prev
next >
Wrap
Text File
|
1994-08-08
|
8KB
|
278 lines
(***************************************************************************
$RCSfile: Expansion.mod $
Description: Interface to expansion.library
Created by: fjc (Frank Copeland)
$Revision: 3.2 $
$Author: fjc $
$Date: 1994/08/08 00:57:27 $
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 Expansion;
(*
** $C- CaseChk $I- IndexChk $L+ LongAdr $N- NilChk
** $P- PortableCode $R- RangeChk $S- StackChk $T- TypeChk
** $V- OvflChk $Z- ZeroVars
*)
IMPORT E := Exec, D := Dos, C := Config, SYS := SYSTEM;
(*
** $VER: expansion.h 36.7 (28.5.90)
**
** External definitions for expansion.library
*)
CONST
name * = "expansion.library";
(* flags for the AddDosNode() call *)
adnStartProc * = 0;
(*
** $VER: expansionbase.h 36.15 (21.10.91)
**
** Definitions for the expansion library base
*)
(* BootNodes are scanned by dos.library at startup. Items found on the
list are started by dos. BootNodes are added with the AddDosNode() or
the V36 AddBootNode() calls. *)
TYPE
BootNodePtr * = CPOINTER TO BootNode;
BootNode * = RECORD (E.Node)
flags * : E.WSET;
deviceNode * : E.APTR;
END; (* BootNode *)
(* expansion.library has functions to manipulate most of the information in
ExpansionBase. Direct access is not permitted. Use FindConfigDev()
to scan the board list. *)
TYPE
ExpansionBasePtr * = CPOINTER TO ExpansionBase;
ExpansionBase * = RECORD (E.Library)
ebFlags - : E.BSET; (* read only (see below) *)
private01 : E.UBYTE; (* private *)
private02 : E.ULONG; (* private *)
private03 : E.ULONG; (* private *)
private04 : C.CurrentBinding; (* private *)
private05 : E.List; (* private *)
mountList * : E.List; (* contains $truct BootNode entries *)
(* private *)
END; (* ExpansionBase *)
CONST
(* error codes *)
eeOk * = 0;
eeLastBoard * = 40; (* could not shut him up *)
eeNoExpansion * = 41; (* not enough expansion mem; board shut up *)
eeNoMemory * = 42; (* not enough normal memory *)
eeNoBoard * = 43; (* no board at that address *)
eeBadMem * = 44; (* tried to add bad memory card *)
(* Flags *)
ebClogged * = 0; (* someone could not be shutup *)
ebShortMem * = 1; (* ran out of expansion mem *)
ebBadMem * = 2; (* tried to add bad memory card *)
ebDosFlag * = 3; (* reserved for use by AmigaDOS *)
ebKickBack33 * = 4; (* reserved for use by AmigaDOS *)
ebKickBack36 * = 5; (* reserved for use by AmigaDOS *)
(* If the following flag is set by a floppy's bootblock code, the initial
open of the initial shell window will be delayed until the first output
to that shell. Otherwise the 1.3 compatible behavior applies. *)
ebSilentStart * = 6;
(* Magic kludge for CC0 use *)
ebStartCC0 * = 7;
(**-- Library Base variable --------------------------------------------*)
VAR
base * : ExpansionBasePtr;
(**-- Library Functions ------------------------------------------------*)
(*
** $VER: expansion_protos.h 39.0 (31.10.91)
*)
(* --- functions in V33 or higher (distributed as Release 1.2) ---*)
LIBCALL (base : ExpansionBasePtr) AddConfigDev*
( configDev [8] : C.ConfigDevPtr );
-30;
(* --- functions in V36 or higher (distributed as Release 2.0) ---*)
LIBCALL (base : ExpansionBasePtr) AddBootNode*
( bootPri [0] : LONGINT;
flags [1] : SET;
deviceNode [8] : D.DeviceNodePtr;
configDev [9] : C.ConfigDevPtr )
: BOOLEAN;
-36;
(* --- functions in V33 or higher (distributed as Release 1.2) ---*)
LIBCALL (base : ExpansionBasePtr) AllocBoardMem*
( slotSpec [0] : E.ULONG );
-42;
LIBCALL (base : ExpansionBasePtr) AllocConfigDev* ()
: C.ConfigDevPtr;
-48;
LIBCALL (base : ExpansionBasePtr) AllocExpansionMem*
( numSlots [0] : E.ULONG;
slotAlign [1] : E.ULONG )
: E.APTR;
-54;
LIBCALL (base : ExpansionBasePtr) ConfigBoard*
( board [8] : E.APTR;
configDev [9] : C.ConfigDevPtr );
-60;
LIBCALL (base : ExpansionBasePtr) ConfigChain*
( baseAddr [8] : E.APTR );
-66;
LIBCALL (base : ExpansionBasePtr) FindConfigDev*
( oldConfigDev [8] : C.ConfigDevPtr;
manufacturer [0] : LONGINT;
product [1] : LONGINT )
: C.ConfigDevPtr;
-72;
LIBCALL (base : ExpansionBasePtr) FreeBoardMem*
( startSlot [0] : E.ULONG;
slotSpec [1] : E.ULONG );
-78;
LIBCALL (base : ExpansionBasePtr) FreeConfigDev*
( configDev [8] : C.ConfigDevPtr );
-84;
LIBCALL (base : ExpansionBasePtr) FreeExpansionMem*
( startSlot [0] : E.ULONG;
numSlots [1] : E.ULONG );
-90;
LIBCALL (base : ExpansionBasePtr) ReadExpansionByte*
( board [8] : E.APTR;
offset [0] : E.ULONG )
: E.UBYTE;
-96;
LIBCALL (base : ExpansionBasePtr) ReadExpansionRom*
( board [8] : E.APTR;
configDev [9] : C.ConfigDevPtr );
-102;
LIBCALL (base : ExpansionBasePtr) RemConfigDev*
( configDev [8] : C.ConfigDevPtr );
-108;
LIBCALL (base : ExpansionBasePtr) WriteExpansionByte*
( board [8] : E.APTR;
offset [0] : E.ULONG;
byte [1] : E.UBYTE );
-114;
LIBCALL (base : ExpansionBasePtr) ObtainConfigBinding* ();
-120;
LIBCALL (base : ExpansionBasePtr) ReleaseConfigBinding* ();
-126;
LIBCALL (base : ExpansionBasePtr) SetCurrentBinding*
( currentBinding [8] : C.CurrentBindingPtr;
bindingSize [0] : E.UWORD );
-132;
LIBCALL (base : ExpansionBasePtr) GetCurrentBinding*
( currentBinding [8] : C.CurrentBindingPtr;
bindingSize [0] : E.UWORD )
: E.ULONG;
-138;
LIBCALL (base : ExpansionBasePtr) MakeDosNode*
( parmPacket [8] : E.APTR )
: D.DeviceNodePtr;
-144;
LIBCALL (base : ExpansionBasePtr) AddDosNode*
( bootPri [0] : LONGINT;
flags [1] : SET;
deviceNode [8] : D.DeviceNodePtr )
: BOOLEAN;
-150;
(* --- functions in V36 or higher (distributed as Release 2.0) ---*)
(**-- C Macros defined as procedures -----------------------------------*)
(** $L+ Absolute long addressing for globals *)
(*
(* figure out amount of memory needed by this box/board *)
define ertMEMNEEDED(t) \
(((t)&ErtMEMMASK)? 10000H << (((t)&ErtMEMMASK) -1) : 800000H )
(* same as ertMEMNEEDED, but return number of slots *)
define ertSLOTSNEEDED(t) \
(((t)&ErtMEMMASK)? 1 << (((t)&ErtMEMMASK)-1) : 80H )
(* convert a expansion slot number into a memory address *)
define ecMEMADDR(slot) ((slot) << (ESLOTSHIFT) )
(* a kludge to get the byte offset of a $tructure *)
define EROFFSET(er) ((int)&(($truct ExpansionRom * )0)->er)
define ECOFFSET(ec) \
(sizeof($truct ExpansionRom)+((int)&(($truct ExpansionControl * )0)->ec))
*)
(**-- Library Base variable --------------------------------------------*)
(** $L- Address globals through A4 *)
(**-----------------------------------*)
PROCEDURE* CloseLib ();
BEGIN (* CloseLib *)
IF base # NIL THEN E.base.CloseLibrary (base) END
END CloseLib;
(**-----------------------------------*)
PROCEDURE OpenLib * (mustOpen : BOOLEAN);
BEGIN (* OpenLib *)
IF base = NIL THEN
base :=
SYS.VAL
( ExpansionBasePtr,
E.base.OpenLibrary (name, E.libraryMinimum) );
IF base # NIL THEN SYS.SETCLEANUP (CloseLib)
ELSIF mustOpen THEN HALT (100)
END;
END;
END OpenLib;
BEGIN
base := NIL
END Expansion.