-- Blt.mesa
-- Last changed by Doug Wyatt, September 15, 1980 5:17 PM
DIRECTORY
BitBltDefs USING [BBptr, BBTableSpace],
Mopcodes,
InlineDefs USING [HighHalf, LowHalf];
Blt: DEFINITIONS
IMPORTS InlineDefs = {
longPointers: BOOLEAN=TRUE;
Grays: TYPE = ARRAY [0..4) OF CARDINAL;
Handle: TYPE = POINTER TO Data;
BBptr: TYPE = BitBltDefs.BBptr;
Data: TYPE = RECORD [
bbt: BBptr,
ycurr:LONG POINTER,
grays: Grays,
sdx,sdy: INTEGER,
refs: PRIVATE CARDINAL←1,
space: PRIVATE BitBltDefs.BBTableSpace
];
New: PROC[base: LONG POINTER, raster: CARDINAL] RETURNS[Handle];
Source: PROC[d: Handle,
base: LONG POINTER, raster: CARDINAL] = INLINE {
bbt: BBptr=d.bbt;
IF longPointers THEN bbt.slbca←base
ELSE {
bh: CARDINAL=InlineDefs.HighHalf[base];
bl: POINTER=InlineDefs.LowHalf[base];
bbt.sbca←bl; IF bh#0 THEN { bbt.sourcealt←TRUE;
IF bbt.unused=0 THEN bbt.unused←bh
ELSE IF bbt.unused#bh THEN ERROR;
};
};
bbt.sbmr←raster;
};
SetX: PROC[d: Handle, xmin,xmax: CARDINAL] = INLINE {
bbt: BBptr=d.bbt;
IF xmin <= xmax THEN {bbt.dlx←xmin; bbt.dw←xmax-xmin;}
ELSE{bbt.dlx←xmin; bbt.dw←0;};
};
SetY: PROC[d: Handle, ymin,ymax: CARDINAL] = INLINE {
bbt: BBptr=d.bbt;
IF ymin <= ymax THEN {bbt.dty←ymin; bbt.dh←ymax-ymin;}
ELSE{bbt.dty←ymin; bbt.dh←0;};
};
SetBox: PROC[d: Handle, xmin,ymin,w,h: CARDINAL] = INLINE {
bbt: BBptr=d.bbt;
bbt.dlx←xmin; bbt.dty←ymin;
bbt.dw←w; bbt.dh←h;
};
Rect: PROC[d: Handle];
SetYCur: PUBLIC PROCEDURE [d:Handle,y:CARDINAL] = INLINE
{bbt: BBptr=d.bbt;
d.ycurr←bbt.dlbca + y*bbt.dbmr;
RETURN;
};
PutPixel: PUBLIC PROCEDURE [d:Handle,i:CARDINAL] = INLINE
{bbt: BBptr=d.bbt;
WLF[1,d.ycurr + i/16,FieldParam[0,FD[i MOD 16, 0]]];
RETURN;
};
FD: TYPE = RECORD [pos, size: [0..17B]];
FieldParam: TYPE = RECORD [alpha: [0..377B], beta: FD];
RLF: PROCEDURE [p:LONG POINTER, f: FieldParam] RETURNS [UNSPECIFIED] =
MACHINE CODE BEGIN Mopcodes.zRFSL; END;
WLF: PROCEDURE [data: UNSPECIFIED, p:LONG POINTER, f: FieldParam] =
MACHINE CODE BEGIN Mopcodes.zWFSL; END;
Ref: PROC[d: Handle] RETURNS[Handle] = INLINE {
d.refs←d.refs+1; RETURN[d]
};
Free: PROC[dPtr: LONG POINTER TO Handle] = INLINE {
d: Handle=dPtr↑; dPtr↑←NIL;
IF (d.refs←d.refs-1)=0 THEN CFree[d]
};
CFree: PRIVATE PROC[d: Handle];
BltImpl: PROGRAM;
}.