Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/netgen/netdev.mac
There are 9 other files named netdev.mac in the archive. Click here to see a list.
	TITLE	NETDEV
;		======
;
;                    COPYRIGHT (c) 1980, 1981, 1982, 1985
;                    DIGITAL EQUIPMENT CORPORATION
;
;     This software is furnished under a license and may  be  used
;     and copied only in accordance with the terms of such license
;     and with the inclusion of the above copyright notice.   This
;     software  or any other copies thereof may not be provided or
;     otherwise made available to any other person.  No  title  to
;     and ownership of the software is hereby transferred.
;
;     The information  in  this  software  is  subject  to  change
;     without  notice  and should not be construed as a commitment
;     by DIGITAL EQUIPMENT CORPORATION.
;
;     DIGITAL assumes no responsibility for the use or reliability
;     of  its  software  on  equipment  which  is  not supplied by
;     DIGITAL.
;
;MODULE NETDEV
;
;	SUMMARY OF EDIT HISTORY - FOR FULL DETAILS SEE MODULE NETGEN.MAC
;
;	EDIT #		DATE
;	1		26JUN81
;	12.		02OCT81
;	37.		07May82
;	39.		04Jun82
;	41.		21Jun82
;	42.		23Jun82
;	46.		09Aug82
; 4.1
;	2.		23Nov82
;	7.		06Jan85
;	10.		07Jan85
;
;	SUBTTL	Universal searches and version information

	SEARCH	NETMAC

	INIGEN (NETDEV)			; Initialize GLXLIB assembly options
;
;	*	*	*	INCLUDE COMMAND	*	*	*	*
;
;*******INCLUDE - top level command dispatcher
;

INCPDB::$NOISE	(INC.1,in configuration)
INC.1:	$KEYDSP	(INCTAB,$ACTION(INC.2))
INCTAB:	$STAB
;	 DSPTAB	(CRLF##,CDR,<Card-Reader>)
	 DSPTAB	(INDMC,DMC,<DMC11>)
	 DSPTAB	(INDMR,DMR,<DMR11>)
	 DSPTAB	(INDTE,DTE,<DTE20>)
	 DSPTAB	(INKDP,KDP,<KDP>)
;	 DSPTAB	(CRLF##,LPT,<Line-Printer>)
	$ETAB

INCDFL:	ASCIZ/0/			;For default string

INC.2:	SETOM	INCFLG#			;No include data to parse
	$RETT

INCCMD:	$BUILD	DEVMAX
	$SET	CDR,,<JRST CDRINC>	;card reader done in action routine
	$SET	DMC,,<JRST DMCIN>	;DMC11
	$SET	DMR,,<JRST DMRIN>	;DMR11
	$SET	DTE,,<JRST DTEIN>	;DTE20
	$SET	KDP,,<JRST KDPIN>	;KDP
	$SET	LPT,,<JRST INLINE>	;line printer done in action routine
	$EOB
;
INCLU::	$CALL	P$KEYW##
	PJRST	@INCCMD(S1)
;
;    Common parse blocks
;
ISUBCS:	$INIT	(ICS.1)			; Circuit cost
ICS.1:	$NUMBER	(CRLF##,^D10,<<Cost of this circuit, X to XX>>,<$PREFILL(ICS.2),$DEFAULT(1),$ACTION(CHKNUM##),$ERROR(NUMERR##)>)
ICS.2:	LOAD	T1,DC900##,PRSMIN	;Set minimum
	MOVEM	T1,NUMMIN##
	LOAD	T1,DC900##,PRSMAX	;and maximum.
	MOVEM	T1,NUMMAX##
	$CALL	NUMLIM##
	$RETT

ISUBPR:	$INIT	(IPR.1)			; Line protocol type
IPR.1:	$KEYDSP	(IPR.2,$DEFAULT(LAPB))
IPR.2:	$STAB
	DSPTAB	(CRLF##,^D4,<DDCMP-DMC>)
	DSPTAB	(CRLF##,^D5,<LAPB>)
	$ETAB	

ISUBDP:	$INIT	(IDP.1)			; Line duplex
IDP.1:	$KEYDSP	(IDP.2,<$DEFAULT(Full),$ERRTXT(Specify either Full or Half -- not)>)
IDP.2:	$STAB
	 DSPTAB	(CRLF##,^D0,<Full>)
	 DSPTAB	(CRLF##,^D1,<Half>)
	$ETAB

ISUBBD:	$INIT	(IBD.1)			; Line baud rate
IBD.1:	$KEYDSP	(IBD.2,<$DEFAULT(19200)>)
IBD.2:	$STAB
	 DSPTAB	(CRLF##,BD.12,<1200>)
	 DSPTAB	(CRLF##,BD.18,<1800>)
	 DSPTAB	(CRLF##,BD.192,<19200>)
	 DSPTAB	(CRLF##,BD.24,<2400>)
	 DSPTAB	(CRLF##,BD.36,<3600>)
	 DSPTAB	(CRLF##,BD.48,<4800>)
	 DSPTAB	(CRLF##,BD.72,<7200>)
	 DSPTAB	(CRLF##,BD.96,<9600>)
	$ETAB
;
;   Common semantic routines
;
STRPRM:	MOVE	T1,PRMBLK##
	XCT	PRMDEF(T1)
	$RETIF
	PJRST	PRMSTR(T1)
;
; HERE TO SPECIFY THE DTE20 NUMBER.
;

INDTE:	$NOISE	(IDTE.1,number)
IDTE.1::$NUMBER	(CRLF,^D10,<<DTE20 number, X to X>>,<$PREFILL(DTESB1),$PDEFAULT(INCDFL),$ACTION(CHKNUM##),$ERROR(NUMERR##)>)

DTESB1:	MOVEI	T1,^D1			;Set minimum
	MOVEM	T1,NUMMIN##
	MOVEI	T1,^D3			;and maximum.
	MOVEM	T1,NUMMAX##
	$CALL	NUMLIM##
	SKIPG	S1,DTENUM##		;if le 0, ie if dte has been excluded,
	MOVEI	S1,1			;	make it default to 1
	PJRST	DTEDFL

IDTES1::$BUILD	PARSIZ			; first prompt for include DTE
	$SET	PAR.PV,,PVLIST(ENTCIR##,DC900##)
	$SET	PAR.PM,,[ASCIZ /DTE-0-0 Cost: /]
	$SET	PAR.TB,,ISUBCS
	$SET	PAR.SM,,STRPRM
	$EOB

DTEIN:	$CALL	DEVDTE
	$CALL	P$NUM##			; Get DTE number.
	MOVEM	S1,UNTNUM##		; and set as unit number.
	MOVEI	S1,IDTES1		; Ask for COST.
	$CALL	DPARSE
ADDDTE::SKIPL	DTENUM			; If DTE defined
	 $CALL	DELXPT			; then remove before re-defining.
	MOVE	S2,UNTNUM##
	MOVEM	S2,DTENUM		; Store new number.
	PJRST	ADDXPT
;
; ROUTINES TO INCLUDE ANOTHER DMC11 IN THE CONFIGURATION
;

INDMC:	$NOISE	(IDMC.1,number)
IDMC.1:	$NUMBER	(CRLF##,^D10,<<Number of DMC11, X to X>>,<$PREFILL(DMCSB1),$PDEFAULT(INCDFL),$ACTION(CHKNUM##),$ERROR(NUMERR##)>)

DMCSB1:	MOVEI	T1,^D0			;Set minimum
	MOVEM	T1,NUMMIN##
	MOVEI	T1,NUMDMC##-1		;and maximum.
	MOVEM	T1,NUMMAX##
	$CALL	NUMLIM##
	MOVE	S1,DMCNUM##
SETDFL:	SKIPN	INCFLG#			; Set default device number.
	 SUBI	S1,1			; (one less if exclude)
	SKIPGE	S1			; and if negative
	 SETZ	S1,			; then back up.
DTEDFL:	ADDI	S1,"0"			;MAKE ASCII
	MOVE	S2,[POINT 7,INCDFL]	;GET BYTE POINTER TO DEFAULT
	IDPB	S1,S2			;AND SAVE THE NEW DEFAULT
	SETZ	S1,
	IDPB	S1,S2
	$RETT

IDMCS2::$BUILD	PARSIZ			; first prompt for include DMC
	$SET	PAR.PV,,PVLIST(ENTLIN##,DL1111##)
	$SET	PAR.PM,,[ASCIZ /DMC-0 Duplex: /]
	$SET	PAR.TB,,ISUBDP
	$SET	PAR.SM,,STRPRM
	$EOB

IDMCS1::$BUILD	PARSIZ			; first prompt for include DMC
	$SET	PAR.PV,,PVLIST(ENTCIR##,DC900##)
	$SET	PAR.PM,,[ASCIZ /DMC-0 Cost: /]
	$SET	PAR.TB,,ISUBCS
	$SET	PAR.SM,,STRPRM
	$EOB

DMCIN:	$CALL	DEVDMC
	$CALL	P$NUM##
	SKIPL DMCUSE##(S1)		;ALREADY SPECIFIED?
	 JRST [	$TEXT ,<?DMC11 is already included, exclude it first>
		$RETF]
	CAMLE S1,DMCNUM			;CAN ONLY ADD IN ORDER
	 JRST [	$TEXT ,<?Illegal to Include DMC11s except in Numeric Order>
		$RETF]			;TELL HIM IF HE TRIES TO DO OTHERWISE
	MOVE	S2,DMXNUM##		;GET NUMBER OF DMx11 DEVICES
	SKIPN	PRVLDG##
	 CAIGE	S2,NUMDMX##		;CAN WE ADD ONE MORE
	  SKIPA
	   JRST [$TEXT ,<?Number of DMx11 (DMC/DMR) Devices Exceeded - Cannot Add this DMC11>
		$RETF]
	MOVEM	S1,CTLNUM##		; Set controller number.
	SKIPN	PRVLDG##		; If privledged,
	 JRST	PDMC2			; then
	MOVEI	S1,IDMCS2		; ask for DUPLEX.
	$CALL	DPARSE
PDMC2:	MOVEI	S1,IDMCS1		; Ask for COST.
	$CALL	DPARSE
ADDDMC::AOS	DMXNUM##		;YES - ONE MORE DMx11
	AOS	DMCNUM			;AND ONE MORE DMC11
	SETZM	DMCSTA##		;NO LONGER DEFAULT
	$CALL	DEVCTL
	SETZM	DMCUSE##(I1)		;THIS DMC11 IN USE
	PJRST	ADDXPT
;
; ROUTINE TO INCLUDE ANOTHER DMR11 IN THE CONFIGURATION
;

INDMR:	$NOISE	(IDMR.1,number)
IDMR.1:	$NUMBER	(CRLF##,^D10,<<Number of DMR11, X to X>>,<$PREFILL(DMRSB1),$PDEFAULT(INCDFL),$ACTION(CHKNUM##),$ERROR(NUMERR##)>)

DMRSB1:	MOVEI	T1,^D0			;Set minimum
	MOVEM	T1,NUMMIN##
	MOVEI	T1,NUMDMR##-1		;and maximum.
	MOVEM	T1,NUMMAX##
	$CALL	NUMLIM##
	MOVE	S1,DMRNUM##
	PJRST	SETDFL

IDMRS2::$BUILD	PARSIZ			; first prompt for include DMR
	$SET	PAR.PV,,PVLIST(ENTLIN##,DL1111##)
	$SET	PAR.PM,,[ASCIZ /DMR-0 Duplex: /]
	$SET	PAR.TB,,ISUBDP
	$SET	PAR.SM,,STRPRM
	$EOB

IDMRS1::$BUILD	PARSIZ			; first prompt for include DMR
	$SET	PAR.PV,,PVLIST(ENTCIR##,DC900##)
	$SET	PAR.PM,,[ASCIZ /DMR-0 Cost: /]
	$SET	PAR.TB,,ISUBCS
	$SET	PAR.SM,,STRPRM
	$EOB

DMRIN:	$CALL	DEVDMR
	$CALL	P$NUM##
	SKIPL DMRUSE##(S1)		;ALREADY SPECIFIED?
	JRST [	$TEXT ,<?DMR11 is already included, exclude it first>
		$RETF]
	CAMLE S1,DMRNUM			;CAN ONLY ADD IN ORDER
	 JRST [	$TEXT ,<?Illegal to Include DMR11s except in Numeric Order>
		$RETF]			;TELL HIM IF HE TRIES TO DO OTHERWISE
	MOVE	S2,DMXNUM##		;GET NUMBER OF DMx11 DEVICES
	SKIPN	PRVLDG##
	 CAIGE	S2,NUMDMX##		;CAN WE ADD ONE MORE
	  SKIPA
	   JRST [$TEXT ,<?Number of DMx11 (DMC/DMR) Devices Exceeded - Cannot Add this DMR11>
		$RETF]
	MOVEM	S1,CTLNUM##		; Set up controller number.
	MOVEI	S1,IDMRS2		; DMR Duplex prompt
	$CALL	DPARSE
	MOVEI	S1,IDMRS1		; DMR Cost prompt
	$CALL	DPARSE
ADDDMR::AOS	DMXNUM##		;YES - ONE MORE DMx11
	AOS	DMRNUM			;ONE MORE DMR11
	SETZM	DMRSTA##		;NO LONGER DEFAULT
	$CALL	DEVUNT
	SETZM	DMRUSE##(I1)		;THIS DMR11 IN USE
	PJRST	ADDXPT
;
; Here to include a KDP in the configuration.
;  First get the controller number then ask the questions.
;

INKDP:	$NOISE	(INK.1,number)
INK.1:	$NUMBER	(CRLF##,10,<<KDP number, X to X>>,<$PREFILL(KDPSB1),$PDEFAULT(INCDFL),$ACTION(CHKNUM##),$ERROR(NUMERR##)>)

KDPSB1:	MOVEI	T1,^D0			;Set minimum
	MOVEM	T1,NUMMIN##
	MOVEI	T1,NUMKDP##-1		;and maximum.
	MOVEM	T1,NUMMAX##
	$CALL	NUMLIM##
	MOVE	S1,KDPNUM##		;GET HIGHEST KDP NUMBER
	PJRST	SETDFL

IKDPS1::$BUILD	PARSIZ			; First prompt for include KDP
	$SET	PAR.PM,,[ASCIZ /Number of DUP11 lines on this KDP: /]
	$SET	PAR.TB,,IKSUB1
	$SET	PAR.SM,,<[
		$CALL	P$NUM##		; get number
		$CALL	DEVCTL		; get back kdp#
		MOVEM	S1,KDPLNM##(I1)	; OK, Save number of lines on this
		SETZM	KDPSTA##	; No longer default
		$RETT]>
	$EOB

IKSUB1:	$INIT	(IKS1.1)
IKS1.1:	$NUMBER	(CRLF##,10,<<Number of lines on this KDP, X to X>>,<$PREFILL(KDPSB9),$PDEFAULT(INCDFL),$ACTION(CHKNUM),$ERROR(NUMERR##)>)

KDPSB9:	MOVEI	T1,^D1
	MOVEM	T1,NUMMIN##		;Set minimum
	MOVEI	T1,DUPRMC##
	MOVEM	T1,NUMMAX##		;and maximum.
	$CALL	NUMLIM##
	MOVEI	S1,2			;Default is two.
	PJRST	DTEDFL

IKDPXX::$BUILD	PARSIZ			; Prompt for line type
	$SET	PAR.PV,,PVLIST(ENTLIN##,DL1112##)
	$SET	PAR.PM,,[ASCIZ /KDP-0-0 Data link protocol type: /]
	$SET	PAR.TB,,ISUBPR
	$SET	PAR.SM,,STRPRM
	$EOB

IKDPS2::$BUILD	PARSIZ			; Second prompt for include KDP
	$SET	PAR.PV,,PVLIST(ENTLIN##,DLS0##)
	$SET	PAR.PM,,[ASCIZ /KDP-0-0 Maximum Baud Rate: /]
	$SET	PAR.TB,,ISUBBD
	$SET	PAR.SM,,STRPRM
	$EOB

IKDPSD::$BUILD	PARSIZ			; Prompt for duplex
	$SET	PAR.PV,,PVLIST(ENTLIN##,DL1111##)
	$SET	PAR.PM,,[ASCIZ /KDP-0-0 Duplex: /]
	$SET	PAR.TB,,ISUBDP
	$SET	PAR.SM,,STRPRM
	$EOB

IKDPS7::$BUILD	PARSIZ			; seventh prompt for include KDP
	$SET	PAR.PV,,PVLIST(ENTCIR##,DC900##)
	$SET	PAR.PM,,[ASCIZ /KDP-0-0 Cost: /]
	$SET	PAR.TB,,ISUBCS
	$SET	PAR.SM,,STRPRM
	$EOB

IKDPX2::$BUILD	PARSIZ			; Prompt for DTE address
	$SET	PAR.PV,,PVLIST(MODXPR##,XP1100##,QUADTE##)
	$SET	PAR.PM,,[ASCIZ /KDP-0-0 DTE address: /]
	$SET	PAR.TB,,IXSUB2
	$SET	PAR.SM,,<[
		$CALL	GETQUA##	; Pick it up
		$CALL	FNDQUA##	;  and check if defined.
		JUMPT	[$DEFFAIL(DTE is already defined)]
		$CALL	ADDQUA##	; add this DTE.
		$RETT]>
	$EOB

IXSUB2:	$INIT	(DTEAD,$ACTION(IXS2.1))
DTEAD:	$FIELD	(CRLF##,<<Address of this DTE, Decimal number>>,<$FLAGS(CM%BRK),$BREAK(DECBRK##),$ACTION(CHKFLD##)>)
IXS2.1:	LOAD	S1,XC1120##,PRSMIN
	MOVEM	S1,NUMMIN##
	LOAD	S1,XC1120##,PRSMAX
	MOVEM	S1,NUMMAX##
	$RETT

IKDPX4::$BUILD	PARSIZ			; Second prompt for include KDP
	$SET	PAR.PV,,PVLIST(MODXPR##,XP1130##,QUADTE##)
	$SET	PAR.PM,,[ASCIZ /KDP-0-0 Channel range for this DTE: /]
	$SET	PAR.TB,,IXSUB4
	$SET	PAR.SM,,STRPRM
	$EOB

IXSUB4:	$INIT	(IXS4.1,$ACTION(IXS4.4))
IXS4.1:	$DIGIT	(IXS4.2,^D10,<<Channel number, XXXXX to YYYYY>>,<$PREFILL(NUMLIM##),$ACTION(CHKNUM##),$ERROR(NUMERR##)>)
IXS4.2:	$TOKEN	(IXS4.3,<->,<$ALTERNATE(CRLF##)>)
IXS4.3:	$DIGIT	(CRLF##,^D10,<<Channel number, XXXXX to YYYYY>>,<$PREFILL(NUMLIM##),$ACTION(CHKNUM##),$ERROR(NUMERR##)>)
IXS4.4:	LOAD	S1,XP1130##,PRSMIN
	MOVEM	S1,NUMMIN##
	LOAD	S1,XP1130##,PRSMAX
	MOVEM	S1,NUMMAX##
	$RETT

DUPCOU:	BLOCK	1	;# DUPs on the KDP
DRPCNT:	BLOCK	1	;for keeping track of drop # - aobjn ptr

KDPIN:	$CALL	DEVKDP
	$CALL	P$NUM##			;get number
	SKIPLE	KDPLNM##(S1)		;See if already specified
	 JRST [	$TEXT ,<?KDP Controller is already included, exclude it first>
		$RETF]
	CAMLE	S1,KDPNUM		;illegal to include this controller?
	 JRST [	$TEXT ,<?Illegal to Include KDP Controllers except in numeric order>
		$RETF]			; and return to top level
	MOVEM	S1,CTLNUM##		; Set up controller number.
	MOVEI	S1,IKDPS1
	$CALL	NPARSE##
	$CALL	DEVCTL			; get back kdp#
	MOVE	S1,KDPLNM##(I1)		; and number of DUPs.
	MOVEM	S1,DUPCOU		; Set up counter.
	SETZM	UNTNUM##		; set to dup # 0
PKDP1:	$CALL	DEVUNT
	LOAD	S1,DL1111##,PRMINI	; Default duplex to FULL
	MOVEM	S1,DUPDUP##(I1)
	LOAD	S1,DL1112##,PRMINI	; Default line protocol to DDCMP-DMC
	MOVEM	S1,LNTYP##(I1)
	SKIPN	PX25##
	 JRST	PKDP2
	MOVEI	S1,IKDPXX		; Prompt for line type
	$CALL	DPARSE
PKDP2:	MOVEI	S1,IKDPS2		; Prompt for baud rate
	$CALL	DPARSE
	$CALL	DEVUNT
	MOVE	LNTYP##(I1)
	CAIE	^D4
	 JRST	PKDP5
	SKIPN	PRVLDG##
	 JRST	PKDP4
	MOVEI	S1,IKDPSD		; Prompt for duplex
	$CALL	DPARSE
PKDP4:	MOVEI	S1,IKDPS7		; Prompt for cost
	$CALL	DPARSE
	JRST	PKDP7
PKDP5:	MOVEI	S1,IKDPX2		; KDP DTE Address prompt
	$CALL	DPARSE
	MOVEI	S1,IKDPX4		; KDP DTE Channel range prompt
	$CALL	DPARSE
PKDP7:	$CALL	ADDKDP
	AOS	UNTNUM##		;
	SOSE	DUPCOU			; decr count and
	 JRST	PKDP1			; loop if more.
	AOS	KDPNUM			;normal return
	$RETT
ADDKDP::$CALL	DEVUNT
	MOVEI	S1,1			; Set old-style point-to-point
	MOVEM	S1,DUPUSE##(I1)
	MOVE	S1,LNTYP##(I1)
	CAIE	S1,^D5
	 PJRST	ADDXPT
	PJRST	ADDLIN
;
;    Update associated variables with changing circuits/lines
;
ADDXPT::AOS	PLKNUM##		; One more XPT line
	SETZM	PLKSTA##		;  no longer default
	AOS	NTPNCK##		; One more NMX circuit
ADDLIN::AOS	NTPNLN##		; One more NMX line
ADDSLT:	AOS	NTPLIX##		; One more system line
	SETZM	NTDLIX##		;  no longer default
	$RETT

DELXPT::SOS	PLKNUM##		; One less XPT line
	SETZM	PLKSTA##		;  no longer default
	SOS	NTPNCK##		; One less NMX circuit
DELLIN::SOS	NTPNLN##		; One less NMX line
DELSLT:	SOS	NTPLIX##		; One less system line
	SETZM	NTDLIX##		;  no longer default
	$RETT
;
; Routine to set CTLNUM and UNTNUM into subcmd prompt strings
;  before calling NPARSE
;	$CALL with S1=parse block
;

DPARSE::LOAD	T4,1(S1)
	SKIPL	T2,CTLNUM##
	 JRST [	ADDI	T2,"0"		;make ASCII
		MOVE	T3,[POINT 7,(T4),27] ; make T2 a pointer to the digit
		IDPB	T2,T3		;put in the controller number
		JRST	.+1]
	SKIPL	T2,UNTNUM##
	 JRST [	ADDI	T2,"0"		;make ASCII
		AOJ	T4,		;  adjust to next digit to change
		MOVE	T3,[POINT 7,(T4),6] ; point to it
		IDPB	T2,T3		;put in the unit number
		JRST	.+1]
	PJRST	NPARSE##
;
;	INCLUDE CARD READER - ACTION ROUTINE
;
; HERE TO INCLUDE A CARD READER IN THE CONFIGURATION.
;
CDRINC::SKIPN CR1STA##			;CARD READER DEFAULT?
	 JRST I$CR2			;NO.
	SETZM CR1NUM##			;YES, NONE NOW.
	SETOM CR1USE##
I$CR2:	SETZM CR1STA##			;NO LONGER DEFAULT
	MOVSI	T1,-NUMCDR##		;FIND AN UNUSED CARD READER
I$CR1:	SKIPL CR1USE##(T1)
	AOBJN T1,I$CR1			;LOOP FOR ALL READERS
	JUMPGE T1,[$TEXT ,<?Too many card readers>
		$RETT]
	SETZM CR1USE##(T1)		;SAY READER IS IN USE
	AOS CR1NUM##			;ONE MORE CARD READER
	SKIPE	PRVLDG##
	 SKIPGE	NRLSTA##		;NRM PIPES DEFAULTED?
	  $CALL	SETPIP			;Set number of NRM pipes.
	$RETT				;DONE.
;
;	INCLUDE LINE PRINTER - ACTION ROUTINE
;
; HERE TO INCLUDE A LINE PRINTER IN THE CONFIGURATION.  IF AN LP20
;  IS INCLUDED, EXCLUDE THE DEFAULT LP11.
;
INLINE::SKIPN LPTSTA##			;IS PRINTER STATUS DEFAULT?
	JRST I$LP2			;NO.
	SETZM LPTNUM##			;YES, NO PRINTER.
	SETOM LPTUSE##
I$LP2:	SETZM LPTSTA##			;NO LONGER DEFAULT
	MOVSI	T1,-NUMLPT##		;FIND AN UNUSED PRINTER
I$LP1:	SKIPL LPTUSE##(T1)
	AOBJN T1,I$LP1
	JUMPGE T1,[$TEXT ,<?Too many line printers>
		$RETT]
;
; CONTINUED ON NEXT PAGE
;
;
; NOW ADD THE PRINTER TO THE DATA BASE.
;
	MOVEI	S1,1			;LP11s are the only supported printer
	MOVEM S1,LPTUSE##(T1)		;THIS PRINTER IN USE
	MOVEI S2,2			; 1 = UPPER, 2 = LOWER
	MOVEM S2,LPTUPC##(T1)
	AOS LPTNUM##			;ONE MORE PRINTER
	SKIPE	PRVLDG##
	 SKIPGE	NRLSTA			;FLOW-COUNT DEFAULTED?
	  $CALL	SETPIP			;Set number of NRM pipes.
	$RETT				;RETURN.
;
;	*	*	*   EXCLUDE COMMAND	*	*	*
;
;*******EXCLUDE - top level command dispatcher
;

EXCPDB::$NOISE	(EXC.1,from configuration)
EXC.1:	$KEYDSP	(INCTAB,$ACTION(EXC.2))

EXC.2:	SETZM	INCFLG#			;No include data to parse
	$RETT

EXCCMD:	$BUILD	(DEVMAX)
	$SET	(CDR,,<JRST CDREXC>)	;card reader done in action routine
	$SET	(DMC,,<JRST DMCEX>)	;DMC11
	$SET	(DMR,,<JRST DMREX>)	;DMR11
	$SET	(DTE,,<JRST DTEEX>)	;DTE20
	$SET	(KDP,,<JRST KDPEX>)	;KDP
	$SET	(LPT,,<JRST LPTEXC>)	;line printer done in action routine
	$EOB
;
EXCLU::	$CALL	P$KEYW##
	PJRST	@EXCCMD(S1)
;
; HERE TO EXCLUDE THE DTE20 FROM THE CONFIGURATION.
;
DTEEX::	$CALL	DEVDTE
	$CALL	P$NUM##
	CAME	S1,DTENUM##		;CORRECT DTE NUMBER?
	JRST [	$TEXT ,<?Incorrect DTE20 number>
		$RETF]
	MOVEM	S1,UNTNUM##
	SETOM	DTENUM##		;NO MORE DTE20.
	SETZM	DTESTA##		;NO LONGER DEFAULT
	PJRST	DELXPT
;
; COME HERE TO EXCLUDE A DMC11
;

DMCEX::	$CALL	DEVDMC
	$CALL	P$NUM##
	SKIPE	DMCUSE##(S1)
	JRST [	$TEXT ,<?DMC11 not in configuration>
		$RETF]
	MOVE	S2,DMCNUM		;ENSURE IT IS THE LAST DMC
	SOS	S2
	CAME	S2,S1			;ANYTHING BUT THE LAST IS ILLEGAL
	 JRST [	$TEXT ,<?Illegal to Exclude DMC11 Other Than The Last One Included>
		$RETF]			;SO SAY SO
	MOVEM	S1,CTLNUM##
DELDMC::$CALL	DEVUNT
	SETOM	DMCUSE##(I1)		;THIS DMC11 NOT IN USE
	SOS	DMCNUM			;ONE FEWER DMC11
	SETZM	DMCSTA##		;NO LONGER DEFAULT
	SOS	DMXNUM##		;ONE LESS DMx11
	PJRST	DELXPT
;
; COME HERE TO EXCLUDE A DMR11
;

DMREX::	$CALL	DEVDMR
	$CALL	P$NUM##
	SKIPE	DMRUSE##(S1)
	JRST [	$TEXT ,<?DMR11 not in configuration>
		$RETF]
	MOVE	S2,DMRNUM		;ENSURE IT IS THE LAST DMR
	SOS	S2
	CAME	S2,S1			;ANYTHING BUT THE LAST IS ILLEGAL
	 JRST [	$TEXT ,<?Illegal to Exclude DMR11 Other Than The Last One Included>
		$RETF]			;SO SAY SO
	MOVEM	S1,CTLNUM##
	$CALL	DEVUNT
	SETOM	DMRUSE##(I1)		;THIS DMR11 NOT IN USE
	SOS	DMRNUM			;ONE FEWER DMR11
	SETZM	DMRSTA##		;NO LONGER DEFAULT
	SOS	DMXNUM##		;ONE LESS DMx11
	PJRST	DELXPT
;
;*******exclude kdp
;
KDPEX::	$CALL	DEVKDP
	$CALL	P$NUM##			;get KDP number
	SKIPG	KDPLNM##(S1)
	JRST [	$TEXT ,<?KDP not in configuration>
		$RETF]
	MOVE	S2,KDPNUM		;Ensure that it is last KDP
	SOS	S2
	CAME	S2,S1			;Anything but last controller illegal
	 JRST	[$TEXT ,<?Illegal to Exclude KDP Controller other than last one Included>			;Tell user of restriction
		$RETF]			; and return

	MOVEM	S1,CTLNUM##
	$CALL	DEVCTL
	MOVE	T1,KDPLNM##(I1)
KDPEX1:	$CALL	DEVUNT
	MOVE	S1,LNTYP##(I1)
	CAIE	S1,^D5
	 $CALL	DELXPT
	CAIN	S1,^D5
	 $CALL	DELLIN
	SETOM	DUPUSE##(I1)		;THIS DUP11 NOT IN USE
	SETZM	DTEADR##(I2)		;Also this X25-PROTOCOL DTE.
	AOS	UNTNUM##
	SOJG	T1,KDPEX1		;Loop for next unit
	$CALL	DEVCTL
	SETZM	KDPLNM##(I1)		;No lines here
	SOS	KDPNUM			;1 less KDP
	SETZM	KDPSTA##		;No longer default
	$RETT
;
;
;	EXCLUDE LINE PRINTER - ACTION ROUTINE
;
; HERE TO EXCLUDE A LINE PRINTER FROM THE CONFIGURATION.
;
LPTEXC::MOVEI	S2,0			;Line printer 0 is only supported
	SKIPGE LPTUSE##(S2)		;IS THIS PRINTER IN USE?
	JRST [	$TEXT ,<?Line printer not in use>
		$RETT]
	SETOM LPTUSE##(S2)		;NO LONGER IN USE
	SOS LPTNUM##			;ONE FEWER PRINTER
	SETZM LPTSTA##			;NO LONGER DEFAULT
	SKIPE	PRVLDG##
	 SKIPGE	NRLSTA			;NRM PIPED DEFAULTED?
	  $CALL	SETPIP			;Set number of NRM pipes.
	$RETT				;DONE.
;
;	EXCLUDE CARD READER - ACTION ROUTINE
;
; HERE TO EXCLUDE THE CARD READER FROM THE CONFIGURATION.
;
CDREXC::MOVEI S2,0			;CARDREADER 0 IS ONLY ONE SUPPORTED
	SKIPGE CR1USE##(S2)		;IS THIS READER IN USE?
	 JRST [	$TEXT ,<?Card Reader Not In Use>
		$RETT]
	SETOM CR1USE##(S2)		;NO LONGER IN USE
	SETZM CR1STA##			;NO LONGER DEFAULT
	SOS CR1NUM##			;ONE FEWER CARD READER
	SKIPE	PRVLDG##
	 SKIPGE	NRLSTA			;NRM PIPES DEFAULTED?
	  $CALL	SETPIP
	$RETT
SETPIP::MOVE S1,LPTNUM##		;GET NUMBER OF LPTS
	ADD S1,CR1NUM##			;PLUS NUMBER OF CR11S
	ADD S1,S1			;one data and one control pipe each
	SKIPN S1			;Make sure
	 ADDI S1,1			;there is at least one
	MOVEM S1,NRLNUM##		;SAVE AS NUMBER OF NRM PIPES
	$RETT				;DONE.
;
;   Utilities
;
DEVTBL:	$BUILD	DEVMAX
	$SET	DTE,,ASCIZ/DTE/
	$SET	DMC,,ASCIZ/DMC/
	$SET	DMR,,ASCIZ/DMR/
	$SET	KDP,,ASCIZ/KDP/
	$EOB
PAGE
;+
; INPUTS:
;	LP = entity block with:
;	   ENTADR(LP) = address of string to check.
; OUTPUTS:
;	DEVTYP = device type or
;		 -1 if no match
;	DEVTXT = device name string
;	CTLNUM = controller number
;	UNTNUM = unit number
;-
DEVPRS::$SAVEC
	MOVEI	I1,DEVMAX-1
	MOVEM	I1,DEVTYP##
DEVPR1:	MOVE	DEVTBL(I1)
	JUMPE	DEVPR2
	MOVEM	DEVTXT##
	MOVEI	C1,^D3			;  source length
	LOAD	C2,(LP),ENTADR		;  source pointer
	HRLI	C2,(POINT 7,0)		;   (entity name)
	MOVE	C4,C1			;  destination length
	MOVE	C5,[POINT 7,DEVTXT##]	;  destination pointer
	EXTEND	C1,[CMPSN 0		; If equal
		    0,0]		;  then
	 PJRST	@DEVPR3(I1)
DEVPR2:	SOSL	I1,DEVTYP##
	 JRST	DEVPR1
	$RETF
DEVPR3:	$BUILD	DEVMAX
	$SET	DTE,,DEVPR5
	$SET	DMC,,DEVPR4
	$SET	DMR,,DEVPR4
	$SET	KDP,,DEVPR5
	$EOB
DEVPR4:	$CALL	DEVPR8			; <dev>-<ctl>
	$RETIF
	MOVEM	I2,CTLNUM##
	SETOM	UNTNUM##
	$RETT
DEVPR5:	$CALL	DEVPR8			; <dev>-<ctl>-<unt>
	$RETIF
	MOVEM	I2,CTLNUM##
	$CALL	DEVPR8
	$RETIF
	MOVEM	I2,UNTNUM##
	$RETT

DEVPR8:	SETZ	I2,
	ILDB	C1,C2			; Check seperator.
	CAIE	C1,"-"
	 $RETF
	ILDB	C1,C2			; Get number
	CAIL	C1,"0"			; and check.
	 CAILE	C1,"9"
	  $RETF
DEVPR9:	SUBI	C1,"0"			; Make numeric.
	IMULI	I2,^D8
	ADD	I2,C1
	MOVEM	C2,C3
	ILDB	C1,C3			; Get number
	CAIL	C1,"0"			; and check.
	 CAILE	C1,"9"
	  $RETT
	MOVE	C2,C3
	JRST	DEVPR9
PAGE
DEVDTE::MOVEI	DTE			; Set device as DTE
	MOVEM	DEVTYP
	MOVE	DEVTBL+DTE
	MOVEM	DEVTXT##
	SETZM	CTLNUM##
	MOVE	DTENUM##
	MOVEM	UNTNUM##
	$RETT

DEVDMC::MOVEI	DMC			; Set device as DMC
	SKIPA
DEVDMR::MOVEI	DMR			; Set device as DMR
	SKIPA
DEVKDP::MOVEI	KDP			; Set device as KDP
	MOVEM	DEVTYP##
	ADDI	DEVTBL
	MOVE	@0
	MOVEM	DEVTXT##
	SETZM	CTLNUM##
	SETOM	UNTNUM##
	$RETT

DEVCHK::MOVE	I1,DEVTYP##		; Check if device is defined.
	CAIG	I1,DEVMAX
	 SKIPN	I2,DEVTBL(I1)
	  $RETF
	MOVEM	I2,DEVTXT##
	MOVE	I2,CTLNUM##
	XCT	DEVCH1(I1)
	 $RETF
	MOVE	UNTNUM##
	XCT	DEVCH2(I1)
	 $RETF
	$RETT
DEVCH1:	$BUILD	DEVMAX
	$SET	DTE,,<SKIPE I2>
	$SET	DMC,,<CAML I2,DMCNUM##>
	$SET	DMR,,<CAML I2,DMRNUM##>
	$SET	KDP,,<CAML I2,KDPNUM##>
	$EOB
DEVCH2:	$BUILD	DEVMAX
	$SET	DTE,,<CAME DTENUM##>
	$SET	DMC,,<SKIPL>
	$SET	DMR,,<SKIPL>
	$SET	KDP,,<CAML KDPLNM##(I2)>
	$EOB
PAGE
DEVCTL::MOVE	I1,DEVTYP##		; Get device controller offset
	PJRST	@DEVCT1(I1)
DEVCT1:	$BUILD	DEVMAX
	$SET	DTE,,<[
		SETZB	I1,I2		; DTE offset (none).
		$RETT]>
	$SET	DMC,,DEVCT2
	$SET	DMR,,DEVCT2
	$SET	KDP,,DEVCT2
	$EOB

DEVCT2:	MOVE	I1,CTLNUM##		; DMX/KDP offset.
	MOVE	I2,I1
	IMULI	I2,QUADTE##+EINC
	$RETT

DEVUNT::MOVE	I1,DEVTYP##		; Get device unit offset
	PJRST	@DEVUN1(I1)
DEVUN1:	$BUILD	DEVMAX
	$SET	DTE,,DEVCT2
	$SET	DMC,,DEVCT2
	$SET	DMR,,DEVCT2
	$SET	KDP,,DEVUN2
	$EOB

DEVUN2:	$SAVE	<T1>			; DUP unit offset.
	MOVE	I1,UNTNUM##
	SETZ	T1,
DEVUN3:	MOVE	I2,I1
	IMUL	I2,QUADTE##+EINC
	CAMN	T1,CTLNUM##
	 $RETT
	ADD	I1,KDPLNM##(T1)
	AOJA	T1,DEVUN3

	END