Google
 

Trailing-Edge - PDP-10 Archives - BB-FP64A-SB_1986 - 10,7/lincln/lincln.mac
There are 4 other files named lincln.mac in the archive. Click here to see a list.
	TITLE	LINCLN
	SUBTTL	Tarl Neustaedter
	SEARCH	DCN
	$INIT	LIN

;LINCLN - One of:
;	Lincoln - Free the slaves
;	Line Clean - Declare lines to be clean



START:	$SETUP
AGAIN:	$PROMPT	T2,%SIXBIT,<Slave TTY to free: >
	MOVE	P2,T2		;SAVE NAME FOR LATER
	SETZB	T1,T3		;OPEN ARGUMENTS
	OPEN	T1		;TRY TO OPEN THE TTY
	 JRST	NOGET		;NOT FREE RIGHT NOW, SEE WHAT HE IS
	$WARN	TAF,<Terminal is already free >,.TSIXN##,P2
	EXIT

NOGET:
	MOVE	P1,P2		;COPY DEVICE NAME
	IONDX.	P1,		;CONVERT TO UDX
	 $WARN	NSD,<No such device >,.TSIXN##,P2,AGAIN
	MOVE	T1,P2		;GET DEVICE NAME AGAIN
	DEVCHR	T1,		;WHAT KIND OF DEVICE IS IT?
	TXNN	T1,DV.MTA	;MAKE SURE IT ISN'T NUL
	TXNN	T1,DV.TTY	;MAKE SURE IT IS A TERMINAL
	 $WARN	NOT,<Not a terminal, >,.TSIXN##,P2,AGAIN
	TXNE	T1,DV.TTA	;IS IT CONTROLLING SOMEONE?
	 $WARN	MAS,<This terminal is a master, not a slave >,.TSIXN##,P2,AGAIN
	TXNN	T1,DV.TTU	;MAKE SURE IT IS IN USE
	 $WARN	TNI,<Terminal not in use, >,.TSIXN##,P2,AGAIN
;We have determined that it is a terminal in use by someone.
	MOVE	T1,P2		;GET THE DEVICE NAME AGAIN
	DEVTYP	T1,		;FIND OUT WHO OWNS IT
	 $ERROR	DVF,<DEVTYP failed, error code >,.TOCTW##,T1
	LDB	T1,[POINTR T1,TY.JOB] ;GET THE JOB NUMBER FIELD
	MOVS	T1,T1		;SWAP HALVES, JOB NUMBER IN LEFT HALF
	HRRI	T1,.GTPRG	;PROGRAM NAME
	GETTAB	T1,		;ASK THE NAME OF WHO OWNS THE LINE
	 JFCL			;DON'T CARE
	CAME	T1,[SIXBIT \STOMPR\];TTY STOMPR?
	 $WARN	NOS,<Not owned by STOMPR, >,.TSIXN##,P2,AGAIN
;We have determined this is a slaved line
	MOVE	T1,[2,,T2]	;ARG FOR TRMOP
	MOVX	T2,.TOTSP	;GET HIS TRANSMIT SPEED
	MOVE	T3,P1		;GET UDX
	TRMOP.	T1,		;ASK
	 $ERROR	CGS,<Can't get original speed to unzerobaud >,.TSIXN##,P2
	MOVE	T4,T1		;COPY SPEED WE JUST READ INTO PLACE TO SET
	MOVX	T2,.TORSP+.TOSET;SET RECEIVE SPEED
	MOVE	T1,[3,,T2]	;ARG FOR TRMOP
	TRMOP.	T1,		;SET THE RECEIVE SPEED
	 $WARN	CSR,<Couldn't set receive speed, proceeding...>
	MOVE	P3,4		;NUMBER OF TIMES TO TYPE ^C^C AT HIM

CCLOOP:	MOVE	T1,[3,,T2]	;ARGUMENT FOR TRMOP
	MOVX	T2,.TOTYP	;FUNCTION, TYPEIN
	MOVEI	T4,[BYTE (7)3,3,0,0,0] ;^C^C
	TRMOP.	T1,		;^C^C
	 $ERROR	CTT,<Couldn't .TOTYP ^C into >,.TSIXN##,P2
	MOVX	T1,1		;SECONDS TO SLEEP
	SLEEP	T1,		;ZZZZ
	SOJG	P3,CCLOOP	;AND DO IT AGAIN

	SETZB	T1,T3		;CLEAR OPEN ARGS
	MOVE	T2,P2		;DEVICE TO LOOK FOR
	OPEN	T1		;TRY TO OPEN HIM
	 $ERROR	CFS,<Couldn't free the slave >,.TSIXN##,P2
	TSTRG.	[ASCIZ \[The slave has been liberated]
\]
	EXIT
	end	START