*----------------------------------------------------------- Title[Jump.mc...November 7, 1982 3:32 PM...Taft]; * Jump instructions (PrincOps, chapter 6) *----------------------------------------------------------- % CONTENTS, by order of occurence Unconditional jumps Jn Jump n JB Jump Byte JW Jump Word JS Jump Stack CATCH Catch Equality jumps JZn Jump Zero n JNZn Jump Not Zero n JZB Jump Zero Byte JNZB Jump Not Zero Byte JEB Jump Equal Byte JNEB Jump Not Equal Byte JEP Jump Equal Pair JNEP Jump Not Equal Pair JEBB Jump Equal Byte Byte JNEBB Jump Not Equal Byte Byte Signed jumps JLB Jump Less Byte JLEB Jump Less Equal Byte JGB Jump Greater Byte JGEB Jump Greater Equal Byte Unsigned jumps JULB Jump Unsigned Less Byte JULEB Jump Unsigned Less Equal Byte JUGB Jump Unsigned Greater Byte JUGEB Jump Unsigned Greater Equal Byte Indexed jumps JIB Jump Indexed Byte JIW Jump Indexed Word Commonly-used exit sequences JumpRelativeT Jump T bytes relative to the current PC SetPCAndJump Restart IFU with new PC in T Subroutines StackPopMinusT Executes PD_ (Stack&-1)-T % TopLevel; *----------------------------------------------------------- IFUR[J2, 2]; * (regular opcodes are faster than jumps) IFUJ[J3, 1, Disp[3]]; * Jump n IFUJ[J4, 1, Disp[4]]; IFUJ[J6, 1, Disp[6]]; IFUJ[J8, 1, Disp[10]]; * PC _ savedPC + n; IFUJ[JB, 2, SignExtend]; * Jump Byte * PC _ savedPC + SignExtend[GetCodeByte[]]; IFUR[CATCH, 2]; * Catch * [] _ GetCodeByte[]; *----------------------------------------------------------- NextOpcode; *----------------------------------------------------------- IFUP[JW, 3]; * Jump Word * PC _ savedPC + GetCodeWord[]; *----------------------------------------------------------- T_ ShiftRMask[RTemp0], RisID; * LSH[ID, 10] T_ (ID) OR T, Branch[JumpRelativeT]; * T_ alpha,,beta *----------------------------------------------------------- NewOp; ESCEntry[JS]; * Jump Stack * PC _ Pop[]; *----------------------------------------------------------- PCF_ Stack&-1, Branch[ExitJump]; *----------------------------------------------------------- IFUR[JZ3, 1, N[3]]; * Jump Zero n IFUR[JZ4, 1, N[4]]; * data: UNSPECIFIED _ Pop[]; IF data=0 THEN PC _ savedPC + n; IFUR[JZB, 2, SignExtend]; * Jump Zero Byte * data: UNSPECIFIED _ Pop[]; disp: BYTE _ GetCodeByte[]; * IF data=0 THEN PC _ savedPC + SignExtend[disp]; *----------------------------------------------------------- PD_ Stack&-1, Branch[JETest]; *----------------------------------------------------------- IFUR[JNZ3, 1, N[3]]; * Jump Not Zero n IFUR[JNZ4, 1, N[4]]; * data: UNSPECIFIED _ Pop[]; IF data#0 THEN PC _ savedPC + n; IFUR[JNZB, 2, SignExtend]; * Jump Not Zero Byte * data: UNSPECIFIED _ Pop[]; disp: BYTE _ GetCodeByte[]; * IF data#0 THEN PC _ savedPC + SignExtend[disp]; *----------------------------------------------------------- PD_ Stack&-1, Branch[JNETest]; *----------------------------------------------------------- IFUR[JEB, 2, SignExtend]; * Jump Equal Byte * v: UNSPECIFIED _ Pop[]; u: UNSPECIFIED _ Pop[]; disp: BYTE _ GetCodeByte[]; * IF u=v THEN PC _ savedPC + SignExtend[disp]; *----------------------------------------------------------- T_ Stack&-1, Call[StackPopMinusT]; JETest: T_ (ID)-(PCX')-1, DblBranch[JNewT, JContF, ALU=0]; JNewT: PCF_ T, Branch[ExitJump]; JContF: NextOpcode; *----------------------------------------------------------- IFUR[JNEB, 2, SignExtend]; * Jump Not Equal Byte * v: UNSPECIFIED _ Pop[]; u: UNSPECIFIED _ Pop[]; disp: BYTE _ GetCodeByte[]; * IF u#v THEN PC _ savedPC + SignExtend[disp]; *----------------------------------------------------------- T_ Stack&-1, Call[StackPopMinusT]; JNETest: T_ (ID)-(PCX')-1, DblBranch[JNewF, JContT, ALU#0]; JNewF: PCF_ T, Branch[ExitJump]; JContT: NextOpcode; *----------------------------------------------------------- IFUR[JEP, 2, PackedAlpha]; * Jump Equal Pair * data: UNSPECIFIED _ Pop[]; pair: NibblePair _ GetCodeByte[]; * IF data=pair.left THEN PC _ savedPC + pair.right + 4; *----------------------------------------------------------- PD_ (ID)#(Stack&-1); T_ (ID)-(PCX')-1, Branch[.+2, ALU=0]; NextOpcode; T_ T+(4C), Branch[SetPCAndJump]; *----------------------------------------------------------- IFUR[JNEP, 2, PackedAlpha]; * Jump Not Equal Pair * data: UNSPECIFIED _ Pop[]; pair: NibblePair _ GetCodeByte[]; * IF data#pair.left THEN PC _ savedPC + pair.right + 4; *----------------------------------------------------------- PD_ (ID)#(Stack&-1); T_ (ID)-(PCX')-1, Branch[.+2, ALU#0]; NextOpcode; T_ T+(4C), Branch[SetPCAndJump]; *----------------------------------------------------------- IFUR[JEBB, 3]; * Jump Equal Byte Byte * data: UNSPECIFIED _ Pop[]; byte: UNSPECIFIED _ GetCodeByte[]; * disp: UNSPECIFIED _ GetCodeByte[]; * IF data=byte THEN PC _ savedPC + SignExtend[disp]; *----------------------------------------------------------- PD_ (ID)#(Stack&-1); T_ (ID)-(200C), Branch[.+2, ALU=0]; NextOpcode; * Note: must SignExtend[disp] manually, as disp is the beta byte and the * hardware sign-extension works only on the alpha byte. T_ T XOR (177600C), Branch[JumpRelativeT]; *----------------------------------------------------------- IFUR[JNEBB, 3]; * Jump Not Equal Byte Byte * data: UNSPECIFIED _ Pop[]; byte: UNSPECIFIED _ GetCodeByte[]; * disp: UNSPECIFIED _ GetCodeByte[]; * IF data#byte THEN PC _ savedPC + SignExtend[disp]; *----------------------------------------------------------- PD_ (ID)#(Stack&-1); T_ (ID)-(200C), Branch[.+2, ALU#0]; NextOpcode; * Note: must SignExtend[disp] manually, as disp is the beta byte and the * hardware sign-extension works only on the alpha byte. T_ T XOR (177600C), Branch[JumpRelativeT]; *----------------------------------------------------------- IFUR[JLB, 2, SignExtend]; * Jump Less Byte * disp: BYTE _ GetCodeByte[]; * k: INTEGER _ Pop[]; j: INTEGER _ Pop[]; * IF jk THEN PC _ savedPC + SignExtend[disp]; IFUR[JGEB, 2, SignExtend, N[0]]; * Jump Greater Equal Byte * disp: BYTE _ GetCodeByte[]; * k: INTEGER _ Pop[]; j: INTEGER _ Pop[]; * IF j>=k THEN PC _ savedPC + SignExtend[disp]; *----------------------------------------------------------- PD_ (ID)-1, Q_ Stack&-1; * Carry_ 1 for JGB, 0 for JGEB PD_ (Stack&-1)-Q, XorSavedCarry; SignedIneqTest: Q_ PCX', Branch[.+2, ALU<0]; T_ (ID)-Q-1, DblBranch[JNewT, JContF, Overflow']; T_ (ID)-Q-1, DblBranch[JContT, JNewF, Overflow']; *----------------------------------------------------------- IFUR[JULB, 2, SignExtend]; * Jump Unsigned Less Byte * disp: BYTE _ GetCodeByte[]; * v: CARDINAL _ Pop[]; u: CARDINAL _ Pop[]; * IF u