DIRECTORY Atom USING [PropList], DragOpsCross USING [Byte, Inst, ShortRegQR, Word], HandCoding; HandCodingSupport: CEDAR DEFINITIONS = BEGIN OPEN DragOpsCross, HandCoding; CARD: TYPE = LONG CARDINAL; Inst: TYPE = DragOpsCross.Inst; PropList: TYPE = Atom.PropList; OQBcommon: PROC[op: Inst, rest: Word]; OIcommon: PROC[op: Inst]; LRcommon: PROC[op: Inst, reg: RegSpec]; QRcommon: PROC[op: Inst, left: ShortRegQR, right: RegSpec]; OBcommon: PROC[op: Inst, lit: Lit8]; LRBcommon: PROC[op: Inst, reg: RegSpec, lit: Lit8]; RRcommon: PROC[op: Inst, c: RegSpec, a,b: RegSpec]; RJBcommon: PROC[op: Inst, left: ShortRegSpec, right: RegSpec, dist: Lit8]; ODBcommon: PROC[op: Inst, lit: Lit16]; LRRBcommon: PROC[op: Inst, reg1,reg2: RegSpec, disp: Lit8]; JBBcommon: PROC[op: Inst, dist: Lit8, lit: Lit8]; Area: TYPE = REF AreaRep; AreaRep: TYPE = RECORD [ name: ATOM, -- name of output area props: PropList, -- properties for this area currentPC: CARD, -- current output program PC (byte address) currentData: CARD, -- current output data PC (byte address) currentWord: Word, -- current partial word currentDirty: BOOL, -- TRUE if the current word was written getWord: GetProc, -- proc to get a word from the area putWord: PutProc, -- proc to put a word into the area data: REF -- data for getWord/putWord ]; GetProc: TYPE = PROC [data: REF, pc: INT] RETURNS [Word]; PutProc: TYPE = PROC [data: REF, pc: INT, word: Word]; ProcList: TYPE = LIST OF PROC; NewArea: PROC [name: ATOM, getWord: GetProc, putWord: PutProc, data: REF _ NIL] RETURNS [Area]; GenWithArea: PROC [area: Area, list: ProcList]; Gen1WithArea: PROC [area: Area, proc: PROC]; ForceOut: PROC [area: Area]; GetCurrentArea: PROC [nilOK: BOOL _ FALSE] RETURNS [Area]; EmptyArea: ERROR; GetOutputPC: PROC [area: Area _ NIL] RETURNS [pc: CARD]; SetOutputPC: PROC [pc: CARD, area: Area _ NIL]; WordAlign: PROC [area: Area _ NIL]; ReserveData: PROC [words: CARD, area: Area _ NIL] RETURNS [pc: CARD]; OutputByte: PROC [area: Area, byte: Byte]; OutputOneByte: PROC [area: Area, word: Word]; OutputAlphaBeta: PROC [area: Area, lit: CARDINAL]; OutputAlphaBetaGammaDelta: PROC [area: Area, word: Word]; OutputWord: PROC [area: Area, word: Word, align: BOOL _ FALSE]; END. nHandCodingSupport.mesa Copyright c 1984, 1985 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) January 24, 1986 6:32:00 pm PST Format Common Routines Output area stuff Creates a new code area Places the area on the process property list under the property $CurrentArea, then calls each procedure in the procedure list, then returns (with the process property list reset to its original value). Places the area on the process property list under the property $CurrentArea, then calls proc (which may be a nested procedure), then returns (with the process property list reset to its original value). Forces the area to dump any buffering it has into the output. Gets the current output area as established by GenWithArea. If not nilOK, EmptyArea will be generated instead of returning NIL. Directives to control output (if area = NIL, gets the area from the current area established by GenWithArea) gets the current output PC sets the current output PC make the code generation PC word-aligned reserve some # of words of data Directives to make output (if area = NIL, gets the area from the current area established by GenWithArea) output the given byte into the current output area output the low-order byte of the word into the current output area output the literal as necessary for the ODB format of the word into the current output area output the given literal as AlphaBetaGammaDelta (Alpha is the low-order byte, Beta the next higher, and so on). The order of bytes in the output stream is reversed from the order in the word. output the given word into the output area, force alignment first if align = TRUE Κ3˜codešœ™Kšœ Οmœ7™BK™3K˜—šΟk ˜ Kšœžœ ˜Kšœ žœ ˜2Kšœ ˜ K˜—šœž˜$Kšœž œž˜&K˜Kšžœžœžœžœ˜Kšœžœ˜Kšœ žœ˜K˜—šœ™K˜KšΟn œžœ˜&KšŸœžœ ˜KšŸœžœ˜'KšŸœžœ-˜;KšŸœžœ˜$KšŸ œžœ$˜3KšŸœžœ%˜3KšŸ œžœ;˜JKšŸ œžœ˜&KšŸ œžœ+˜;KšŸ œžœ"˜1K˜—™K˜Kšœžœžœ ˜–24 sp tabStopsšœ žœžœ˜K–24 sp tabStopsšœžœΟc˜"K–24 sp tabStopsšœ ˜,K–24 sp tabStopsšœ žœ +˜