-- File: GSysPress.mesa
-- Written by Martin Newell July 1981
-- Last edited (Alto/Pilot): August 6, 1981 3:04 PM by DF

DIRECTORY

GSysPressDefs: FROM "GSysPressDefs",
PressDefs: FROM "PressDefs" USING [
InitPressFileDescriptor, --PutComputedDots,-- ClosePressFile,
PressFileDescriptor];

GSysPress: PROGRAM
IMPORTS PressDefs
EXPORTS GSysPressDefs =
BEGIN
OPEN PressDefs;

ScreenToPress: PUBLIC PROCEDURE [name: STRING,
base: LONG POINTER, raster,height: CARDINAL] =
BEGIN
p: PressFileDescriptor;
BEGIN
nWords: CARDINAL = raster;
nBits: CARDINAL = 16*nWords;
nLines: CARDINAL = height;

InitPressFileDescriptor[@p, name];
PutLongAltoDots[
@p, 10795 - 16*nBits, 14605 + 16*nLines, nWords, nBits, nLines, base];
ClosePressFile[@p];
END;
END;

PutLongAltoDots: PROCEDURE [
p: POINTER TO PressFileDescriptor,
x, y, wordsPerLine, npixels, nscans: CARDINAL, bitmapAddress: LONG POINTER] =
--Generate Press bitmap file
BEGIN
width, height, wordindent: CARDINAL;
wordindent ← x/16;
width ← 32*npixels;
height ← 32*nscans;
ResetScanProc[bitmapAddress, wordsPerLine];
--PutComputedDots[
--
p: p, x: x, y: y - height, nPixels: npixels, nScanLines: nscans,
--
bitsPerPixel: 0, width: width, height: height, nextScanLine: LongScanProc];
END;

ResetScanProc: PROCEDURE [bitmapAddress: LONG POINTER, wordsPerLine: CARDINAL] =
BEGIN LineAddress ← bitmapAddress; WordsPerLine ← wordsPerLine; END;

LongScanProc: PROCEDURE RETURNS [LONG POINTER] =
BEGIN --Pilot Version
--This procedure must return a pointer to a single scanline of dots
--It will be called repetitively by PutComputedDots
l: LONG POINTER ← LineAddress;
LineAddress ← LineAddress + WordsPerLine;
RETURN[l];
END;

LineArray: ARRAY [0..40) OF WORD;
LineBuffer: POINTER ← BASE[LineArray];
LineAddress: LONG POINTER;
WordsPerLine: CARDINAL;

END.