*----------------------------------------------------------- Title[DMesaJumps...March 8, 1981 7:14 PM...Taft]; *----------------------------------------------------------- % CONTENTS, by order of occurence The term "byte" refers to alpha operand which is sign-extended and used as an offset. Unconditional jumps Jn Jump .+n JB Jump Byte JW Jump Word Conditional equality jumps JEQn Jump IF Equal JEQB Jump If Equal Byte JZEQB Jump Equal Zero Byte JNEn Jump If Not equal JNEB Jump If not equal Byte JZNEB Jump Not Equal Zero Byte Conditional signed jumps JLB Jump Less JGEB Jump Greater or EQual Byte JGB Jump Greater Byte JLEB Jump Less or Equal Byte Conditional unsigned jumps JULB Jump Unsigned Less Byte JUGEB Jump Unsigned Greater or EQual Byte JULEB Jump Unsigned Less or Equal Byte Indexed jumps JIB Jump Indexed Byte JIW Jump Indexed Word % TopLevel; *----------------------------------------------------------- SetPCAndJump0: * Common exit sequence: * Effectively, execute PCF_ T followed by IFUNext0. * Actually, adjust TOS to a more favorable configuration (if possible) * during the dead time between PCF_ and IFUJump. *----------------------------------------------------------- Global, PCF_ T; :IfMEP; ExitJump0: T_ TIOA&StkP; PD_ T AND (377C); Branch[.+2, ALU#0]; IFUNext0; * Stack empty, must exit in state 0 T_ Stack&-1, IFUNext2; * Non-empty, adjust to state 2 :Else; ExitJump0: Branch[@J2]; * Nop; IFUNext0; :EndIf; *----------------------------------------------------------- IFUR[J2, 2, L]; * Define J2 as 2-byte regular because it's faster that way IFUJ[J3, 1, L, Disp[3]]; * Jump n (unconditional): PC _ savePC+n IFUJ[J4, 1, L, Disp[4]]; IFUJ[J5, 1, L, Disp[5]]; IFUJ[J6, 1, L, Disp[6]]; IFUJ[J7, 1, L, Disp[7]]; IFUJ[J8, 1, L, Disp[10]]; IFUJ[J9, 1, L, Disp[11]]; :If[Not[AltoMode]]; ******** PrincOps version ******** IFUJ[JB, 2, L, SignExtend]; * Jump Byte (unconditional) * PC _ savePC + SignExtend[alpha]; :EndIf; ********************************** *----------------------------------------------------------- IFUNext0; :IfMEP; T_ Stack&-1_ MD, IFUNext2; IFUNext2; :EndIf; :If[AltoMode]; ********** Alto version ********** *----------------------------------------------------------- IFUP[JB, 2, L, SignExtend]; * Jump Byte (unconditional) * Alto Mesa: the offset is relative to the PC of the last byte. * Defined as a Pause opcode because the IFU can't do the jump. *----------------------------------------------------------- T_ (ID)-(PCX'), Branch[SetPCAndJump0]; :IfMEP; T_ (ID)-(PCX'), Stack_ MD, Branch[SetPCAndJump0]; T_ (ID)-(PCX'), StkP+1, Branch[SetPCAndJump0]; :EndIf; :EndIf; ********************************** :If[AltoMode]; ********** Alto version ********** *----------------------------------------------------------- IFUP[JW, 3, Code, N[1]]; * Jump Word (unconditional) * Alto Mesa: this is an aligned 3-byte instruction, and the offset * is relative to the PC of the last byte. *----------------------------------------------------------- T_ (ID)-(PCX'), Branch[JWM1]; * T_ PCX+2 :IfMEP; T_ (ID)-(PCX'), Stack_ MD, Branch[JWM1]; T_ (ID)-(PCX'), StkP+1, Branch[JWM1]; :EndIf; JWM1: T_ T RSH 1; T_ (Fetch_ T)+T+1; T_ T+MD, Branch[SetPCAndJump0]; :Else; ******** PrincOps version ******** *----------------------------------------------------------- IFUP[JW, 3, L]; * Jump Word (unconditional) * disp _ 256*alpha + beta; PC _ savePC+disp; *----------------------------------------------------------- T_ ID, Branch[JWM1]; :IfMEP; T_ ID, Stack_ MD, Branch[JWM1]; T_ ID, StkP+1, Branch[JWM1]; :EndIf; JWM1: T_ LSH[T, 10]; T_ (ID) OR T; * T_ alpha,,beta T_ T-(PCX')-1, Branch[SetPCAndJump0]; :EndIf; ********************************** *----------------------------------------------------------- IFUR[JEQ2, 1, L, N[IfE[AltoMode, 0, 2, 1]]]; * Jump Equal n: IFUR[JEQ3, 1, L, N[IfE[AltoMode, 0, 3, 2]]]; IFUR[JEQ4, 1, L, N[IfE[AltoMode, 0, 4, 3]]]; IFUR[JEQ5, 1, L, N[IfE[AltoMode, 0, 5, 4]]]; IFUR[JEQ6, 1, L, N[IfE[AltoMode, 0, 6, 5]]]; IFUR[JEQ7, 1, L, N[IfE[AltoMode, 0, 7, 6]]]; IFUR[JEQ8, 1, L, N[IfE[AltoMode, 0, 10, 7]]]; IFUR[JEQ9, 1, L, N[IfE[AltoMode, 0, 11, 10]]]; * u _ Pop[]; v _ Pop[]; IF u=v THEN PC _ savePC + n; IFUR[JEQB, 2, L, SignExtend]; * Jump Equal Byte: * u _ Pop[]; v _ Pop[]; IF u=v THEN PC _ savePC + SignExtend[alpha]; * Alto Mesa: the offset is relative to the PC of the last byte. *----------------------------------------------------------- T_ Stack&-1, Branch[JEQM2]; :IfMEP; PD_ T#MD, Stack&-2_ MD, Branch[JEQM1]; :EndIf; JEQM2: PD_ T#(Stack&-1), Branch[JEQM1]; :If[AltoMode]; ********** Alto version ********** * For 1-byte opcodes in Alto mode, ID = displacement-1. JEQM1: T_ (ID)-(PCX'), DblBranch[JNewT, JContF, ALU=0]; * T_ PCX+alpha+1 :Else; ******** PrincOps version ******** JEQM1: T_ (ID)-(PCX')-1, DblBranch[JNewT, JContF, ALU=0]; * T_ PCX+alpha :EndIf; ********************************** JNewT: PCF_ T, Branch[ExitJump0]; JContF: IFUNext0; *----------------------------------------------------------- IFUR[JZEQB, 2, L, SignExtend]; * Jump Zero Equal Byte * u _ Pop[]; IF u=0 THEN PC _ savePC + SignExtend[alpha]; * Alto Mesa: the offset is relative to the PC of the last byte. *----------------------------------------------------------- PD_ Stack&-1, Branch[JEQM1]; :IfMEP; Stack&-1_ PD_ MD, Branch[JEQM1]; PD_ T, Branch[JEQM1]; :EndIf; *----------------------------------------------------------- IFUR[JNE2, 1, L, N[IfE[AltoMode, 0, 2, 1]]]; * Jump Not Equal n: IFUR[JNE3, 1, L, N[IfE[AltoMode, 0, 3, 2]]]; IFUR[JNE4, 1, L, N[IfE[AltoMode, 0, 4, 3]]]; IFUR[JNE5, 1, L, N[IfE[AltoMode, 0, 5, 4]]]; IFUR[JNE6, 1, L, N[IfE[AltoMode, 0, 6, 5]]]; IFUR[JNE7, 1, L, N[IfE[AltoMode, 0, 7, 6]]]; IFUR[JNE8, 1, L, N[IfE[AltoMode, 0, 10, 7]]]; IFUR[JNE9, 1, L, N[IfE[AltoMode, 0, 11, 10]]]; * u _ Pop[]; v _ Pop[]; IF u#v THEN PC _ savePC + n; IFUR[JNEB, 2, L, SignExtend]; * Jump Not Equal Byte: * u _ Pop[]; v _ Pop[]; IF u#v THEN PC _ savePC + SignExtend[alpha]; * Alto Mesa: the offset is relative to the PC of the last byte. *----------------------------------------------------------- T_ Stack&-1, Branch[JNEM2]; :IfMEP; PD_ T#MD, Stack&-2_ MD, Branch[JNEM1]; :EndIf; JNEM2: PD_ T#(Stack&-1), Branch[JNEM1]; :If[AltoMode]; ********** Alto version ********** * For 1-byte opcodes in Alto mode, ID = displacement-1. JNEM1: T_ (ID)-(PCX'), DblBranch[JNewF, JContT, ALU#0]; * T_ PCX+alpha+1 :Else; ******** PrincOps version ******** JNEM1: T_ (ID)-(PCX')-1, DblBranch[JNewF, JContT, ALU#0]; * T_ PCX+alpha :EndIf; ********************************** JNewF: PCF_ T, Branch[ExitJump0]; JContT: IFUNext0; *----------------------------------------------------------- IFUR[JZNEB, 2, L, SignExtend]; * Jump Zero Not Equal Byte * u _ Pop[]; IF u#0 THEN PC _ savePC + SignExtend[alpha]; * Alto Mesa: the offset is relative to the PC of the last byte. *----------------------------------------------------------- PD_ Stack&-1, Branch[JNEM1]; :IfMEP; Stack&-1_ PD_ MD, Branch[JNEM1]; PD_ T, Branch[JNEM1]; :EndIf; * Signed jumps *----------------------------------------------------------- IFUR[JLB, 2, L, SignExtend]; * Jump Less Byte: * k: INTEGER _ Pop[]; j: INTEGER _ Pop[]; * IF j=k THEN PC _ savePC + SignExtend[alpha]; * Alto Mesa: the offset is relative to the PC of the last byte. *----------------------------------------------------------- T_ Stack&-1, Branch[JGEBM2]; :IfMEP; PD_ T-MD, Stack&-2_ MD, Branch[JineqM1]; :EndIf; JGEBM2: PD_ (Stack&-1)-T, Branch[JineqM1]; *----------------------------------------------------------- IFUR[JGB, 2, L, SignExtend]; * Jump Greater Byte: * k: INTEGER _ Pop[]; j: INTEGER _ Pop[]; * IF j>k THEN PC _ savePC + SignExtend[alpha]; * Alto Mesa: the offset is relative to the PC of the last byte. *----------------------------------------------------------- T_ Stack&-1, Branch[JGBM2]; :IfMEP; PD_ T-MD-1, Stack&-2_ MD, Branch[JineqM1]; :EndIf; JGBM2: PD_ (Stack&-1)-T-1, Branch[JineqM1]; *----------------------------------------------------------- IFUR[JLEB, 2, L, SignExtend]; * Jump Less Equal Byte: * k: INTEGER _ Pop[]; j: INTEGER _ Pop[]; * IF j<=k THEN PC _ savePC + SignExtend[alpha]; * Alto Mesa: the offset is relative to the PC of the last byte. *----------------------------------------------------------- T_ Stack&-1, Branch[JLEBM2]; :IfMEP; PD_ MD-T, Stack&-2_ MD, Branch[JineqM1]; :EndIf; JLEBM2: PD_ T-(Stack&-1), Branch[JineqM1]; * Unsigned jumps *----------------------------------------------------------- IFUR[JULB, 2, L, SignExtend]; * Jump Unsigned Less Byte: * v: CARDINAL _ Pop[]; u: CARDINAL _ Pop[]; * IF u=v THEN PC _ savePC + SignExtend[alpha]; * Alto Mesa: the offset is relative to the PC of the last byte. *----------------------------------------------------------- T_ Stack&-1, Branch[JUGEBM2]; :IfMEP; PD_ T-MD, Stack&-2_ MD, Branch[JUineqM1]; :EndIf; JUGEBM2: PD_ (Stack&-1)-T, Branch[JUineqM1]; *----------------------------------------------------------- IFUR[JUGB, 2, L, SignExtend]; * Jump Unsigned Greater Byte: * v: CARDINAL _ Pop[]; u: CARDINAL _ Pop[]; * IF u>v THEN PC _ savePC + SignExtend[alpha]; * Alto Mesa: the offset is relative to the PC of the last byte. *----------------------------------------------------------- T_ Stack&-1, Branch[JUGBM2]; :IfMEP; PD_ T-MD-1, Stack&-2_ MD, Branch[JUineqM1]; :EndIf; JUGBM2: PD_ (Stack&-1)-T-1, Branch[JUineqM1]; *----------------------------------------------------------- IFUR[JULEB, 2, L, SignExtend]; * Jump Unsigned Less Equal Byte: * v: CARDINAL _ Pop[]; u: CARDINAL _ Pop[]; * IF u<=v THEN PC _ savePC + SignExtend[alpha]; * Alto Mesa: the offset is relative to the PC of the last byte. *----------------------------------------------------------- T_ Stack&-1, Branch[JULEBM2]; :IfMEP; PD_ MD-T, Stack&-2_ MD, Branch[JUineqM1]; :EndIf; JULEBM2: PD_ T-(Stack&-1), Branch[JUineqM1]; *----------------------------------------------------------- IFUR[JIB, 3, Code, N[0]]; * Jump Indexed Byte * base: CARDINAL _ 256*alpha + beta; * limit: CARDINAL _ Pop[]; index: CARDINAL _ Pop[]; * IF index