DEFINITION MODULE Expansion {"expansion.library",33};

FROM SYSTEM IMPORT
 ADDRESS,BYTE,LONGSET;
FROM Exec IMPORT
 Node,UByte;

TYPE
 ExpansionRom=RECORD
  type:UByte;
  product:UByte;
  flags:UByte;
  reserved03:UByte;
  manufacturer:CARDINAL;
  serialNumber:LONGCARD;
  initDiagVec:CARDINAL;
  reserved0c:UByte;
  reserved0d:UByte;
  reserved0e:UByte;
  reserved0f:UByte
 END;
 ExpansionControl=RECORD
  interrupt:UByte;
  reserved11:UByte;
  baseAddress:UByte;
  shutup:UByte;
  reserved14:UByte;
  reserved15:UByte;
  reserved16:UByte;
  reserved17:UByte;
  reserved18:UByte;
  reserved19:UByte;
  reserved1a:UByte;
  reserved1b:UByte;
  reserved1c:UByte;
  reserved1d:UByte;
  reserved1e:UByte;
  reserved1f:UByte;
 END;

CONST
 slotSize=10000H;
 slotMask=0FFFFH;
 slotShift=16;
 expansionBase=0E80000H;
 expansionSize=080000H;
 expansionSlots=8;
 memoryBase=200000H;
 memorySize=800000H;
 memorySlots=128;
 typrMask=0C0H;
 typeBit=6;
 typeSize=2;
 newBoard=0C0H;
 memMask=07H;
 memBit=0;
 memSize=3;
 chainedConfig=3;
 diagValid=4;
 memList=5;
 memSpace=7;
 noShutup=6;

 intena=1;
 reset=3;
 int2pend=4;
 int6pend=5;
 int7pend=6;
 interrupting=7;
 
TYPE
 DiagArea=RECORD
  config:UByte;
  flags:UByte;
  size:CARDINAL;
  diagPoint:CARDINAL;
  bootPoint:CARDINAL;
  name:CARDINAL;
  reserved01:CARDINAL;
  reserved02:CARDINAL
 END;

CONST
 busWidth=0C0H;
 nibbleWide=0;
 byteWide=040H;
 wordWide=080H;
 bootTime=030H;
 never=0;
 configTime=010H;
 bindTime=020H;
 
TYPE
 ConfigDevPtr=POINTER TO ConfigDev;
 ConfigDev=RECORD
  node:Node;
  flags:UByte;
  pad:UByte;
  rom:ExpansionRom;
  boardAddr:ADDRESS;
  boardSize:ADDRESS;
  slotAddr:CARDINAL;
  slotSize:CARDINAL;
  driver:ADDRESS;
  nextCD:ConfigDevPtr;
  unused:ARRAY [0..3] OF LONGINT;
 END;

CONST
 shutup=0;
 configMe=1;

TYPE
 CurrentBinding=RECORD
  configDev:ConfigDevPtr;
  fileName:ADDRESS;
  productString:ADDRESS;
  toolTypes:ADDRESS;
 END;
 CurrentBindingPtr=POINTER TO CurrentBinding;

PROCEDURE AddConfigDev(configDev{8}:ConfigDevPtr); CODE -30;
PROCEDURE AddDosNode(
           bootPri{0}:LONGINT;
           flags{1}:LONGSET;
           deviceNode{8}:ADDRESS):LONGINT; CODE -150;
PROCEDURE AllocBoardMem(
           slotSpec{0}:LONGINT):LONGINT; CODE -42;
PROCEDURE AllocConfigDev():ConfigDevPtr; CODE -48;
PROCEDURE AllocExpansionMem(
           numSlots{0}:LONGINT;
           slotAlign{1}:LONGINT;
           slotOffset{2}:LONGINT):LONGINT; CODE -54;
PROCEDURE ConfigBoard(
           board{8}:ADDRESS;
           configDev{9}:ConfigDevPtr):LONGINT; CODE -60;
PROCEDURE ConfigChain(baseAddr{8}:ADDRESS); CODE -66;
PROCEDURE expansionUnused(); CODE -36;
PROCEDURE FindConfigDev(oldConfigDev{8}:ConfigDevPtr;
                        manufacturer{0}:LONGINT;
                        product{1}:LONGINT); CODE -72;
PROCEDURE FreeBoardMem(startSlot{0}:LONGINT;
                       slotSpec{1}:LONGINT); CODE -78;
PROCEDURE FreeConfigDev(configDev{8}:ConfigDevPtr); CODE -84;
PROCEDURE FreeExpansionMem(startSlot{0}:LONGINT;
                           numSlots{1}:LONGINT); CODE -90;
PROCEDURE GetCurrentBinding(
           currentBinding{8}:CurrentBindingPtr;
           size{0}:LONGINT):LONGINT; CODE -138;
PROCEDURE MakeDosNode(
           parameterPkt{0}:ADDRESS):ADDRESS; CODE -144;
PROCEDURE ObtainConfigBinding(); CODE -120;
PROCEDURE ReadExpansionByte(board{8}:ADDRESS;
                            offset{0}:LONGINT):BYTE; CODE -96;
PROCEDURE ReadExpansionRom(
           board{8}:ADDRESS;
           configDev{9}:ConfigDevPtr):LONGINT; CODE -102;
PROCEDURE ReleaseConfigBinding(); CODE -126;
PROCEDURE RemConfigDev(configDev{8}:ConfigDevPtr); CODE -108;
PROCEDURE SetCurrentBinding(
           currentBinding{8}:CurrentBindingPtr;
           size{0}:LONGINT); CODE -132;
PROCEDURE WriteExpansionByte(board{8}:ADDRESS;
                             offset{0}:LONGINT;
                             byte{1}:BYTE); CODE -114;

END Expansion.
