Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50034/sim.c34
There are no other files named sim.c34 in the archive.
C COPYRIGHT 1969 DIGITAL EQUIPMENT CORPORATION.
C
C
C PDP-11 SIMULATOR MAIN PROGRAM
C
C
C COMMAND DECODER(INITIAL)
C
IMPLICIT INTEGER(A-Z)
C MEMORY ARRAY
COMMON/MEM/MEM(4096),MEMROL,MEMROH,ROMF,MEMH ,MEMLIM
C REGISTER ARRAY
COMMON/SCRATCH/REGISTER(9),SAV(9)
EQUIVALENCE (LP,REGISTER(8)),(PC,REGISTER(9)),(ST,REGISTER(1))
EQUIVALENCE (ST,STATUS)
COMMON/CNTRLC/CNTRLC
C GENERAL VARIABLES
COMMON/GEN1/ IC,OP,IR,IOLINK,STOP(8),STOPC(8),CAR,RESULT,BW,CAD,
1 BRKN,DEV,FIL,FILN,IRET,NOTYO,NOTYI,SG,SGA,SUBOPA,
2 TYEQTY,ADSTOP,ADSTCL,ADSTFL,ADSTAD,TR1,TR2,TR3,TIME,TIMES,
3 TTYSRC,SERMSK,SERLOW,SERHI,TYOERR,TDEV,TFIL,GROUP,GROUPA,OVR
EQUIVALENCE(TI,T1)
COMMON /GEN2/ PTIDEV,PTIFIL,PTODEV,PTOFIL,TIDEV,TIFIL,NOPTI,
1 NOPTO,PUNCH,GENIOR,TYISTY
C COMMONLY USED CONSTANTS, MASKS.
COMMON/CONST/MH,ML,MAL,MALC,MLC,M7,M8,SCRBEG,SCREND,C2T7,C2T15,
1 TYO,CON,TYI,BIN,TTYNAM,PTRNAM,DSKNAM,TTOFIL,TTIFIL,
2 NUMINW,CR,LF,TAB,CHRLEN,WRDLEN,B,DOL,BLANK,EQUALS,COMMA,
3 WM0,WM1,WM2,WM3,WM4,WM5,WM6,WM7,WM8,WM9,WM10,WM11,WM12,
4 WM13,WM14,WM15,SL8,APC,ACC,ADR0,
5 TSTION
EQUIVALENCE(ETFLG,ADR0)
C MESSAGE ARRAY
COMMON/MESAGE/MES1,MES1A,MES1B,MES1X,MES2,MES2A,MES2B,MES2X,
1 MES3,MES3A,MES3B,MES3X,MES4,MES4X,MES5,MES5A,MES5B,
2 MES5C,MES5D,MES5X,MES6,MES6X,MES7,MES7X,MES8,MES8A,
3 MES8B,MES8X,MES9,MES9A,MES9B,MES9X,MES10,MES10A,
4 MES10B,MES10X,MES11,MES11X,MES12,MES12X,MES13,MES13X,
5 MES14,MES14X,MES15,MES15X,MES16,MES16X,MES17,MES17X,
6 MES18,MES18X,MES19,MES19X,MES20,MES20A,MES20B,MES20C,
7 MES20D,MES20X,MES21,MES21X,MES22,MES22X,MES23,MES23A,
8 MES23B,MES23X,MES24,MES25,MES25X,MES26,MES26X,
9 MES27,MES27A,MES27B,MES27C,MES27D,MES27X,MES28,MES28X,
1 MES29,MES29A,MES29B,MES29C,MES29D,MES29E,MES29F,MES29X,
2 MES30,MES30X,MES31,MES31X,MES32,MES32A,MES32B,MES32C,
3 MES32D,MES32X,MES33,MES33A,MES33B,MES33C,MES33D,MES33X
4 ,MES20E,MES20F,MES24X
DIMENSION MES1(6),MES2(3),MES3(5),MES4(2),MES5(3),MES6(1),MES7(1),
1 MES8(3),MES9(2),MES10(2),MES11(1),MES12(1),MES13(2),MES14(2),
2 MES15(3),MES16(2),MES17(1),MES18(3),MES19(3),MES20(6),MES21(1)
3 ,MES22(1),MES23(4),MES24(1),MES25(1),MES26(2),MES27(7),
4 MES28(2),MES29(5),MES30(2),MES31(1),MES32(3),MES33(2)
COMMON/MESAG2/MES34,MES34X,MES35,MES35X,MES36,MES36X,
1 MES37,MES37X
DIMENSION MES34(2),MES35(1),MES36(1),MES37(6)
C ADDRESSING VARIABLES FOR SOURCE, DEST.
C EFFECTIVE ADDRESSES; DEFER BIT; MODE;
C AND REGISTER NUMBER.
COMMON/GEN3/SOUR,DEST,SD,DD,SM,DM,SREG,DREG
COMMON/CNTRLR/CNTRLR
COMMON/NOTYOA/NOTYOA
C SPECIAL CHARACTERS.
C COMMND IS THE ODT COMMAND ARRAY.
COMMON/CHAR/LEGALF,NUM,COMMND,COMMNN,SHIFT,CNTRLU,RUBOUT,
1 ALTMD1,ALTMD2,ALTMD3,DOLLFT,BLANKL ,LEGALN,NUMN,TABLFT,ICHAR,
2 COLON,SLASH
DIMENSION LEGALF(4),NUM(2),COMMND(40,2)
EQUIVALENCE (CRLEFT,COMMND(25,1)),(ARO,COMMND(27,1)),
1 (BARO,COMMND(26,1)),(LFLEFT,COMMND(29,1)),(BLF,COMMND(28,1))
DIMENSION DUM1(1)
EQUIVALENCE(DUM1(1),WM0)
C SWITCH REGISTER AND ITS ADDRESS.
COMMON/XTCH/XTCH,XTCHAD
C
C~ DEVICE REGISTERS IN EXTERNAL PAGE.
C
C XPG(I,1)=ADDRESS OF BYTE I.
C XPG(I,2)=CONTENTS OF BYTE I.
C XPG(I,3)=READ ONLY MASK. SET A 1 FOR A READ ONLY BIT.
C XPG(I,4)=WRITE ONLY MASK. SET A 1 FOR EACH WRITE ONLY BIT.
C XPG(I,5)=ACCESS FLAG. 0=NOT ACCESSED.
C 1=READ.
C 2=WRITTEN.
C 3=BOTH.
C XPG(I,6)=POWER UP CONTENTS OF BYTE I.
C XPG(I,7-10)=NOT DEFINED.
C
C
C XPGI AND XPGJ ARE LIMITS ON I,J DIMENSIONS OF XPG.
C TIMEX IS THE TIMER FOR DEVICE FUNCTIONS
C
C
COMMON/XPG/XPG,XPGI,XPGJ,TIMEX
DIMENSION XPG(30,10)
C
C DEVICE CHARACTERISTICS TABLE. FOR EACH DEVICE I, THE CURRENT
C STATUS IS HELD IN THIS TABLE.
C
C I=1 FOR KBD,LSR.
C I=2 FOR TTY,LSP.
C I=3 FOR HSR.
C I=4 FOR HSP.
C
C
C DCH(I,1)=TIME INTERVAL FOR DOING FUNCTION.
C DCH(I,2)=TIME AT LAST SELECT.
C DCH(I,3)=DEVICE PRIORITY.
C DCH(I,4)=ADDRESS OF INTERRUPT VECTOR.
C DCH(I,5)=INTERRUPT REQUEST FLAG.
C DCH(I,6)=INTERRUPT ENABLE BIT ON LAST CYCLE.
C DCH(I,7)=EOF INDICATOR(OUT OF TAPE).
C DCH(I,8-10)=NOT DEFINED.
C
C
C DCHI AND DCHJ ARE LIMITS ON I,J DIMENSIONS OF DCH
C NUMDEV IS THE CURRENT NUMBER OF DEVICES
C
COMMON/DCH/DCH,DCHI,DCHJ,NUMDEV
DIMENSION DCH(10,10)
COMMON/POWTWO/ CT0,CT1,CT2,CT3,CT4,CT5,CT6,CT7
C
C
C DEVICE INDEXES
C
C
COMMON/DEVINX/DEVINX
DIMENSION DEVINX(10,6)
C
C
COMMON/SINGIN/SINGIN
COMMON/LPOVAD/LPOVAD,LPOVFL,TRAF,WAITF
COMMON/GEN5/STDEST
C
C SET UP MASKS, CONSTANTS AND SPECIAL CHARACTERS
C
I=(2**CHRLEN)-1
J=CHRLEN-1
CALL BTX (MASK,0,J,I)
CALL BTX (CNTRLU,0,J,21)
CALL BTX (CNTRLR,0,J,18)
CALL BTX (RUBOUT,0,J,127)
CALL BTX (ALTMD1,0,J,125)
CALL BTX (ALTMD2,0,J,123)
CALL BTX (ALTMD3,0,J,27)
CALL BTX (ARO,0,J,95)
CALL BTX (UPARO,0,J,94)
CALL MOVE (MES17,1,UPARO,1,1)
DOLLFT=DOL
CALL LAND (DOLLFT,MASK)
CALL LAND (BLANK,MASK)
CALL BTX (CRLEFT,0,J,CR)
CALL BTX (TABLFT,0,J,TAB)
CALL BTX (LFLEFT,0,J,LF)
BLANKL=BLANK
BB=B
CALL LAND(BB,MASK)
BARO=BB
BLF=BB
CALL MOVE (BARO,2,ARO,1,1)
CALL MOVE (BLF,2,LFLEFT,1,1)
SL8=2**8
ML=255
MH=ML*SL8
MALC=SL8**2
MAL=MALC-1
MLC=SL8
C2T7=SL8/2
C2T15=MALC/2
M7=7
M8=8
APC=7
ACC=MAL-1
XTCH=0
XTCHAD=MH+120
C CREATE WM0,...,WM15 FOR INDEXING TO PDP-11
C BIT POSITIONS WITH ROUTINES BXT,BTX.
DO 941 I=1,16
DUM1(I)=WRDLEN-I
941 CONTINUE
ADSTCL=0
ADSTFL=0
K=MEMLIM+1
MEMH=K
ROMF=0
K=K/NUMINW
C CLEAR THE MAIN MEMORY AREA
900 DO 9001 I=1,K
MEM(I)=0
9001 CONTINUE
C INITIALIZE THE CONSOLE TTY ON CHANNEL 0
902 CALL GCI(TTYNAM,CON,2,2,0,I)
C INITIALIZE ASSIGNED GO TO VARIABLES FOR IO ERRORS.
ASSIGN 10131 TO GENIOR
ASSIGN 1013 TO TYOERR
C INITIALIZE FLAGS FOR IO CONTROL
NOTYOA=0
NOTYO=0
NOTYI=0
NOPTI=0
NOPTO=0
TYISTY=0
TYEQTY=0
C INITIALIZE THE DDT SUBMODE ROUTINES
C AND SET UP ASSIGNED GO TO VARIABLES
CALL ICRWCS
ASSIGN 902 TO IRET
ASSIGN 902 TO IRETA
C CHECK FOR ERRORS FROM THE GCI CALL.
GO TO (901,903,902,903),I+1
C SYSTEM ERROR 1
903 E=1
GO TO 81
901 CALL CRLFC
CALL VERSION
C PROCESS *CORE COMMAND
9101 CALL LIST(MES30,1,MES30X,2)
ASSIGN 9101 TO IRET
CALL GCOMD(N,V1,V2,I)
IF(I.NE.0)GO TO 84
IF(N.NE.33)GO TO 84
IF(V1.EQ.-1)V1=2
IF(V1.LE.0.OR.V1.GE.3)GO TO 84
MEMH=8192*V1
C PROCESS *ROM COMMAND
9102 ASSIGN 9102 TO IRET
CALL LIST(MES31,1,MES31X,2)
CALL GCOMD(N,V1,V2,I)
IF(I.NE.0)GO TO 84
ROMFA=0
IF(N.EQ.33.AND.V1.EQ.-1)GO TO 910
IF(N.EQ.34.AND.V1.NE.-1.AND.V2.NE.-1)GO TO 9103
GO TO 84
9103 MEMROL=V1
MEMROH=V2
ROMFA=1
GO TO 910
C SYSTEM ERROR 2
912 E=2
GO TO 81
C PROCESS *OBJ COMMAND
910 ASSIGN 910 TO IRET
911 CALL LIST(MES12,1,MES12X,2)
CALL DEVFIL(I,J,K)
GO TO (913,904,940,84),I+1
913 CALL GCI(DEV,BIN,0,2,1,I)
IF(I.EQ.0)GO TO 914
C COMMON ERROR HANDLING FOR GCI CALLS.
919 GO TO(903,82,903),I
C BAD DEVICE ERROR.
82 CALL LIST(MES13,1,MES13X,4)
GO TO IRET
C OPEN FILE TO LOAD OBJ PROGRAM
914 CALL OFIN(BIN,FIL,I)
IF(I.EQ.0)GO TO 916
C ON AN ERROR, FINISH THE CHANNEL AND DISPATCH TO ERROR LOCS.
945 CALL FIN(BIN,J)
946 GO TO(917,917,83,83,917),I
C SYSTEM ERROR 3.
917 E=3
GO TO 81
C BAD FILE ERROR
83 CALL LIST(MES14,1,MES14X,4)
GO TO IRET
C LOAD THE OBJ FILE.
916 CALL MLOAD(I)
IF(I.EQ.0)GO TO 910
C LOAD ERROR.
CALL LIST(MES4,1,MES4X,4)
GO TO IRET
C GENERAL COMMAND ERROR.
84 CALL LIST(MES18,1,MES18X,4)
GO TO IRET
940 CONTINUE
C PROCESS *TTY COMMAND
950 ASSIGN 950 TO IRET
951 NOTYO=0
NOTYOA=0
TYISTY=0
TYEQTY=0
CALL LIST(MES 21,1,MES21X,2)
CALL DEVFIL(I,J,K)
GO TO(952,904,990,84),I+1
C CONTROL-R DETECTED BY ROUTINE DEVFIL.
904 CALL LIST(MES17,1,MES17X,3)
K=IRETA
C GO CLOSE ALL FILES.
GO TO 14131
C INDICATE THAT TTY OUTPUT IS SPECIFIED.
952 NOTYO=1
NOTYOA=1
C REMEMBER DEV, FIL FOR FINAL COMMAND STRING.
CALL MOVE (TDEV,1,DEV,1,5)
CALL MOVE (TFIL,1,FIL,1,4)
C IF DEV IS NOT A TTY, GO TO 100
CALL CAM(I,TDEV,1,TTYNAM,1,3)
IF(I.NE.0)GO TO 100
CALL CAM (I,TDEV,4,BLANK,1,1)
IF(I.NE.0)GO TO 101
C DEV IS TTY: , SET FLAGS TO USE ROUTINE CWC RATHER THAN PRT.
C DO NOT SET UP A CHANNEL FOR TTY OUTPUT. USE CHANNEL 0.
TYEQTY=1
NOTYOA=0
GO TO 990
C DEV IS TTYNN: , SET FLAG.
101 TYISTY=1
100 CALL GCI(DEV,TYO,1,2,0,I)
IF(I.NE.0)GO TO 919
C IF NO FILE SPECIFIED, ASSUME TTO.
CALL CAM(I,TFIL,1,BLANK,1,1)
IF(I.EQ.0)CALL MOVE(TFIL,1,TTOFIL,1,4)
CALL OFOUT(TYO,TFIL,I)
IF(I.EQ.0)GO TO 954
C ON ERROR DURING OFOUT, CLOSE CHANNEL AND DISPATCH.
956 CALL FIN(TYO,J)
955 GO TO(915,915,83,83,915,918),I
C SYSTEM ERROR 4.
915 E=4
GO TO 81
C SYSTEM ERROR 5.
918 E=5
GO TO 81
954 CONTINUE
C PROCESS *LSR COMMAND.
990 NOTYI=0
ASSIGN 990 TO IRET
991 CALL LIST(MES22,1,MES22X,2)
CALL DEVFIL(I,J,K)
GO TO(992,904,9100,84),I+1
992 NOTYI=1
CALL MOVE(TIDEV,1,DEV,1,5)
CALL MOVE(TIFIL,1,FIL,1,4)
9120 CALL GCI(DEV,TYI,0,2,1,I)
IF(I.NE.0)GO TO 919
CALL CAM(I,TIFIL,1,BLANK,1,1)
IF(I.EQ.0)CALL MOVE (TIFIL,1,TTIFIL,1,4)
9914 CALL OFIN(TYI,TIFIL,I)
IF(I.EQ.0)GO TO 9100
947 CALL FIN(TYI,J)
GO TO 946
9100 CONTINUE
C PROCESS *HSP COMMAND
ASSIGN 9100 TO IRET
NOPTO=0
CALL LIST(MES35,1,MES35X,2)
CALL DEVFIL(I,J,K)
GO TO(9201,904,9300,84),I+1
9201 NOPTO=1
CALL MOVE(PTODEV,1,DEV,1,5)
CALL MOVE(PTOFIL,1,FIL,1,4)
CALL GCI(DEV,PUNCH,1,2,1,I)
IF(I.NE.0)GO TO 919
CALL OFOUT(PUNCH,PTOFIL,I)
IF(I.EQ.0)GO TO 9300
CALL FIN(PUNCH,J)
GO TO 955
C PROCESS *HSR COMMAND
9300 ASSIGN 9300 TO IRET
NOPTI=0
CALL LIST(MES36,1,MES36X,2)
CALL DEVFIL(I,J,K)
GO TO (9301,904,9400,84),I+1
9301 NOPTI=1
CALL MOVE(PTIDEV,1,DEV,1,5)
CALL MOVE(PTIFIL,1,FIL,1,5)
CALL GCI(DEV,BIN,0,2,1,I)
IF(I.NE.0)GO TO 919
CALL OFIN(BIN,PTIFIL,I)
IF(I.EQ.0)GO TO 9400
CALL FIN(BIN,J)
GO TO 946
9400 CONTINUE
C CLEAR ALL REGISTERS
DO 9002 I=1,9
REGISTER(I)=0
9002 CONTINUE
GO TO 130
C SYSTEM ERROR PRINTOUT
81 CALL CHA(MES23,MES23A,MES23B,E)
CALL LIST(MES23,1,MES23X,4)
GO TO IRET
C
CODT HANDLERS
C
C CLEAR ALL STOP POINTS AND OTHER FLAGS.
130 DO 1301 I=1,8
STOP(I)=-1
STOPC(I)=1
1301 CONTINUE
CAD=0
TR3=0
TIME=0
TIMES=0
SINGIN=0
BW=0
ROMF=ROMFA
ADSTCL=0
ADSTFL=0
CNTRLC=0
TTYSRC=0
ETFLG=0
TRAF=0
WAITF=0
CALL LIST(MES6,1,1,2)
C SIMM RETURNS HERE TO ODT.
131 BRKN=0
1311 TIMES=TIME
ROMFA=ROMF
ROMF=0
C SET UP ^C - REENTER PROCESS.
CALL SREENT
C ODT MAIN LOOP. GET COMMAND AND DISPATCH.
132 CALL GCOMD(I,N1,N2,E)
IF(E.NE.0)GO TO 7
GO TO(141,142,143,144,145,146,147,148,149,1410,1411,1412,1413,
1 1414,1415,1416,1417,1418,1419,1420,1421,1422,1423,1424,
2 1425,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,
3 1436,1437,1438,1439,1440),I
C
C G$ -- GO COMMAND
C
141 IF(N1.EQ.-1)GO TO 7
IF(N1.LT.0.OR.N1.GT.MEMH)GO TO 7
CALL CHA(MES8,MES8A,MES8B,N1)
CALL TTYO(MES8,1,MES8X,4)
CALL RESET
ST=0
TRAF=0
14105 BRKN=0
BW=0
CALL LIST(BLANK,1,1,4)
TIME=TIMES
CALL PREG(APC,N1)
IC=N1
ROMF=ROMFA
ADSTFL=0
CNTRLC=0
GO TO 105
C ODT COMMAND ERROR HANDLER.
7 CALL LIST(MES7,1,MES7X,2)
CALL LIST(MES6,1,1,2)
BW=0
GO TO 132
C
C B$ -- OPEN BYTE
C
142 IF(N1.LT.0) N1=CAD
14201 BW=1
CALL FME(N1,I,J)
IF(J.NE.0)GO TO 7
14202 T1=MES9A+2
T2=T1+2
14203 CALL SETB(MES9,MES9A,6)
CALL CHA(MES9,MES9A,T1,I)
CALL LIST(MES9,1,T2,1)
CAD=N1
GO TO 132
C
C $ -- OPEN WORD
C
143 IF(N1.LT.0) N1=CAD
BW=2
CALL FMW(N1,I,J)
IF(J.NE.0)GO TO 7
14301 T1=MES9B
T2=MES9X
GO TO 14203
C
C PC$ -- OPEN PC
C
144 N1=APC
14401 BW=7
CALL GREG(N1,I)
GOTO 14301
C
C V$ -- OPEN OVERFLOW FLAG.
C
145 K=2
BW=6
GOTO 14602
C
C C$ -- OPEN CARRY FLAG
C
146 K=1
BW=3
14602 CALL FME(ACC,I,J)
CALL LAND(I,K)
IF(I.NE.0)I=1
N1=ACC
GO TO 14202
C
C N$ -- OPEN NEGATIVE FLAG.
C
147 K=8
BW=4
GO TO 14602
C
C Z$ -- OPEN ZERO FLAG.
C
148 K=4
BW=5
GO TO 14602
C
C NRG$ -- OPEN REGISTER N.
C
149 IF(N1.LT.0.OR.N1.GT.7)GO TO 7
GO TO 14401
C
C ST$ -- STOP POINT SET, CLEAR, MOVE.
C
1410 IF(N1.NE.-1)GO TO 14102
IF(N2.NE.-1)GO TO 7
C ST$--REMOVE ALL BREAKS
DO 14103 I=1,8
STOP(I)=-1
14103 CONTINUE
CALL TTYOS(MES5,1,2)
14101 CALL LIST(MES6,1,1,2)
GO TO 132
14102 IF(N2.NE.-1)GO TO 14104
C REMOVE STOP N1
IF(N1.LT.0.OR.N1.GT.7)GO TO 7
STOP(N1+1)=-1
CALL CHA(MES10,MES10A,MES10B,N1)
CALL TTYO(MES10,1,MES10X,4)
GO TO 14101
14104 IF(N1.LT.0.OR.N1.GE.MEMH)GO TO 7
IF(N2.LT.0.OR.N2.GT.7)GO TO 7
C SET STOP N2 AT ADDRESS N1
STOP(N2+1)=N1
STOPC(N2+1)=1
CALL CHA(MES5,MES5A,MES5B,N1)
CALL CHA(MES5,MES5C,MES5D,N2)
CALL TTYOS(MES5,1,MES5X)
GO TO 14101
C
C P$ -- PROCEED
C
C TEST FOR ACTIVE STOP OR SINGLE INSTRUCTION MODE.
1411 IF(BRKN.GT.0)GO TO 14111
IF(SINGIN.EQ.2)GOTO 14112
GOTO 7
14111 IF(N1.LE.0)N1=1
C ON A STOP-POINT PROCEED, SET PROCEED COUNTER.
STOPC(BRKN)=N1
14112 CALL GREG(APC,IC)
IF(SINGIN.EQ.2)SINGIN=1
TIME=TIMES
ROMF=ROMFA
ADSTFL=0
CALL LIST (BLANK,1,1,4)
GO TO 105
C
C K$ -- KILL SIMULATION
C
1412 ASSIGN 60 TO K
GO TO 14131
C
C R$ -- RESTART SIMULATION
C
1413 CALL TTYO(MES11,1,MES11X,4)
ASSIGN 902 TO K
C FINISH ALL ACTIVE CHANNELS.
14131 IF(NOTYO.NE.0.AND.TYEQTY.EQ.0)CALL FIN(TYO,I)
IF(NOTYI.NE.0)CALL FIN(TYI,I)
IF(NOPTI.NE.0)CALL FIN(BIN,I)
IF(NOPTO.NE.0)CALL FIN(PUNCH,I)
NOTYO=0
NOTYI=0
NOPTI=0
NOPTO=0
GO TO K
C
C M$ -- SET SEARCH MASK.
C
1414 IF(N1.EQ.-1)N1=0
SERMSK=N1
GO TO 14101
C
C LI$ -- SET SEARCH LIMITS
C
1415 IF(N1.EQ.-1)GO TO 7
IF(N2.EQ.-1)GO TO 7
IF(N1.LT.0.OR.N1.GE.MEMH)GO TO 7
IF(N2.LT.0.OR.N2.GE.MEMH)GO TO 7
IF(N1.GT.N2)GO TO 7
SERLOW=N1
SERHI=N2
GO TO 14101
C
CXB $ -- EXAMINE MEMORY FOR BYTES.
C
1416 BW=1
14161 IF(SERLOW.GT.SERHI)GO TO 7
FL=0
IF(N1.EQ.-1)N1=0
CALL CRLFC
L=0
I=SERLOW
14162 CALL FME(I,J,K)
IF(BW.EQ.2)CALL FMW(I,J,K)
IF(K.NE.0)GO TO 14163
K=J
CALL LAND(K,SERMSK)
IF(N1.NE.K)GO TO 14163
14166 L=L+1
IF(L.GE.4)GO TO 14164
M=1
GO TO 14165
14164 M=3
L=0
14165 CALL CHA(MES32,MES32A,MES32B,I)
CALL CHA(MES32,MES32C,MES32D,J)
IF(BW.EQ.1)CALL SETB(MES32,MES32C,3)
CALL LIST(MES32,1,MES32X,M)
IF(M.EQ.3)CALL CRLFC
IF(FL.NE.0)GO TO 14261
14163 I=I+BW
IF(I.LE.SERHI)GO TO 14162
BW=0
GO TO 14101
C
C X$ -- EXAMINE MEMORY FOR WORDS.
C
1417 BW=2
GO TO 14161
C
C TR$ -- TRACE COMMAND.
C
1418 TR3=0
IF(N1.EQ.-1.AND.N2.EQ.-1)GO TO 14101
IF(N1.EQ.-1)GO TO 7
IF(N2.EQ.-1)GO TO 7
IF(N1.GE.MEMH)GO TO 7
IF(N2.GE.MEMH)GO TO 7
TR1=N1
TR2=N2
TR3=1
GO TO 14101
C
C TI$ -- TIMING
C
1419 CALL CHA(MES9,MES9A,MES9B,TIMES)
CALL LIST(MES9,1,MES9X,1)
IF(N1.NE.-1)TIMES=N1
GO TO 14101
C
C S$ -- REMOVE ADDRESS STOP.
C
1420 ADSTCL=0
GO TO 14101
C
C SR$ -- SET STOP ON READ.
C
1421 I=1
14211 IF(N1.EQ.-1)GO TO 7
ADSTCL=I
ADSTOP=N1
GO TO 14101
C
C SW$ -- SET ADDRESS STOP ON WRITE.
C
1422 I=2
GO TO 14211
C
C B-LINE-FEED
C
1423 J=1
14231 IF(BW.GE.3.AND.BW.LE.7)GO TO 7
IF(BW.EQ.0)GO TO 7
I=BW
14232 CONTINUE
14233 CALL CLOSE(N1,N2)
BW=J
N1=CAD+I
CALL LAND(N1,MAL)
CALL MEMLEG(N1,I,J)
IF(I.EQ.1) GO TO 7
IF(BW.EQ.2)CALL MEMLEG(N1+1,I,J)
IF(I.EQ.1) GO TO 7
CAD=N1
CALL CHA(MES32,MES32A,MES32B,N1)
CALL LIST(MES32,1,MES32B+1,2)
IF(BW.EQ.1)GO TO 142
GO TO 143
C
C LINE-FEED
C
1424 J=2
GO TO 14231
C
C B-LEFT-ARROW
C
1425 J=1
14251 IF(BW.GE.3.AND.BW.LE.6)GO TO 7
IF(BW.EQ.0)GO TO 7
CALL FME(CAD,I,K)
IF(BW.EQ.2)CALL FMW(CAD,I,K)
IF(BW.EQ.7)CALL GREG(CAD,I)
IF(K.NE.0)GO TO 7
14252 I=I-CAD
GO TO 14232
C
C XE$ -- EXAMINE MEMORY FOR EFFECTIVE ADDRESS REF.
C
1426 CONTINUE
IF(N1.EQ.-1)GO TO 7
IF(N1.LT.0.OR.N1.GE.MEMH)GO TO 7
FL=1
BW=2
CALL CRLFC
L=0
I=0
14262 CALL FMW(I,J,K)
IF(K.NE.0)GO TO 14261
I1=I+2
T1=J
CALL BXT(T2,T1,WM15,WM8)
C TEST FOR RELATIVE BRANCH
IF(T2.NE.0.AND.T2.LE.7.OR.(128.LE.T2.AND.T2.LE.135))GOTO14265
C TEST FOR DIRECT ABSOLUTE REF.
IF(N1.EQ.T1)GOTO 14263
T2=T1
GOTO 14264
C ON A REL BRANCH, TEST OFFSET FOR REFERENCE TO N1.
14265 CALL BXT(T2,T1,WM7,WM0)
T3=T2
CALL LAND(T3,C2T7)
IF(T3.NE.0)T2=T2+MH
T2=T2*2
C TEST FOR INDEXED BY PC REFERENCE TO N1.
14264 K=I1+T2
CALL LAND(K,MAL)
IF(K.NE.N1)GOTO14261
C ON A MATCH, GET ORIGINAL AND PRINT.
14263 CALL FMW(I,J,K)
GOTO14166
C RETURN FROM PRINTING (SEE XB$ COMMAND)
14261 I=I+2
IF(I.LE.MEMH-2)GO TO 14262
BW=0
GO TO 14101
C
C OLSR$ -- OPEN LSR FILE.
C
1427 IF(NOTYI.EQ.0)GO TO 7
CALL OFIN(TYI,TIFIL,I)
14271 IF(I.EQ.0)GO TO 14101
GO TO 7
C
C OHSR$ -- OPEN HSR FILE.
C
1428 IF(NOPTI.EQ.0)GO TO 7
CALL OFIN(BIN,PTIFIL,I)
GO TO 14271
C
C ARROW
C
1429 J=2
GO TO 14251
C
C SI$ -- SINGLE INSTRUCTION
1430 SINGIN=1
IF(N1.EQ.-1)SINGIN=0
GOTO 14101
CC
C LS$ LIST STOP POINT ADDRESSES
C
1431 CONTINUE
CALL LIST(MES24,1,MES24X,3)
DO 14311 I=1,8
II=STOP(I)
IF(II.EQ.-1)GOTO 14311
CALL CHA(MES5,MES5A,MES5B,II)
CALL CHA(MES5,MES5C,MES5D,I-1)
CALL LIST(MES5,1,MES5X,3)
14311 CONTINUE
GOTO 14101
C
C RC$ RELATIVE CALCULATOR
C
1432 IF(N1.EQ.-1.OR.N2.EQ.-1)GOTO 7
CALL ODD(N1,E)
IF(E.NE.0)GOTO 7
T1=N2-N1-2
T2=T1
T3=MH+C2T7
CALL LAND(T1,MAL)
CALL CHA(MES9,MES9A,MES9B,T1)
CALL LIST(MES9,1,MES9X,4)
CALL ODD(N2,E)
IF(E.NE.0)GOTO 7
T2=T2/2
CALL LAND(T2,MAL)
T1=T2
CALL LAND(T1,T3)
IF(T1.EQ.0)GOTO 14321
CALL LXOR(T1,T3)
IF(T1.NE.0)GOTO 7
14321 CALL LAND(T2,ML)
CALL CHA(MES9,MES9A,MES9A+2,T2)
CALL LIST(MES9,1,MES9A+2,4)
GOTO 14101
C
C CARRAIGE RETURN
C
1434 CONTINUE
1433 CALL CLOSE(N1,N2)
GO TO 14101
C
C ET$-ENABLE TRAP TO FOUR
C
1435 ETFLG=0
IF(N1.NE.-1)ETFLG=1
GOTO 14101
C
C SE$ -- ADDRESS STOP ON EITHER READ OR WRITE
C
1436 I=3
GO TO 14211
C
C DR$----DEVICE RATE
C
1438 IF(N1.LE.0.OR.N2.LE.0)GO TO 7
IF(N1.GT.NUMDEV)GO TO 7
DCH(N1,1)=N2
GOTO 14101
C
C CON$---CONTINUE
C
1437 N2=PC
IF(N1.GE.0)N2=N1
IF(N2.GT.MEMH)GOTO 7
CALL ODD(N2,N1)
IF(N1.NE.0)GOTO 7
N1=N2
GOTO 14105
C
C DI$----DEVICE INITIALIZE
C
1439 IF(N1.LE.0.OR.N1.GT.NUMDEV)GOTO 7
I=N1
DO 14391 J=1,6
K=DEVINX(I,J)
IF(K.EQ.0)GOTO 14392
XPG(K,2)=XPG(K,6)
XPG(K,5)=0
14391 CONTINUE
14392 DCH(I,2)=0
DCH(I,5)=0
DCH(I,6)=0
DCH(I,7)=0
IF(I.NE.1)GOTO 14101
CALL GCI(TTYNAM,CON,2,2,0,I)
GOTO 14101
C
C DP$----DEVICE PRIORITY
C
1440 IF(N1.LE.0.OR.N1.GT.NUMDEV)GOTO 7
IF(N2.LT.4.OR.N2.GT.7)GOTO 7
DCH(N1,3)=N2
GOTO 14101
C TTYO FILE DATA ERROR
C
C CONTROL COMES TO 1013 AND 10131 USING
C ASSIGNED GOTO 'S.
1013 CALL STATUS(J)
CALL DATER(TDEV,TFIL,J)
10131 CALL RESTOR
ASSIGN 130 TO K
GO TO 14131
C
C CALL SIMULATION ROUTINE.
C SIMULATES UNTIL AN ERROR, STOP-POINT,
C HALT, ETC.
C
C
105 CALL SIMM(E)
GO TO(131,1311),E+1
C SHOULDN'T FALL THRU.
CALL EXIT
C
C FINAL COMMAND STRING
C
60 ASSIGN 60 TO IRETA
ROMF=0
ADSTCL=0
ADSTFL=0
C PROCESS *TTY COMMAND
60200 ASSIGN 60200 TO IRET
CALL LIST(MES21,1,MES21X,2)
CALL DEVFIL(I,J,K)
GO TO(60201,904,60300,84),I+1
C INIT CHANNELS TO READ TTY OUTPUT FILE
C AND OUTPUT IT.
60201 CALL GCI(TDEV,TYI,0,2,0,I)
IF(I.NE.0)GO TO 919
CALL GCI(DEV,TYO,1,2,0,I)
IF(I.EQ.0)GO TO 60202
60312 CALL FIN(TYI,J)
GO TO 919
60202 CALL OFIN(TYI,TFIL,I)
IF(I.NE.0)GO TO 947
CALL OFOUT(TYO,FIL,I)
IF(I.EQ.0)GO TO 60203
60319 CALL FIN(TYI,J)
GO TO 956
C INPUT/OUTPUT LOOP
60203 CALL GSR(N1,I)
IF(I.EQ.2)GO TO 60204
IF(I.EQ.3)GO TO 60205
CALL PRT(N1,I)
IF(I.EQ.2)GO TO 60206
GO TO 60203
60205 CALL STATUS(J)
CALL DATER(TDEV,TFIL,J)
60207 CALL FIN(TYO,J)
CALL FIN(TYI,J)
GO TO IRET
60206 CALL STATUS(J)
CALL DATER(DEV,FIL,J)
GO TO 60207
60204 ASSIGN 60206 TO TYOERR
CALL CRLFT
N1=0
ASSIGN 60300 TO IRET
60208 CALL PRT(N1,I)
IF(I.EQ.0)GO TO 60208
GO TO 60207
C PROCESS *HSP COMMAND.
60300 ASSIGN 60300 TO IRET
CALL LIST(MES35,1,MES35X,2)
CALL DEVFIL(I,J,K)
GO TO(60311,904,60350,84),I+1
60311 CALL GCI(PTODEV,TYI,0,2,1,I)
IF(I.NE.0)GO TO 919
CALL CAM(L,K,1,1HA,1,1)
M=1
IF(L.EQ.0)M=0
CALL GCI(DEV,TYO,1,2,M,I)
IF(I.NE.0)GO TO 60312
CALL OFIN(TYI,PTOFIL,I)
IF(I.NE.0)GO TO 947
CALL OFOUT(TYO,FIL,I)
IF(I.NE.0)GO TO 60319
C INPUT/OUTPUT LOOP.
60313 CALL GSR(N1,I)
IF(I.EQ.2)GO TO 60314
IF(I.EQ.3)GO TO 60315
CALL PRT(N1,I)
IF(I.EQ.2)GO TO 60316
GO TO 60313
60315 CALL STATUS(J)
CALL DATER(PTODEV,PTOFIL,J)
60317 CALL FIN(TYO,J)
CALL FIN(TYI,J)
GO TO IRET
60316 CALL STATUS(J)
CALL DATER(DEV,FIL,J)
GO TO 60317
60314 ASSIGN 60316 TO TYOERR
CALL CRLFT
N1=0
ASSIGN 60350 TO IRET
GO TO 60208
60350 CONTINUE
C PROCESS *MEM-DMP COMMAND.
60001 ASSIGN 60001 TO IRET
CALL LIST(MES26,1,MES26X,2)
CALL DEVFIL(I,J,K)
GO TO(60002,904,60100,84),I+1
60002 BOOTFL=0
C IF A SWITCH WAS SPECIFIED, CHECK FOR B.
C SET BOOTFL ACCORDINGLY.
IF(K.EQ.0)GO TO 60003
CALL CAM(L,K,1,1HB,1,1)
IF(L.NE.0)GO TO 84
BOOTFL=1
60003 AD1=0
AD2=MEMH-1
IF(L.EQ.1 )GO TO 60004
C GET LIMITS OF DUMP.
CALL GCOMD(I,N1,N2,E)
IF(E.NE.0)GO TO 84
IF(I.NE.34)GO TO 84
IF(N1.LE.-1.OR.N2.LE.-1)GO TO 84
AD1=N1
AD2=N2
IF(AD1.GT.AD2 )GO TO 84
IF(AD2.GE.MEMH)GO TO 84
60004 CALL GCI(DEV,BIN,1,2,1,I)
IF(I.NE.0)GO TO 919
CALL OFOUT(BIN,FIL,I)
IF(I.EQ.0)GO TO 60005
CALL FIN(BIN,J)
GO TO 955
60005 CALL MDMP(AD1,AD2,BOOTFL,E)
IF(E.EQ.0)GO TO 60001
C DUMP ERROR.
60006 CALL LIST(MES34,1,MES34X,4)
GO TO IRET
C RESTART SIMULATOR AT INITIAL COMMAND STRING.
60100 GO TO 902
END