Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50034/t3.c10
There are no other files named t3.c10 in the archive.
	SUBROUTINE LSRKBD
C       LSR/KBD SIMULATOR
	IMPLICIT INTEGER (A-Z)
      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
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
C       USE ROWS 1,2,3,4 OF XPG.

	EQUIVALENCE (DBRL,XPG(3,2)),(DBRH,XPG(4,2)),(DACLF,XPG(3,5))
     1    ,(DACHF,XPG(4,5)),(STL,XPG(1,2)),(STH,XPG(2,2))
C       USE ROW 1 OF DCH.

	EQUIVALENCE (TIN,DCH(1,1)), (TLS,DCH(1,2)), (PRI,DCH(1,3))
     1   ,(INTAD,DCH(1,4)),(INTREQ,DCH(1,5)),(IENL,DCH(1,6))
     2   ,(EOFF,DCH(1,7))

	EQUIVALENCE (DONE,CT7),(BUSY,CT3), (MAINF1,CT2),(INTEN,CT6)
     1   ,(RDREN,CT0)
C       IF LOW OR HIGH DATA REGISTER REFERENCED, FALL THROUGH.
100	IF((DACLF.EQ.0.OR.DACLF.EQ.2).AND.(DACHF.EQ.0
     1  .OR.DACHF.EQ.2))GOTO 101
	DACLF=0
	DACHF=0
	INTREQ=0
	CALL LANC(STL,DONE)
	CALL LANC(STH,BUSY)
C       DETECT 0-1 TRANSITION OF INT ENABLE.
101	T1=STL
	CALL LAND(T1,INTEN)
	IF(T1.EQ.0)INTREQ=0
	IF(T1.EQ.0.OR.IENL.NE.0)GOTO 102
	T2=STL
	CALL LAND(T2,DONE)
	INTREQ=INTREQ+T2
102	IENL=T1
	T1=STL
C       TEST READER ENABLE BIT.
	CALL LAND(T1,RDREN)
	IF(T1.EQ.0)GOTO 103
C       READER ENABLED. CLEAR BIT. IF AT EOF, EXIT.
C       IF NO INPUT FILE DEFINED, SET EOF, CLEAR BUSY AND DONE
C       AND EXIT.
	CALL LANC(STL,RDREN)
	IF(EOFF.NE.0)GOTO 106
	IF(NOTYI.EQ.0)GOTO 104
C       GET A CHARACTER. CLEAR DONE. SET BUSY.
	CALL GSR(I,J)
105	CALL LANC(STL,DONE)
	CALL LOR(STH,BUSY)
	IF(J.EQ.2)GOTO 104
	IF(J.NE.3)GOTO 107
C       DATA ERROR.
	CALL STATUS(J)
	CALL DATER (TIDEV,TIFIL,J)
	GOTO GENIOR
C       NO DATA FOR LSR.
104	CALL LANC(STL,DONE)
	CALL LANC(STH,BUSY)
	EOFF=1
	GOTO 106
C       SET CHAR IN DATA REG. START TIMER.
107	DBRL=I
	TLS=TIMEX
C       CHECK IF TIME IS UP.
109	IF(TIMEX-TLS.LT.TIN)GOTO 106
C       TIME IS UP. CLEAR BUSY AND MAINT FUNCT #1. SET DONE.
	CALL LANC(STL,MAINF1)
	CALL LANC(STH,BUSY)
	CALL LOR(STL,DONE)
C      SET INT REQUEST IF INTERRUPT ENABLED.
108	T1=STL
	CALL LAND(T1,INTEN)
	INTREQ=INTREQ+T1
	GOTO 106
C       READER NOT ENABLED. TRY FOR KBD INPUT.
103	T1=STH
	CALL LAND(T1,BUSY)
C       IF DEVICE BUSY, GO WAIT.
	IF(T1.NE.0)GOTO 109
	T1=STL
	CALL LAND(T1,DONE)
	IF(T1.NE.0)GOTO 106
C       DEVICE NOT BUSY AND NOT DONE. IS KBD INPUT AVAILABLE?
	CALL CCK(I)
	J=0
C       NO, CHECK FOR MAINT FUNCT #1.
	IF(I.EQ.0)GOTO 110
C       YES, GET A CHARACTER AND TREAT SAME AS CHAR FROM LSR.
	CALL CRC(I)
	GOTO 105
110	T1=STL
	CALL LAND(T1,MAINF1)
	IF(T1.EQ.0)GOTO 106
	I=255
	GOTO 105
106	RETURN
	END
	SUBROUTINE TTY
C       TTY OUTPUT SIMULATION.
	IMPLICIT INTEGER (A-Z)
      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
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
C       USES ROWS 5,6,7,8 OF XPG.

	EQUIVALENCE (DBRL,XPG(7,2)),(DBRH,XPG(8,2)),(DACLF,XPG(7,5))
     1   ,(DACHF,XPG(8,5)),(STL,XPG(5,2))
C       USE ROW 2 OF DCH.

	EQUIVALENCE (TIN,DCH(2,1)),(TLS,DCH(2,2)),(PRI,DCH(2,3))
     1   ,(INTAD,DCH(2,4)),(INTREQ,DCH(2,5)),(IENL,DCH(2,6))
     2   ,(EOFF,DCH(2,7))

	EQUIVALENCE (READY,CT7),(MAINF2,CT2),(INTEN,CT6)
C       IF NO OUTPUT FILE, FORCE EOF.
100	IF(NOTYO.EQ.0)EOFF=1
C       CHECK FOR ACCESS OF DATA REG.
	IF(DACLF.LT.2.AND.DACHF.LT.2)GOTO 101
	DACLF=0
	DACHF=0
	INTREQ=0
	T4=STL
	CALL LAND(T4,MAINF2)
	IF(EOFF.NE.0.AND.T4.EQ.0)GOTO 101
	J=0
C       MAINT FUNCT #2.
C       GET CHAR FROM DATA REG AND SAVE. CLEAR READY.
	CURCH=DBRL
	CALL LANC(STL,READY)
C	SET BITS IN KBD STATUS REG, IF MAINT FCN ON.
	IF(T4.EQ.0)GO TO 103
	CALL LANC(XPG(1,2),READY)
	CALL LOR(XPG(2,2),CT3)
103	IF(TYEQTY.EQ.0)CALL PRT(DBRL,J)
	IF(TYEQTY.NE.0)CALL CWC(DBRL,I)
	IF(J.EQ.2)GOTO TYOERR
	TLS=TIMEX
C        DETECT 0-1 TRANSITION OF INT ENABLE.
101	T1=STL
	CALL LAND(T1,INTEN)
	IF(T1.EQ.0)INTREQ=0
	IF(T1.EQ.0.OR.IENL.NE.0)GOTO 102
	T2=STL
	CALL LAND(T2,READY)
	INTREQ=INTREQ+T2
102	IENL=T1
	T1=STL
	CALL LAND(T1,READY)
C       IF READY, EXIT.
	IF(T1.NE.0)GOTO 106
C       NOT READY; TEST IF TIME IS UP. NO, EXIT.
	IF(TIMEX-TLS.LT.TIN)GOTO 106
C       YES, SET READY. SET INT REQUEST IF ENABLED.
	CALL LOR(STL,READY)
	T1=STL
	CALL LAND(T1,INTEN)
	INTREQ=INTREQ+T1
C       IF MAINT FUNCT #2, PUT CHAR INTO KBD DATA REG.
C       AND SET KBD DONE; CLEAR KBD BUSY AND MAINT FUNCT #1.
	IF(T4.EQ.0)GOTO 106
	XPG(3,2)=CURCH
	CALL LOR(XPG(1,2),READY)
	CALL LANC(XPG(1,2), CT2)
	CALL LANC(XPG(2,2),CT3)
	T1=XPG(1,2)
	CALL LAND(T1,INTEN)
	DCH(1,5)=DCH(1,5)+T1
	GOTO 106
106	RETURN
	END
	SUBROUTINE HSR
C       HSR SIMULATION
	IMPLICIT INTEGER (A-Z)
      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
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
C       USE ROWS 9,10,11,12 OF XPG.

	EQUIVALENCE (DBRL,XPG(11,2)),(DBRH,XPG(12,2)),(DACLF,XPG(11,5))
     1   ,(DACHF,XPG(12,5)),(STL,XPG(9,2)),(STH,XPG(10,2))
C       USE ROW 3 OF DCH.

	EQUIVALENCE (TIN,DCH(3,1)),(TLS,DCH(3,2)),(PRI,DCH(3,3))
     1   ,(INTAD,DCH(3,4)),(INTREQ,DCH(3,5)),(IENL,DCH(3,6))
     2   ,(EOFF,DCH(3,7))

	EQUIVALENCE (DONE,CT7),(BUSY,CT3),(NOTAPE,CT7),(INTEN,CT6)
     1   , (RDREN,CT0)

C       IF NO INPUT FILE, FORCE EOF.
100	IF(NOPTI.NE.0)GOTO 109
	CALL LOR(STH,NOTAPE)
	EOFF=1
C       CHECK FOR REF TO DATA REG.
109	IF(DACLF+DACHF.EQ.0)GOTO 102
	CALL LANC(STL,DONE)
	CALL LANC(STH,BUSY)
	DACLF=0
	DACHF=0
	INTREQ=0
C       DETECT 0-1 TRANSITION OF INT ENABLE.
102	T1=STL
	CALL LAND(T1,INTEN)
	IF(T1.EQ.0)INTREQ=0
	IF(T1.NE.0.AND.IENL.EQ.0)GOTO 103
104	IENL=T1
	T1=STL
C       CHECK FOR READER ENABLE.
	CALL LAND(T1,RDREN)
	IF(T1.EQ.0)GOTO 105
C       ENABLED. IF AT EOF, IGNORE IT. OTHERWISE, CLEAR
C       DATA REG, CLEAR DONE, SET BUSY, CLEAR INT REG.
	CALL LANC(STL,RDREN)
	IF(EOFF.NE.0)GOTO 106
	DBRL=0
	DBRH=0
	IF(NOPTI.EQ.0)GOTO 107
	CALL LANC(STL,DONE)
	CALL LOR(STH,BUSY)
	INTREQ=0
C       GET A CHAR AND PUT IN DATA REG. START THE TIMER.
	CALL GDA(I,J)
	IF(J.EQ.2)GOTO 107
	IF(J.EQ.3)GOTO 101
	DBRL=I
	TLS=TIMEX
	GOTO 105
103	T2=STL
	CALL LAND(T2,DONE)
	T3=STH
	CALL LAND(T3,NOTAPE)
	INTREQ=INTREQ+T2+T3
	GOTO 104
C       DATA ERROR.
101	CALL STATUS(J)
	CALL DATER(PTIDEV,PTIFIL,J)
	GOTO GENIOR
C       EOF. DON'T RESPOND. SET OUTAPE.
107	DBRL=0
	DBRH=0
	EOFF=1
	CALL LANC(STL,DONE)
	CALL LANC(STH,BUSY)
	CALL LOR(STH,NOTAPE)
C       SET INT REQUEST IF ENABLED.
108	T1=STL
	CALL LAND(T1,INTEN)
	INTREQ=INTREQ+T1
	GOTO 106
C       IF DEVICE IS BUSY, TEST TIMER.
105	T1=STH
	CALL LAND(T1,BUSY)
	IF(T1.EQ.0)GOTO 106
	IF(TIMEX-TLS.LT.TIN)GOTO 106
C       TIME IS UP. CLEAR BUSY. SET DONE.
	CALL LANC(STH,BUSY)
	CALL LOR(STL,DONE)
	GOTO 108
106	RETURN
	END
	SUBROUTINE HSP
C       HSP SIMULATION
	IMPLICIT INTEGER (A-Z)
      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
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
C       USE ROWS 13,14,15,16 OF XPG.

	EQUIVALENCE (DBRL,XPG(15,2)),(DBRH,XPG(16,2)),(DACLF,XPG(15,5))
     1   ,(DACHF,XPG(16,5)),(STL,XPG(13,2)),(STH,XPG(14,2))

C       USE ROW 4 OF DCH.
	EQUIVALENCE (TIN,DCH(4,1)),(TLS,DCH(4,2)),(PRI,DCH(4,3))
     1   ,(INTAD,DCH(4,4)),(INTREQ,DCH(4,5)),(IENL,DCH(4,6))
     2   ,(EOFF,DCH(4,7))

	EQUIVALENCE (READY,CT7),(NOTAPE,CT7),(INTEN,CT6)

C       IF NO OUTPUT FILE, FORCE EOF.
100	IF(NOPTO.NE.0)GOTO 101
	CALL LOR(STH,NOTAPE)
	EOFF=1
C       TEST FOR REF TO DATA REG.
101	IF(DACLF.LT.2.AND.DACHF.LT.2)GOTO 103
	DACLF=0
	DACHF=0
	INTREQ=0
	IF(EOFF.NE.0)GOTO 103
C       DATA REG REFERENCED. CLEAR READY.
C       PUNCH THE CHARACTER.
	CALL LANC(STL,READY)
	CALL PUN(DBRL,I)
	IF(I.LT.2)GOTO 104
C       DATA ERROR.
	CALL STATUS(J)
	CALL DATER(PTODEV,PTOFIL,J)
	GOTO GENIOR
104	TLS=TIMEX
103	T1=STL
C       DETECT 0-1 TRANSITION OF INT ENABLE.
	CALL LAND(T1,INTEN)
	IF(T1.EQ.0)INTREQ=0
	IF(T1.EQ.0.OR.IENL.NE.0)GOTO 105
	T2=STL
	CALL LAND(T2,READY)
	T3=STH
	CALL LAND(T3,NOTAPE)
	INTREQ=INTREQ+T2+T3
105	IENL=T1
102	T1=STL
	CALL LAND(T1,READY)
	IF(T1.NE.0)GOTO 106
C       DEVICE NOT READY. IS TIME UP?
	IF(TIMEX-TLS.LT.TIN)GOTO 106
C       YES, SET READY AND GENERATE INT REQUEST IF ENABLED.
	CALL LOR(STL,READY)
	T1=STL
	CALL LAND(T1,INTEN)
	INTREQ=INTREQ+T1
106	RETURN
	END  

	SUBROUTINE LANC(I,J)
C       AND COMPLEMENT.
C       I=I.AND.(.NOT.J)
	K=J
	CALL LNOT(K)
	CALL LAND(I,K)
	RETURN
	END

	SUBROUTINE GETPRI(I)
C       GET PRIORITY FROM STATUS WORD.
C       OUTPUT: PRIORITY, RIGHT ADJUSTED.
	IMPLICIT INTEGER(A-Z)
      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
      COMMON/SCRATCH/REGISTER(9),SAV(9)
      EQUIVALENCE (LP,REGISTER(8)),(PC,REGISTER(9)),(ST,REGISTER(1))
      EQUIVALENCE (ST,STATUS)


	J=STATUS
	CALL BXT(I,J,WM7,WM5)
	RETURN
	END
	SUBROUTINE RESET
C       EXTERNAL RESET FUNCTION.
	IMPLICIT INTEGER(A-Z)

C
C~	DEVICE REGISTERS IN EXTERNAL PAGE.
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
	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
	TIMEX=0
C       SET POWER UP STATES. CLEAR ACCESS FLAGS.
	DO 1 I=1,XPGI
	XPG(I,2)=XPG(I,6)
	XPG(I,5)=0
1	CONTINUE
C       CLEAR DEVICE PARAMETERS.
	DO 2 I=1,DCHI
	DCH(I,2)=0
	DCH(I,5)=0
	DCH(I,6)=0
	DCH(I,7)=0
2	CONTINUE
C       INTIALIZE THE CONSOLE CHANNEL.
	CALL GCI(3HTTY,0,2,2,0,I)
	RETURN
	END