DIRECTORY DragOpsCross USING [FieldDescriptor, ProcessorRegister, Word], HandCoding USING [ConstSpec, Lit16, Lit8, RegSpec], HandCodingSupport USING [Area], IO USING [STREAM], Rope USING [ROPE], SymTab USING [Ref]; HandCodingPseudos: CEDAR DEFINITIONS = BEGIN OPEN DragOpsCross, HandCoding; Label: TYPE = REF LabelRep; LabelRep: TYPE = RECORD [ area: HandCodingSupport.Area, -- area for definition of label (NIL if undefined) name: Rope.ROPE, -- the global name (if any) for this label offset: INT, -- offset for definition of label uses: REF -- uses of label that need fixing (internal) ]; SetLabel: PROC [label: Label]; GenLabel: PROC RETURNS [label: Label]; GenLabelHere: PROC RETURNS [label: Label]; UseLabel8A: PROC [label: Label] RETURNS [Lit8]; UseLabel8B: PROC [label: Label] RETURNS [Lit8]; UseLabel16: PROC [label: Label] RETURNS [Lit16]; UseLabel32: PROC [label: Label] RETURNS [Word]; GenDataLabel: PROC [area: HandCodingSupport.Area, bytes: CARD] RETURNS [Label]; OutputWordAddr: PROC [area: HandCodingSupport.Area, label: Label, offset: INT _ 0]; OutputByteAddr: PROC [area: HandCodingSupport.Area, label: Label, offset: INT _ 0]; PushWordAddr: PROC [area: HandCodingSupport.Area, label: Label, offset: INT _ 0]; PushByteAddr: PROC [area: HandCodingSupport.Area, label: Label, offset: INT _ 0]; AddWordAddr: PROC [area: HandCodingSupport.Area, label: Label, offset: INT _ 0]; AddByteAddr: PROC [area: HandCodingSupport.Area, label: Label, offset: INT _ 0]; MakeLabelGlobal: PROC [name: Rope.ROPE, label: Label]; GetGlobalLabel: PROC [name: Rope.ROPE] RETURNS [Label]; GetGlobalLabelTable: PROC [area: HandCodingSupport.Area _ NIL] RETURNS [SymTab.Ref]; ShowGlobalLabelTable: PROC [st: IO.STREAM, sortNames: BOOL _ TRUE, area: HandCodingSupport.Area _ NIL]; LReg: PROC [reg: RegSpec]; PReg: PROC [reg: RegSpec]; SReg: PROC [reg: RegSpec]; AddReg: PROC [reg: RegSpec, const: ConstSpec]; SubReg: PROC [reg: RegSpec, const: ConstSpec]; SetRegConst: PROC [reg: RegSpec, const: ConstSpec]; MoveReg: PROC [dst,src: RegSpec]; MoveRegI: PROC [dst,src: RegSpec, const: ConstSpec]; LRegI: PROC [reg: RegSpec, const: ConstSpec]; IndexedJump: PROC [dest: Label, long: BOOL _ FALSE, back: BOOL _ FALSE]; ProcedureEntry: PROC [label: Label, args: [0..15], dontChangeRL: BOOL _ FALSE]; ProcedureExit: PROC [rets: [0..15], dontChangeSP: BOOL _ FALSE]; SetupField: PROC [fd: DragOpsCross.FieldDescriptor]; ExtractField: PROC [first: [0..31], bits: [0..31]]; ShiftLeft: PROC [bits: [0..31]]; LoadProcessorReg: PROC [which: DragOpsCross.ProcessorRegister]; StoreProcessorReg: PROC [which: DragOpsCross.ProcessorRegister]; CauseReschedule: PROC; CauseReset: PROC; GetSPLimit: PROC; SetSPLimit: PROC; GetYoungestPC: PROC; GetYoungestStatus: PROC; GetEldestPC: PROC; GetEldestStatus: PROC; SetYoungestPC: PROC; SetYoungestStatus: PROC; SetEldestPC: PROC; SetEldestStatus: PROC; Pause: PROC; Halt: PROC [code: CARDINAL]; END. $HandCodingPseudos.mesa Copyright c 1984, 1985, 1986 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) April 24, 1987 4:59:23 pm PDT Pseudo-Op Declarations Labelling Use a label in the Alpha byte Use a label in the Beta byte Reserves a given number of data bytes and returns a label to the start of the bytes. No alignment takes place. Puts out the label as a word address into the code stream. No alignment takes place. Puts out the label as a byte address into the code stream. No alignment takes place. Pushes the label as a word address. No alignment takes place. Pushes the label as a byte address. No alignment takes place. Adds the label as a word address to [S]. No alignment takes place. Adds the label as a byte address to [S]. No alignment takes place. shows the global label table for the given area to the given stream. If sortNames, then the labels come out sorted by name, otherwise sorted by address. Macros Uses the top of stack as a jump offset from the given label, and jumps there (popping the stack, of course). If long, then the label given can be more than 127 bytes away (32K bytes, actually). If back, then the dest label must occur before the jump, else it must occur after. Notes procedure entry. NOT dontChangeRL => generate procedure entry instruction generates the procedure return instruction dontChangeSP => RETN ELSE => RET generates shifter control from the given field descriptor pieces generates the appropriate instruction to extract the specified bits from [S] generates the appropriate instruction to shift [S] left by bits IFU primitives (mostly translate to LIP, SIP) Loads the specified processor register onto the stack. Pops the stack into the specified processor register. ... causes a reschedule interrupt when interrupts are next enabled (possibly immediately). The state of traps enabled/disabled is not changed. ... causes a reset trap. ... push stack limit. ... pop stack to stack limit register. ... pushes the youngest PC entry in the IFU stack (into [S]). ... pushes the status part of the youngest IFU stack entry. ... pushes the eldest PC in the IFU stack and removes the eldest entry from the IFU stack. The results are undefined if there was no PC to get. ... pushes the status part of the eldest IFU stack entry. ... sets the youngest PC entry in the IFU stack (from [S]). S_S-1. ... sets the youngest status entry in the IFU stack (from [S]). S_S-1. ... causes a new eldest IFU stack entry to be created and sets the PC part of that entry (from [S]). S_S-1. ... sets the status part of the eldest IFU stack entry (from [S]). Interaction with the interpreter ... Instructs the interpreter to pause. This emits the X0 operation. ... Instructs the interpreter to halt. The code will be evident in the instruction trace. This emits the X377 operation. Κκ˜codešœ™Kšœ Οmœ=™HK™1K˜šΟk ˜ Kšœ žœ,˜>Kšœ žœ#˜3Kšœžœ˜Kšžœžœžœ˜Kšœžœžœ˜Kšœžœ˜——K˜Kš Οnœžœž œžœžœ˜KK˜šœ™K˜™ K˜Kšœžœžœ ˜–40 sp tabStopsšœ žœžœ˜K–40 sp tabStopsšœΟc2˜PK–40 sp tabStopsšœ žœ *˜;K–40 sp tabStopsšœžœ !˜.K–40 sp tabStopsšœžœ ,˜6K–40 sp tabStopsšœ˜—KšŸœžœ˜KšŸœžœžœ˜&KšŸ œžœžœ˜*šŸ œžœžœ˜/Kšœ™—šŸ œžœžœ˜/Kšœ™—KšŸ œžœžœ ˜0KšŸ œžœžœ˜/K˜šŸ œžœ'žœžœ ˜OK™oK™—šŸœžœ6žœ˜SK™UK™—šŸœžœ6žœ˜SK™U—K˜šŸ œžœ6žœ˜QK™>K™—šŸ œžœ6žœ˜QK™>—K˜šŸ œžœ6žœ˜PK™CK™—šŸ œžœ6žœ˜PK™C—K˜KšŸœžœ žœ˜6KšŸœžœ žœžœ ˜7KšŸœžœ!žœžœ˜TK˜šŸœžœžœžœ žœžœ!žœ˜gKšœ™™™—K˜—™K˜KšŸœžœ˜KšŸœžœ˜KšŸœžœ˜KšŸœžœ"˜.KšŸœžœ"˜.KšŸ œžœ"˜3KšŸœžœ˜!KšŸœžœ&˜4KšŸœžœ"˜-K˜š Ÿ œžœžœžœžœžœ˜HKšœ–™–—K˜šŸœžœ-žœžœ˜Ošœ™Kšœ8™8—K˜—šŸ œžœžœžœ˜@šœ*™*Kšœ™Kšœ ™ —K˜—šŸ œžœ$˜4K™@K˜—šŸ œžœ!˜3K™LK˜—šŸ œžœ˜ K™?K˜——šœ$Οfœ‘œ™-K˜šŸœžœ)˜?Kšœ6™6—šŸœžœ)˜@Kšœ5™5K˜—šŸœžœ˜Kšœ™—šŸ œžœ˜Kšœ™—K˜šŸ œžœ˜Kšœ™—šŸ œžœ˜Kšœ&™&—K˜šŸ œžœ˜Kšœ=™=—šŸœžœ˜Kšœ=™=—šŸ œžœ˜Kšœ™—šŸœžœ˜Kšœ;™;—šŸ œžœ˜KšœC™C—šŸœžœ˜KšœG™G—šŸ œžœ˜Kšœl™l—šŸœžœ˜KšœB™B—K˜—™ K˜šŸœžœ˜ KšœE™E—K˜šŸœžœžœ˜Kšœz™z—K˜—Kšžœ˜K˜—K˜—…— ‚