-- OldBitBltImpl.mesa Last edit: July 25, 1980 8:36 PM By: Forrest
DIRECTORY
BitBlt: FROM "BitBlt",
Environment: FROM "Environment" USING [bitsPerWord],
Inline: FROM "Inline",
OldBitBlt: FROM "OldBitBlt",
Mopcodes: FROM "Mopcodes",
UserTerminal USING [GetBitBltTable, screenWidth, screenHeight];
OldBitBltImpl: PROGRAM
IMPORTS BitBlt, Inline, UserTerminal
EXPORTS OldBitBlt =
BEGIN
GetBitBltTable: PUBLIC PROCEDURE RETURNS [bbt: OldBitBlt.LongBBTable] =
BEGIN
bitmapBase: LONG POINTER = UserTerminal.GetBitBltTable[].bbt.dst.word;
screenWords: CARDINAL = UserTerminal.screenWidth/Environment.bitsPerWord;
RETURN[[
d0: TRUE, pad: 0, sourcetype: block, function: replace,
gray0: 0, gray1: 0, gray2: 0, gray3: 0,-- four words of "gray"
sbmr: screenWords, slbca: bitmapBase, slx: 0, sty: 0,-- source
dbmr: screenWords, dlbca: bitmapBase, dlx: 0, dty: 0,-- destination
dw: UserTerminal.screenWidth, dh: UserTerminal.screenHeight]];
END;
-- useNewBitBlt: BOOLEAN ← FALSE;
BITBLT: PUBLIC PROCEDURE [ptr: OldBitBlt.BBptr] =
BEGIN OPEN n: ptr.newBBTable;
Addr: PROCEDURE [a: LONG POINTER, xoff, yoff, widthWds: CARDINAL] RETURNS [BitBlt.BitAddress] =
INLINE BEGIN
bpw: CARDINAL = Environment.bitsPerWord;
RETURN[[
a+
Inline.LongMult[yoff, widthWds]+ LONG[xoff / bpw], 0, xoff MOD bpw]];
END;
-- IF ~useNewBitBlt THEN
-- BEGIN
-- BB: PROCEDURE [POINTER] = MACHINE CODE
-- BEGIN Mopcodes.zLI0; Mopcodes.zBITBLT; END;
-- s: OldBitBlt.BBoperation ← ptr.function;
-- map: ARRAY OldBitBlt.BBoperation OF OldBitBlt.BBoperation =
-- [replace, invert, erase, paint];
-- ptr.d0 ← TRUE; ptr.pad ← 0;
-- ptr.unused ← 0;
-- ptr.function ← map[s];
-- ptr.unusedDbca ← Inline.LowHalf[ptr.dlbca];
-- ptr.unusedSbca ← Inline.LowHalf[ptr.slbca];
-- BB[ptr+SIZE[BitBlt.BBTable]];
-- ptr.function ← s;
-- RETURN;
-- END;
n.dst ← Addr[ptr.dlbca, ptr.dlx, ptr.dty, ptr.dbmr];
n.dstBpl ← Environment.bitsPerWord * ptr.dbmr;
n.width ← ptr.dw; n.height ← ptr.dh;
IF ptr.sourcetype = gray THEN
BEGIN
n.flags ← [
direction:
forward, disjoint: TRUE, disjointItems: TRUE, gray: TRUE,
srcFunc: IF
ptr.function=erase THEN complement ELSE null,
dstFunc: LOOPHOLE[ptr.function]];
n.src ← [@ptr.gray0, 0, n.dst.bit];
n.srcDesc ← [gray[[0, 0, 0, 3]]];
END
ELSE
BEGIN
n.srcDesc ← [srcBpl[Environment.bitsPerWord * ptr.sbmr]];
n.src ← Addr[ptr.slbca, ptr.slx, ptr.sty, ptr.sbmr];
n.flags ← [
direction: IF
ptr.dty > ptr.sty THEN backward ELSE IF ptr.dty < ptr.sty THEN forward ELSE IF ptr.dlx < ptr.slx THEN forward ELSE backward,
disjoint: ptr.dlbca#ptr.slbca, disjointItems: ptr.dty # ptr.sty, gray: FALSE,
srcFunc:
srcConv[ptr.sourcetype][ptr.function],
dstFunc: LOOPHOLE[ptr.function]];
IF n.flags.direction=backward THEN
BEGIN
-- point to first word on last line, and set Bpl’s negative
n.src.word ← n.src.word + Inline.LongMult[n.height-1, ptr.sbmr];
n.dst.word ← n.dst.word + Inline.LongMult[n.height-1, ptr.dbmr];
n.dstBpl ← - n.dstBpl;
n.srcDesc.srcBpl ← - n.srcDesc.srcBpl;
END;
END;
n.reserved ← 0;
BitBlt.BITBLT[@ptr.newBBTable];
END;
srcConv: ARRAY OldBitBlt.BBsourcetype OF ARRAY OldBitBlt.BBoperation OF BitBlt.SrcFunc = [
-- replaceerasepaintinvert
[null,complement,null,null],-- block
[complement,null,complement,complement],
[,,,],
[,,,]];-- complement
END.
LOG
Time: April 13, 1980 9:14 PM By: Forrest Action: CreatedFile
Time: April 15, 1980 4:01 PM By: Forrest Action: Set Gray flag in Gray case
Time: April 28, 1980 1:51 PM By: Forrest Action: Comment out old=>old section.