ColorDisplayFace.mesa
Last edit by Doug Wyatt, 9-Jul-81 15:21:55
Last Edited by: Levin, August 8, 1983 2:43 pm
DIRECTORY
Basics USING [BYTE],
PrincOps USING [PageCount, PageNumber];
ColorDisplayFace: DEFINITIONS =
BEGIN
Processor-independent interface to color display.
Types
Mode: TYPE = RECORD[full, useA, useB: BOOL, lgBitsPerPixelA,lgBitsPerPixelB: [0..3]];
Encodes the color display modes that may be available on a given processor.
full=TRUE specifies 24 bit per pixel mode; the other fields are ignored.
full=FALSE specifies a mode with one or two bitmaps addressing a color map:
if useA=TRUE, lgBitsPerPixelA specifies 1,2,4 or 8 bits per pixel for bitmap "A"
if useB=TRUE, lgBitsPerPixelB specifies 1,2,4 or 8 bits per pixel for bitmap "B"
Color: TYPE = [0..256); -- an 8 bit color value (red, green, or blue)
DisplayType: TYPE = {none, ramtek525, hitachi3619};
Interface variables
globalStateSize: READONLY NAT; -- number of words required by Initialize
displayType: READONLY DisplayType;
pixelsPerInch: READONLY NAT; -- size of a pixel
The following variables are established by Connect (see below) and remain unchanged between a call to Connect and a call to Disconnect.
width, height: READONLY NAT; -- raster dimensions in pixels (0,0 if disconnected)
baseA, baseB: READONLY LONG POINTER; -- bitmap addresses (NIL if bitmap not in use)
bplA, bplB: READONLY NAT; -- bitmap bits per line (0 if bitmap not in use)
Procedures
Initialization
Initialize: PROC [globalState: LONG POINTER];
Initializes the implementation; the client must supply a block of globalStateSize words, permanently allocated in first 64K of address space.
InitializeCleanup: PROC;
Initializes the cleanup coroutine for world swaps.
Bitmap control
HasMode: PROC [mode: Mode] RETURNS [BOOL];
Returns TRUE if the specified mode is available.
PagesForMode: PROC [mode: Mode] RETURNS [PrincOps.PageCount];
Returns the number of pages required to Connect the specified mode, with a raster the size of the full screen.
Connect: PROC [mode: Mode, firstPage: PrincOps.PageNumber, nPages: PrincOps.PageCount];
Establishes the specified mode; allocates bitmap(s) and colormap(s) from a client-supplied block of nPages pages of mapped virtual memory. If mode.full=TRUE, nPages may be less than PagesForMode[mode]; in this case, the raster size will be reduced to fit. Subsequent changes to the bitmap or color map will affect the color image, but the image will not appear on the screen until TurnOn is called.
Disconnect: PROC;
Disconnects the display; releases all references to the pages passed to Connect.
TurnOn: PROC;
Turns display on, causing an image to appear on the screen. Caution: the connected pages must be made resident before TurnOn is called!
TurnOff: PROC;
Turns display off, causing the screen to be dark. The bitmap(s) and colormap are retained; the image will reappear if TurnOn is called. The connected pages may be made swappable after TurnOff is called.
Show: PROC [a, b: BOOLTRUE];
Makes each bitmap visible (TRUE) or invisible (FALSE).
Color map control when mode.full = FALSE
GetColor: PROC [pixelA, pixelB: Basics.BYTE ← 0] RETURNS [r,g,b: Color];
Returns the current color map entry for the given combination of pixel values from bitmaps A and B. (For a bitmap not in use, the pixel value is always 0.)
SetColor: PROC [pixelA, pixelB: Basics.BYTE ← 0, r, g, b: Color];
Sets the color map entry for the given combination of pixel values. If the display is 'on', the screen will show the change by the next frame time.
Color map control when mode.full = TRUE
GetRedMap: PROC [in: Color] RETURNS [out: Color];
GetGreenMap: PROC [in: Color] RETURNS [out: Color];
GetBlueMap: PROC [in: Color] RETURNS [out: Color];
These procedures return the current entry from the red, green, or blue map.
SetRedMap: PROC [in, out: Color];
SetGreenMap: PROC [in, out: Color];
SetBlueMap: PROC [in, out: Color];
These procedures alter the red, green, and blue maps. If the display is 'on', the screen will show the change by the next frame time.
END.