ER[CONT]; *I = 95 (94 ON MAXC2) TARGET[ILC]; %OPCODES 0 AND 40-77 ARE UUO'S WHICH TRAP TO MONITOR LOCATION 41 AFTER STORING THE OPCODE AND EFFECTIVE ADDRESS IN 40. UUO'S 1-37 TRAP TO USER LOCATIONS 40-41. UUO'S 110-113 AND 116-127 TRAP TO MONITOR 60-61 INSTEAD OF 40-41. BYTE LISP USES OPCODES FROM 700-777. **MONITOR UUO'S CAN'T HAVE INDIRECT ADDRESSING IN 41 OR IN 61 BECAUSE OF **INTERRUPT COMPUTATION OF UM PROBLEM TIMING = 4 + W + (1 FOR MONITOR UUO'S) + TRAP INSTRUCTION TIME I = 9 % SM[NOTFLAGS,IP[37 777777S]]; ***NOTE: CANNOT POP AND READ STACK CONCURRENTLY Q←WMQ, CALL[LOADMAP]; UUO: MAPVA←P←(REFADR←P) U (BLTWLE); WREF, Q←INSTR, LEFADR←P, AC←NULL, INHINT, CALL[SCRASH,G=1]; Q←(NOT Q) U (NOTFLAGS), GOTO[.-3,G=1], INHINT, P←LTEMP; MDR←P OR NOT Q, POP; MAPVA←P←STACK, A1, GOTO[XCT]; *J←UM FOR THE TRAP INSTRUCTION UUOU: SETSF[UM&J], LTEMP←P, P←STACK, GOTO[UUO]; *K=1 WILL PREVENT XCT FROM BEING INTERRUPTED (WHICH WOULD LOSE UM) *WORD SAVED IN 40 WILL BE OPCODE AND AC FIELD FROM "INSTR" ORED WITH P. UUOM: SETSF[UM&J&K], LTEMP←P, P←STACK; CLEARF[TFLAGSPI], GOTO[UUO]; IM[XXX,41]; *NEED ADDRESS=41 FOR SI AND DI MACROS *HALT IN USER MODE AND ILLEGAL I/O INSTRUCTIONS ARE ALSO TREATED AS OPCODE 0 UUO DI[0,UUOM,40,XXX]; *MONITOR UUO 0 REPEAT[37,DLC[E1[UUOU] E2[40] E3[4041]]]; *USER UUO'S (1-37) REPEAT[40,DLC[E1[UUOM] E2[40] E3[4041]]]; *MONITOR UUO'S (40-77) %700 IS FOR APR AND PI 712 FOR TTY AND --- 776 FOR UJMC 777 FOR JMC % %XCT HAS BEEN CHANGED SO THAT IN MONITOR MODE, IF THE AC FIELD IS #0, SOME MEMORY REFERENCES FOR THE INSTRUCTION BEING EXECUTED WILL BE FORCED TO USER MODE. THIS IS CONTROLLED BY THE XCT0, XCT1, XCT2, AND XCT3 FLAGS IN F, BUT IS TURNED OFF BY THE CFM FLAG. FORCED AC REFERENCES GO TO THE ACBASE STACK UNAFFECTED BY CFM BUT NOT WHEN UM=1. ON PAGER TRAPS AND PI CYCLES, J=UM. TIMING: 1 + R I = 9 % Q←XMQ, LEFADR←Q, CALL[LOADMAP]; *XREF DOESN'T CLOBBER H. PICYC JUMPS HERE WITH K=1, UUO WITH K=UM XCT: Q←AC, XREF, REFADR←P, GOTO[XAC,G=1], SETSF[INTCONDH]; 0Q RCY [22], Q←(P) U (XLE), GOTO[.-2,G=1]; Q←P, GOTO[XCTA,H=0]; XPI: GOTO[PI,K=0]; *"PTRAP" JUMPS IN HERE ALSO WITH XCT FLAGS IN Q XCTA: P←ICTR, STEMP←Q; SETF[STEMP], GOTO[XREMAP]; XAC: Q←LX, 0Q RCY [22], DGOTO[XCTA]; MDR←Q, Q←P, GOTO[XPI,H=1]; DI[256,XCT,SCRASH,SCRASH]; %JSYS IS ONE OF THE LEGAL INTERRUPT INSTRUCTIONS (JSR IS THE OTHER) AND SO IT MUST CHECK FOR J=1. WHEN J=1, THE UM FLAG SAVED IN LH OF PC WORD SHOULD BE 1. E > 777 INVOKES A USER JSYS. E < 1000 USES THE TABLE POINTED TO BY JSYST. PC AND FLAGS ARE SAVED AT THE LOCATION POINTED TO BY THE L.H. OF MEMORY, CONTROL IS GIVEN TO THE R.H. OF MEMORY. BIS, MD0, MD1, AND MD2 ARE CLEARED AFTER THE FLAGS ARE SAVED. ***CFM IS SET AFTER THE FLAGS ARE SAVED ON A MONITOR JSYS FROM MONITOR MODE. ***CFM IS CLEARED ON A MONITOR JSYS FROM USER MODE. TIMING: 9 + R + W + (2 IF MONITOR JSYS OR INTERRUPT INSTRUCTION) I = 11 % SM[UM,IP[10000 000000S]]; *** SM[CFM,IP[2000 000000S]]; *** ** TOP HALF OF OLDPC MUST BE 0 HERE. RETURN PC & FLAGS IN MDR, E IN P, 777 IN Q *! MAXC1 ONLY JSYS: P←OLDPC, Q←(NOT F) U (NOTFLAGS), GOTO[.+2,J=1]; MDR←P OR NOT Q, P←REFADR, BAMASK[22], Q←777L, RETURN; MDR←(P OR NOT Q) U (UM), P←REFADR, BAMASK[22], Q←777L, RETURN; *! *~ MAXC2 ONLY JSYS: P←REFADR, BAMASK[22], Q←777L, MDR←(TENF) U (PC), RETURN[J=0]; MDR←(MDR) U (UM), RETURN; *~ *NOW HAVE PC AND FLAGS IN MDR, E IN P, 777 IN Q JSYS0: P AND NOT Q, Q←MDR, SETSF[UM&J]; Q←JSYST, RTEMP←Q, GOTO[JSYS1,ALU#0]; *HERE IFF E<1000 CLEARF[UM], DGOTO[JSYS1]; MAPVA←P←P+Q, SETFC[CFM,J=0], GOTO[JSYS1,J=0]; Q←RMQ, CALL[LOADMAP]; JSYS1: RREF, P←(REFADR←P) U (RLE), CALL[RETN]; LEFADR←P, PC←P←MDR, GOTO[.-2,G=1]; PQ RCY [22], Q←RTEMP, CLEARF[BIS&MD0&MD1&MD2&J], GOTO[WQTOP]; DI[104,JSYS,JSYS0,SCRASH]; %JSR IS THE SECOND INSTRUCTION WHICH CAN BE USED IN AN INTERRUPT LOCATION. AS SUCH IT MUST SET THE UM FLAG IN THE PC WORD WHEN IT FINDS J=1. ALSO IT MUST CLEAR BIS AFTER SAVING THE FLAGS. JSR CAN BE SPEEDED UP BY 3 OR 4 CYCLES BY PROGRAMMING THE MEMORY REFERENCE IN LINE RATHER THAN JUMPING TO WREFQ. TIMING = M + W + 4 I = 2 % JSR: Q←P+1, P←MDR, CLEARF[BIS&MD0&MD1&MD2&J]; PC←Q, Q←P, P←REFADR, BAMASK[22], RETURN; DI[264,JSYS,JSR,WREFQ]; %THE AC REGISTER CONTROLS WHAT THE JRST DOES: 10: DISMISS INTERRUPT PRIVILEGED TRAP TO MONITOR LOCATION UUO40 4: HALT IF EXECUTED IN USER MODE 2: RESTORE FLAGS AS DESCRIBED BELOW 1: ENTER USER MODE WHEN FLAGS ARE RESTORED, THEY ARE RESTORED FROM THE LEFT HALF OF THE LAST WORD IN THE EFFECTIVE ADDRESS CALCULATION. THAT IS, FROM THE INDEX REGISTER, IF THE LAST THING WAS INDEXING, ELSE FROM THE INDIRECT WORD, ELSE FROM THE INSTRUCTION ITSELF. HOWEVER, FINAL INDEXING WILL NOT BE DONE IF THE LAST INDIRECT WORD (OR THE INSTRUCTION ITSELF, IF NO INDIRECTION) HAS MACHINE MODE FLAGS DIFFERENT FROM 0. TO PREPARE FOR THIS JRST BREAKS OUT OF THE MAIN LOOP AND SAVES THE INSTRUCTION IN "RTEMP", THEN JUMPS BACK TO THE MAIN LOOP FOR INDIRECT ADDRESS CALCULATION IF NECESSARY. THE MAIN LOOP CANNOT DO THIS WITHOUT BEING LENGTHENED BY ONE INSTRUCTION. THE UM FLAG CAN BE SET BUT NOT CLEARED BY JRST 2,E. USER IN-OUT HAS NOT BEEN IMPLEMENTED. WHEN HALT OR DISMISS INTERRUPT ARE GIVEN IN USER MODE NEITHER JUMPING NOR RESTORING FLAGS WILL TAKE PLACE. INSTEAD THE INSTRUCTION WILL TRAP TO THE LOCATION POINTED TO BY UUO40. IF AC ODD DO; UM←1; END; IF (T←AC RSH 1)=0 DO; PC←REFADR←E; GOTO[REMAPPC]; ELSEIF (T AND 6)#0 DO; IF (J←UM)=1 DO; STACK←DM 0; CLEARF[TFLAGSPI]; GOTO[UUO]; ELSEIF (T AND 2)#0 DO; HALT END; CALL[DISMISINT] IF (T AND 4)#0; GOTO[REMAPPC] IF (T AND 1)=0; END; CLEARF[FLAGS EXCEPT UM]; ISPLIT←RTEMP; IF MD0=MD1=MD2=0 AND X#0 DO; SETF[LINDX AND FLAGS]; ELSE DO; SETF[RTEMP AND FLAGS]; END; DISPATCH TO MACHINE THROUGH IM TABLE; I = 18 + 1/MACHINE MODE HERE + A FEW IN "PISYS" AT "DISMISINT" TIMING = M + 4 CYCLES FOR A JRST WITH AC=0 + 7 CYCLES + TIME FOR DISMISINT TO DISMISS AN INTERRUPT + 9 OR 10 CYCLES TO RESTORE THE FLAGS = M + 6 + W + R FOR A HALT OR JEN IN USER MODE % SV[FLAGSNOTUM,767740 000017]; *JUMP BACK TO MAIN LOOP TO DO INDIRECTION IF NECESSARY JIND: Q←INSTR, GOTO[INDLP,H=0]; RTEMP←Q, Q←AC, SETSF[UM&J&K], GOTO[JRST1], POP; *TO "JRST" WITH LAST MEM FETCH IN "RTEMP", E IN P, AC IN Q, UM IN J E[LASTOK]; *LASTOK MUST BE 4 X N SO DISPATCH IS AT BOUNDARY OF 4 *NEED BOTH J AND K = UM FOR UUO TRAP JRST: Q←AC, SETSF[UM&J&K]; JRST1: RPGRT←Q, Q RSH 1, SETFC[UM,Q ODD], CALL[AQQ,Q ODD]; *ENTER USER MODE MAPVA←LTEMP←P, Q←1R, GOTO[REMAP1,ALU=0]; P←(777L) LSH [1], Y←NULL, BAMASK[3], Q←(RPGRT) RSH 1; *P←6, Q←AC RSH 1 P AND Q, GOTO[JRST3,J=1], PQ RCY[0], SAMASK[2], STACK←D; ***DM76 GOTO[JRST3,ALU=0], P AND Q, P←4S; *MONITOR HALT OR DISMISS INTERRUPT FALLS THROUGH CALL[SPUNT,ALU#0]; *OLD PC+1 IN "PC", NEW PC IN "LTEMP" DGOTO[REMAPPC,Q EVEN], P AND Q, Q←LTEMP; CALL[DISMISINT,ALU#0], PC←Q, A0; *CLOBBERS LPGRT, RPGRT, LPGRT2, MDR *RESTORE FLAGS FROM FINAL WORD OF EFFECTIVE ADDRESS CALCULATION, BUT *FINAL INDEXING IS SUPPRESSED WHEN MD1&MD2 IN THE LAST INDIRECT ADDRESS *WORD (OR THE INSTRUCTION, IF NO INDIRECTION) ARE NON-0. JRST3: Q←RTEMP, P←NOTFLAGS, GOTO[JRST2,ALU#0]; *"DISMISINT" LEAVES ALU=0 AT RETURN JRST5: ISPLIT←Q, Q←NOT P AND Q, CLEARF[FLAGSNOTUM], CALL[SSTEMP]; NPC←(P) U (NPC), GOTO[JNEWM]; *DISPATCH TO MACHINE SELECTED BY MD1&MD2 RIGHT-JUSTIFIED IN P. *HAVE LAST MEM FETCH IN RTEMP, E IN LTEMP. MUST BE BOUNDARY OF 4. Q←NOT P AND Q, CALL[SSTEMP,X>=0]; *M0 = PDP-10 (RETURNS TO JNEWM+1) P←RTEMP, Q←A0, SETF[STEMP], GOTO[LENTER]; *M1 = BLISP *USER HALT = UUO 76. LTEMP←E, J←UM, STACK←DM 76 DONE ABOVE. JRST2: P←STACK, CLEARF[TFLAGSPI], GOTO[UUO]; *M2 UNDEFINED SSTEMP: STEMP←Q, QQ RCY [31], BAMASK[1], RETURN; *P[43]←MD2 TARGET[ILC]; *DGOTO[JRSTD+MD2] PENDING JNEWM: Q←LINDX, DECX, P←NOTFLAGS, DGOTO[.+1]; *POSTPONE MAPVA←P UNTIL AFTER UM IS SET SETF[STEMP], P←LTEMP, A1, GOTO[JUMPN]; DIS[254,JIND,JRST,SCRASH]; %JFCL JUMPS IF ANY OF THE FLAGS SELECTED BY AC IS SET AND CLEARS THE SELECTED FLAGS. TIMING = M + 7 I = 4 % JFCL: Q←(AC) U (20S), RTEMP←P, DGOTO[SSTEMP]; QQ RCY [4], Q←A0, CALL[UPQ]; JFCL1: SETSF[STEMP], Q←RTEMP, DGOTO[REMAPPC]; CLEARF[STEMP], GOTO[PCQ,G=1]; *PCQ IS WITH JRA CODE DI[255,JFCL,JFCL1,SCRASH]; %JSP PLACES FLAGS AND PC IN AC, CLEARS BIS, AND JUMPS TO E. TIMING = M + 2 I = 2 % *! MAXC1 ONLY JSP: P←OLDPC, Q←(NOT F) U (NOTFLAGS); LAC←P OR NOT Q, P←REFADR, CLEARF[BIS&MD0&MD1&MD2&J], GOTO[JUMPA]; *! *~ MAXC2 ONLY JSP: Q←(TENF) U (PC); LAC←Q, P←REFADR, CLEARF[BIS&MD0&MD1&MD2&J], GOTO[JUMPA]; *~ DI[265,JSP,REMAP1,SCRASH]; %JSA PLACES THE AC IN LOCATION E, E IN AC LEFT, AND PC IN AC RIGHT. THEN IT JUMPS TO E+1. THE FLAGS ARE NOT SAVED. BIS IS CLEARED. TIMING = M + 6 + W I = 4 % *MAKE SURE JSA AC,777777 STORES 0 IN L.H. OF PC. JSA: MDR←Q, P←P+1, BAMASK[22], Q←REFADR; RTEMP←P, PQ RCY [22], Q←PC; LAC←P OR Q, CLEARF[BIS&MD0&MD1&MD2&J], Q←RTEMP, P←MDR, DGOTO[WREFQ]; PC←Q, P←REFADR, BAMASK[22], Q←P; DI[266,JSA,SCRASH,SCRASH]; %JRA LOADS AC FROM THE LOCATION ADDRESSED BY AC LEFT AND JUMPS TO E. TIMING = M + R + 6 I = 3 % *CAN'T CHANGE PC YET BECAUSE OF POSSIBLE MAP FAULT JRA: RTEMP←P, QQ RCY [22], SAMASK[22], GOTO[JUMPA]; *TO MAPVA AND RARG JRA1: LAC←P, Q←RTEMP; PCQ: PC←MAPVA←P←BQ, AQ, Q←1R, GOTO[REMAP1]; *ENTER HERE FROM JFCL DI[267,JRA,RARG,JRA1]; %POP AND POPJ ACCEPT E IN "RTEMP", J=1, LAC IN P, 1 000001 IN Q. THEY RETURN UPDATED PUSHDOWN POINTER IN LAC, PDOVF SET IF NECESSARY. POPJ DOES NOT RESTORE THE FLAGS. POPJ TIMING = M + R + 5 POP TIMING = M + R + W + 5 I = 5 % SM[PDOVF,IP[20 000000S]]; POPJ: LAC←P-Q-NJ, PC←P←MDR; MAPVA←P←P, SAMASK[22], Q←1R, GOTO[REMAP1,J=1]; SETPDF: SETF[PDOVF], RETURN; DI[263,POPX,POPJ,REMAP1]; *POPJ POPY: LAC←P-Q-NJ, P←RTEMP, DGOTO[WTOP1]; MAPVA←P, CALL[SETPDF,J=0]; DI[262,POPX,POPY,SCRASH]; %PUSHJ HAS TO CHANGE THE PC AND AC BEFORE CHECKING FOR A MAP FAULT SO THAT THE INSTRUCTION WILL BE COMPLETED EXCEPT FOR THE WRITE IF A MAP LOADING TRAP OCCURS. PDOVF IS SET IF THE POINTER IN THE AC CROSSES 0 WHEN 1 000001 IS ADDED TO IT. NOTE THAT BECAUSE PUSHJ IS NOT A LEGAL INTERRUPT INSTRUCTION, THE J FLAG (REMEMBERING USER MODE) DOES NOT HAVE TO BE CHECKED AS IT WAS FOR JSR AND JSYS. BIS, MD0, MD1, AND MD2 ARE IS CLEARED. TIMING = M + 4 + W I = 6 % *! MAXC1 ONLY PUSHJ: P←(NOT F) U (NOTFLAGS), LTEMP←P, Q←OLDPC; MDR←NOT P OR Q, P←LAC, Q←(2 000002R) RSH 1, CLEARF[BIS&MD0&MD1&MD2&J]; *! *~ MAXC2 ONLY PUSHJ: LTEMP←P, MDR←(TENF) U (PC), P←Q, Q←(2 000002R) RSH 1; CLEARF[BIS&MD0&MD1&MD2&J]; *~ PUSHJ1: MAPVA←P←LAC←P+Q+J, Q←777777R; WREF, P←MDR, Q←LTEMP, REFADR←P AND Q, DGOTO[QTOLX,G=1]; PC←Q, Q←P, P←REFADR, CALL[SETPDF,J=1]; GOTO[WQTOP0]; DI[260,PUSHJ,SCRASH,SCRASH]; %PUSH BEGINS WITH [E] IN MDR, AC IN P, 1 000001 IN Q. IT INCREMENTS AC BY 1 000001, WRITES THE MEMORY DATA ONTO THE STACK, THEN SETS PDOVF IF THE STACK POINTER CROSSES 0. TIMING = M + R + W + 3 I = 2 % *! MAXC1 ONLY (BETTER) PUSH0: MAPVA←P←LAC←P+Q+J, Q←777777R, DGOTO[WREFQ]; P←REFADR←P AND Q, Q←MDR, SETFC[PDOVF,J=1], GOTO[WREFQ,J=1]; *! *~ MAXC2 ONLY PUSH0: P←LAC←P+Q+J, Q←777777R, DGOTO[WQTOP]; P←P AND Q, Q←MDR, SETFC[PDOVF,J=1], GOTO[WQTOP,J=1]; *~ DI[261,RTOMDR,PUSH0,SCRASH]; %JFFO LEAVES IN AC+1 A COUNT OF THE NUMBER OF LEADING ZEROES IN AC AND JUMPS TO E. HOWEVER, IF AC CONTAINS 0 IT DOES NOT JUMP. TIMING = M + 4 WHEN AC CONTAINS 0 = M + 7 + NO. LEADING ZEROES WHEN LEADING ONE IS IN L.H. = M + 9 + (NO. LEADING ZEROES - 18) WHEN LEADING ONE IS IN R.H. I = 7 % JFFO: MDR←P, P←LAC, SAMASK[22]; AQ, Y←NULL; P#Q, PQ RCY [22], STEMP←MDR, INCAC, GOTO[SETZ,ALU=0]; GOTO[.+2,ALU#0], AQ, Q LSH 1; *SKIP IF L.H. # 0 Q←P, Y←22S, GOTO[.-1]; INCY, GOTO[.,ALU>0], Q LSH 1, AQ, P←Y; LAC←P, P←MAPVA←STEMP, ACFS, Q←1R, GOTO[REMAP1]; DI[243,JFFO,SCRASH,SCRASH]; %THE JUMP CLASS INSTRUCTIONS JUMP TO E IF THE AC MEETS THE SPECIFIED CONDITION. TIMING = M + 2 + 1 IF NO JUMP -1 FOR JUMPA I = 7 TOTAL % SLC[PREMAP: E1[REMAPPC]]; JUMPC: AQ, NPC←PREMAP, RETURN; JUMPL: MAPVA←P, Q←1R, GOTO[REMAP1,ALU<0]; JUMPE: MAPVA←P, Q←1R, GOTO[REMAP1,ALU=0]; JUMPLE: MAPVA←P, Q←1R, GOTO[REMAP1,ALU<=0]; JUMPGE: MAPVA←P, Q←1R, GOTO[REMAP1,ALU>=0]; JUMPN: MAPVA←P, Q←1R, GOTO[REMAP1,ALU#0]; JUMPG: MAPVA←P, Q←1R, GOTO[REMAP1,ALU>0]; DI[320,REMAPPC,SCRASH,SCRASH]; DI[321,JUMPC,JUMPL,SCRASH]; DI[322,JUMPC,JUMPE,SCRASH]; DI[323,JUMPC,JUMPLE,SCRASH]; DI[324,XJMP,SCRASH,SCRASH]; DI[325,JUMPC,JUMPGE,SCRASH]; DI[326,JUMPC,JUMPN,SCRASH]; DI[327,JUMPC,JUMPG,SCRASH]; %AOBJP AND AOBJN BEGIN WITH AOBJ WHICH INCREMENTS THE AC BY 1 000001. TIMING = M + 3 + 1 IF IT JUMPS I = 2 TOTAL % **THESE DO NOT OVF, PC0, OR PC1 AOBJ: RTEMP←P, P←LAC, Q←1 000001S; LAC←P+Q, P←RTEMP, NPC←PREMAP, RETURN; DI[252,AOBJ,JUMPGE,SCRASH]; *AOBJP DI[253,AOBJ,JUMPL,SCRASH]; *AOBJN %THE AOJ AND SOJ GROUP OF INSTRUCTIONS INCREMENTS OR DECREMENTS THE AC AND JUMPS IF THE SPECIFIED CONDITION IS MET. OVERFLOW, CARRY0, AND CARRY1 ARE ALSO SET WHEN APPROPRIATE. TIMING = M + 3 + 1 IF NO JUMP FOR THE AOJ GROUP = M + 4 + 1 IF NO JUMP FOR THE SOJ GROUP I = 4 TOTAL % AOJC: LAC←P+Q, P←REFADR, SETOVPC01, NPC←PREMAP, RETURN; AOJS: P←1R, RETURN; AOJA: LAC←P+Q, SETOVPC01, P←REFADR, Q←1S, GOTO[REMAP1]; DI[340,AOJS,AOJC,REMAPPC]; DI[341,AOJS,AOJC,JUMPL]; DI[342,AOJS,AOJC,JUMPE]; DI[343,AOJS,AOJC,JUMPLE]; DI[344,AOJS,AOJA,SCRASH]; DI[345,AOJS,AOJC,JUMPGE]; DI[346,AOJS,AOJC,JUMPN]; DI[347,AOJS,AOJC,JUMPG]; SOJS: P←-1L, RETURN; DI[360,SOJS,AOJC,REMAPPC]; DI[361,SOJS,AOJC,JUMPL]; DI[362,SOJS,AOJC,JUMPE]; DI[363,SOJS,AOJC,JUMPLE]; DI[364,SOJS,AOJA,SCRASH]; DI[365,SOJS,AOJC,JUMPGE]; DI[366,SOJS,AOJC,JUMPN]; DI[367,SOJS,AOJC,JUMPG];