~
BEGIN
wordsPerPage: NAT ~ PrincOps.wordsPerPage;
IOAddress:
TYPE ~ DoradoInputOutput.IOAddress;
selCmd: IOAddress = 320B;
addrCmd: IOAddress = 321B;
dataCmd: IOAddress = 322B;
taskCmd: IOAddress = 323B;
config0Cmd: IOAddress = 324B;
config1Cmd: IOAddress = 325B;
wordsPerMunch: NAT ~ 16;
HardwareConfig:
TYPE ~
MACHINE
DEPENDENT
RECORD [
rastAHere: BOOLEAN,
rastBHere: BOOLEAN,
ws: [0..37777B] ← 0
];
Config0:
TYPE ~
MACHINE
DEPENDENT
RECORD [
ABGetsAEdgeClk (0: 0 .. 0): BOOLEAN ← FALSE,
ws1 (0: 1 .. 5): [0..37B] ← 0,
OnGetsAHSync (0: 6 .. 6): BOOLEAN ← FALSE,
AHSyncGetsROSSync (0: 7 .. 7): BOOLEAN ← FALSE,
ws2 (0: 8 .. 8): [0..1] ← 0,
ABGetsTestClk (0: 9 .. 9): BOOLEAN ← FALSE,
ws3 (0: 10 .. 15): [0..77B] ← 0
];
defaultConfig0: Config0 ~ [FALSE, 0, FALSE, FALSE, 0, FALSE, 0];
ExtendedChannel: TYPE ~ MACHINE DEPENDENT {A (0), B (1), C (2), D (3)};
Channel: TYPE ~ ExtendedChannel [A..C];
MRBPointer: TYPE ~ LONG POINTER TO MRB;
MRB:
TYPE ~
RECORD [
Master Raster Block
seal: CARDINAL ← goodMRBSeal,
stb: STBPointer,
rcb: ARRAY Channel OF RCBPointer,
ccb: CCBPointer,
flags: CARDINAL,
interruptMask: WORD,
status: LTStatus
];
goodMRBSeal: CARDINAL ~ 177574B;
STBPointer: TYPE ~ LONG POINTER TO STB;
STB:
TYPE ~
RECORD [
State Transition Block
seal: CARDINAL ← goodSTBSeal,
lineCount: CARDINAL,
tStates: ARRAY [0..16) OF CARDINAL,
tCounts: ARRAY [0..16) OF CARDINAL,
next: STBPointer
];
goodSTBSeal: CARDINAL ~ 177570B;
RCBPointer: TYPE ~ LONG POINTER TO RCB;
RCB:
TYPE ~
RECORD [
Raster Channel Block
seal: CARDINAL ← goodRCBSeal,
next: RCBPointer,
extraLines: INTEGER, -- lines after the first one - 1 (= total lines - 2)
repeatCnt: INTEGER ← -1, -- The repeat count - 1.
ccr: ChannelControlRegister,
handshake: Handshake,
bitmap: LONG POINTER,
activeMunches: INTEGER,
wordsPerLine: CARDINAL,
indexIntoBuffer: CARDINAL,
status: Status
];
CCBPointer: TYPE ~ LONG POINTER TO CCB;
CCB:
TYPE ~
RECORD [
Control Channel Block
seal: CARDINAL ← goodRCBSeal,
next: CCBPointer,
extraLines: INTEGER, -- lines after the first one - 1 (= total lines - 2)
repeatCnt: INTEGER ← -1, -- The repeat count - 1.
ccr: ChannelControlRegister,
handshake: Handshake,
bitmap: LONG POINTER,
activeMunches: INTEGER,
wordsPerLine: CARDINAL,
indexIntoBuffer: CARDINAL,
status: Status,
cursorCtl: CursorCtl,
modeCtl: ModeCtl,
halftoneCtl: HalftoneCtl,
selCtl: SelCtl
];
ChannelStatus:
TYPE ~
MACHINE
DEPENDENT
RECORD [ badWake, badRCBSeal, rcbFinished:
BOOLEAN ];
csMask: WORD ~ 7B;
nullChannelStatus: ChannelStatus ~ [FALSE, FALSE, FALSE];
Channels: TYPE ~ PACKED ARRAY ExtendedChannel OF ChannelStatus;
LTStatus:
TYPE ~
MACHINE
DEPENDENT
RECORD [
microcodeDone (0:0..0): BOOL ← FALSE,
ws (0: 1..2): [0..3B] ← 0,
badSTBSeal (0: 3..3): BOOL ← FALSE,
channels (0: 4..15): Channels ← ALL[nullChannelStatus]
a (0: 4..6): ChannelStatus ← nullChannelStatus,
b (0: 7..9): ChannelStatus ← nullChannelStatus,
c (0: 10..12): ChannelStatus ← nullChannelStatus,
d (0: 13..15): ChannelStatus ← nullChannelStatus
];
channelsWidth: INTEGER ~ 12;
channelWidth: INTEGER ~ 3;
channelOffset: INTEGER ~ channelsWidth-channelWidth;
channels:
PROC [foo: LTStatus, chan: ExtendedChannel]
RETURNS [ChannelStatus] ~
TRUSTED
INLINE {
cnt: INTEGER ← LOOPHOLE[chan];
cnt ← (cnt+cnt+cnt)-channelOffset;
RETURN [LOOPHOLE[Basics.BITAND[Basics.BITSHIFT[LOOPHOLE[foo], cnt], csMask]]];
};
Reference the channel stuff as ltStatus.channels[chan]
nullLTStatus: LTStatus ~ LOOPHOLE[0];
Handshake:
TYPE ~
MACHINE
DEPENDENT
RECORD [
bitmapAddrValid (0: 0..0): BOOL ← FALSE,
ws (0: 1..15): [0..37777B] ← 0
];
Status:
TYPE ~
MACHINE
DEPENDENT
RECORD [
bitmapAddrValid (0: 0..0): BOOL ← FALSE,
ws (0: 1..14): [0..17777B] ← 0,
rcbComplete (0: 15..15): BOOL ← FALSE
];
goodRCBSeal: CARDINAL = 177573B;
ItemSize: TYPE = MACHINE DEPENDENT {b1 (0), b2 (1), b4 (2), b8 (3), b10 (4), b12 (7)};
ChannelControlRegister:
TYPE =
MACHINE
DEPENDENT
RECORD [
-- NLCB word 0 + 2*channel #
ws1 (0: 0 .. 0): [0..0]← 0,
dontSwapBuffers (0: 1 .. 1): BOOL ← FALSE, -- Inhibits swapping of scan line buffers
ws2 (0: 2 .. 2): [0..0]← 0,
itemClockRes (0: 3 .. 6): [0 .. 16) ← 15, -- The a item clock resolution (2's compliment)
reverse (0: 7 .. 7): BOOL ← FALSE, -- Should the scan line be read out reverse
mosaic (0: 8 .. 8): BOOL ← FALSE, -- Should the pixels be replicated by itemClockRes
itemIs10Bit (0: 9 .. 9): BOOL ← FALSE, -- Enable bits 8 and 9 of the channel
itemIs12Bit (0: 10 .. 10): BOOL ← FALSE, -- Enable bits 10 and 11 of the channel
ws3 (0: 11 .. 12): [0..0]← 0,
itemSize (0: 13 .. 15): ItemSize ← b1 -- The number of bits per pixel
];
CursorCtl:
TYPE ~
MACHINE
DEPENDENT
RECORD [
-- NLCB word 8
ws (0: 0 .. 11): [0..4096) ← 0,
cur4OnThisLine (0: 12 .. 12): BOOLEAN ← FALSE,
cur5OnThisLine (0: 13 .. 13): BOOLEAN ← FALSE,
cur6OnThisLine (0: 14 .. 14): BOOLEAN ← FALSE,
cur7OnThisLine (0: 15 .. 15): BOOLEAN ← FALSE
];
defaultCursorCtl: CursorCtl ~ [0, FALSE, FALSE, FALSE, FALSE];
ModeCtl:
TYPE ~
MACHINE
DEPENDENT
RECORD [
-- NLCB word 9
ws (0: 0 .. 4): [0..32) ← 0,
notMode2 (0: 5 .. 5): BOOLEAN ← FALSE,
useDCntr (0: 6 .. 6): BOOLEAN ← FALSE,
useModeBitForMask (0: 7 .. 7): BOOLEAN ← FALSE,
bBufToAItem (0: 8 .. 8): BOOLEAN ← FALSE,
channelSelCode (0: 9 .. 15): [0..128) ← 0
];
defaultModeCtl: ModeCtl ~ [0, FALSE, FALSE, FALSE, FALSE, 0];
HalftoneCtl:
TYPE ~
MACHINE
DEPENDENT
RECORD [
-- NLCB word 10
ws (0: 0 .. 3): [0..16) ← 0,
invertMask (0: 4 .. 4): BOOLEAN ← FALSE,
halftone (0: 5 .. 5): BOOLEAN ← FALSE,
htInvert (0: 6 .. 6): BOOLEAN ← FALSE,
useRCntr (0: 7 .. 7): BOOLEAN ← FALSE,
rCnt (0: 8 .. 15): [0..256) ← 0
];
defaultHalftoneCtl: HalftoneCtl ~ [0, FALSE, FALSE, FALSE, FALSE, 0];
SelCtl:
TYPE ~
MACHINE
DEPENDENT
RECORD [
-- NLCB word 11
ws (0: 0 .. 4): [0..32) ← 0,
useDDA (0: 5 .. 5): BOOLEAN ← FALSE,
ctrlSel (0: 6 .. 7): [0..3] ← 0,
useAForCtrl (0: 8 .. 8): BOOLEAN ← FALSE,
useBForCtrl (0: 9 .. 9): BOOLEAN ← FALSE,
useCForCtrl (0: 10 .. 10): BOOLEAN ← FALSE,
useDForCtrl (0: 11 .. 11): BOOLEAN ← FALSE,
ctrlMask (0:12 .. 15): [0..15] ← 0
];
defaultSelCtl: SelCtl ~ [0, FALSE, 0, FALSE, FALSE, FALSE, FALSE, 0];