HandCoding.mesa
Copyright © 1984, 1985, 1986 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) April 21, 1987 1:54:21 pm PDT
DIRECTORY
DragOpsCross USING [ShortRegQR, Word];
HandCoding: CEDAR DEFINITIONS = BEGIN
Errors
IllegalDst: ERROR;
IllegalReg: ERROR;
IllegalSrc: ERROR;
IllegalMix: ERROR;
Register Declarations
LocalRegIndex: TYPE = [0..15];
AuxRegIndex: TYPE = [0..15];
ConstIndex: TYPE = [0..11];
SrcStackIndex: TYPE = [0..15]; -- 12..15 only are valid
DstStackIndex: TYPE = [0..15]; -- 12..15 only are valid
RegSpec: TYPE = RECORD[SELECT kind: * FROM
reg => [reg: LocalRegIndex],
aux => [aux: AuxRegIndex],
const => [const: ConstIndex],
srcStack => [stack: SrcStackIndex],
dstStack => [stack: DstStackIndex],
ENDCASE];
LocalRegSpec: TYPE = RegSpec[reg];
AuxRegSpec: TYPE = RegSpec[aux];
ConstSpec: TYPE = RegSpec[const];
SrcStackSpec: TYPE = RegSpec[srcStack];
DstStackSpec: TYPE = RegSpec[dstStack];
reg0: LocalRegSpec = [reg[0]];
reg1: LocalRegSpec = [reg[1]];
reg2: LocalRegSpec = [reg[2]];
reg3: LocalRegSpec = [reg[3]];
reg4: LocalRegSpec = [reg[4]];
reg5: LocalRegSpec = [reg[5]];
reg6: LocalRegSpec = [reg[6]];
reg7: LocalRegSpec = [reg[7]];
reg8: LocalRegSpec = [reg[8]];
reg9: LocalRegSpec = [reg[9]];
reg10: LocalRegSpec = [reg[10]];
reg11: LocalRegSpec = [reg[11]];
reg12: LocalRegSpec = [reg[12]];
reg13: LocalRegSpec = [reg[13]];
reg14: LocalRegSpec = [reg[14]];
reg15: LocalRegSpec = [reg[15]];
The first 8 auxilliary registers can only written from kernel mode
global: AuxRegSpec = [aux[0]]; -- base of global frame table
hook: AuxRegSpec = [aux[1]]; -- addr of eldest frame saved to memory (per process)
free: AuxRegSpec = [aux[2]]; -- free frame slot addr (per processor)
base: AuxRegSpec = [aux[3]]; -- base of frame slots (per processor)
process: AuxRegSpec = [aux[4]]; -- addr of current process object (per process)
processor: AuxRegSpec = [aux[5]]; -- addr of current processor block
aux6: AuxRegSpec = [aux[6]]; -- # 0 => trace and sweep collection prohibited
aux7: AuxRegSpec = [aux[7]];
The second 8 auxilliary registers can be written from user mode
aux8: AuxRegSpec = [aux[8]];
aux9: AuxRegSpec = [aux[9]];
aux10: AuxRegSpec = [aux[10]];
aux11: AuxRegSpec = [aux[11]];
aux12: AuxRegSpec = [aux[12]];
noTS: AuxRegSpec = [aux[13]]; -- # 0 => trace and sweep collection prohibited
temp: AuxRegSpec = [aux[14]]; -- just used for stack save/restore
nregs: AuxRegSpec = [aux[15]]; -- just used for stack save/restore
The constant registers can only written from kernel mode
const0: ConstSpec = [const[0]]; -- constant 0
const1: ConstSpec = [const[1]]; -- constant 1
const2: ConstSpec = [const[2]]; -- constant 2
const3: ConstSpec = [const[3]]; -- constant 3
const4: ConstSpec = [const[4]]; -- constant 4
constN2: ConstSpec = [const[5]]; -- constant - 2
constN1: ConstSpec = [const[6]]; -- constant - 1
constNI: ConstSpec = [const[7]]; -- constant FIRST[INT]
constNSI: ConstSpec = [const[8]]; -- constant 100000B
constU9: ConstSpec = [const[9]]; -- unspecified right now
constU10: ConstSpec = [const[10]]; -- unspecified right now
constU11: ConstSpec = [const[11]]; -- unspecified right now
stack options for sources (RRformInst & RJBformInst)
topSrc: SrcStackSpec = [srcStack[12]];
belowSrc: SrcStackSpec = [srcStack[13]];
popSrc: SrcStackSpec = [srcStack[14]];
belowSrcPop: SrcStackSpec = [srcStack[15]];
stack options for destinations (RRformInst)
topDst: DstStackSpec = [dstStack[12]];
belowDst: DstStackSpec = [dstStack[13]];
pushDst: DstStackSpec = [dstStack[15]];
ShortRegSpec: TYPE = MACHINE DEPENDENT {
Must be consistent with DragOpsCross.ShortRegRJB for numbers, but should be consistent with HandCoding.RegSpec for names.
const0(0), -- constant 0
const1(1), -- constant 1
topSrc(2), -- [S]
popSrc(3)}; -- [S]-
Useful operand types
Lit4: TYPE = CARDINAL[0..15];
Lit8: TYPE = CARDINAL[0..255];
Lit16: TYPE = CARDINAL;
Reg: TYPE = CARDINAL[0..15];
Machine Instruction Declarations
OQBformInst: TYPE = PROC [rest: DragOpsCross.Word];
drDFC: OQBformInst;
drLIQB: OQBformInst;
drADDQB: OQBformInst;
drSUBQB: OQBformInst;
drJQB: OQBformInst;
OIformInst: TYPE = PROC [];
drOR: OIformInst;
drAND: OIformInst;
drRX: OIformInst;
drBC: OIformInst;
drADD: OIformInst;
drSUB: OIformInst;
drLADD: OIformInst;
drLSUB: OIformInst;
drDUP: OIformInst;
drDIS: OIformInst;
drEXDIS: OIformInst;
drSFC: OIformInst;
drSFCI: OIformInst;
drRETN: OIformInst;
drKFC: OIformInst;
drJ1: OIformInst;
drJSD: OIformInst;
drJSR: OIformInst;
drLC0: OIformInst;
drLC1: OIformInst;
drLC2: OIformInst;
drLC3: OIformInst;
drLC4: OIformInst;
drLC5: OIformInst;
drLC6: OIformInst;
drLC7: OIformInst;
drLC8: OIformInst;
drLC9: OIformInst;
drLC10: OIformInst;
drLC11: OIformInst;
The following are not really OIformat as far as the machine is concerned, but it is best for the hand coder to regard them as single-byte opcodes.
drJ2: OIformInst;
drJ3: OIformInst;
drJ5: OIformInst;
LRformInst: TYPE = PROC [reg: RegSpec];
drLRn: LRformInst;
drSRn: LRformInst;
QRformInst: TYPE = PROC [left: DragOpsCross.ShortRegQR, right: RegSpec];
drQOR: QRformInst;
drQAND: QRformInst;
drQRX: QRformInst;
drQBC: QRformInst;
drQADD: QRformInst;
drQSUB: QRformInst;
drQLADD: QRformInst;
drQLSUB: QRformInst;
OBformInst: TYPE = PROC [lit: Lit8];
drALS: OBformInst;
drAL: OBformInst;
drASL: OBformInst;
drAS: OBformInst;
drCST: OBformInst;
drRET: OBformInst;
drLIP: OBformInst;
drSIP: OBformInst;
drLIB: OBformInst;
drADDB: OBformInst;
drSUBB: OBformInst;
drJB: OBformInst;
drRB: OBformInst;
drWB: OBformInst;
drRSB: OBformInst;
drWSB: OBformInst;
drPSB: OBformInst;
LRBformInst: TYPE = PROC [reg: RegSpec, lit: Lit8];
drLRIn: LRBformInst;
drSRIn: LRBformInst;
RRformInst: TYPE = PROC [c: RegSpec, a,b: RegSpec];
drROR: RRformInst;
drRAND: RRformInst;
drRRX: RRformInst;
drRBC: RRformInst;
drRADD: RRformInst;
drRSUB: RRformInst;
drRLADD: RRformInst;
drRLSUB: RRformInst;
drRXOR: RRformInst;
drRFU: RRformInst;
drRVADD: RRformInst;
drRVSUB: RRformInst;
drRUADD: RRformInst;
drRUSUB: RRformInst;
ODBformInst: TYPE = PROC [lit: Lit16];
drLGF: ODBformInst;
drLFC: ODBformInst;
drLIDB: ODBformInst;
drADDDB: ODBformInst;
drSUBDB: ODBformInst;
drJDB: ODBformInst;
drIODA: ODBformInst;
drIOD: ODBformInst;
drION: ODBformInst;
drSHL: ODBformInst;
drSHR: ODBformInst;
drSHDL: ODBformInst;
drSHDR: ODBformInst;
drFSDB: ODBformInst;
LRRBformInst: TYPE = PROC [reg1,reg2: RegSpec, disp: Lit8];
drRAI: LRRBformInst;
drWAI: LRRBformInst;
drRRI: LRRBformInst;
drWRI: LRRBformInst;
RJBformInst: TYPE = PROC [left: ShortRegSpec, right: RegSpec, dist: Lit8];
drRJEB: RJBformInst;
drRJEBJ: RJBformInst;
drRJGB: RJBformInst;
drRJGBJ: RJBformInst;
drRJGEB: RJBformInst;
drRJGEBJ: RJBformInst;
drRJLB: RJBformInst;
drRJLBJ: RJBformInst;
drRJLEB: RJBformInst;
drRJLEBJ: RJBformInst;
drRJNEB: RJBformInst;
drRJNEBJ: RJBformInst;
JBBformInst: TYPE = PROC [lit: Lit8, dist: Lit8];
drJEBB: JBBformInst;
drJEBBJ: JBBformInst;
drJNEBB: JBBformInst;
drJNEBBJ: JBBformInst;
END.