--last edit by Gobbel on January 22, 1981  3:27 PM
--last edit by Jarvis on July 7, 1980  5:02 PM
--last edit by Olmstead on August 28, 1980  11:41 AM
--last edit by Forrest on November 12, 1980  2:56 PM

DIRECTORY
  Environment USING [PageCount, PageNumber, wordsPerPage];

RavenFace: DEFINITIONS =
BEGIN

MaxBands: CARDINAL = 8;
Index: TYPE [1];
BandPointer: TYPE = LONG POINTER;

-- Initialization, Device Cleanup.
AllocateBands: PROC [
  bandVirtualPageNumber: Environment.PageNumber,
  nBands: (0..MaxBands],
  sizeEachBand: Environment.PageCount];
InitializeCleanUp: PROC;
SetInterruptMasks: PROC [control, status, data: WORD];
DeallocateBands: PROC;

-- Console Character
ConsoleCharacter: TYPE = MACHINE DEPENDENT {
  zero(0), one, two, three, four, five, six, seven, eight, nine, A, L, C, D, E,
  blank(15)};
Display: PROC [char: ConsoleCharacter];

-- Paper Control
PaperSource: TYPE = MACHINE DEPENDENT {bottom(0), top(1)};
PaperStacking: TYPE = MACHINE DEPENDENT {aligned(0), offset(1)};
Feed: PROC [paperSource: PaperSource, paperStacking: PaperStacking];

-- Status
PrinterStatus: TYPE = MACHINE DEPENDENT {
  noStatus(0B),
  key0(60B), key1(61B), key2(62B), key3(63B),
  key4(64B), key5(65B), key6(66B), key7(67B),
  key8(70B), key9(71B), keyClear(72B), keyTest(73B),
  keyOnLine(74B), keyOffLine(75B), (76B), (77B),
  warming(100B), standBy(101B), feederFault(102B),
  registrationJam(104B), fuserJam(105B), noExit(106B), (107B),
  interlockOpen(110B), fuserCold(111B), feeding(112B), readyToFeed(113B),
  displayAcknowledge(114B), parityError(115B), illegalCharacter(116B),
  illegalSequence(117B),
  (120B), noPaper(121B), pageSync(122B), pageAtOutputTray(123B),
  (124B), goingOffLine(125B), offLine(126B), (127B),
  outputTrayFull(130B),
  statusOverRun(177B)};

SolicitStatus: PROC;   -- suggest to printer you'd like to find out what's happening
GetStatus: PROC RETURNS [status: PrinterStatus];

-- Reset and describe Bands, image, and advance bands.
-- A band consists of sizeEachBands pages, with one scan line residing in each
--   page.  A line goes in portrait mode from bottom to top of page; lines are scanned
--   from left to right accross the page.
-- Bands are filled by clients, and imaged by the LSEP

SetScanLineLength: PROC [activeWordsEachScanline: [0..Environment.wordsPerPage]];
  -- indicate the number of words to make up each scanLine

SetPageOffsets: PROC [linesFromLeft: CARDINAL, wordTabFromBottom: CARDINAL];
  -- indicate where first band and beginning of each band is printed.

ResetBands: PROC RETURNS [firstBand: Index, firstBandAddress: BandPointer];

StartImage:  PROC [firstBand: Index];   -- start imaging 

BandOverrun: PROC RETURNS [BOOLEAN];    -- imaging got ahead of filling.

AdvanceBand: PROC [currentBand: Index]
  RETURNS [nextBand: Index, nextBandAddress: BandPointer];
  -- this band filled; mark for imaging  get next band to fill.  nextBand should
  -- not be refilled untill BandFull[nextBand]=FALSE.

BandFull: PROC [band: Index] RETURNS [bandBusy: BOOLEAN];
  -- see if band has been imaging.
LastBand: PROC [Index];                 -- indicate last band is filled

END....

Jarvis:  Created file March 6, 1980  1:30 PM
Jarvis:  June 8, 1980  10:04 PM Added SolictStatus, Mesa 6.0 clean up
Jarvis:  June 30, 1980  1:24 PM Deleted SetActiveScan, SetLineBufferSize.  Added SetLineParameters, changes for new microcode
Jarvis:  July 7, 1980  5:01 PM Added status to SetInterruptMasks parameters
Olmstead: August 17, 1980  5:08 PM Changed parameter n in AllocateBands from PageCount to CARDINAL, added CARDINAL MaxBands and SIGNAL TooManyBands.
Olmstead:  August 28, 1980  11:41 AM  Changed Display to only send one character.
Forrest:  November 12, 1980  12:44 PM  Eliminate sorter, add stacker.  change rendering to imaging.
Gobbel:  January 22, 1981  3:27 PM  Change Allocate.nBands from [) to (].  Change SetScanLineLength.activeWordsEachScanLine from [) to [].