|##########|
|#MAGIC   #|CLABLMFB
|#PROJECT #|"ImportAll"
|#PATHS   #|"StdProject"
|#FLAGS   #|xx---x-xx---x-x-----------------
|#USERSW  #|--------------------------------
|#USERMASK#|--------------------------------
|#SWITCHES#|x-xx-x----------
|##########|
DEFINITION MODULE HardBlocks;
(* $A- *)
FROM System IMPORT LONGSET;
FROM Dos    IMPORT DosEnvec;

TYPE
  IdField              = ARRAY [0..3] OF CHAR;

CONST
  locationLimit        = $10;
  nil                  = $FFFFFFFF;
  badBlock             = IdField:("B","A","D","B");
  fileSysHeader        = IdField:("F","S","H","D");
  loadSeg              = IdField:("L","S","E","G");
  partition            = IdField:("P","A","R","T");
  rigidDisk            = IdField:("R","D","S","K");

TYPE
  HardBlock            = RECORD
			   id          : IdField;
			   summedLongs : LONGCARD;
			   chkSum      : LONGINT;
			   hostId      : LONGCARD;
			 END;

  BadBlockEntry        = RECORD
			   badBlock,
			   goodBlock : LONGCARD
			 END;

  BadBlockBlock        = RECORD OF HardBlock;
			   next        : LONGCARD;
			   reserved    : LONGCARD;
			   blockPairs  : ARRAY [61] OF BadBlockEntry
			 END;

  FileSysHeaderBlock   = RECORD OF HardBlock;
			   next          : LONGCARD;
			   flags         : LONGSET;
			   reserved1     : ARRAY [2] OF LONGCARD;
			   dosType,
			   version       : LONGCARD;
			   patchFlags    : LONGSET;
			   type,
			   task,
			   lock,
			   handler,
			   stackSize     : LONGCARD;
			   priority,
			   startup,
			   segListBlocks,
			   globalVec     : LONGINT;
			   reserved2     : ARRAY [23] OF LONGCARD;
			   reserved3     : ARRAY [21] OF LONGCARD
			 END;

  LoadSegBlock         = RECORD OF HardBlock;
			   next        : LONGCARD;
			   loadData    : ARRAY [123] OF LONGCARD;
			 END;

  PartitionFlags       = (bootable, noMount, makeMeLong = 31);
  PartitionFlagSet     = SET OF PartitionFlags;

  PartitionBlock       = RECORD OF HardBlock;
			   next        : LONGCARD;
			   flags       : PartitionFlagSet;
			   reserved1   : ARRAY [2] OF LONGCARD;
			   DevFlags    : LONGSET;
			   driveName   : ARRAY [32] OF CHAR;
			   reserved2   : ARRAY [15] OF LONGCARD;
			   enviroment  : DosEnvec;
			   ereserved   : ARRAY [15] OF LONGCARD;
			   reserved256 : ARRAY [256] OF SHORTCARD;
			 END;

  RigidDiskFlags       = (last,       lastLun,    lastTId,    noReselect,
			  diskId,     ctrlrId,
			  makeMeLong = 31);
  RigidDiskFlagSet     = SET OF RigidDiskFlags;

  RigidDiskBlock       = RECORD OF HardBlock;
			   blockBytes         : LONGCARD;
			   flags              : RigidDiskFlagSet;
			   badBlockList,
			   partitionList,
			   fileSysHeaderList,
			   driveInit          : LONGCARD;
			   reserved1          : ARRAY [6] OF LONGCARD;
			   cylinders,
			   sectors,
			   heads,
			   interleave,
			   park               : LONGCARD;
			   reserved2          : ARRAY [3] OF LONGCARD;
			   writePreComp,
			   reducedWrite,
			   stepRate           : LONGCARD;
			   reserved3          : ARRAY [5] OF LONGCARD;
			   blocksLo,
			   blocksHi,
			   loCylinder,
			   hiCylinder,
			   cylBlocks,
			   autoParkSeconds    : LONGCARD;
			   reserved4          : ARRAY [2]   OF LONGCARD;
			   diskVendor         : ARRAY [8]   OF CHAR;
			   diskProduct        : ARRAY [16]  OF CHAR;
			   diskRevision       : ARRAY [4]   OF CHAR;
			   controllerVendor   : ARRAY [8]   OF CHAR;
			   controllerProduct  : ARRAY [16]  OF CHAR;
			   controllerRevision : ARRAY [4]   OF CHAR;
			   reserved5          : ARRAY [10]  OF LONGCARD;
			   reserved512        : ARRAY [256] OF SHORTCARD
			 END;


GROUP
  All   =
  (*I*)   LONGSET,
  (*T*)   BadBlockBlock,      BadBlockEntry,      FileSysHeaderBlock,
	  IdField,            LoadSegBlock,       PartitionBlock,
	  PartitionBlock,     PartitionFlags,     PartitionFlagSet,
	  RigidDiskBlock,     RigidDiskBlock,     RigidDiskFlags,
	  RigidDiskFlagSet,
  (*C*)   badBlock,           fileSysHeader,      loadSeg,
	  locationLimit,      nil,                partition,
	  rigidDisk;

END HardBlocks.
