UserTerminalHeadDorado.mesa
Last Edited by: Taft, February 27, 1983 3:27 pm
Last Edited by: Levin, August 8, 1983 3:08 pm
Last Edited by: Birrell, August 18, 1983 1:54 pm
DIRECTORY
Basics USING [bitsPerWord],
DoradoInputOutput USING [millisecondsPerTick, RWMufMan, savedCursor, SetDisplayFieldRate],
DeviceCleanup USING [Await, Item, Reason],
DisplayFace USING [
Background, CursorPtr, FieldRate, GlobalStatePtr, MonitorType, Point],
KeyboardFace USING [KeyBits],
MouseFace USING [Buttons, Point],
PrincOps USING [BBTable, PageCount, PageNumber],
PrincOpsUtils USING [AddressForPageNumber, BITOR, LowHalf, PagesForWords],
ProcessorFace USING [GetClockPulses, microsecondsPerHundredPulses];
UserTerminalHeadDorado: CEDAR PROGRAM
IMPORTS
DeviceCleanup, DoradoInputOutput, PrincOpsUtils, ProcessorFace
EXPORTS
DisplayFace, KeyboardFace, MouseFace =
BEGIN
DisplayFace
CSBPtr: TYPE = LONG POINTER TO CSBState;
CSBState: TYPE = MACHINE DEPENDENT RECORD [dcbChainHead: PDCB, wakeupMask: WORD];
csbPtr: CSBPtr = LOOPHOLE[LONG[420B]]; -- SHOULD MOVE TO IO PAGE
PDCB: TYPE = POINTER TO DCB;
DCB: TYPE = MACHINE DEPENDENT RECORD [ -- address must be even
next: PDCB,
resolution: {high, low},
background: DisplayFace.Background,
indenting: [0..77B], -- in units of 16 bits
width: [0..377B], -- in units of 16 bits; must be even
shortBitmap: POINTER, -- must be even
tag: {short, long},
height: [0..77777B], -- in double scan lines
longBitmap: LONG POINTER]; -- must be even
longBitMapSeal: POINTER = LOOPHOLE[177423B]; -- required value of DCB.shortBitmap
displayState: {disconnected, off, on} ← disconnected;
bitmapBase: LONG POINTER; -- undefined if displayState=disconnected
pDCBReal: LONG POINTER TO DCB;
pDCBBlank: LONG POINTER TO DCB;
pDCBNull: PDCB = LOOPHOLE[0];
hasBuffer: PUBLIC BOOLFALSE;
pagesForBitmap: PUBLIC PrincOps.PageCount; -- see initialization below
Connect: PUBLIC PROC [bitmap: PrincOps.PageNumber] = TRUSTED {
displayState ← off;
bitmapBase ← PrincOpsUtils.AddressForPageNumber[bitmap];
csbPtr.dcbChainHead ← PrincOpsUtils.LowHalf[pDCBBlank]; -- DCB's are in first64K
};
Disconnect: PUBLIC PROC = TRUSTED {
displayState ← disconnected; csbPtr.dcbChainHead ← pDCBNull;
};
TurnOn: PUBLIC PROC = TRUSTED {
IF displayState = disconnected THEN ERROR;
displayState ← on;
pDCBReal.longBitmap ← bitmapBase;
csbPtr.dcbChainHead ← PrincOpsUtils.LowHalf[pDCBReal] -- DCB's are in first64K
};
TurnOff: PUBLIC PROC = TRUSTED {
IF displayState = disconnected THEN ERROR;
displayState ← off;
csbPtr.dcbChainHead ← PrincOpsUtils.LowHalf[pDCBBlank]; -- DCB's are in first64K
};
GetBitBltTable: PUBLIC PROC RETURNS [PrincOps.BBTable] = TRUSTED {
RETURN[
[
dst: [word: IF displayState = disconnected THEN NIL ELSE bitmapBase, bit: 0],
dstBpl: bitmapWidth,
src: [word: IF displayState = disconnected THEN NIL ELSE bitmapBase, bit: 0],
srcDesc: [srcBpl[bitmapWidth]],
width: width, height: height, flags: []]];
};
SetBackground: PUBLIC PROC [background: DisplayFace.Background] = TRUSTED {
pDCBReal.background ← pDCBBlank.background ← background};
width: PUBLIC NAT ← lfWordsPerLine*Basics.bitsPerWord;
cslWordsPerLine: CARDINAL = 38;
lfWordsPerLine: CARDINAL = 64;
torWordsPerLine: CARDINAL = 40;
bitmapWidth: CARDINAL ← lfWordsPerLine*Basics.bitsPerWord;
Size of bitmap, possibly large than screen image
height: PUBLIC NAT ← 808; -- LF and CSL
torHeight: CARDINAL = 800;
pixelsPerInch: PUBLIC CARDINAL ← 72;
refreshRate: PUBLIC CARDINAL ← lfRefreshRate; -- frames (two fields) per second
cslRefreshRate: CARDINAL = 30;
lfRefreshRate: CARDINAL = 38; -- actually ??
interlaced: PUBLIC BOOLTRUE;
Scan line wakeups
SetScanLineWakeup not implemented.
GetScanLine not implemented.
Border pattern
hasBorder: PUBLIC BOOLFALSE;
SetBorderPattern: PUBLIC PROC [oddPairs, evenPairs: [0..377B]] = TRUSTED {};
Monitor type, field rate, and waveforms
monitorType: PUBLIC DisplayFace.MonitorType ← lf; -- changed in Start
SetFieldRate: PUBLIC PROC [rate: DisplayFace.FieldRate] RETURNS [ok: BOOL] = TRUSTED {
SELECT monitorType FROM
alto => RETURN [rate=normalAlto];
lf => {
SELECT rate FROM
normalLF =>
DoradoInputOutput.SetDisplayFieldRate[sync: 18, visible: 430, topBorder: 14];
lfBall60hz =>
DoradoInputOutput.SetDisplayFieldRate[sync: 18, visible: 560, topBorder: 14];
lfPhillips60hz =>
DoradoInputOutput.SetDisplayFieldRate[sync: 58, visible: 520, topBorder: 25];
ENDCASE =>
RETURN [FALSE];
RETURN [TRUE];
};
ENDCASE;
};
SetVerticalWaveforms: PUBLIC PROC [sync, visible, topBorder: CARDINAL]
RETURNS [ok: BOOL] = TRUSTED {
DoradoInputOutput.SetDisplayFieldRate[sync: sync, visible: visible, topBorder: topBorder];
RETURN [TRUE]
};
Cursor
pHardwareCursor: DisplayFace.CursorPtr = LOOPHOLE[LONG[431B]];
SetCursorPattern: PUBLIC PROC [cursorPtr: DisplayFace.CursorPtr] = TRUSTED {
pHardwareCursor^ ← cursorPtr^;
DoradoInputOutput.savedCursor ← cursorPtr^;
};
cursorPosition: PUBLIC LONG POINTER TO DisplayFace.Point ← LOOPHOLE[LONG[426B]];
Initialization
globalStateSize: PUBLIC CARDINALSIZE[DCB]*2;
InitializeCleanup: PUBLIC PROC = TRUSTED {
OPEN DeviceCleanup;
item: Item;
reason: Reason;
state: CSBState;
mouseCoord: MouseFace.Point;
cursorCoord: DisplayFace.Point;
timeDone: LONG CARDINAL;
maxPulsesPerRefresh: LONG CARDINAL =
2* --for safety--
(LONG[100]* --pulsesPerHundredPulses-- 1000000 --microsecondsPerSecond--
)/(LONG[refreshRate] --framesPerSecond--
*ProcessorFace.microsecondsPerHundredPulses);
DO
reason ← Await[@item];
SELECT reason FROM
turnOff => {
state ← csbPtr^;
mouseCoord ← mouse^;
cursorCoord ← cursorPosition^;
copy of cursor pattern itself is saved by SetCursorPattern
csbPtr.dcbChainHead ← pDCBNull;
timeDone ← ProcessorFace.GetClockPulses[];
WHILE ProcessorFace.GetClockPulses[] - timeDone < maxPulsesPerRefresh DO
ENDLOOP;
};
turnOn => {
mouse^ ← mouseCoord;
cursorPosition^ ← cursorCoord;
cursor pattern itself is restored by SetMP trap handler in ProcessorHeadDorado
csbPtr^ ← state;
};
ENDCASE;
ENDLOOP;
};
Initialize: PUBLIC UNSAFE PROC [globalState: DisplayFace.GlobalStatePtr, wakeVF: WORD] = TRUSTED {
dcb: DCB = [
next: pDCBNull, resolution: high, background: white, indenting: 0, width: 0,
shortBitmap: longBitMapSeal, tag: long, height: 0, longBitmap: NIL];
csbPtr.wakeupMask ← PrincOpsUtils.BITOR[wakeVF, csbPtr.wakeupMask];
pDCBBlank ← LOOPHOLE[globalState];
pDCBReal ← LOOPHOLE[globalState + SIZE[DCB]];
pDCBBlank^ ← pDCBReal^ ← dcb;
pDCBReal.width ← width/Basics.bitsPerWord;
pDCBReal.height ← height/2;
};
KeyboardFace
keyboard: PUBLIC LONG POINTER TO READONLY KeyboardFace.KeyBits ←
LOOPHOLE[LONG[177033B]];
MouseFace
position: PUBLIC LONG POINTER TO READONLY MouseFace.Point ← mouse;
SetPosition: PUBLIC PROC [newMousePosition: MouseFace.Point] = TRUSTED
{ mouse^ ← newMousePosition };
buttons: PUBLIC LONG POINTER TO READONLY MouseFace.Buttons ← LOOPHOLE[keyboard];
mouse: LONG POINTER TO MouseFace.Point = LOOPHOLE[LONG[424B]];
Constants for ProcessorFace condition variable time
cslMillisecondsPerTick: CARDINAL = 50;
lfMillisecondsPerTick: CARDINAL = 40; -- actually 39.7
torMillisecondsPerTick: CARDINAL = 40; -- what should this be?
Main Body
TRUSTED {
displayIsLF: BOOL =
(DoradoInputOutput.RWMufMan[[useDMD: FALSE, dMuxAddr: 3106B]].dMuxData # 0);
IF displayIsLF
THEN DoradoInputOutput.millisecondsPerTick ← lfMillisecondsPerTick
ELSE {
monitorType ← alto;
bitmapWidth ← width ← cslWordsPerLine*Basics.bitsPerWord;
refreshRate ← cslRefreshRate;
DoradoInputOutput.millisecondsPerTick ← cslMillisecondsPerTick;
};
pagesForBitmap ← PrincOpsUtils.PagesForWords[(bitmapWidth.LONG/Basics.bitsPerWord)*height];
csbPtr.dcbChainHead ← pDCBNull; -- DCB's are in first64K
};
END.
February 6, 1980 3:55 PM Gobbel Create file from UserTerminalImpl
February 8, 1980 12:29 PM McJones Start chaining
February 25, 1980 1:46 PM McJones Automatic determination of LF/CSL/Tor display
March 7, 1980 5:56 PM McJones Wait for two frames in turnOff arm of cleanup procedure
June 26, 1980 11:04 AM McJones OISProcessorFace=>ProcessorFace; allow Disconnect in disconnected state; add cursorPosition, mousePosition
July 29, 1980 9:54 AM McJones Add keyboard, hasBorder; split off MouseFace
July 30, 1980 6:21 PM McJones Add pagesForBitmap, GetBitBltTables; buffered=>hasBuffer
January 28, 1981 9:27 AM McJones Dummy SoundGenerator
March 21, 1981 4:51 PM Taft Convert for Dorado
9-Jun-81 18:04:35 Taft LF display
February 27, 1983 2:12 pm Taft DisplayFaceExtras