Google
 

Trailing-Edge - PDP-10 Archives - BB-M080K-SM - monitor-sources/rsxsrv.mac
There are 19 other files named rsxsrv.mac in the archive. Click here to see a list.
;------------------------- Autopatch Tape # 12 -------------------------
; *** Edit 7195 to RSXSRV.MAC by JROSSELL on 15-Nov-85
; Do not allocate space when setting line speed for an unprileged user from a
; remote or autobaud terminal 
; UPD ID= 2177, SNARK:<6.1.MONITOR>RSXSRV.MAC.5,   5-Jun-85 10:58:25 by MCCOLLUM
;TCO 6.1.1406  - Update copyright notice.
; UPD ID= 1930, SNARK:<6.1.MONITOR>RSXSRV.MAC.4,   7-May-85 22:09:41 by MCCOLLUM
;TCO 6.1.1238 - Fix BUG. documentation
; UPD ID= 957, SNARK:<6.1.MONITOR>RSXSRV.MAC.3,   5-Nov-84 19:17:03 by PRATT
;TCO 6.1.1032 - Make TTYSRV compile independently:
;  Create RSXSRV.MAC and move FE code to it from TTPHDV
;  Duplicate the TTPHDV edit history here and in NRTSRV.MAC
;  Make many symbols global for TTYSRV
; UPD ID= 941, SNARK:<6.1.MONITOR>TTPHDV.MAC.22,   1-Nov-84 14:49:14 by PRATT
;Merge m60: edit 4900
; UPD ID= 4900, SNARK:<6.MONITOR>TTPHDV.MAC.91,   8-Oct-84 05:07:38 by TBOYLE
;TCO 6.2238 - handle speed setting properly.
; UPD ID= 930, SNARK:<6.1.MONITOR>TTPHDV.MAC.20,  28-Oct-84 11:12:08 by PRATT
;TCO 6.1.1022 - Add support code for NTINF jsys: 
;  Add field NRRID for remote host ID
;  Do a read connect info to get the remote host ID just before accepting
; UPD ID= 713, SNARK:<6.1.MONITOR>TTPHDV.MAC.18,  26-Jul-84 08:31:11 by MCINTEE
;Add CTERM - NRT support
; UPD ID= 578, SNARK:<6.1.MONITOR>TTPHDV.MAC.17,  29-May-84 14:57:05 by MCINTEE
;Fix another of previous
; UPD ID= 575, SNARK:<6.1.MONITOR>TTPHDV.MAC.16,  29-May-84 13:19:03 by MCINTEE
;Fix detach/attach bug in NRT (TNUKIL)
; UPD ID= 545, SNARK:<6.1.MONITOR>TTPHDV.MAC.15,  23-May-84 07:49:45 by MCINTEE
;Merge from M60:
; UPD ID= 4178, SNARK:<6.MONITOR>TTPHDV.MAC.89,   7-May-84 13:32:27 by LOMARTIRE
;More TCO 6.2047 - Fix all possible cases of PI 6 NOSKED/OKSKED from TTYDED
; UPD ID= 381, SNARK:<6.1.MONITOR>TTPHDV.MAC.14,  12-Mar-84 14:58:09 by MCINTEE
;Fix logout bug in NRT.
; UPD ID= 332, SNARK:<6.1.MONITOR>TTPHDV.MAC.13,  13-Feb-84 14:35:32 by MCINTEE
;Make NRTSOF get more buffers
; UPD ID= 293, SNARK:<6.1.MONITOR>TTPHDV.MAC.12,  16-Jan-84 08:33:37 by MCINTEE
;Merge from M60:
; UPD ID= 3397, SNARK:<6.MONITOR>TTPHDV.MAC.88,   3-Jan-84 10:38:46 by PRATT
;TCO 6.1796 - Create TTNTM1, sets/clears TTNTS in fe only.
; UPD ID= 286, SNARK:<6.1.MONITOR>TTPHDV.MAC.11,   5-Jan-84 17:33:38 by NICHOLS
;Fix previous edit, it should give up (RET), not go to MCSRV2 or MCSRV5
; UPD ID= 282, SNARK:<6.1.MONITOR>TTPHDV.MAC.10,  27-Dec-83 23:23:52 by GROSSMAN
;Fix bug in MCSRV when NRTUNB fails, go to MCSRV2, not MCSRV5.
; UPD ID= 218, SNARK:<6.1.MONITOR>TTPHDV.MAC.9,  17-Oct-83 15:48:54 by MCINTEE
;Change IBFRCC to IBRFC1
; UPD ID= 197, SNARK:<6.1.MONITOR>TTPHDV.MAC.8,  25-Aug-83 07:55:07 by MCINTEE
;TCO 6.1784 - In TTSETH, fix logic that sets TTNPM 
; UPD ID= 191, SNARK:<6.1.MONITOR>TTPHDV.MAC.7,   5-Aug-83 12:29:25 by MCINTEE
;Yet another NRT bug fix. Add a SETZRO TTOTP in NETUSER release code.
; UPD ID= 189, SNARK:<6.1.MONITOR>TTPHDV.MAC.6,   4-Aug-83 09:46:46 by MCINTEE
;TCO 6.1718 - Fix code so LOCAL AUTOBAUD lines don't get the REMOTE bit set
;	when the speed is recieved from the FE
; UPD ID= 187, SNARK:<6.1.MONITOR>TTPHDV.MAC.5,   2-Aug-83 15:52:22 by MCINTEE
;More TCO 6.1426 - remove an extra SETZRO TTPRM
;TCO 6.1600 - Allow LOCAL lines to be set as autobaud
; UPD ID= 104, SNARK:<6.1.MONITOR>TTPHDV.MAC.8,  18-Apr-83 13:12:19 by PAETZOLD
;TCO 6.1557 - TCP Merge
; UPD ID= 94, SNARK:<6.1.MONITOR>TTPHDV.MAC.7,  28-Mar-83 14:03:38 by MCINTEE
;Do the previous edit in a cleaner manner
; UPD ID= 93, SNARK:<6.1.MONITOR>TTPHDV.MAC.6,  28-Mar-83 12:35:46 by MCINTEE
;Fix bug in NRT that causes an occasional NSKDIS bughlt.
; UPD ID= 2039, SNARK:<6.MONITOR>TTPHDV.MAC.83,  20-Mar-83 12:46:39 by HALL
;TCO 6.1502 - Allow resident free space in extended section
;	Use one-word global byte pointers to point to sendall buffer and
;		I/O buffers, which must be in section 0 for the DTE.
;	Convert one-word global to one-word local before handing to DTESRV
;	Change handling of end of I/O buffers, and definition of WRPMSK,
;		to reflect use of one-word globals
;	In FNDEND, use ADJBP to decrement byte pointer instead of previous hack
; UPD ID= 1985, SNARK:<6.MONITOR>TTPHDV.MAC.82,  14-Mar-83 08:48:34 by HALL
;TCO 6.1502 - Allow resident free space in extended section
;	Add EA.ENT to TTDTRM
; UPD ID= 1970, SNARK:<6.MONITOR>TTPHDV.MAC.81,  10-Mar-83 19:11:06 by HALL
;TCO 6.1502 - Allow resident free space in extended section
;	Add EA.ENT to TTYINT,TTSPST,TTYDON,TTYDLU,TTYHGU,TTYSLA,IDCTY,
;		DTESTO,DFNDL1
; UPD ID= 1945, SNARK:<6.MONITOR>TTPHDV.MAC.80,   9-Mar-83 10:16:58 by HALL
;TCO 6.1502 - Allow resident free space in extended section
;	Change call to ASGRSB to set RS%SE0
; UPD ID= 4, SNARK:<6.1.MONITOR>TTPHDV.MAC.2,   2-Feb-83 07:38:59 by MCINTEE
;TCO 6.1485 - Fix TCO 6.1480, put TT%XFF in dynamic storage block.
; UPD ID= 1714, SNARK:<6.MONITOR>TTPHDV.MAC.78,  28-Jan-83 10:56:17 by MURPHY
;More 6.1390 - Add dummy symbol if no FE code.
; UPD ID= 1711, SNARK:<6.MONITOR>TTPHDV.MAC.77,  27-Jan-83 22:58:02 by WEAVER
;TCO 6.1480 - Only send XOFF/XON status to front-end if TTXFF (XOFF FORCE)
;is set.
; UPD ID= 1572, SNARK:<6.MONITOR>TTPHDV.MAC.76,  27-Dec-82 08:30:12 by GRANT
;TCO 6.1426 - When closing an NVT connection, don't undo TTPRM if the line
; is an MCB TTY or the CTY
; UPD ID= 1533, SNARK:<6.MONITOR>TTPHDV.MAC.75,  14-Dec-82 09:55:48 by MURPHY
;TCO 5.1.1114 - Index needed at SNDXN2+8L to fix XOFF/XON for incoming chars.
; UPD ID= 1489, SNARK:<6.MONITOR>TTPHDV.MAC.74,  30-Nov-82 11:45:34 by WEAVER
;TCO 6.1393 - Use Break Through Write to send XONs and XOFFs to a line
; UPD ID= 1485, SNARK:<6.MONITOR>TTPHDV.MAC.73,  29-Nov-82 13:36:14 by MURPHY
;TCO 6.1390 - Shut off 20F line if more than 2 noise characters in 1 second.
; UPD ID= 1332, SNARK:<6.MONITOR>TTPHDV.MAC.72,  13-Oct-82 07:04:19 by GRANT
;More of previous edit - fix bug in TNTCLS's debugging code
; UPD ID= 1312, SNARK:<6.MONITOR>TTPHDV.MAC.71,   9-Oct-82 10:28:22 by GRANT
;TCO 5.1.1089 - Rewrite TNTCLS, save link IDs rather than LL block addresses
; UPD ID= 1086, SNARK:<6.MONITOR>TTPHDV.MAC.70,  16-Aug-82 14:31:44 by MURPHY
;TCO 6.1202 - Pass proper arg to TTCBF9 at TINET3.
; UPD ID= 994, SNARK:<6.MONITOR>TTPHDV.MAC.69,  18-Jul-82 13:52:18 by MURPHY
;TCO 5.1.1048 - Add TTCLSH to clear "set host" state when closing LL.
; UPD ID= 991, SNARK:<6.MONITOR>TTPHDV.MAC.68,  18-Jul-82 13:30:31 by MURPHY
;TCO 5.1.1047 - Put NOSKED before call to TNTCLS to interlock ULLCZQ.
; UPD ID= 990, SNARK:<6.MONITOR>TTPHDV.MAC.67,  18-Jul-82 13:28:02 by MURPHY
;TCO 5.1.1046 - Check TTNUS before call to TNUREC.
; UPD ID= 970, SNARK:<6.MONITOR>TTPHDV.MAC.66,  30-Jun-82 08:55:45 by GRANT
;TCO 5.1.1038 - Remove CALL SQIACK in DECnet NVT processor
; UPD ID= 328, SNARK:<6.MONITOR>TTPHDV.MAC.58,  19-Jan-82 15:23:21 by MURPHY
;TCO 5.1688 - report TTYSTP only once per line
; UPD ID= 851, SNARK:<6.MONITOR>TTPHDV.MAC.65,   6-Jun-82 13:29:44 by MURPHY
;TCO 6.1147 - Move bugdefs from BUGS.MAC to here and put them in-line.
; UPD ID= 819, SNARK:<6.MONITOR>TTPHDV.MAC.64,   3-Jun-82 07:42:18 by GRANT
;TCO 6.1154 - Fix failure return from CALL SNDCHK in MCSTRO.
;Change comment in CHKLLT.
; UPD ID= 800, SNARK:<6.MONITOR>TTPHDV.MAC.63,   1-Jun-82 08:31:46 by GRANT
;TCO 6.1148 - Remove code which breaks DECnet connection when a character is
;received on a line on which there is no job
; UPD ID= 771, SNARK:<6.MONITOR>TTPHDV.MAC.62,  19-May-82 17:20:19 by MILLER
;TCO 6.1066 AGAIN. Make RSP output work in secondary protocol
; UPD ID= 505, SNARK:<6.MONITOR>TTPHDV.MAC.61,  16-Mar-82 07:01:10 by MILLER
; UPD ID= 476, SNARK:<6.MONITOR>TTPHDV.MAC.60,  13-Mar-82 14:49:59 by MILLER
;TCO 6.1066 AGAIN. Add some of the RSP support code
; UPD ID= 458, SNARK:<6.MONITOR>TTPHDV.MAC.59,  11-Mar-82 11:47:06 by MILLER
;TCO 6.1066. Make MCSRV internal
; UPD ID= 328, SNARK:<6.MONITOR>TTPHDV.MAC.58,  19-Jan-82 15:23:21 by MURPHY
;TCO 5.1688 - report TTYSTP only once per line
; UPD ID= 150, SNARK:<6.MONITOR>TTPHDV.MAC.57,  21-Oct-81 12:14:07 by GRANT
;TCO 5.1594 - Move code from MCTYI2 and MCTYI3 into NSPSRV
; UPD ID= 193, SNARK:<5.MONITOR>TTPHDV.MAC.56,  17-Sep-81 13:19:49 by GRANT
;Reinstate the UPD ID=153 edit.  Also, it should say TCO 5.1490 no 5.1409
; UPD ID= 172, SNARK:<5.MONITOR>TTPHDV.MAC.55,  14-Sep-81 13:44:20 by GRANT
;Temporarily undo previous edit
; UPD ID= 153, SNARK:<5.MONITOR>TTPHDV.MAC.54,   8-Sep-81 17:31:11 by GRANT
;Needed for TCO 5.1490 - Remove segment number handling in MCTYI3
; UPD ID= 172, SNARK:<5.MONITOR>TTPHDV.MAC.55,  14-Sep-81 13:44:20 by GRANT
;Temporarily undo previous edit
; UPD ID= 153, SNARK:<5.MONITOR>TTPHDV.MAC.54,   8-Sep-81 17:31:11 by GRANT
;Needed for TCO 5.1409 - Remove segment number handling in MCTYI3
;Minor changes needed for handling LLOMSG queue in MCTYI3 and MCTYI2
; UPD ID= 138, SNARK:<5.MONITOR>TTPHDV.MAC.53,   2-Sep-81 16:38:01 by GRANT
;Eliminate cause of OKSKBG BUGHLT - in TNHCLS, NOSKED before calling TTCOB5
; UPD ID= 2307, SNARK:<5.MONITOR>TTPHDV.MAC.52,   8-Jul-81 11:20:59 by MURPHY
;CALL REQNS INSTEAD OF TNUSND FROM TTCHI
; UPD ID= 2295, SNARK:<5.MONITOR>TTPHDV.MAC.51,   6-Jul-81 13:50:54 by MURPHY
;DEBUG CODE TO RECORD DEAD LINKS
;PROCESS ALL INPUT IN TINET BEFORE QUITTING
; UPD ID= 2269, SNARK:<5.MONITOR>TTPHDV.MAC.50,  29-Jun-81 17:48:31 by MURPHY
;ANTX01
; UPD ID= 2190, SNARK:<5.MONITOR>TTPHDV.MAC.49,  11-Jun-81 15:59:54 by MURPHY
;CHANGE TQNx TO TMNx REFLECTING CHANGE IN MACSYM
;DITTO
; UPD ID= 1867, SNARK:<5.MONITOR>TTPHDV.MAC.45,  21-Apr-81 23:41:55 by MURPHY
;DITTO
; UPD ID= 1865, SNARK:<5.MONITOR>TTPHDV.MAC.44,  21-Apr-81 18:29:43 by MURPHY
;DITTO
; UPD ID= 1830, SNARK:<5.MONITOR>TTPHDV.MAC.43,  17-Apr-81 14:19:33 by MURPHY
;MAKE LINE SHUTOFF FOR 5 SECONDS INSTEAD OF 3
;REVISE SENDALL LOGIC
;REVISE STARTUP LOGIC
; UPD ID= 1752, SNARK:<5.MONITOR>TTPHDV.MAC.42,  20-Mar-81 13:32:21 by MURPHY
;Ditto
; UPD ID= 1745, SNARK:<5.MONITOR>TTPHDV.MAC.41,  19-Mar-81 23:11:04 by MURPHY
;Fix problems with line shut-off and XOFF/XON logic.
; UPD ID= 1663, SNARK:<5.MONITOR>TTPHDV.MAC.40,  11-Mar-81 16:30:30 by MURPHY
;Fix up some failures of DTEQ which were not handled
; UPD ID= 1554, SNARK:<5.MONITOR>TTPHDV.MAC.39,  11-Feb-81 17:33:25 by MURPHY
;MAKE SURE LINE GETS RESTARTED AFTER STOP BECAUSE INBFR OR TTBBUF FULL
; UPD ID= 1550, SNARK:<5.MONITOR>TTPHDV.MAC.38,  10-Feb-81 17:57:41 by MURPHY
;FIX XOFF DURING SYSTEM STARTUP PROBLEM
;CHANGE NAMES TO BLSUB., BLCAL.
;DITTO
; UPD ID= 1477, SNARK:<5.MONITOR>TTPHDV.MAC.35,  22-Jan-81 12:24:13 by MURPHY
;FIX TTQAD PROBLEMS
; UPD ID= 1377, SNARK:<5.MONITOR>TTPHDV.MAC.34,  22-Dec-80 18:25:37 by MURPHY
;<5.MONITOR>TTPHDV.MAC.33, 17-Dec-80 18:10:33, EDIT BY MURPHY
;TNUREC
; UPD ID= 1361, SNARK:<5.MONITOR>TTPHDV.MAC.32,  17-Dec-80 15:46:27 by MURPHY
;CHKLLT
;<5.MONITOR>TTPHDV.MAC.31, 12-Dec-80 11:11:34, EDIT BY MURPHY
;<5.MONITOR>TTPHDV.MAC.30, 12-Dec-80 10:34:51, EDIT BY MURPHY
;<5.MONITOR>TTPHDV.MAC.29, 12-Dec-80 10:23:26, EDIT BY MURPHY
;FLOW CONTROL
;<5.MONITOR>TTPHDV.MAC.28,  9-Dec-80 15:16:03, EDIT BY MURPHY
;CKMCOU
;<5.MONITOR>TTPHDV.MAC.27,  5-Dec-80 16:49:34, EDIT BY MURPHY
;VARIOUS MCB FIXES AND ENHANCEMENTS
;<5.MONITOR>TTPHDV.MAC.25, 24-Nov-80 16:46:49, EDIT BY MURPHY
;Requeue line if SQILS or SQIACK fails
;<5.MONITOR>TTPHDV.MAC.24, 21-Nov-80 18:29:16, EDIT BY MURPHY
;FLUSH LINK IF INPUT AND NO JOB
; UPD ID= 1301, SNARK:<5.MONITOR>TTPHDV.MAC.23,  19-Nov-80 17:05:35 by MURPHY
;LOCAL XON,XOFF OPTION FOR NVTS
; UPD ID= 1290, SNARK:<5.MONITOR>TTPHDV.MAC.22,  18-Nov-80 16:45:45 by MURPHY
;<5.MONITOR>TTPHDV.MAC.21, 31-Oct-80 17:37:34, EDIT BY MURPHY
;<5.MONITOR>TTPHDV.MAC.20, 30-Oct-80 22:59:18, EDIT BY MURPHY
;<5.MONITOR>TTPHDV.MAC.19, 21-Oct-80 12:10:07, EDIT BY MURPHY
;<5.MONITOR>TTPHDV.MAC.18, 20-Oct-80 17:12:52, EDIT BY MURPHY
;<5.MONITOR>TTPHDV.MAC.17, 20-Oct-80 14:40:25, EDIT BY MURPHY
;<5.MONITOR>TTPHDV.MAC.16,  7-Oct-80 15:27:36, EDIT BY MURPHY
;<5.MONITOR>TTPHDV.MAC.15,  6-Oct-80 11:32:21, EDIT BY MURPHY
; UPD ID= 1126, SNARK:<5.MONITOR>TTPHDV.MAC.14,   5-Oct-80 15:02:40 by MURPHY
;DITTO
;<5.MONITOR>TTPHDV.MAC.13,  3-Oct-80 14:04:57, EDIT BY MURPHY
; UPD ID= 1120, SNARK:<5.MONITOR>TTPHDV.MAC.12,   3-Oct-80 12:21:22 by MURPHY
;DITTO
; UPD ID= 1113, SNARK:<5.MONITOR>TTPHDV.MAC.11,   3-Oct-80 01:00:51 by MURPHY
;NVT IMPROVEMENTS
; UPD ID= 1077, SNARK:<5.MONITOR>TTPHDV.MAC.10,   1-Oct-80 10:37:44 by MURPHY
;RELEVANT END STATEMENTS FOR STKVAR, ETC.
; UPD ID= 1063, SNARK:<5.MONITOR>TTPHDV.MAC.9,  30-Sep-80 10:16:58 by MURPHY
;DITTO
; UPD ID= 1057, SNARK:<5.MONITOR>TTPHDV.MAC.8,  26-Sep-80 12:13:03 by MURPHY
;MCB FIXES
; UPD ID= 944, SNARK:<5.MONITOR>TTPHDV.MAC.7,  20-Aug-80 20:09:15 by MURPHY
;MCB FIXES
; UPD ID= 925, SNARK:<5.MONITOR>TTPHDV.MAC.6,  20-Aug-80 10:21:12 by MURPHY
;INCLUDE MCB DEVICE
; UPD ID= 699, SNARK:<5.MONITOR>TTPHDV.MAC.5,  25-Jun-80 17:23:34 by MURPHY
;REMOVE TTDBEF REDUNDANT SUBROUTINE
;MERGE TTFEDV AND TTDZDV FILES INTO TTPHDV
;CHANGE DEVICE VECTORING
; UPD ID= 645, SNARK:<5.MONITOR>TTFEDV.MAC.4,  16-Jun-80 12:09:09 by MURPHY
;CLEAN UP VECTOR COMMENTS
; UPD ID= 443, SNARK:<5.MONITOR>TTFEDV.MAC.3,  15-Apr-80 09:41:02 by KONEN
;TCO 4.1.1143 -- Check for XOFF before storing character in big buff.
; UPD ID= 405, SNARK:<5.MONITOR>TTFEDV.MAC.2,   3-Apr-80 16:06:55 by HALL
;CHANGES TO WRITE-PROTECT THE RESIDENT MONITOR:
;	CHANGE ALL REFERENCES TO TT1LIN TO EXPECT A TABLE
;<4.1.MONITOR>TTFEDV.MAC.52, 16-Nov-79 11:29:17, EDIT BY MILLER
;ASGALL NOW SKIPS
;<4.MONITOR>TTFEDV.MAC.51,  1-Nov-79 17:15:09, EDIT BY MILLER
;Previous edit lines deleted

;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED
;OR COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT  (C)  DIGITAL  EQUIPMENT  CORPORATION  1976, 1985.
;ALL RIGHTS RESERVED.


 	SEARCH TTYDEF,PROLOG
	TTITLE	(RSXSRV,RSXSRV,< - Front End Terminal Support>)

	RESCD

	SUBTTL FRONT-END DEPENDENT CODE

;THIS MODULE IS NECESSARY TO SUPPORT THE KL10 -DTE20 INTERFACE
;FOR TTYSRV.  IT DOES ALL THE DEVICE SPECIFIC FUNCTIONS AND
;PROCESSES DATA TO AND FROM THE FRONT END.


MAXABC==TTBSIZ/2		;MAX ENTRIES ALLOWED IN BIGBUF FOR THIS
				; LINE WHEN LINE IS SHUT OFF
				;(CAN'T BE IN TTYDEF BECAUSE TTBSIZ IS DEFINED
				; IN STG)


;DEFINITIONS FOR TTDEV FOR FE TYPE LINES

;DEFINITIONS FOR TT.FE LINE TYPE

DEFSTR TTFCT,TTDEV,27,8		;NUMBER BYTES IN FRONT END
DEFSTR TTFMC,TTDEV,35,8		;MAX BYTES IN FRONT END
SPCLIN==4			;HIGHEST SPECIAL LINE NUMBER

RS TOTFCT,1			;TOTAL BYTES IN FE
RS MAXFCT,1			;TOTAL CAPACITY OF FE
	COMMENT !		;FOR INFO ONLY, ACTUAL DEFS IN PROKL

;THE FRONT END FUNCTION CODES

.DFLCI==1			;LINE COUNT IS
.DFHSD==:3			;HERE IS STRING DATA
.DFHLC==:4			;HERE ARE LINE CHARACTERS
.DFRDS==:5			;REQUEST DEVICE STATUS
.DFSDO==:6			;SPECIAL DEVICE OPERATION
	.DFLPC==1		;LOAD PAGE COUNTER
.DFSTS==:7			;HERE IS DEVICE STATUS
.DFESD==:10			;ERROR ON DEVICE
.DFRTD==:11			;REQUEST TIME OF DAY
.DFHTD==:12			;HERE IS TIME OF DAY
.DFFDO==:13			;FLUSH OUTPUT (SENT TO 11 ONLY)
.DFSTA==:14			;SEND TO ALL (SENT TO 11 ONLY)
.DFLDU==:15			;A LINE DIALED UP (FROM 11 ONLY)
.DFLHU==:16			;A LINE HUNG UP OR LOGGED OUT
.DFLBE==:17			;LINE BUFFER BECAME EMPTY
.DFXOF==:20			;XOF COMMAND TO THE FE
.DFXON==:21			;XON COMMAND TO THE FE
.DFSPD==:22			;SET TTY LINE SPEED
.DFHLA==:23			;HERE IS LINE ALLOCATION
.DFHRW==:24			;HERE IS -11 RELOAD WORD
.DFACK==:25			;GO ACK ALL DEVICES AND UNITS
.DFTOL==:26			;TURN OFF/ON LINE
	.DFTLO==:0		;TURN IT OFF
	.DFTOO==:1		;TURN IT ON
.DFEDR==:27			;ENABLE/DISABLE DATASETS
.DFLTR==:30			;LOAD TRANSLATION RAM
.DFLVF==:31			;LOAD VFU
.DFMSG==:32			;SUPPRESS SYSTEM MESSAGES TO TTY
.DFKLS==:33			;SEND KLINIK DATA TO THE -11
.DFXEN==:34			;ENABLE XON (SENT TO 11 ONLY)
.DFBKW==:35			;BREAK-THROUGH WRITE
.DFDBN==:36			;DEBUG MODE ON
.DFDBF==:37			;DEBUG MODE OFF
	!

	RESCD
; CLEAR OUTPUT BUFFER ROUTINE

TTCOB4::STKVAR <TTCBSV>
	MOVEM B,TTCBSV		;SAVE ADDRESS OF DYNAMIC DATA
	DYNST			;GET LINE NUMBER
	MOVE D,B		;GET COPY OF LINE NUMBER
	MOVS C,B		;LINE NUMBER
	MOVEI B,.FEDLS		;GET DEVICE CODE
	MOVE A,MSTRDT		;MASTER DTE, NO POST
	CALL FIXARG		;GET PROPER ARGS
	EXCH D,TTCBSV		;GET BACK DYNAMIC DATA
	TMNE TTOTP,(D)		;OUTPUT IN PROGRESS?
	JRST [	EXCH D,TTCBSV	;YES. GET BACK ORIGINAL ARGUMENT
		CALL DTEFLO	;YES, FLUSH DTE REQUESTS
		JRST TTCBF5]
	EXCH D,TTCBSV		;GET BACK ORIGINAL ARGUMENT
TTCBF5:	MOVS D,C		;LINE NUMBER AS ARG
	SETZ C,
	HRLI B,.DFFDO		;FLUSH FUNCTION
	CALL DTEQI		;QUEUE IT UP
	MOVE B,TTCBSV		;GET BACK DYNAMIC DATA
	RET

	ENDSV.			;END STKVAR
	SWAPCD

; SET TERMINAL SPEED

TTSSP2::TRVAR <LINENO>
	MOVEM T2,LINENO		;SAVE LINE NUMBER
	SKIPN FEFLG		;IN PRIMARY PROTOCOL?
	RET			;NO. IGNORE IT THEN
	ACVAR <W1,SSBFR>
	UMOVE W1,2		;GET FLAGS
;**;[7195]INSERT 5 LINES AFTER TTSSP2::+5L  JCR  8-NOV-85
	MOVX D,SC%OPR!SC%WHL	;[7195]SEE IF PRIVILEGED
	TDNN D,CAPENB		;[7195]PRIVILEGED?
	TXNN W1,MO%RMT!MO%AUT	;[7195]NO, REMOTE OR AUTOBAUD?
	SKIPA			;[7195]PRIV'D OR NOT SETTING REMOTE/AUTOBAUD
	ITERR (CAPX1)		;[7195]NOT PRIV'D, USER CAN NOT DO THIS
	NOINT			;PREVENT INTS
	BLCAL. ASGRSB,<[4],[.RESP3],[RS%SE0!.RESTP]> ;GET A 4-WORD BLOCK
	 ITERR ()		;SHOULDN'T HAPPEN
	MOVEM A,SSBFR		;SAVE ADR OF BLOCK
	MOVE C,A
	HRLI C,(POINT 16,0)	;MAKE BYTE PTR
	UMOVE D,C		;GET USER'S ARGS
	HLRZ A,D		;GET INPUT SPEED

;THE LAW OF SPEED SETTING: 

; (1) IF MO%AUT=0 AND A LINE IS NOT REMOTE NOR AUTOBAUD, THEN SET TTSPWD
;	AND ALSO SET SAVED SPEED IF ANY. THE SAVED SPEED IS ACTUALLY ONLY
;	USED WHEN THE LINE IS GOING MO%RMT.
; (2) IN THE OTHER CASES, IF MO%AUT=0 THEN SET TTSPWD ONLY IF THERE IS
;	A DYNAMIC DATA BLOCK. THIS COVERS THE CASE OF PRESERVING LINE
;	SPEED WHEN A LINE IS REMOTE ONLY AND LEAVING SPEED ALONE IF
;	A LINE IS AUTOSPEED AND NO DYNAMIC DATA EXISTS. WE SET THE SPEED
;	IN THE FRONT-END IN THE REMOTE CASE.
; (3) OTHER CASES ARE MO%AUT=1, SPEEDS ARE IGNORED IN THIS CASE.

	TXNE W1,MO%AUT		;IS MO%AUT ZERO?
	IFSKP.
	  TMNE TT%AUT+TT%FEM,TTSTAT(B) ;YES, IS LINE NOT REMOTE NOR AUTO?
	  IFSKP.
	    MOVEM D,TTSPWD(B)	;YES, SET SPEED
	    CALL STADYN		;(T2/T2) IS THERE DYNAMIC DATA?
	    ANSKP.		;IF NOT, PROCEED WITH SPEED SETTING
	    MOVEM D,TTSVPD(B)	;YES, SET SAVED SPEED
	    ENDIF.
				;HERE FOR OTHER CASES WHERE MO%AUT=0

	  MOVE B,LINENO		;GET LINENO BACK
	  CALL STADY		;IS THERE DYNAMIC DATA
	  ANSKP.		;NO, DON'T CHANGE SPEED OF AUTOSPEED LINE
	  MOVE B,LINENO		;GET LINENO BACK
	  MOVEM D,TTSPWD(B)	;SET SPEED
	  ENDIF.

	MOVE B,LINENO		;GET LINENO BACK
	CALL TTEXFA		;SET XON/XOFF STATE
	IDPB A,C		;STORE INPUT
	IDPB D,C		;STORE OUTPUT SPEED
	MOVEI D,0(D)
	MOVEI A,1		;ASSUME ONE STOP BIT
	CAIG D,^D110		;LESS THAN OR EQUAL TO 110 BAUD?
	MOVEI A,2		;YES. USE 2 STOP BITS THEN
	TXNE W1,MO%RMT		;WANT REMOTE?
;**;[7195]REPLACE 4 LINES WITH 1 LINE AT TTSSP5:-13L  JCR  8-NOV-85
	JRST [	TRO A,(1B2)	;[7195]SET HIGH ORDER BIT
		SETONE TTFEM,(B) ;SAY IS REMOTE
		JRST .+1]	;GO SET SPEED ANYWAY
	TXNE W1,MO%AUT		;WANT "AUTO" SPEED?
;**;[7195]Replace 4 lines with 1 line at TTSSP5:-6L  JCR  8-NOV-85
	JRST [	SETONE TTAUT,(B) ;[7195]SET INDICATOR
		TRO A,(1B3)	;SET BIT IN MESSAGE TO FE
		JRST TTSSP5]	;AND PROCEED
TTSSP5:	IDPB A,C		;STORE THIS
	MOVE C,SSBFR		;REFRESH PTR
	HRLI C,(POINT 8,0)
	MOVE F,SSBFR		;PASS BUFFER ADDRESS FOR INTERRUPT
	BLCAL. TTDTEQ,<[SSPINT],[.DFSPD],[6],C>
;**;[7195]REPLACE 1 LINE AT TTSSP3:+0L  JCR  8-NOV-85
	OKINT			;ALLOW INTS AGAIN
	RET			;AND DONE

	ENDAV.			;END ACVAR

;HERE AT INTERRUPT LEVEL AFTER MSG SENT TO FE
; A/ UNIQUE CODE - ADR OF RESIDENT BFR

	RESCD

SSPINT:	CALL RELRES
	RET

	SWAPCD
; SET/RETURN DEVICE NON-TERMINAL STATUS

TTSNT1::SKIPN FEFLG		;IN PRIMARY PROTOCOL?
	RET			;NO. IGNORE IT THEN
	STOR C,TTNTS,(B)	;SAVE NEW VALUE
	BLCAL. TTDTEQ,<[0],[.DFMSG],[0],C>
	RET			;AND DONE

;TELL 20F TO ALLOW OR NOT ALLOW SENDALLS, BUT DON'T SAVE TTNTS
TTNTM1::SKIPN FEFLG		;IN PRIMARY PROTOCOL?
	RET			;NO. IGNORE IT THEN
	BLCAL. TTDTEQ,<[0],[.DFMSG],[0],C>
	RET			;AND DONE


;ENABLE/DISABLE XOFF RECOGNITION IN THE FRONT-END

	RESCD


TTEXFA:	SAVET			;SAVE REGISTERS
	CALL STADYN
	 RET			;NOT IMPORTANT
	JRST TTEXZ

TTEXF::	SKIPN FEFLG		;CHECK FOR PRIMARY PROTOCOL
	RET			;NO. IGNORE IT THEN
	SAVET			;SAVE TEMPS
TTEXZ:	SETZ T4,0		;ASSUME CLEAR
	TMNE TT%PGM,TTFLGS(T2)
	SETO T4,0		;SET
	DYNST			;GET STATIC TTY NUMBER
	SKIPG TTACTL(T2)	;NORMALLY ACTIVE LINE?
	SETZ T4,		;NO, DISABLE FE XOFF
	BLCAL. TTDTEQ,<[0],[.DFXEN],[0],T4>
	RET

	SWAPCD
;TTMSG...

;CODE TO DO A SEND ALL FOR KL DTE20 CONFIGURATIONS

;TTMSSN FOR SINGLE LINE, TTMSAL FOR ALL LINES
; A/ BYTE PTR TO STRING
; B/ LINE NUMBER
; C/ COUNT OF BYTES IN STRING

TTMSAL::SASUBR <MSBP,MSLN,MSCT>
	SKIPN FEFLG		;USING PRIMARY PROTOCOL?
	JRST [	CAME B,CTYLNO	;CTY?
		RET		;NO, FORGET IT
		RETSKP]		;DO IT
	SETOB B,MSLN		;NOTE ALL LINES
	HRLI B,.DFSTA		;ASSUME SEND ALL
	MOVSI A,DECSAL		;INTERRUPT LOCATION
	HRR A,MSTRDT
	HRRI B,.FEDLS		;THE LINE SCANNER
	CALL FIXARG		;GO CHECK FOR CTY,ETC.
	HRR C,MSCT		;THE COUNT
	MOVE D,MSBP		;THE POINTER
	TXO C,DTBYTM		;FORCE BYTE MODE SEND
	AOS SALCNT		;INCREMENT SENDALL COUNT
	CALL DTEQI		;GO SCHEDULE THE REQUEST
	RETSKP

	ENDSA.

;ROUTINE TO DO SENDALL FOR SINGLE LINE
; T2/ LINE NUMBER
; RETURN +1: DON'T DO THE LINE
; 	+2: OK TO DO, T2/ LINE NUMBER

TTMSSN::SKIPN FEFLG		;PRIMARY PROTOCOL?
	CAMN T2,CTYLNO		;OR CTY?
	RETSKP			;YES, OK TO DO
	RET			;SKIP IT
	RESCD

;TELL FE TO RESUME SENDING TO TERMINAL

TTXON1::SKIPN FEFLG		;IN PRIMARY PROTOCOL?
	RET			;NO .SKIP THE MESSAGE THEN
	JE TTXFF,(B),R		;IF NOT FORCING STATUS TO FE, RETURN
	SETZRO TTXFF,(B)	;CLEAR THE BIT
	MOVEI A,.DFXON		;FE XON FUNCTION
	SAVEAC <B>
	DYNST			;GET LINE NUMBER
	CALLRET SNDFNC		;TELL FE TO RESTART

;FRONT END LINE. TELL FRONT END TO STOP SENDING TO TERMINAL

TTCHI3::SAVET			;SAVE TEMPS
	JE TTXFF,(B),R		;IF NOT FORCING STATUS TO FE, RETURN
	SETZRO TTXFF,(B)	;CLEAR THE BIT
	DYNST			;GET STAT ADDRESS
	MOVEI A,.DFXOF		;TELL FE TO STOP
	CALLRET SNDFNC		;DO IT

;ROUTINE TO SEND XOFF OR XON TO THE FRONT END
;ACCEPTS: A/ FUNCTION TO SEND
;	  B/ LINE NUMBER
;RETURNS:	+1 /COULD NOT SEND REQUEST
;		+2/ REQUEST SENT

SNDFNC:	SAVEAC <B>
	MOVSI C,0(B)		;PUT LINE NUMBER IN CORRECT PLACE
	MOVSI B,0(A)		;FUNCTION CODE
	HRRI B,.FEDLS		;ASSUME DLS
	CALL FIXARG		;GO FIX UP THE ARGS
	HLRZ D,C		;LINE NUMBER AS DATUM
	SETZM C			;DIRECT
	MOVE A,MSTRDT		;TO THE MASTER -11
	CALLRET DTEQI		;QUEUE TO DTE
;SEND XOFF TO DISCOURAGE FURTHER INPUT FROM TERMINAL

SNDXO2::CONSZ PI,1B<^D20+DLSCHN> ;AT DTE PI LEVEL?
	JRST SNDXO1		;YES. GO TO IT
	NOSKD1			;PREVENT SCHEDULER INTERRUPTS
	CHNOFF DLSCHN		;AND DTE INTERRUPTS
SNDXO1:	SAVET
	SKIPG TTACTL(B)		;LINE ACTIVE?
	JRST SNDXO3		;NO, SEND NOTHING
	JN TTFXO,(B),SNDXO3	;DO NOTHING IF PREVIOUS XOFF SENT
	SETONE TTFXO,(B)	;SAY X-ON  NEEDED
	MOVEI D,XOFFC		;THE CHARACTER
	SKIPGE CHITAB(D)	;PARITY NEEDED?
	TXO D,200		;YES. APPLY IT
	MOVE A,MSTRDT		;SEND TO THE MASTER
	MOVSI C,0(B)		;LINE NUMBER
	MOVE B,[.DFBKW,,.FEDLS]
	CALL FIXARG		;FIX UP THE ARGS
	CALL DTEQI		;GO SEND IT
SNDXO3:	CONSZ PI,1B<^D20+DLSCHN> ;AT DTE PI LEVEL?
	RET			;YES. ALL DONE THEN
	CHNON DLSCHN		;RESTORE THE CHANNEL
	OKSKD1			;AND THE SCHEDULER
	RET			;AND DONE
;SEND XON ONLY IF LINE IS MARKED AS NEEDING
;ONE, AND IT HAS NOT STORED TOO MANY CHARACTERS IN EITHER ITS
;INPUT BUFFER OR TTBBUF

SNDXN2::JE TTFXO,(B),R		;IF NOT WAITING, RETURN
	JN TTSHU,(B),R		;DO NOTHING IF LINE TURNED OFF
	SAVET			;BE TRANSPARENT
	STKVAR <SNDXSV>
	MOVEM B,SNDXSV		;SAVE THE LINE NUMBER
	CONSO PI,77000		;SKIP NOSKED IF NOT AT PI LEVEL 7
	NOSKD1			;PREVENT SCHEDULER INTERRUPTION
	CHNOFF DLSCHN		;AND DTE INTERRUPTS
	LOAD A,TTFBB,(B)	;GET NUMBER CHARS IN TTBBUF
	SKIPG TTACTL(B)		;ACTIVE LINE?
	JRST SNDXN1		;NO, SEND NOTHING.
	CAIL A,MXBBC1		;STILL TO MUCH IN BBUF?
	JRST SNDXN1		;YES, NO XON YET
	CALL STADY		;GET ADDRESS OF DYNAMIC DATA
	 JRST SNDXN3		;NOT ACTIVE. INPUT BUFFER CAN'T OVERFLOW
	MOVEI A,MINXON		;LEVEL AT WHICH TO START AGAIN
	CAMGE A,TTICT(B)	;IS INPUT BUFFER THIS FULL?
	JRST SNDXN1		;YES. DON'T SEND XON

;XON IS TO BE SENT. TELL DTE SERVICE

SNDXN3:	MOVE B,SNDXSV		;TURN IT ON IF NOT ACTIVE.
	MOVE A,MSTRDT		;TO THE MASTER
	MOVEI D,XONC		;THE CHARACTER
	SKIPGE CHITAB(D)	;PARITY NEEDED?
	TXO D,200		;YES. APPLY IT
	MOVSI C,0(B)
	MOVE B,[.DFBKW,,.FEDLS]
	CALL FIXARG
	CALL DTEQI		;GO SEND THE BYTE
	MOVE B,SNDXSV		;GET LINE NUMBER
	SETZRO TTFXO,(B)	;NO X-ON NEEDED NOW
SNDXN1:	MOVE B,SNDXSV		;RESTORE LINE NUMBER
	CHNON DLSCHN		;RESTORE DTE
	CONSO PI,77000		;SKIP OKSKED IF NOT AT PI LEVEL 7
	OKSKD1			;AND THE SHCEDULER
	RET			;AND DONE

	ENDSV.			;END STKVAR
;THIS IS A FRONT END LINE

TTHU2::	SAVET			;SAVE TEMPS
	MOVE A,MSTRDT		;MASTER -11, NO INT
	MOVS C,B
	MOVE B,[.DFLHU,,.FEDLS]	;HANG UP THIS LINE
	CALL FIXARG
	HLRZ D,C
	SETZ C,
	CALL DTEQI		;REQUEST THE HANGUP
	RET			;AND DONE
;CHECK INPUT RATE OF LINE
;LIMIT ITS STORAGE IN TTBBUF

BIGST2::LOAD C,TTFBB,(B)	;GET COUNT OF CHARACTERS IN TTBBUF
	AOS C			;INCREASE IT
	CAIL C,MAXABC		;BEYOND BAD GUY CUTOFF?
	JRST STPLNF		;STOP LINE
	CAIG C,2		;CHECK FOR 2 IN BUFFER
	JRST BIGST4		;NO NOT THIS TIME
	SKIPG TTACTL(T2)	;YES CHECK TO SEE IF ACTIVE
	JRST STPLNF		;NO SHUT LINE DOWN IT IS ANOYING ME
BIGST4:	STOR C,TTFBB,(B)	;UPDATE COUNT OF CHARACTERS IN TTBBUF
	CAIGE C,MAXBBC		;MANY CHARS FOR THIS LINE?
	RETSKP			;NO, CONTINUE
	MOVE C,TTBIGC		;YES, BIGBUF GETTING FULL TOO?
	CAIL C,MAXABC-^D20
	CALL SNDXO2		;YES, SEND XOF
	RETSKP

;TELL FE TO STOP ACCEPTING INPUT ON LINE, I.E. BY SETTING INPUT
;SPEED TO 0.

STPLNF:	JN TTSHU,(B),R		;DO NOTHING IF LINE ALREADY OFF
	SAVEAC <T2>
	IFQE. TTWSO,(B)		;LINE HAS BEEN SHUT OFF BEFORE?
	  SETONE TTWSO,(B)	;NO, REPORT IT VIA BUGINF
	  BUG.(INF,TTYSTP,RSXSRV,HARD,<Line has been shut off because of excessive input rate>,<<T2,LINE>>,<

Cause:	A terminal line on RSX20F is generating input at an excessive
	rate.  It is being shut off for 3 seconds by having its input
	speed set to 0. This can result from a noisy line which has a high
	input baud rate.  If an EIA line, it may be too long and so picks
	up electrical noise.

Action:	This problem can be prevented by eliminating the noise or reducing
	the input speed.
>)
	ENDIF.
	SETONE TTSHU,(B)	;NOTE LINE SHUT OFF
	MOVEI C,TTTOBL		;C/THE ROUTINE TO CALL
	MOVEI A,^D5000		;5 SECONDS
	CALL TTQAD		;GO Q IT UP AND LOSE DATUM
	MOVSI C,0(B)		;THE LINE
	MOVE B,[.DFTOL,,.FEDLS]
	MOVE A,MSTRDT		;TO THE MASTER
	MOVEI D,.DFTLO		;TURN IT OFF
	CALL FIXARG
	CALL DTEQI		;OUTPUT IT
	RET
;NOISY LINE CHECK IN TTCHI.  CALLED WHEN CHARACTER TAKEN FROM BIGBUF
;FOR INACTIVE LINE THAT WILL ECHO BELL.
; T2/ LINE NUMBER

TTCHNL::JN TTSHU,(T2),R		;DONE IF LINE ALREADY SHUT OFF
	LOAD T1,TTNOI,(T2)	;SEE IF NOISY LINE--NOISE CHARACTER COUNT
	CAIL T1,3		;ALREADY SAW 3?
	RET			;YES, ENOUGH ALREADY.
	ADDI T1,1		;BUMP NOISE COUNT
	STOR T1,TTNOI,(T2)
	CAIE T1,1		;FIRST ONE?
	RET			;NO
	MOVEI T1,^D1000		;YES, QUEUE A CHECK FOR ONE SECOND
	MOVEI T3,CKNOIS
	CALL TTQAD
	RET

;CHECK OF POSSIBLY NOISY LINE AFTER 1 SECOND
; T2/ LINE NUMBER

CKNOIS::LOAD T1,TTNOI,(T2)	;SEE HOW MANY IN LAST SECOND
	CAILE T1,2		;MORE THAN 2?
	CALL STPLNF		;YES, SHUT OFF LINE
	SETZRO TTNOI,(T2)	;CLEAR COUNT, START FRESH
	RET
;THIS CODE IS USED TO START UP A LINE TRANSFER VIA THE DTE20.

TTFES1:	CALL TTSND		;GET ONE OUTPUT CHAR
	 RET			;BUFFER EMPTY
	SKIPE FEFLG		;USING PRIMARY PROTOCOL?
	IFSKP.
	  CALL [SAVEAC <B>	;NO
		DYNST		;GET LINE NUMBER
		CALLRET DTECHO]	;OUTPUT VIA SECONDARY
	   RET
	  SETONE TTOTP,(B)	;INDICATE LINE IS ACTIVE
	  RET			;AND DONE
	ENDIF.
	MOVE D,A		;THE CHARACTER
	SETONE TTOTP,(B)	;SAY LINE IS ACTIVE
	INCR TTFCT,(B)		;INCREASE COUNT OF BYTES IN -11
	AOS TOTFCT		;MAINTAIN TOTAL OF ALL LINES
	PUSH P,B		;SAVE ADDRESS OF DYNAMIC DATA
	DYNST			;GET LINE NUMBER
	SETONE TTFPK,(B)	;SAY WAITING FOR TO -11 DONE
	MOVSI C,0(B)		;LINE NUMBER
	MOVE B,[.DFHLC,,.FEDLS]	;ARGS
	CALL FIXARG		;GET PROPER ARGS
	PUSH P,F
	SETZ F,			;JUST IN CASE
	CALL DTSNGL		;GO DO A SINGLE REQUEST
	 JRST [	POP P,F		;FAILED. RESTORE FLAGS
		POP P,B		;RESTORE ADDRESS OF DYNAMIC DATA
		DECR TTFCT,(B)	;DECREMENT BYTES IN -11
		SOS TOTFCT
		CALL BAKTTO	;BACKUP TTY OUTPUT
		JRST INTRST]	;GO SCHEDULE RETRY
	POP P,F			;RESTORE FLAGS
	POP P,B			;ADDRESS OF DYNAMIC BLOCK
	RET			;AND DONE
;TTTOBL - ROUTINE CALLED FROM SCHEDULER TO TURN ON LINE AGAIN

;ACCEPTS:
;	T2/ INTERNAL LINE NUMBER

TTTOBL::JE TTSHU,(B),R		;IF ALREADY RESTARTED, DO NOTHING
	SETZRO TTSHU,(B)
	BLCAL. TTDTEQ,<[0],[.DFTOL],[0],[.DFTOO]>
				;TURN ON LINE
	CALLRET SNDXN2		;ASSUME AN X-ON IS NEEDED

; ENABLE/DISABLE TTY'S

FEDABL::SETZ C,0		;SET LINE # (ALL)
	MOVE A,MSTRDT		;GET ID OF MASTER
	MOVE B,[.DFEDR,,.FEDH1]	;ENABLE/DISABLE DATASETS
	CALL DTEQI
	RET
	SUBTTL FRONT-END TERMINAL HANDLING
	RESCD			;MUST BE RESIDENT

;THIS ROUTINE IS CALLED FROM THE DTE20 INTERRUPT ROUITNE TO COMPLETE
;A TTY OUTPUT REQUEST. INPUT IS:
;	A/ UNIQUE CODE (SEE BELOW)
;	B/UNIT NUMBER
;	C/DEVICE CODE

;UNIQUE CODE IS
;	(0,,COUNT)
;WHERE	COUNT IS THE NUMBER OF CHARACTERS SENT TO THE 11 IN SOME CALL TO
;		DTEQ THAT SPECIFIED TTYINT AS ITS RETURN ADDRESS
;	IF COUNT IS 0, THIS WAS A SINGLE CHARACTER (DTSNGL WAS CALLED)
;		AND BUFFER COUNTS HAVE ALREADY BEEN UPDATED
;	IF COUNT IS NON-ZERO, THIS WAS MULTIPLE CHARACTERS, AND THE BUFFER
;		COUNT MUST BE UPDATED

;AT THIS POINT, THE CHARACTERS HAVE BEEN SENT TO THE 11 BUT NOT ACKNOWLEDGED

TTYINT::EA.ENT
	PUSH P,A		;SAVE UNIQUE CODE
	MOVE A,C		;MOVE DEVICE TO A
	CALL GETLIN		;GET PROPER CODE
	 JRST [	POP P,A		;RESTORE CODE
		RET]		;AND GIVE UP
	SETZRO TTFPK,(B)	;CLEAR WAITING FOR -11
	POP P,A			;GET BACK UNIQUE CODE
	CALL STADY		;GET ADDRESS OF DYNAMIC DATA
	 RET			;RETURN IF BECOMING ACTIVE OR INACTIVE
	JUMPE A,TTYIN3		;HAVE A COUNT?

;MULTIPLE CHARACTERS WERE SENT. UPDATE COUNT OF CHARACTERS IN OUTPUT
;BUFFER

	MOVEI C,0(A)		;NUMBER OF CHARACTERS SENT
	SUB C,TTOCT(B)		;COMPUTE NEW COUNT OF CHARACTERS IN BUFFER
	SKIPG C			;IF COUNT WENT NEGATIVE, DON'T STORE IT
	MOVNM C,TTOCT(B)	;STORE NEW COUNT
	OPSTRM <ADDM A,>,TTFCT,(B) ;UPDATE FE CHAR COUNT
	ADDM A,TOTFCT		;UPDATE TOTAL
	CALL CHKWRN		;SEE IF FORK WAKEUP NEEDED
	JRST TTYIN3		;SEE IF MORE OUTPUT
;TTYINT..
;CALLED FROM SCHEDULER PERIODIC TASK PROCESSOR TO START OUTPUT FOR A LINE
; T2/ DYNAMIC PTR
; RETURN +1 ALWAYS

FESTRO::CHNOFF DLSCHN		;AVOID INTERRUPTS
	SKIPE FEFLG		;PRIMARY PROTOCOL RUNNING?
	IFSKP.
	 CALL TTFES1		;NO, HANDLED BY 1-CHAR CASE
	ELSE.
	 CALL TTYIN3		;DO THE WORK
	ENDIF.
	CHNON DLSCHN
	RETSKP			;NOTE NOTHING ELSE TO BE DONE

;CHARACTERS ARE IN OUTPUT BUFFER. CALL TTSND IF THERE IS ONLY ONE.
;OTHERWISE CALL DTEQ TO SEND THEM ALL

TTYIN3:	STKVAR <TTYVR1,TTYVR2>	;GET SOME SAVE CELLS
	CALL GETFMC		;GET LINE MAX ALLOCATION
	LOAD D,TTFCT,(B)	;GET COUNT OF CHARS IN FE
	CAML D,A		;ROOM FOR MORE?
	JRST [	SETONE TTOTP,(B) ;SAY LINE IS WAITING FOR UNBLOCK
		RET]		;AND GO DISMISS THIS INTERRUPT
	JN <TTFLO,TTSAL,TTHPO,TTSFG,TTRXF>,(T2),[ ;ANY SPECIAL FLAGS?
		CALLRET TTFES1]	;YES, HANDLED BY THE 1-CHAR CASE
	SKIPN C,TTOCT(B)	;ANY OUTPUT CHARACTERS?
	CALLRET TTFES1		;NO
	MOVE C,TTOOUT(B)	;GET POINTER
	TDNN C,WRPMSK		;AT LAST WORD IN THIS BUFFER?
	JRST [	LDB A,[POINT 6,C,5] ;LOOK AT P,S FIELD OF BYTE POINTER
		CAIE A,73	;POINTING TO LAST BYTE?
		JRST .+1	;NO.
		HRRZ A,C	;YES. GET ADDRESS OF CURRENT WORD
		HRR C,1-TTSIZ(A) ;POINT TO NEXT BUFFER IN CHAIN
		JRST .+1]
	MOVE A,TTOCT(B)		;GET OUTPUT COUNT
	CALL CNTSET		;GO ADJUST COUNT
	MOVEM C,TTYVR1		;SAVE STARTING BYTE POINTER
	CALL FNDEND		;GO GET CHARACTERS
	MOVE D,TTYVR1		;GET BACK ORIGINAL BYTE POINTER
	TRNN A,777776		;AT LEAST TWO?
	CALLRET TTFES1		;NO. GO DO SINGLE CHARACTER
	SETONE TTOTP,(B)	;MAKE SURE THIS IS ON
	MOVEM C,TTOOUT(B)	;NEW OUTPUT POINTER
	SETZ F,			;OUTPUT BUFFER
	HRR F,A			;GET COUNT OF BYTES FOUND
	MOVSI A,TTYINT		;IT'S TTY
	HRR A,MSTRDT		;TO THE MASTER
	MOVEM B,TTYVR2		;SAVE ADDRESS OF DYNAMIC DATA
	DYNST			;GET LINE NUMBER
	SETONE TTFPK,(B)	;WAITING FRO TO -11 DONE
	MOVS C,B		;LINE NUMBER
	HRR C,F			;COUNT
	MOVE B,[.DFHSD,,.FEDLS]	;STRING DATA
	CALL FIXARG		;FIX UP THE ARGS
	CALL DTEQBP
	CALL DTEQ		;QUEUE THE REQUEST
	 JRST RSCHED		;GO DO RESCHEDULE
	RET			;GO DISMISS THE INTERRUPT

;DTEQ FAILED. RESTORE COUNTS AND ARRANGE FOR SCHEDULER TO RESTART OUTPUT

RSCHED:	MOVE B,TTYVR2		;ADDRSS OF DYNAMIC DATA
	MOVE D,TTYVR1		;GET ORIGINAL BYTE POINTER
	MOVEM D,TTOOUT(B)	;RESTORE OUTPUT BYTE POINTER
INTRST:	DYNST			;B/ LINE NUMBER
	SETZRO <TTOTP,TTFPK>,(B) ;NOT WAITING FOR PACKET
	MOVEI A,^D100		;TRY AGAIN IN 100 MS.
	MOVEI C,TTSN10		;START UP AS SINGLE CHARACTER
	CALLRET TTQAD		;GO DO IT

	ENDSV.			;END STKVAR
;CNTSET - ROUTINE TO FIGURE OUT MAX COUNT ALLOWED IN STRING DATA FUNCTION
;INPUT:	A/ TTY BUFFER COUNT
;	B/ ADDRESS OF DYNAMIC DATA
;RETURNS +1 ALWAYS WITH: A/-MAX COUNT,,0

CNTSET:	SASUBR <CA,CB>
	CALL GETFMC		;GET MAX ALLOC FOR THIS LINE
	LOAD D,TTFCT,(B)	;CURRENT FRONT END COUNT
	SUB A,D			;COUNT ALLOWED TO SEND
	CAMLE A,CA		;CAN DO ALL?
	MOVE A,CA		;YES
	MOVN A,A		;FOR AOBJN
	HRLZM A,CA		;TO LH AND RETURN IT
	RET			;AND DONE

;GET MAX FE ALLOC FOR LINE.  DEPENDS ON SPEED OF LINE
; B/ DYN PTR
; RETURNS +1 ALWAYS,
;	A/ MAX BYTE COUNT

GETFMC:	SAVEAC <C>
	LOAD A,TTFMC,(B)	;GET NOMINAL MAX
	STALOD C,TTOSP,(B)	;GET LINE SPEED
	CAIE C,-1		;UNKNOWN?
	CAIGE C,^D1200		;OR LESS THAN 1200?
	JRST [	ASH A,-2	;YES, 1/4 ALLOC
		RET]
	CAIL C,^D9600		;FAST?
	IMULI A,2		;YES, DOUBLE ALLOC
	RET			;OTHERWISE, NORMAL ALLOC
;FNDEND - FIND END OF MESSAGE TO SEND TO TERMINAL

;ACCEPTS:
;	T1/ AOBJN POINTER TO STEP THROUGH OUTPUT BUFFER
;	T3/ POINTER FOR REMOVING CHARACTERS FROM OUTPUT BUFFER

;	CALL FNDEND

;RETURNS +1: ALWAYS,
;	T1/ UPDATED AOBJN PTR, RH CONTAINS NUMBER CHARS TO DO
;	T3/ UPDATED POINTER TO OUTPUT BUFFER

FNDEND:	TDNN C,WRPMSK		;TO THE NEXT?
	JRST [	LDB D,[POINT 6,C,5]
		CAIN D,73
		RET
		JRST .+1]
	ILDB D,C		;GET NEXT BYTE
	TRNE D,TTOESC		;ESCAPE CHARACTER?
	JRST [	MOVNI D,1
		ADJBP D,C
		MOVEM D,C
		RET]
;	JRST [	ADD C,[^D9B5]	;DECREMENT BYTE POINTER
;		TLNE C,(40B5)	;WENT INTO PREVIOUS WORD?
;		SUB C,[44B5+1]	;YES. CORRECT IT
;		RET]		;AND RETURN
	AOBJN A,FNDEND		;NO. GET MORE
	RET			;ALL EXHAUSTED

;ROUTINE TO SET SPEED OF LINE FROM VALUES SENT BY -11
;ACCEPTS:
;	A/ DEVICE CODE
;	B/ UNIT NUMBER
;	C/ REMOTE INDICATOR
;	D/ INPUT,,OUTPUT

TTSPST::EA.ENT
	CALL GETLIN		;GET INTERNAL LINE NUMBER
	 RET			;INVALID
	TRNN C,(1B2)		;IS IT REMOTE?
	JRST TTSPS0		;NO, CHECK AUTO
	SETONE TTFEM,(B)	;YES, INDICATE REMOTE
TTSPS0:	TRNN C,(1B3)		;IS IT AUTO?
	JRST TTSPS1		;NO.
	SETONE TTAUT,(B)	;YES. SET INDICATOR
TTSPS1:	MOVEM D,TTSPWD(B)	;STORE IT
	RET			;AND DONE
;ROUTINE TO HANDLE SIGNAL FROM A FE THAT ITS LINE BUFFER FOR
;A GIVEN LINE IS EMPTY. ACCEPTS:
;	A/ DEVICE CODE
;	B/LINE NUMBER

TTYDON::EA.ENT
	JUMPL B,DONALL		;IF NEG HE WANTS TO ACK THEM ALL
	CALL GETLIN
	 RET			;ILLEGAL LINE
	JN TTFPK,(B),R		;IF TO -11 DONE PENDING, GO AWAY
	CALL STADY		;GET ADDRESS OF DYNAMIC DATA
	 RET			;GONE
	LOAD C,TTFCT,(B)	;GET COUNT OUTSTANDING
	MOVN C,C
	ADDM C,TOTFCT		;REDUCE FE TOTAL
	SETZRO TTFCT,(B)	;CLEAR COUNT OF BYTES IN -11
	JE TTOTP,(B),R		;IS THIS LINE WAITING FOR THIS INT?
	CALLRET TTYIN3		;YES, CONTINUE OUTPUT TO THE LINE

;HERE WHEN FRONT END IS ACKING ALL UNITS

DONALL:	STKVAR <SAVEE>
	MOVSI C,NTTFE		;NUMBER OF FRONT END LINES
	MOVNS C			;MAKE AOBJN POINTER
DONAL1:	MOVEM C,SAVEE		;SAVE AOBJN POINTER
	MOVEI B,0(C)		;B/LINE NUMBER
	MOVEI A,.FEDLS		;ALL LINES ARE DLS
	CALL TTYDON		;GO ACK THIS GUY
	MOVE C,SAVEE
	AOBJN C,DONAL1		;DO ALL LINES
	MOVE B,CTYLNO		;GET CTY LINE NUMBER
	LOAD C,TTSTY,(B)	;GET LINE TYPE
	CAIE C,TT.FE		;FRONT END LINE?
	RET			;NO. DON'T ACK IT
	SKIPGE B,CTYUNT		;B/UNIT NUMBER FOR CTY
	RET			;NOT SET UP YET
	MOVEI A,.FEDLS		;A/ DEVICE .FEDLS
	CALLRET TTYDON		;GO ACK THE LINE

	ENDSV.			;END STKVAR
;ROUTINE TO HANDLE A DIAL UP SIGNAL FROM THE FE
;	A/DEVICE CODE
;	B/LINE NUMBER

TTYDLU::EA.ENT
	CALL GETLIN		;GET PROPER LINE NUMBER
	 RET			;ILLEGAL LINE
	MOVSI A,0(B)		;LINE NUMBER TO LH
	HRRI A,DLSCXF+CARONB	;INDICATE CARRIER ON
	CALLRET BIGSTO		;PUT IT IN BUFFER

;ROUTINE TO HANDLE HANG UP SIGNAL FROM FE
;	A/DEVICE CODE
;	B/LINE NUMBER

TTYHGU::EA.ENT
	CALL GETLIN		;GET LINE NUMBER
	 RET			;ILLEAGAL LINE
	MOVSI A,0(B)		;TO LH
	HRRI A,DLSCXF		;CARRIER TRANSITION
	CALLRET BIGSTO		;STORE IT

;DEFINE THE PROTOCOL TRANSFER VECTOR

TTYDTV::0			;NO STRING DATA
	TTYDON			;ACK
	0			;NO STATUS
	TTYSLA			;SET LINE ALLOCATION
	R			;NO ERROR REPORTING
	TTDTRM			;DETACH REMOTES ON RELOAD
;THIS ROUTINE IS CALLED FROM THE DTE INTERRUPT ROUTINE TO SET
;THE LINE ALLOCATION FOR A TTY LINE. ACCEPTS:
;	1/ DEVICE CODE
;	2/ ALLOCATION
;	3/ LINE NUMBER

TTYSLA::EA.ENT
	EXCH B,C		;GET ARGS IN PROPER PLACES
	CALL GETLIN		;GET INTERNAL LINE NUMBER
	 RET			;ILLEGAL LINE
	STOR C,TSFMC,(B)	;STORE NEW ALLOCATION
	RET			;AND DONE

;IDCTY - IDENTIFY THE CTY

;ACCEPTS:
;	T2/ UNIT NUMBER FOR THE CTY AS KNOWN BY THE FRONT END

;	CALL IDCTY

;RETURNS +1: ALWAYS

;CALLED FROM DTE SERVICE WHEN THE FRONT END SENDS OVER THE UNIT NUMBER
;WITHIN THE .FEDLS DEVICE THAT IT KNOWS AS THE CTY.  STORES:
;CTYUNT/ THE UNIT NUMBER
;CTYINT/ THE INTERNAL EQUIVALENT OF THAT (INTERNAL LINE NUMBER)

;THE CTY SHOULD ALWAYS BE ADDRESSED INTERNALLY BY CTYLNO, WHICH IS
;SET UP BY TTINIT. CTYINT WILL CONTAIN THE INTERNAL
;EQUIVALENT OF THE LINE ON WHICH THE CTY IS PHYSICALLY LOCATED FOR THIS
;MONITOR LOAD. ADDRESSING THE LINE BY THIS NUMBER IS AN ERROR.
;IF CTYINT=CTYLNO, CTYINT IS SET TO -1 SO THAT NO LINE NUMBER WILL
;EVER MATCH IT

IDCTY::	EA.ENT
	SAVET
	PUSH P,T2		;SAVE UNIT NUMBER
	SETOM CTYUNT		;INDICATE CTY NOT KNOWN FOR GETLIN
	MOVEI T1,.FEDLS		;T1/DEVICE
	CALL GETLIN		;GET THE INTERNAL EQUIVALENT
	 RET			;NOT A FRONT END LINE
	CAME T2,CTYLNO		;IS THIS ITS VALID INTERNAL LINE NUMBER?
	MOVEM T2,CTYINT		;NO. SAVE THIS AS ITS ALIAS
	POP P,CTYUNT		;SET UNIT NUMBER FOR CTY
	RET
;GETLIN - ROUTINE TO CONVERT DEVICE/LINE TO INTERNAL LINE NUMBER
;ACCEPTS:
;	A/DEVICE CODE (ONLY .FECTY OR .FEDLS)
;	B/LINE NUMBER
;RETURNS +1: FAILURE
;	 +2: SUCCESS,
;		T2/INTERNAL LINE NUMBER
;DOES NOT CLOBBER ANY REGISTERS EXCEPT B

GETLIN:	CAIN A,.FECTY		;THE CTY?
	JRST [	MOVE B,CTYLNO	;YES. USE INTERNAL NUMBER OF CTY
		RETSKP]		;AND RETURN WITH GOOD LINE

;THE DEVICE MUST BE .FEDLS

	CAMN B,CTYUNT		;THE UNIT NUMBER FOR THE CTY?
	JRST [	MOVE B,CTYLNO	;YES. GET INTERNAL LINE NUMBER FOR CTY
		RETSKP]
	CAIL B,NTTFE		;IS THE UNIT NUMBER WITHIN THE NUMBER
				; OF FRONT END LINES THAT WE KNOW ABOUT?
	RET			;NO. CAN'T BE A FRONT END LINE
	JUMPE B,GETLN1		;IF THE DL11, SKIP BIAS
	SUBI B,SPCLIN		;BIAS THE LINE
	SKIPG B			;NOW A GOOD T/S LINE NUMBER?
	ADDI B,NTTFE-1		;NO. WAS A SPECIAL. TRANSLATE THE LINE #
GETLN1:	ADD B,TT1LIN+TT.FE	;YES. ADD NUMBER OF FIRST F.E. LINE
	RETSKP			;RETURN SUCCESS


;FIXARG - ROUTINE TO DETERMINE PROPER DEVICE/LINE NUMBER FOR LINE ON RSX20F
;FRONT END

;ACCEPTS: RH B/ DEVICE (ONLY .FEDLS)
;	  LH C/ INTERNAL LINE NUMBER
;	CALL FIXARG
;RETURNS +1: ALWAYS,
;		RH B/ DEVICE AS KNOWN BY THE FRONT END
;		LH C/ UNIT AS KNOWN BY FRONT END

;CALLED IN PREPARATION FOR CALLING DTE SERVICE. LINE IS ASSUMED TO
;BE ON THE FRONT END

;NOTE: IF CALLED WITH -1, RETURNS IMMEDIATELY. THIS IS BECAUSE OF A
;FRONT-END BUG THAT REQUIRES RECEIVING -1 ON A SENDALL

FIXARG:	ACVAR <W1>		;GET SOME WORK REGISTERS
	JUMPL C,R		;IF UNIT .LE. 0, NO CHANGE
	HLRZ W1,C		;GET INTERNAL LINE NUMBER
	CAMN W1,CTYLNO		;THE CTY?
	JRST [	HRRI B,.FECTY	;YES. USE THE CTY
		HRLI C,0	;AND UNIT 0
		RET]
	SUB W1,TT1LIN+TT.FE	;GET LINE NUMBER WITHIN TYPE
	JUMPE W1,FIXAR1		;IF THE DL11, ALL DONE
	ADDI W1,SPCLIN		;NOT. BIAS THE LINE NUMBER
	CAILE W1,NTTFE-1	;A VALID T/S LINE?
	SUBI W1,NTTFE-1		;NO. ONE OF THE SPECIALS THEN
FIXAR1:	HRL C,W1		;RETURN IT IN LH OF C
	RET			;AND DONE

	ENDAV.			;END ACVAR
;LOCAL ROUTINE TO SIMPLIFY CALLS TO DTEQ - USES "BLISS" CALLING SEQUENCE
; T2/ LINE NUMBER
;	CALL <AA,AB,AC,AD>
; WHERE: (SEE DTESRV FOR FURTHER DETAILS)
;   AA - DRIVER INT LOC (ASSUME MASTER DTE)
;   AB - DTE FUNCTION (ASSUME .FEDLS)
;   AC - 0 ,, BYTE CNT (LH FILLED IN WITH LINE NUMBER)
;   AD - DATUM
;RETURN +1: ALWAYS
;  ALL ACS PRESERVED

TTDTEQ:	BLSUB. <AA,AB,AC,AD>
	SAVET
	HRLZ C,B
	HRLZ B,AB
	HRRI B,.FEDLS
	CALL FIXARG		;CONVERT LINE NUMBER
	HRLZ A,AA
	HRR A,MSTRDT
	HRR C,AC
	MOVE D,AD
	CALLRET DTEQI		;USE NON-SKIP VERSION OF DTEQ

	ENDBS.

;Convert byte pointer before calling DTEQ.

;	CALL DTEQBP

;ACCEPTS USUAL ARGUMENTS FOR DTEQ, WITH BYTE POINTER IN T4

;RETURNS +1: ALWAYS
;	T4/ CONVERTED BYTE POINTER

;ASSUMES BYTE POINTER IS ONE-WORD GLOBAL TO SECTION 0, WITH 9-BIT BYTE SIZE

DTEQBP:	ACVAR <W1>
	LDB W1,[POINT 6,T4,5]	;GET P,S FIELD
	SUBI W1,67		;NORMALIZE TO LOWEST VALUE
	CAILE W1,4		;CAN'T BE MORE THAN 4
	MOVEI W1,4		;SO FORCE IT
	HRL T4,OWG9(W1)		;MAKE A ONE-WORD LOCAL OUT OF IT
	RET
	ENDAV.			;END ACVAR

RSI OWG9,<441100,331100,221100,111100,001100>
;DTESTO - ROUTINE TO STORE A CHARACTER IN TTBBUF. CALLED AT INTERRUPT LEVEL
;FROM DTE SERVICE. DATA IS ALWAYS A CHARACTER AT THIS POINT.

;ACCEPTS:
;	T1/CHARACTER IN 8 BITS
;	T2/(0,, PHYSICAL LINE NUMBER)
;	T3/DEVICE TYPE

;RETURNS +1: ALWAYS

DTESTO::EA.ENT
	EXCH C,A		;TYPE TO A, CHAR TO C
	CALL GETLIN		;GET INTERNAL LINE NUMBER FOR THIS LINE
	 RET			;LINE NOT ON FRONT END
	MOVE A,C		;RESTORE CHARACTER
	CALLRET TTIDON		;GO STORE CHARACTER

;DEVICE DEPENDENT CODE FOR SOBE
;SKIP IF FE BUFFER NOT EMPTY

TTSBEF::JN TTFCT,(T2),RSKP	;LOCAL RETURN SKIP IF NON-EMPTY
	RET			;EMPTY


;DEVICE DEPENDENT CODE FOR INIALIZING DYNAMIC STORAGE

TTSETF::LOAD T3,TSFMC,(T2)	;GET FRONT END CHARACTER LIMIT FROM DYNAMIC
	STOR T3,TTFMC,(T1)	; AND COPY TO DYNAMIC
	CAIN T4,MSGLEN		;IS THIS A MESSAGE-LENGTH BLOCK?
	RET			;YES. NO MORE INITIALIZATION
	MOVE T3,TTSPWD(T2)	;GET SPEED WORD
	MOVEM T3,TTSVPD(T1)	;SAVE IN SAVED SPEED WORD
	RET
;ROUTINE CALLED FROM PROTOCOL HANDLER TO DETACH ALL REMOTE JOBS FOR
;A GIVEN DTE. ACCEPTS:
;	A/ DTE NUMBER (NOT USED)
;RETURNS	+1 ALWAYS

	SWAPCD			;IS SWAPPABLE
TTDTRM:	EA.ENT
	CAME A,MSTRDT		;IS THIS FOR THE MASTER DTE?
	RET			;NO. DON'T DO ANYTHING THEN
	SAVET			;SAVE ALL TEMP REGISTERS
	MOVSI B,NTTFE		;NUMBER OF FE LINES
	MOVNS B			;SET UP AOBJN POINTER
	HRR B,TT1LIN+TT.FE	;START WITH FIRST LINE AND LOOP THROUGH ALL
TTDTR1:	TMNE TTFEM,(B) ;IS THIS LINE REMOTE?
	CALL TTJBDT		;YES. DETACH IT THEN
	AOBJN B,TTDTR1		; DO ALL LINES
	MOVEI A,.SFRMT		;SEE IF REMOTE LOGINS NOW ALLOWED
	TMON			;GET VALUE
	XCT [	CALL DTRMDS	;NOW DISALLOWED
		CALL DTRMEN](B)	;NOW ALLOWED
	RET			;AND DONE
;ROUTINE TO DEFINE THE DL11W PSEUDO-CTY'S.
;PRIMARY PROTOCOL MUST BE RUNNING

DFNDL1::EA.ENT
	ACVAR <W1>		;GET A WORK REG
	STKVAR <<DFNDLS,2>,<DFNDS1,1>>	;A STRING
	MOVE T2,[ASCII /TTY/]	;GET BASE STRING
	MOVEM T2,DFNDLS		;SAVE IT
	MOVE T2,[ASCIZ /DL0/]	;GET DEFINITION STRING
	MOVEM T2,DFNDS1		;SAVE IT
	MOVE W1,[-<SPCLIN-1>,,SPCLIN-2] ;THE LINES TO DO
DFNDLL:	HRRZ T2,W1		;GET LINE NUMBER
	MOVEI T1,.FEDLS		;FOR THE DLS DEVICE
	CALL GETLIN		;GET ITS INTERNAL NUMBER
	 JRST DFNDLE		;?
	SETONE TTIGI,(T2)	;SET IGNORE
	MOVEI T1,DFNDLS		;GET ADDRESS OF BYTE ARRAY
	HRLI T1,(<POINT 7,0,20>) ;MAKE IT A STRING POINTER
	MOVEI T3,10		;GET AN OCTAL NUMBER
	NOUT			;PUT LINE NUMBER IN STRING
	 JFCL
	MOVEI T3,":"		;GET TERMINATOR
	IDPB T3,T1		;STORE COLON
	SETZM T3		;GET A NULL
	IDPB T3,T1		;TIE OFF STRING
	MOVX T1,<BYTE (7)0,0,1>
	ADDM T1,DFNDS1		;CHANGE LOGICAL NAME STRING
	MOVEI T1,.TTDES(T2)	;GET DEVICE DESIGNATOR IN T1
	MOVEI T2,.MOSNT		;SET NON-TERMINAL STATUS
	MOVEI T3,.MOSMN		;SUPPRESS SYSTEM MESSAGES
	MTOPR			;DO IT
	 ERJMP .+1		;PROCEED IF IT FAILS
	MOVX T1,.CLNSY		;CREATE SYSTEM LOGICAL NAME
	HRROI T2,DFNDS1		;THE LOGICAL NAME
	HRROI T3,DFNDLS		;THE DEFINITION
	CRLNM			;DO IT
DFNDLE:	 BUG.(INF,DLDEF,RSXSRV,HARD,<Logical name define failed for FE CTY>,,<

Cause:	A CRLNM was performed to define the logical names for the FE but it
	failed.
>)
	AOBJN W1,DFNDLL		;DO THEM ALL
	RET			;AND DOND

	ENDSV.			;END STKVAR
	ENDAV.			;END ACVAR
	TNXEND
	END