-- File: ColorPress.mesa: this pack reads Press.bits and writes ColorPress.bits. ColorPress.bits must already exist. The output can be used to drive an n-Color laser printer
-- Last Edited: November 5, 1981 11:38 AM By: GWilliams
DIRECTORY
AltoRam USING[DoSilentBoot],
ImageDefs USING [StopMesa],
IODefs USING[--CR, NUL, SP, TAB, ReadChar, WriteChar, WriteString,-- WriteLine],
PressDefs USING [filePtr, Init, numPages, pageGarray],
ColorPressDefs USING [filePtrOut, InitPage],
SystemDefs USING [FreeHeapNode],
TridentDefs USING [PAGE, tfsdskPtr, TfsCloseDisk, VDA];
ColorPress: PROGRAM
IMPORTS AltoRam, ImageDefs, IODefs, PressDefs, SystemDefs, TridentDefs
EXPORTS PressDefs
=
BEGIN OPEN AltoRam, IODefs, PressDefs, SystemDefs, TridentDefs;
serverMode: PUBLIC BOOLEAN ← FALSE;
uCodeLoaded: PUBLIC BOOLEAN ← FALSE;
BitsWord: TYPE = MACHINE DEPENDENT RECORD
[B15, B14, B13, B12, B11, B10, B9, B8, B7, B6, B5, B4, B3, B2, B1, B0: BOOLEAN
];
ColorEnum: TYPE = {cyan, magenta, yellow};
abortFile: PUBLIC ERROR=CODE;
CPress: PROC[] =
{bitPageNumber: CARDINAL;
continue: BOOLEAN;
diskIn, diskOut: tfsdskPtr;
firstDa: PAGE;
firstVDAIn, firstVDAOut: VDA;
i: CARDINAL;
WriteLine["Color Press Bits creator, writes to file ColorPress.bits"];
--don’t read Com.cm
[diskIn, firstVDAIn, continue]←Init[];--load global settings from Press.state and open trident
IF ~continue THEN GOTO done;
[diskOut, firstVDAOut, continue, filePtrOut]←InitOutFile[];
bitPageNumber ← pageGarray[0].BitPage;--for debugging
firstDa ← LOOPHOLE [firstVDA];
FOR i IN [0..numPages)
DO
firstBand ← MIN[pageGarray[0*i].FirstBand, MIN[pageGarray[1*i].FirstBand, pageGarray[2*i].FirstBand]];
lastBand ← MAX[pageGarray[0*i].LastBand, MAX[pageGarray[1*i].LastBand, pageGarray[2*i].FirstBand]];
FOR color: INTEGER IN [0..3)
DO
InitPage[diskOut, color, i];--initializes outgoing pageG ’s, globals, and synchronizes reading
ENDLOOP;
--use nColors PageG’s per real page
FOR scanLineNum IN [0..totalScans)--totalScans is union of all 3 colors
DO
cyan ← GetNextByte[diskOut, scanLineNum, scanLineLength, cyan];
ENDLOOP;
ENDLOOP;
ENDLOOP;
--Clean up
FreeHeapNode[pageGarray];
[]←TfsCloseDisk[diskOut, TRUE];--free ddMgr
[]←TfsCloseDisk[diskIn, TRUE];--free ddMgr
EXITS
done => NULL;
};--Procedure Press
--Mainline code
CPress[];
ImageDefs.StopMesa[];--put into main program later.
END. -- CPress