-- AltoScreenImpl.mesa
-- Last changed by Doug Wyatt, September 2, 1980 3:22 PM
-- Last changed by Doug Brotz, June 16, 1981 3:45 PM
DIRECTORY
AltoDevice USING [Bitmap],
AltoDisplay USING [DCBHandle, LongDCB, DCBchainHead, DCBnil, LongDCBSeal,
MaxWordsPerLine, MaxScanLines],
Blt USING [longPointers, Handle, New, SetX, SetY, Rect, Free],
FrameDefs USING [IsBound],
InlineDefs USING [LowHalf],
SegmentDefs USING [NewDataSegment, LongDataSegmentAddress,
DefaultXMBase, DefaultMDSBase],
SystemDefs USING [Even, PagesForWords];
AltoScreenImpl: PROGRAM
IMPORTS Blt, FrameDefs, InlineDefs,SegmentDefs, SystemDefs
EXPORTS AltoDevice = {
Bitmap: TYPE = AltoDevice.Bitmap;
dcbsp: ARRAY [0..SIZE[AltoDisplay.LongDCB]] OF WORD;
dcb: AltoDisplay.DCBHandle←SystemDefs.Even[@dcbsp];
screenBitmap: Bitmap ← [NIL,0,0];
screenx,screeny: CARDINAL←0;
ScreenBitmap: PUBLIC PROCEDURE RETURNS[Bitmap] = {
IF screenBitmap.base=NIL THEN InitScreen[];
RETURN[screenBitmap];
};
InitScreen: PROCEDURE = {
OPEN SegmentDefs,AltoDisplay;
pnext: POINTER TO DCBHandle←DCBchainHead;
w,h,words: CARDINAL;
UNTIL pnext↑=NIL DO
dcb: DCBHandle=pnext↑;
screeny←screeny+2*dcb.height;
pnext←@dcb.next
ENDLOOP;
w←MaxWordsPerLine; h←MaxScanLines-screeny;
screenBitmap ← [
base: LongDataSegmentAddress[NewDataSegment[
base: IF Blt.longPointers THEN DefaultXMBase ELSE DefaultMDSBase,
pages: SystemDefs.PagesForWords[words←w*h]]],
raster: w, height: h
];
ClearBitmap[screenBitmap];
IF Blt.longPointers THEN {
ldcb: POINTER TO LongDCB=LOOPHOLE[dcb];
ldcb↑←[next: DCBnil, resolution: high, background: white,
indenting: 0, width: w, height: h/2,
tag: long, bitmap: LongDCBSeal,
longBitmap: screenBitmap.base];
}
ELSE dcb↑←[next: DCBnil, resolution: high, background: white,
indenting: 0, width: w, height: h/2,
bitmap: InlineDefs.LowHalf[screenBitmap.base]];
pnext↑←dcb;
};
ClearBitmap: PROCEDURE[b: Bitmap] = {
blt: Blt.Handle←Blt.New[b.base,b.raster];
Blt.SetX[blt,0,16*b.raster];
Blt.SetY[blt,0,b.height];
blt.grays[0]←125252B; blt.grays[1]←52525B;
blt.grays[2]←125252B; blt.grays[3]←52525B;
Blt.Rect[blt]; Blt.Free[@blt];
};
ScreenOrigin: PUBLIC PROCEDURE RETURNS[x,y: CARDINAL] = {
RETURN[x: screenx, y: screeny]
};
}.