RealTest.mesa
Copyright Ó 1985, 1986, 1987 by Xerox Corporation. All rights reserved.
Levin on September 20, 1983 10:54 am
Russ Atkinson (RRA) February 27, 1985 7:15:04 pm PST
Willie-Sue, October 28, 1986 11:32:10 am PST
Doug Wyatt, January 14, 1987 3:23:55 pm PST
Lucy Hederman August 7, 1987 4:32:42 pm PDT
This interface consists exclusively of type definitions for the architectural data structures of the Mesa processor. A companion interface, PrincOpsUtils, provides convenient operations (usually inline) for manipulating many of these structures.
Note to the casual reader: Most of the definitions in this interface are intended for use by wizards. Only the first section "Basic Types and Associated Values" is likely to be useful to general clients.
--PrincOps: DEFINITIONS
-- =
BEGIN
Basic Types and Associated Values
bitsPerWord: NAT = BITS[WORD];
wordsPerPage: NAT = 256;
bytesPerPage: NAT = BYTES[WORD]*wordsPerPage;
logWordsPerPage: NAT = SIZE[[0..wordsPerPage)]; --LogBase2[wordsPerPage]
logBytesPerPage: NAT = SIZE[[0..bytesPerPage)]; --LogBase2[bytesPerPage]
PageCount: TYPE = INT; -- actually, [0..maxPagesInVM]; intended for use by VM
PageNumber: TYPE = INT; -- actually, [0..2^24); intended for use by VM
ShortPointer: TYPE = ORDERED POINTER [0..CARDINAL.LAST];
maxPagesInVM: PageCount = 65536; -- 2^16 pages = 24-bit address space
shortPointerSpan: PageCount = (ShortPointer.LAST-ShortPointer.FIRST).LONG.SUCC/wordsPerPage;
RawWords: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF WORD];
RawCards: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF CARDINAL];
RawBytes: TYPE = RECORD [PACKED SEQUENCE COMPUTED CARDINAL OF BYTE];
RawChars: TYPE = RECORD [PACKED SEQUENCE COMPUTED CARDINAL OF CHAR];
Declarations for Faces (wizards only)
Base: TYPE = LONG BASE POINTER; -- (from Mesa>Public>Environment.mesa)
first64K: Base = LOOPHOLE[LONG[0]]; -- base pointer to the first 64K of virtual memory
VMPartition:
TYPE = {lowCore, pda, mds, normalVM};
In XDE, lowCore is "first64K", normalVM is "hyperspace"
Alignment:
TYPE = {a1, a2, a4, a8, a16};
-- (from Mesa>Public>ResidentHeap.mesa)
= {a1 (word aligned), a2 (double word aligned), a4 (quad word aligned),
a8 (eight-word aligned), a16 (16-word aligned)}
Instruction Set (wizards only)
Instructions
op: TYPE = [0..400B);
Alpha byte values
alpha: TYPE = [0..400B);
aASSOC: alpha = 0B; -- obsolete
aSETF: alpha = 1B; -- obsolete
aREADRAM: alpha = 2B;
aLOADRAMJ: alpha = 3B;
a4: alpha = 4B; -- unused
aINPUT: alpha = 5B;
aOUTPUT: alpha = 6B;
aCHKSUM: alpha = 7B;
aSETMP: alpha = 10B;
aRCLK: alpha = 11B;
aRPRINTER: alpha = 12B;
aWPRINTER: alpha = 13B;
aBANDBLT: alpha = 14B;
aTEXTBLT: alpha = 15B;
aGETF: alpha = 16B; -- obsolete
a17: alpha = 17B; -- unused
Floating Point (20B-57B are reserved)
aFADD: alpha = 20B;
aFSUB: alpha = 21B;
aFMUL: alpha = 22B;
aFDIV: alpha = 23B;
aFCOMP: alpha = 24B;
aFIX: alpha = 25B;
aFLOAT: alpha = 26B;
aFIXI: alpha = 27B;
aFIXC: alpha = 30B;
aFSTICKY: alpha = 31B;
aFREM: alpha = 32B;
aROUND: alpha = 33B;
aROUNDI: alpha = 34B;
aROUNDC: alpha = 35B;
aFSQRT: alpha = 36B;
Runtime types
aGETCANONICALREFERENTTYPE: alpha = 72B;
Miscellaneous
aZERO: alpha = 102B;
aVERSION: alpha = 104B;
[105B..117B] reserved for DLion
SafeStorage microcode
aRECLAIMEDREF: alpha = 140B;
aENABLEMICROCODE: alpha = 141B;
aDISABLEMICROCODE: alpha = 142B;
aCREATEREF: alpha = 143B;
aRECLAIMABLEREF: alpha = 144B;
aALLOCATEOBJECT: alpha = 145B;
aFREEOBJECT: alpha = 146B;
Long map operations
aSETMAP: alpha = 150B;
aGETMAPFLAGS: alpha = 151B;
aSETMAPFLAGS: alpha = 152B;
[240B..257B] reserved for Dorado
Data Types For Xfer (wizards only)
Control links
ControlLinkTag: TYPE = {frame, procedure, indirect, rep};
ControlLink:
TYPE =
MACHINE
DEPENDENT
RECORD [
SELECT
OVERLAID ControlLinkTag
FROM
frame => [frame: FrameHandle],
procedure => [gfi: GFTIndex, ep: EPIndex, tag: BOOL],
indirect => [
SELECT
OVERLAID *
FROM
port => [port: PortHandle],
link => [link: POINTER TO ControlLink],
ENDCASE
],
rep => [fill: [0..37777B], indirect: BOOL, proc: BOOL],
ENDCASE
ProcDesc, SignalDesc: TYPE = procedure ControlLink;
TrapLink, NullLink: ControlLink = ControlLink[frame[NullFrame]];
UnboundLink: ControlLink = ControlLink[procedure[gfi: 0, ep: 0, tag: TRUE]];
PortHandle: TYPE = POINTER TO Port;
Port:
TYPE =
MACHINE
DEPENDENT
RECORD [
SELECT
OVERLAID *
FROM
representation => [in, out: WORD],
links => [frame: FrameHandle, dest: ControlLink],
ENDCASE
Frames
MaxFrameSize: CARDINAL = 4096 - 4;
MaxSmallFrameIndex: CARDINAL = 17;
FrameVec:
ARRAY FrameSizeIndex
OF [0..MaxFrameSize] = [
7, 11, 15, 19, 23, 27, 31, 39, 47, 55, 67, 79, 95, 111, 127, 147, 171, 203,
252, 508, 764, 1020, 1276, 1532, 1788, 2044, 2554, 3068, 3580, 4092];
FrameClass: TYPE = {global, local, signal, catch, dying};
Local frame format
Frame:
TYPE =
MACHINE
DEPENDENT
RECORD [
accesslink: GlobalFrameHandle,
pc: BytePC,
returnlink: ControlLink,
extensions:
SELECT
OVERLAID FrameClass
FROM
local => [unused: WORD, local: SEQUENCE COMPUTED CARDINAL OF WORD],
signal => [mark: BOOL, unused: [0..77777B]],
catch => [unused: WORD, staticlink: FrameHandle, messageval: WORD],
dying => [state: {dead, alive}, unused: [0..77777B]],
ENDCASE
FrameHandle: TYPE = POINTER TO Frame;
NullFrame: FrameHandle = NIL;
accessOffset: CARDINAL = 0; -- OFFSET[Frame.accesslink]
pcOffset: CARDINAL = 1; -- OFFSET[Frame.pc]
returnOffset: CARDINAL = 2; -- OFFSET[Frame.returnlink]
markOffset: CARDINAL = 3; -- OFFSET[Frame.mark]
localbase: CARDINAL = SIZE[local Frame];
framelink: CARDINAL = localbase;
Global frame format
GlobalFrame:
TYPE =
MACHINE
DEPENDENT
RECORD [
gfi: GFTIndex,
copied, alloced, shared, started: BOOL,
trapxfers, codelinks: BOOL,
code: FrameCodeBase,
extensions:
SELECT
OVERLAID *
FROM
global => [global: SEQUENCE COMPUTED CARDINAL OF WORD],
ENDCASE
];
FrameCodeBase:
TYPE =
MACHINE
DEPENDENT
RECORD [
SELECT
OVERLAID *
FROM
long => [longbase: LONG POINTER],
cseg => [cseg: PrefixHandle],
either => [fill: [0..77777B], out: BOOL, highByte, otherByte: BYTE],
ENDCASE
GlobalFrameHandle: TYPE = POINTER TO GlobalFrame;
NullGlobalFrame: GlobalFrameHandle = NIL;
NullProgram: PROGRAM = NIL;
gfiOffset: CARDINAL = 0; -- OFFSET[GlobalFrame.gfi]
codebaseOffset: CARDINAL = 1; -- OFFSET[GlobalFrame.code]
globalbase: CARDINAL = SIZE[GlobalFrame];
Code segment format
BytePC: TYPE = RECORD [CARDINAL];
InstWord: TYPE = MACHINE DEPENDENT RECORD [evenbyte, oddbyte: BYTE];
FieldDescriptor:
TYPE =
MACHINE
DEPENDENT
RECORD [
offset: BYTE, posn: [0..bitsPerWord), size: [1..bitsPerWord]
];
EPRange: CARDINAL = 32;
EPIndex: TYPE = [0..EPRange);
CSegPrefix:
TYPE =
MACHINE
DEPENDENT
RECORD [
header: PrefixHeader,
entry: SEQUENCE COMPUTED CARDINAL OF EntryVectorItem
];
Note: the global frame size (in words) is in the word preceding the body of procedure 0.
PrefixHandle: TYPE = LONG POINTER TO CSegPrefix;
PrefixHeader:
TYPE =
MACHINE
DEPENDENT
RECORD [
swapinfo: WORD, info: PrefixInfo];
PrefixInfo:
TYPE =
MACHINE
DEPENDENT
RECORD [
stops: BOOL,
altoCode: BOOL, -- obsolete
fill: [0..17B],
ngfi: [1..MaxNGfi],
nlinks: [0..MaxNLinks]
];
EntryVectorItem:
TYPE =
MACHINE
DEPENDENT
RECORD [
initialpc: BytePC, -- (currently implemented as WordPC)
info: EntryInfo
];
EntryInfo:
TYPE =
MACHINE
DEPENDENT
RECORD [
defaults: BOOL, nparams: [0..177B], framesize: [0..377B]
];
MaxNLinks: CARDINAL = 255;
MainBodyIndex: CARDINAL = 0;
Global Frame Table format
GFTIndex: TYPE = [0..1777B];
GFTNull: GFTIndex = 0;
GFTHandle: TYPE = POINTER TO GFTable;
GFTable: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF GFTItem];
GFT: GFTHandle = LOOPHOLE[1400B];
GFTItem:
TYPE =
MACHINE
DEPENDENT
RECORD [
SELECT
OVERLAID *
FROM
frame => [framePtr: GlobalFrameHandle],
ep => [data: [0..37777B], epbias: EPBias],
ENDCASE
MaxNGfi: CARDINAL = 4;
MaxGFTSize: CARDINAL = (LAST[GFTIndex] + 1)*SIZE[GFTItem];
EPBias: TYPE = [0..MaxNGfi);
EmptyGFTItem: GFTItem = [ep[data: 0, epbias: EPBias.FIRST]];
FreedGFTItem: GFTItem = [ep[data: 0, epbias: EPBias.LAST]];
Allocation Vector format
AllocTag: TYPE = {frame, empty, indirect, enable};
AVItem:
TYPE =
MACHINE
DEPENDENT
RECORD [
SELECT
OVERLAID *
FROM
data => [fsi: [0..37777B], tag: AllocTag],
link => [link: POINTER TO AVItem],
frame => [frame: FrameHandle],
ENDCASE
AllocationVectorSize: CARDINAL = 40B;
LastAVSlot: CARDINAL = AllocationVectorSize - 3;
FrameSizeIndex: TYPE = [0..LastAVSlot];
AllocationVector: TYPE = ARRAY [0..AllocationVectorSize) OF AVItem;
AVHandle: TYPE = POINTER TO AllocationVector;
AV: AVHandle = LOOPHOLE[1000B];
The following frame sizes are not generated by the Compiler
LargeReturnSlot: CARDINAL = AllocationVectorSize - 2;
SpecialReturnSlot: CARDINAL = AllocationVectorSize - 1;
Control Module format
ControlModule:
TYPE =
MACHINE
DEPENDENT
RECORD [
SELECT
OVERLAID *
FROM
frame => [frame: GlobalFrameHandle],
list => [list: POINTER TO FrameList],
tag => [fill: [0..77777B], multiple: BOOL],
ENDCASE
FrameList:
TYPE =
MACHINE
DEPENDENT
RECORD [
nModules: CARDINAL,
frames: SEQUENCE COMPUTED CARDINAL OF GlobalFrameHandle
];
NullControl: ControlModule = [frame[NullGlobalFrame]];
System Dispatch Vector format
SD: POINTER TO RawWords = LOOPHOLE[1100B];
[0..37B] are known by microcode, the rest are assigned by software convention
sBreak: CARDINAL = 0;
sStackError: CARDINAL = 2;
sWakeupError: CARDINAL = 3;
sXferTrap: CARDINAL = 4;
sUnimplemented: CARDINAL = 5;
sAllocTrap: CARDINAL = 6;
sControlFault: CARDINAL = 7;
sSwapTrap: CARDINAL = 10B;
sPageFault: CARDINAL = 11B;
sWriteProtect: CARDINAL = 12B;
sUnbound: CARDINAL = 13B;
sZeroDivisor: CARDINAL = 14B;
sDivideCheck: CARDINAL = 15B;
sHardwareError: CARDINAL = 16B;
sProcessTrap: CARDINAL = 17B;
sBoundsFault: CARDINAL = 20B;
sPointerFault: CARDINAL = 21B;
Signals
sSignalList: CARDINAL = 40B;
sSignal: CARDINAL = 41B;
sErrorList: CARDINAL = 42B;
sError: CARDINAL = 43B;
sReturnErrorList: CARDINAL = 44B;
sReturnError: CARDINAL = 45B;
sUnnamedError: CARDINAL = 46B;
sUncaughtSignal: CARDINAL = 47B;
Instructions (to be removed in Trinity and implemented by opcode trapping)
sBLTE: CARDINAL = 52B;
sBYTBLTE: CARDINAL = 53B;
sBLTEC: CARDINAL = 54B;
sBYTBLTEC: CARDINAL = 55B;
sBLTEL: CARDINAL = 56B;
sBYTBLTEL: CARDINAL = 57B;
sBLTECL: CARDINAL = 60B;
sBYTBLTECL: CARDINAL = 61B;
sStringInit: CARDINAL = 62B;
sSignedDiv: CARDINAL = 63B;
sLongMul: CARDINAL = 64B;
sLongDivMod: CARDINAL = 65B;
sLongDiv: CARDINAL = 66B;
sLongMod: CARDINAL = 67B;
sULongDivMod: CARDINAL = 70B;
sULongDiv: CARDINAL = 71B;
sULongMod: CARDINAL = 72B;
sLongStringCheck: CARDINAL = 73B;
Frames
sCopy: CARDINAL = 75B; -- implements NEW <PROGRAM>
sStart: CARDINAL = 77B; -- implements START <PROGRAM>
sRestart: CARDINAL = 100B; -- implements RESTART <PROGRAM>
sGFTLength: CARDINAL = 101B;
Debugger (should be moved elsewhere, e.g., the debugger Nub)
sAlternateBreak: CARDINAL = 103B;
sIOResetBits: CARDINAL = 113B;
sBreakBlock: CARDINAL = 114B;
sBreakBlockSize: CARDINAL = 115B;
sPerfMonitor: CARDINAL = 116B;
sLogging: CARDINAL = 117B;
sXferTrapMonitor: CARDINAL = 120B;
sCrossMDSLow: CARDINAL = 121B;
sCrossMDSHigh: CARDINAL = 122B;
Processes
sFork: CARDINAL = 124B; -- implements FORK <proc>
sJoin: CARDINAL = 125B; -- implements JOIN <PROCESS>
Floating Point (to be removed in Trinity and implemented by opcode trapping)
sFADD: CARDINAL = 130B;
sFSUB: CARDINAL = 131B;
sFMUL: CARDINAL = 132B;
sFDIV: CARDINAL = 133B;
sFCOMP: CARDINAL = 134B;
sFIX: CARDINAL = 135B;
sFLOAT: CARDINAL = 136B;
Miscellaneous
sBootSwitches: CARDINAL = 142B;
sFirstCedar: CARDINAL = 150B;
sLastCedar: CARDINAL = 277B;
sLastSD: CARDINAL = 277B;
Xfer traps
XferTrapStatus:
TYPE =
MACHINE
DEPENDENT {
off(0), on(1), skip1(2), skip2(4), skip3(8), skip4(16), (65535)};
Data Types for Process machinery (wizards only)
State vector format
SVPointer: TYPE = POINTER TO StateVector;
stackDepth: CARDINAL = 14;
sd1: CARDINAL = stackDepth+1;
sd2: CARDINAL = stackDepth+2;
StateVector:
TYPE =
MACHINE
DEPENDENT
RECORD [
stk(0): ARRAY [0..stackDepth) OF WORD,
instbyte(stackDepth:0..7): BYTE,
stkptr(stackDepth:8..15): BYTE, -- 0 => empty stack
data(sd1):
SELECT
OVERLAID *
FROM
dst => NULL,
lst => [dest(sd1), source(sd2): ControlLink],
fault => [
frame(sd1): POINTER TO local Frame,
faultData(sd2):
SELECT
OVERLAID *
FROM
allocFault => [fsi(sd2): FrameSizeIndex],
memFault => [memPointer(sd2): LONG POINTER],
otherFault => [data0(sd2):
WORD, data1(sd2+1):
WORD],
If other words are needed then they go after this, one has to use pointer arithmetic. We would like this variant to be SEQUENCE COMPUTED CARDINAL OF WORD, but the compiler is not obliging.
ENDCASE
],
ENDCASE
MaxParamsInStack: CARDINAL = stackDepth - 3;
Process Data Area format
PDABase: TYPE = LONG BASE POINTER TO ProcessDataArea;
PDA: PDABase = LOOPHOLE[200000B];
ProcessDataArea:
TYPE =
MACHINE
DEPENDENT
RECORD [
vp(0):
SELECT
OVERLAID *
FROM
header => [
ready(0): Queue,
count(1):
CARDINAL,
number of PSB's (excludes global info overlaid on PDABase.PSB[0..StartPsb) ).
timeout(2): PDABase RELATIVE POINTER TO TimeoutVector,
available(3): ARRAY [0..5) OF WORD ← ALL[0],
state(10B): StateAllocationTable,
interrupt(20B): InterruptVector,
fault(60B): FaultVector
],
blocks => [block(0): SEQUENCE COMPUTED CARDINAL OF ProcessStateBlock],
ENDCASE
PsbIndex: TYPE = CARDINAL [0..1024);
PsbNull: PsbIndex = 0;
StartPsb: PsbIndex =
-- first actual Psb follows header.
(SIZE[ProcessDataArea] + SIZE[ProcessStateBlock] - 1)/SIZE[ProcessStateBlock];
PsbHandle: TYPE = PDABase RELATIVE POINTER TO ProcessStateBlock;
NullPsbHandle: PsbHandle = LOOPHOLE[0];
ProcessStateBlock:
TYPE =
MACHINE
DEPENDENT
RECORD [
link(0): PsbLink,
flags(1): PsbFlags,
context(2): Context,
mds(3): CARDINAL -- temporarily used for timeout until moved to timeoutVector.
];
Context:
TYPE =
MACHINE
DEPENDENT
RECORD [
context(0):
SELECT
OVERLAID *
FROM
frame => [frame(0): --PrincOps.--FrameHandle], -- (in the psb's mds.)
state => [state(0): StateVectorHandle],
ENDCASE
Priority: TYPE = [0..7];
PsbLink:
TYPE =
MACHINE
DEPENDENT
RECORD [
failed(0:0..0): BOOL,
priority(0:1..3): Priority,
next(0:4..13): PsbIndex,
reserved(0:14..14): [0..1] ← 0,
vector(0:15..15): BOOL
];
PsbFlags:
TYPE =
MACHINE
DEPENDENT
RECORD [
processState(0:0..2): ProcessState ← NULL, -- used by software only
reserved(0:3..3): [0..1] ← 0,
cleanup(0:4..13): PsbIndex,
waiting(0:14..14): BOOL,
abort(0:15..15): BOOL
];
ProcessState:
TYPE =
MACHINE
DEPENDENT
RECORD [
state(0:0..1):
MACHINE
DEPENDENT {
frameReady(0), -- child process ready to be Joined (or Detached).
frameTaken(1), -- parent process has recorded child's frameHandle.
dead(2), -- child process has finished all cleanup, and is dead.
alive(3)}, -- normal state of running process.
detached(0:2..2): BOOL
];
Monitor and Condition Variable format
Monitor:
TYPE =
MACHINE
DEPENDENT
RECORD [
reserved(0:0..3): [0..17B] ← 0,
tail(0:4..13): PsbIndex,
available(0:14..14): [0..1] ← 0,
locked(0:15..15): BOOL
];
LockedEmpty: Monitor = [tail: PsbNull, locked: TRUE];
UnlockedEmpty: Monitor = [tail: PsbNull, locked: FALSE];
Condition:
TYPE =
MACHINE
DEPENDENT
RECORD [
reserved(0:0..3): [0..17B] ← 0,
tail(0:4..13): PsbIndex,
abortable(0:14..14): BOOL,
wakeup(0:15..15): BOOL
];
ConditionVariable:
TYPE =
MACHINE
DEPENDENT
RECORD [
condition(0): Condition,
timeout(1): Ticks
];
Queue format
QueueHandle: TYPE = LONG POINTER TO Queue;
Queue:
TYPE =
MACHINE
DEPENDENT
RECORD [
(Note: format matches that of condition variables and monitor locks.)
reserved1(0:0..3): [0..17B] ← 0,
tail(0:4..13): PsbIndex,
reserved2(0:14..15): [0..3] ← 0
];
QueueEmpty: Queue = [tail: PsbNull];
StateAllocationTable: TYPE = ARRAY Priority OF StateVectorHandle;
StateVectorHandle: TYPE = PDABase RELATIVE POINTER TO --PrincOps.--StateVector;
NullStateVectorHandle: StateVectorHandle = LOOPHOLE[0];
Faults
FaultVector: TYPE = ARRAY FaultIndex OF FaultQueue;
FaultIndex: TYPE = [0..8);
qFrameFault: FaultIndex = 0;
qPageFault: FaultIndex = 1;
qWriteProtectFault: FaultIndex = 2;
FaultQueue:
TYPE =
MACHINE
DEPENDENT
RECORD [
queue(0): Queue, condition(1): Condition
];
Interrupts
InterruptVector:
TYPE =
ARRAY InterruptLevel
OF InterruptItem;
InterruptLevel:
TYPE = [0..bitsPerWord);
InterruptItem:
TYPE =
MACHINE
DEPENDENT
RECORD [
condition(0): Condition,
available(1): WORD -- temp used for timeout till timeoutVector.
];
Timeouts
TimeoutVector:
TYPE =
-- (must be 16-word aligned.)
ARRAY PsbIndex OF Ticks; -- (only PDA.count are actually used.)
Data Structures for Virtual Memory Map (wizards only)
RealPageNumber:
TYPE =
CARDINAL;
There is an implicit limitation to 24 bits of real address here.
PageState:
TYPE =
MACHINE
DEPENDENT
RECORD [
processorDependent(0:0..12): ProcessorDependent ← NULL,
flags(0:13..15): PageFlags
];
PageFlags:
TYPE =
MACHINE
DEPENDENT
RECORD [
readonly(0:0..0): BOOL, -- (0 for FALSE, 1 for TRUE.)
dirty(0:1..1): BOOL,
referenced(0:2..2): BOOL
];
PageValue:
TYPE =
MACHINE
DEPENDENT
RECORD [
state(0:0..15): PageState,
real(1:0..15): RealPageNumber
];
ProcessorDependent: TYPE = MACHINE DEPENDENT RECORD [bits(0:0..12): CARDINAL [0..17777B]];
flagsClean, flagsNone: PageFlags = [readonly: FALSE, dirty: FALSE, referenced: FALSE];
flagsDirty: PageFlags = [readonly: FALSE, dirty: TRUE, referenced: FALSE];
flagsDirtyReferenced: PageFlags = [readonly: FALSE, dirty: TRUE, referenced: TRUE];
flagsReadOnly: PageFlags = [readonly: TRUE, dirty: FALSE, referenced: FALSE];
flagsReadOnlyReferenced: PageFlags = [readonly: TRUE, dirty: FALSE, referenced: TRUE];
flagsVacant: PageFlags = [readonly: TRUE, dirty: TRUE, referenced: FALSE];
flagsReadOnlyDirtyReferenced: PageFlags = [readonly: TRUE, dirty: TRUE, referenced: TRUE];
B0: BOOL = FALSE;
B1: BOOL = TRUE;
maskNone: PageFlags = [readonly: B0, dirty: B0, referenced: B0];
maskReferenced: PageFlags = [readonly: B0, dirty: B0, referenced: B1];
maskDirty: PageFlags = [readonly: B0, dirty: B1, referenced: B0];
maskDirtyReferenced: PageFlags = [readonly: B0, dirty: B1, referenced: B1];
maskReadOnly: PageFlags = [readonly: B1, dirty: B0, referenced: B0];
maskReadOnlyReferenced: PageFlags = [readonly: B1, dirty: B0, referenced: B1];
maskReadOnlyDirty: PageFlags = [readonly: B1, dirty: B1, referenced: B0];
maskAll: PageFlags = [readonly: B1, dirty: B1, referenced: B1];
Data Structures for ByteBlt (wizards only)
ByteBltBlock:
TYPE =
MACHINE
DEPENDENT
RECORD [
blockPointer: LONG POINTER,
startIndex, stopIndexPlusOne: CARDINAL
];
nullByteBltBlock: ByteBltBlock = [NIL, 0, 0];
Data Structures for BitBlt (wizards only)
BitAddress:
TYPE =
MACHINE
DEPENDENT
RECORD [
word: LONG POINTER,
reserved: [0..LAST[WORD]/bitsPerWord) ← 0,
bit: [0..bitsPerWord)
];
BitBltFlags:
TYPE =
MACHINE
DEPENDENT
RECORD [
determines the BitBlt function
direction: Direction ← forward,
disjoint: BOOL ← FALSE,
disjointItems: BOOL ← FALSE,
gray: BOOL ← FALSE,
srcFunc: SrcFunc ← null,
dstFunc: DstFunc ← null,
reserved: [0..511] ← 0
];
Direction: TYPE = {forward, backward};
DstFunc: TYPE = {null, and, or, xor};
GrayParm:
TYPE =
MACHINE
DEPENDENT
RECORD [
used with Src to describe gray brick
reserved: [0..15] ← 0,
yOffset: [0..15],
widthMinusOne: [0..15],
restricted to 0 for initial microcode implementations
heightMinusOne: [0..15]
];
SrcDesc:
TYPE =
MACHINE
DEPENDENT
RECORD [
SELECT
OVERLAID *
FROM
gray => [gray: GrayParm],
srcBpl => [srcBpl: INTEGER],
ENDCASE
SrcFunc: TYPE = {null, complement};
BBptr, BitBltTablePtr: TYPE = POINTER TO BBTable;
BBTable, BitBltTable:
TYPE =
MACHINE
DEPENDENT
RECORD [
dst: BitAddress,
dstBpl: INTEGER,
src: BitAddress,
srcDesc: SrcDesc,
width: CARDINAL,
height: CARDINAL,
flags: BitBltFlags,
reserved: WORD ← 0
];
BBTableAlignment: CARDINAL = 16;
BBTableSpace: TYPE = ARRAY [1..SIZE[BBTable] + BBTableAlignment) OF WORD;
Data Structures for TextBlt (wizards only)
TextBltFunction: TYPE = {display, format, resolve};
TextBltArg:
TYPE =
MACHINE
DEPENDENT
RECORD [
reserved: [0..37777B] ← 0,
function: TextBltFunction, -- display, format or resolve
last: CARDINAL, -- index of last character to process
text: LONG POINTER TO RawChars,
font: TextBltFontHandle, -- Long Pointer to font information
dst: LONG POINTER, -- destination bitmap (display only)
dstBpl: CARDINAL, -- Bits per line (display only)
margin: CARDINAL, -- mica value of right margin (format only)
space: INTEGER, -- width adjustment to pad characters (display, resolve)
coord: POINTER TO RawCards -- widths array for resolve
];
TextBltArgAlignment: CARDINAL = 16;
TextBltArgSpace:
TYPE =
ARRAY [1..
SIZE[TextBltArg] + TextBltArgAlignment)
OF
WORD;
TextBltFontHandle: TYPE = LONG POINTER TO TextBltFont;
TextBltFont:
TYPE =
MACHINE
DEPENDENT
RECORD [
Quad-word aligned
font(0): LONG POINTER TO TextBltFontBody,
rgflags(2): Rgflags,
height(4): CARDINAL
];
Rgflags: TYPE = LONG POINTER TO PACKED ARRAY CHAR OF CharFlags;
CharFlags: TYPE = MACHINE DEPENDENT RECORD [pad: BOOL, stop: BOOL];
TextBltFontBody:
TYPE =
MACHINE
DEPENDENT
RECORD [
char: ARRAY CHAR OF CharEntry, -- 512 words
widths: PACKED ARRAY CHAR OF BYTE, -- 128 words
bits: SEQUENCE COMPUTED CARDINAL OF WORD
];
CharEntry:
TYPE =
MACHINE
DEPENDENT
RECORD [
leftKern: BOOL, -- If true, character has one bit hanging out past left edge
rightKern: BOOL, -- If true, character has one bit hanging out past right edge
offset: [0..37777B],
-- 14 bit offset to first word for this character
Note that this offset is measured from the bits origin, not TextBltFontBody. This is a word offset to the first scan line of the character. As a temporary implementation restriction, each scan line of the character starts on a word boundary.
mica: CARDINAL -- Mica width for this characer
];
TextBltResult: TYPE = {normal, margin, stop};
Miscellaneous (wizards only)
Control registers known by the microcode
PSBreg: CARDINAL = 0; -- current process
WDCreg: CARDINAL = 1; -- wakeup disable counter
XTSreg: CARDINAL = 2; -- xfer trap status
MDSreg: CARDINAL = 3; -- main data space
Note: 4, 5, and 6 are unused.
PDAreg: CARDINAL = 7; -- process data area
PTCreg: CARDINAL = 8; -- process tick count
Microcode and machine version information
MachineType:
TYPE =
MACHINE
DEPENDENT {
altoI (1), altoII (2), altoIIXM (3),
dolphin (4), dorado (5), dandelion (6), dicentra (7),
daybreak (8), daisy(9), kiku (10),
(17B)
};
horizon: MachineType ~ kiku;
MDVFlags:
TYPE =
MACHINE
DEPENDENT
RECORD [
f0, f1, f2, f3, f4, f5: [0..1]
];
VersionResult:
TYPE =
MACHINE
DEPENDENT
RECORD [
machineType (0: 0..3): MachineType,
majorVersion (0: 4..7): [0..17B], -- incremented by incompatible changes
mdvFlags (0: 8..13): MDVFlags, -- machine dependent version flags, by number only
floatingPoint (0: 14..14): BOOL,
cedar (0: 15..15): BOOL,
releaseDate (1): CARDINAL -- days since January 1, 1901
];
END