DisplayFace.mesa
last edited by Levin on June 6, 1983 2:51 pm
1) Is SetScanLineWakeup really necessary? Is it implementable on all controllers?
2) Is 16 word alignment of globalState area necessary on D0?
DIRECTORY
PrincOps USING [BBTable, PageCount, PageNumber];
DisplayFace: CEDAR DEFINITIONS =
BEGIN
Processor-independent interface to bitmap display.
There is no provision for multiple displays on a single machine.
The display has two state variables: mode and background. The mode has three values: on, off, and disconnected; the background has two values: white and black. When the system is booted, state = disconnected, and background = white.
hasBuffer: READONLY BOOL;
TRUE => display implementation provides real memory for bitmap;
FALSE => client provides real memory for bitmap.
pagesForBitmap: READONLY PrincOps.PageCount;
size of virtual memory required to hold full size bitmap; may be larger than implied by size of visible image
Connect: PROC [bitmap: PrincOps.PageNumber];
Display must be in 'disconnected' mode; connects display to specified bitmap and leaves it in 'off' mode. Bitmap is taken by reference (first page in virtual address space); subsequent changes to bitmap in memory will affect screen image. Bitmap is always full size (i.e. pagesForBitmap pages). The bitmap does not appear on the screen until the display is turned on (see below).
Disconnect: PROC;
Display must be in 'off' mode; places display in 'disconnected' mode. Turns screen black, and minimizes consumption of resources (e.g. microprocessor time, memory accesses, etc.). The virtual memory area used for the bitmap may be reused for other purposes while the display is disconnected. The real memory may be reclaimed by the party providing it (i.e. if 'buffered' is FALSE, the face client may reclaim the real memory; if 'buffered' is TRUE, the face implementation may reclaim the real memory.)
TurnOn: PROC;
Display must be in 'off' mode; places display in 'on' mode, causing bitmap to be displayed on screen. Bitmap must have real memory mapped to it before this operation is invoked.
TurnOff: PROC;
Display must be in 'on' mode; places display in 'off' mode, causing background color to be displayed on screen.
GetBitBltTable: PROC RETURNS [PrincOps.BBTable];
SetBackground: PROC [background: Background];
Background: TYPE = {white, black};
white => normal (black on white) view of bitmap (0=>white, 1=>black);
black => inverted (white on black) view of bitmap (0=>black, 1=>white);
width, height: READONLY NAT; -- Dimensions of screen in pixels
pixelsPerInch: READONLY CARDINAL; -- Size of a pixel
refreshRate: READONLY CARDINAL; -- Number of times per second that entire screen is refreshed.
interlaced: READONLY BOOL; -- Is the refresh two-way interlaced?
SetScanLineWakeup: PROC [line: CARDINAL, mask: WORD];
Causes naked notify using specifed interrupt mask each time the specified line is refreshed on the screen.
GetScanLine: PROC RETURNS [line: CARDINAL];
Returns scan line currently being refreshed on the screen.
hasBorder: READONLY BOOL; -- Is border pattern implemented?
SetBorderPattern: PROC [oddPairs, evenPairs: [0..377B]];
Defines bit pattern shown in visible screen area (if any) outside bitmap. The bit pattern for an individual scan line is defined by displaying a single byte repeatedly along the entire scan line. The same pattern is shown on alternating pairs of lines. (Byte for even pairs shown on lines -4, -3, 0, 1, 4, 5, etc. Byte for odd pairs shown on lines -2, -1, 2, 3, 6, 7, etc.)
MonitorType: TYPE = {alto, lf};
There are two basic types of monitors that can be connected to D-machines: the narrow Alto-style monitor and the wide LF (large-format) monitor.
Alto monitors run at a fixed field rate (60 hz) which it is not reasonable to change. LF monitors normally run at a field rate of approximately 77 hz. However, this may be reduced to 60 hz for compatibility with videotape and other TV equipment.
To complicate matters, there are two brands of LF monitors presently in use, one made by Ball Brothers and the other by Phillips. They respond in different ways to having their field rate reduced, and require different waveforms for reasonable results.
The software cannot detect which brand of LF monitor is connected; this must be determined by the user. Shine a light through the ventilation slots in the top of the housing. If there is a horizontal logic board at the bottom (under the neck of the picture tube) then it is a Ball Brothers monitor. If the logic board is vertically oriented on the left-hand side (with a bunch of adjustments on the top) then it is a Phillips monitor.
After changing the field rate, it may be necessary to adjust the monitor to restore the proper position of the picture. This is more likely to be needed with a Ball Brothers monitor than with a Phillips monitor.
monitorType: MonitorType; -- the monitor connected to this machine
FieldRate: TYPE = {normalAlto, normalLF, lfBall60hz, lfPhillips60hz};
SetFieldRate: PROC [rate: FieldRate] RETURNS [ok: BOOL];
Establishes the new field rate, in a machine-independent fashion. Returns TRUE if the operation is reasonable and is implemented on this machine.
SetVerticalWaveforms: PROC [sync, visible, topBorder: CARDINAL] RETURNS [ok: BOOL];
Sets the vertical waveform parameters to arbitrary values. Sync is the duration of the sync pulse in scan lines; visible is the duration of the visible field including top and bottom borders (i.e., everything except sync); topBorder is the duration of the top border.
All numbers describe scan lines in the even field and must be greater than zero.
For an LF monitor, the standard values are sync=18, visible=430, topBorder=14.
To obtain the normal field rate requires that sync+visible = 448.
To obtain the 60 hz field rate requires that sync+visible = 578.
At present, on the Dorado the three values can be adjusted independently; on the Dolphin and Dandelion nothing may be changed.
Returns TRUE if the operation is implemented on this machine; no other check is made for reasonableness of the operation.
SetCursorPattern: PROC [cursorPtr: CursorPtr];
Sets the cursor bitmap to the indicated pattern by value; subsequent changes to the indicated cursor in memory will not affect screen image, hence SetCursorPattern must be called each time the cursor pattern is changed.
CursorPtr: TYPE = LONG POINTER TO Cursor;
Cursor: TYPE = ARRAY [0..16) OF WORD;
cursorPosition: READONLY LONG POINTER TO Point;
Point: TYPE = RECORD [x, y: INTEGER]; -- x and y , measured from upper-left corner of screen.
General
globalStateSize: READONLY CARDINAL;
GlobalStatePtr: TYPE = LONG POINTER;
InitializeCleanup: PROC;
Initialize: UNSAFE PROC [globalState: GlobalStatePtr, wakeVF: WORD];
This procedure initializes the implementation; 'globalState' is a client supplied block of globalStateSize words, 16-word aligned in first 64K of address space. Lifetime: permanently allocated and passed in on call to Initialize; 'wakeVF' is the wakeup mask for vertical-field interrupts (i.e. refresh of scan lines 0 and 1).
END.