-- MesaBandFormat.mesa
-- Last edit by Ken Pier,     April 12, 1982  2:38 PM

DIRECTORY
  MesaBands USING [BandDevice];

MesaBandFormat: DEFINITIONS = {

-- 8.5 * 11 * 384 * 384 = 13,787,136  (bits on Hornet page)
-- 5 * 5 * 5000 * 5000 = 625,000,000  (bits on reticle)

Marker: TYPE = INTEGER ← 23456; --supposed unique bit string
Bit: TYPE = BOOLEAN;

Type: TYPE = {all0, all1, brick, bits, fontcache, herald, end};--in three bit field
Flags: TYPE = MACHINE DEPENDENT RECORD [type: Type, rect: BOOLEAN];--four bit field
BandX: TYPE = [0..7777B]; -- twelve bit field adjoins Flags

--N.B.: ALL object types must start with the marker, then flags, then band

ObjectRef: TYPE = POINTER TO Object;
Object: TYPE = MACHINE DEPENDENT RECORD [
  mark: Marker,
  flags: Flags, band: BandX,
  yStart: CARDINAL ← 0,
  height: CARDINAL ← 0,
  -- if rect=TRUE, only runs[0] is given
  -- if rect=FALSE, runs[0..height) are given
  runs: SEQUENCE COMPUTED CARDINAL OF Run
  -- if type=bits, bits follow
  -- if type=brick, brick follows
  ];
objectSize: CARDINAL = SIZE[Object];

RunRef: TYPE = POINTER TO Run;
Run: TYPE = MACHINE DEPENDENT RECORD [
  xmin: CARDINAL, -- left end of scanline
  xmax: CARDINAL -- right end of scanline
  ];
runSize: CARDINAL = SIZE[Run];

HeraldRef: TYPE = POINTER TO HeraldObject;
HeraldObject: TYPE =  MACHINE DEPENDENT RECORD [
  mark(0): Marker,
  flags(1:0..3): Flags ← [type: herald, rect: FALSE],
  band(1:4..15): BandX ← 7777B,
  singleFile(2:0..0): BOOLEAN,--TRUE if one band file only
  unused(2:1..9): [0..777b], device(2:10..15): MesaBands.BandDevice,
  bandCount(3): CARDINAL,  --number of bands for this device
  bandHeight(4): CARDINAL, --height of each band in scanlines
  bandWidth(5): CARDINAL    --width of each band in words
  ];
heraldObjectSize: CARDINAL = SIZE[HeraldObject];

EndRef: TYPE = POINTER TO EndObject;
EndObject: TYPE = MACHINE DEPENDENT RECORD [
  mark: Marker,
  flags: Flags ← [type: end, rect: FALSE], band: BandX ← 7777B,
  yStart: CARDINAL ← 177777B,
  height: CARDINAL ← 177777B
  ];
endObjectSize: CARDINAL = SIZE[EndObject];

--thresholded brick stuff

TBrickRef: TYPE = POINTER TO TBrickRep;
TBrickRep: TYPE = RECORD[
		  L,p: CARDINAL,       --length, height of brick
		  D: INTEGER,          --displacement
		  hx,hy: CARDINAL,     --initial location for scan conversion
                  color: CARDINAL,     --that this brick represents
		  brickSize: CARDINAL,  --actual size of brick sequence
                  brick: PACKED SEQUENCE max: INTEGER OF Bit
                  ];
tBrickSize: CARDINAL = SIZE[TBrickRep];

LineRef: TYPE = POINTER TO Line;
Line: TYPE = RECORD[PACKED SEQUENCE COMPUTED INTEGER OF Bit];

}.

LOG
March 11, 1982, changed everything to SHORT POINTERS
--change Marker, band field; remove skipCount, run.Count, tail of EndObj, 3/14/82
--REMOVED NAT from sequences, 4/12/82