DIRECTORY RobotDefs USING [Instruction], RobotEvaluator USING [ApplyBinaryFcn, NewValueFromInteger, opMOD, opPlus], RobotInstruction; RobotInstructionImpl: CEDAR PROGRAM IMPORTS RobotEvaluator EXPORTS RobotInstruction ~ { OPEN RobotInstruction; v256: Value _ RobotEvaluator.NewValueFromInteger[256]; EncodeStatement: PUBLIC PROC [opNum: INTEGER, tag: Value, immediate, indirect, indexed: BOOL] RETURNS [value: Value] ~ { instruction: RobotDefs.Instruction _ [ immediate: immediate, indirect: indirect, indexed: indexed, opNum: opNum, tag: 0 ]; insValue: INTEGER _ LOOPHOLE[instruction]; value _ RobotEvaluator.ApplyBinaryFcn[ RobotEvaluator.opPlus, RobotEvaluator.ApplyBinaryFcn[RobotEvaluator.opMOD, tag, RobotEvaluator.NewValueFromInteger[256]], RobotEvaluator.NewValueFromInteger[insValue]]; }; DecodeStatement: PUBLIC PROC [integer: INTEGER] RETURNS [opNum, tag: INTEGER, immediate, indirect, indexed: BOOL _ FALSE] ~ { instruction: RobotDefs.Instruction _ LOOPHOLE[integer]; RETURN [ opNum: instruction.opNum, tag: instruction.tag, immediate: instruction.immediate, indirect: instruction.indirect, indexed: instruction.indexed ]; }; }. FRobotInstructionImpl.mesa Created Saturday, June 9, 1984 2:25 pm PDT Last edited by Eric Nickell, October 25, 1984 9:51:09 pm PDT Current encoding (and therefore decoding) scheme: #^Ioooootttttttt, where # is the immediate bit ^ is the indirect bit I is the index bit ooooo is the opcode number tttttttt is the tag Κ†˜šœ™Jšœ*™*J™