-- Compiler Cursors/n
-- stone November 10, 1980  5:18 PM

DIRECTORY
	PointDefs: FROM "PointDefs" USING [ScrPt, X, Y],
	ProcessDefs: FROM "ProcessDefs"
		USING [DisableInterrupts, EnableInterrupts],
	CursorDefs: FROM "CursorDefs";

Cursors: PROGRAM IMPORTS ProcessDefs EXPORTS CursorDefs =
BEGIN OPEN CursorDefs, PointDefs;
startCursor: ARRAY [0..15] OF CARDINAL;
offset: PointDefs.ScrPt ← [0,0];
cursorBitMap: POINTER TO ARRAY [0..15] OF CARDINAL = LOOPHOLE[431B];
cursorCoordinates: POINTER TO PointDefs.ScrPt = LOOPHOLE[426B];
mouseCoordinates: POINTER TO PointDefs.ScrPt = LOOPHOLE[424B];

SetCursor: PUBLIC PROCEDURE[cursor: Cursor] =
BEGIN
ProcessDefs.DisableInterrupts;
cursorCoordinates[X] ← cursorCoordinates[X] - offset[X];
cursorCoordinates[Y] ← cursorCoordinates[Y] - offset[Y];
SELECT cursor FROM
pointingCursor =>
	BEGIN
	cursorBitMap↑ ← 
	[400B,400B,400B,400B,
	400B,400B,0B,176576B,
	0B,400B,400B,400B,
	400B,400B,400B,0B];
	offset ← [-7,-7];
	END;
abortCursor =>
	BEGIN
	cursorBitMap↑ ← 
	[100002B,40004B,20010B,10020B,
	4040B,2100B,1200B,400B,
	1200B,2100B,4040B,10020B,
	20010B,40004B,100002B,0];
	offset ← [-7,-7];
	END;
busyCursor =>
	BEGIN
	cursorBitMap↑ ← 
	[160020B, 57430B, 100244B, 40146B,
	110050B, 62010B, 150411B, 36006B,
	70111B, 111610B, 110520B, 44520B,
	42460B, 145020B, 46020B, 13054B];
	offset ← [-7,-7];
	END;
menuCursor =>
	BEGIN
	cursorBitMap↑ ← 
	[177777B,100001B,100001B,100001B,
	100001B,100001B,100001B,100001B,
	100001B,100001B,100001B,100001B,
	100001B,100001B,100001B,177777B];
	offset ← [-7,-7];
	END;
ENDCASE;
cursorCoordinates[X] ← cursorCoordinates[X] + offset[X];
cursorCoordinates[Y] ← cursorCoordinates[Y] + offset[Y];
mouseCoordinates↑ ← cursorCoordinates↑;
ProcessDefs.EnableInterrupts;
END;

CursorPosition: PUBLIC PROCEDURE RETURNS[pt: PointDefs.ScrPt] =
BEGIN
pt[X] ← cursorCoordinates[X] - offset[X];
pt[Y] ← cursorCoordinates[Y] - offset[Y];
END;

startCursor ← cursorBitMap↑;
END.