Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-10 - 43,50517/setty.mac
There is 1 other file named setty.mac in the archive. Click here to see a list.
	TITLE SETTY COBOL SET TTY MACRO ROUTINES


	T1=1		;HOLDS CHAR
	T2=2		;ARG
	T3=3		;FUNCTION
	T4=4		;FLAGS
	P1=5		;COBOL POINTER
	P2=6		;CHARACTER COUNT
	P3=7		;MY POINTER
	P4=10		;KEYWRD STORAGE
	X=11		;ARG POINTER INDEX
	J=16		;POINTER TO ARG LIST
	P=17		;PDL POINTER


	F.NO==1		;"NO"
	F.KEY==2	;HAVE KEYWORD

	ENTRY	SETTY

SETTY:	MOVEM	0,SAVEAC	;SAVE 1ST AC
	MOVE	0,[T1,,SAVEAC+1]
	BLT	0,SAVEAC+17
	MOVE	X,-1(J)		;GET -NUMBER OF ARGS,,0
	AOBJN	X,.		;TRICKY...
GOGO:	MOVE	T1,(J)		;GET TYPE,,ADDRESS OF POINTER
	MOVE	P1,(T1)		;GET POINTER
	HRRZ	P2,1(T1)	;GET CHAR. COUNT
	SETZB	T3,T4
GO2:	MOVE	P3,[POINT 6,P4]	;POINTER
	SETZB	P4,T2		;CLEAR STORAGE
GO1:	ILDB	T1,P1		;GET CHAR.
	TLNE	P1,100		;ASCII?
	SUBI	T1,40		;YES-MAKE 6BIT
	JUMPE	T1,TESTIT	;JUMP IF END OF BYTE
	TRNN	T4,F.KEY	;LOOKING FOR ARG?
	JRST	GO3		;NO, SKIP
	SUBI	T1,20		;TO BINARY
	IMULI	T2,12		;SHIFT
	ADD	T2,T1		;ADD
	JRST	TESTIT-1

GO3:	TLNE	P3,770000	;FOR OVER-ZEALOUS KEYWORDS
	IDPB	T1,P3		;STUFF BYTE
	SOJG	P2,GO1		;LOOP FOR ALL CHARS.
TESTIT:	SOJ	P2,		;FOR SPACE
	TRNE	T4,F.KEY	;HAVE WE GOT A KEYWORD?
	JRST	DOIT		;NO- WE HAVE EVERYTHING
	CAMN	P4,[SIXBIT/NO/]	;NO?
	JRST	DONO		;YES-NO
	MOVSI	T1,-TABLEN	;TABLE LENGTH
	CAMN	P4,TAB1(T1)	;KEYWORD MATCH?
	JRST	GOTIT		;YES
	AOBJN	T1,.-2		;NO LOOP
	OUTSTR	[ASCIZ/
% ILLEGAL SET TTY KEYWORD
/]
	EXIT

DONO:	TRO	T4,F.NO		;SAY NO
	JRST	GO2		;LOOK FOR KEYWORD

GOTIT:	TRO	T4,F.KEY	;FLAG KEYWORD
	MOVE	T3,TAB2(T1)	;GET FUNCTION CODE & FLAGS
	JRST	GO2

DOIT:	PJOB	P3,		;GET JOB NUMBER
	TRMNO.	P3,		;GET .UXTRM + LINE NUMBER
	  EXIT			;I'M DETACHED

	MOVEI	P2,2		;FUNCTION 2
RETRY:	MOVE	P1,[2,,P2]
	TRMOP.	P1,		;SKIP IF OUTPUT BUFFER NOT EMPTY
	JRST	SETIT		;EMPTY
	MOVEI	P1,200		;HIBERNATE 200 MS.
	HIBER	P1,
	  JFCL			;FAILURE DOESN'T MATTER
	JRST	RETRY		;LOOP

SETIT:	HRRZ	P2,T3		;FUNCTION
	MOVE	P1,[3,,P2]	;ARG POINTER
	TLNN	T3,2		;YES/NO APPLICABLE?
	JRST	SET1		;NO-DO ARG
	MOVEI	P4,1		;ASSUME YES=1
	TLNN	T3,1		;RIGHT?
	SETZ	P4,		;OF COURSE NOT
	TRNE	T4,F.NO		;DOING A "NO"?
	TRC	P4,1		;NO IS COMPLIMENT OF YES
	JRST	SET2		;SET IT

SET1:	MOVE	P4,T2		;MOVE ARG
SET2:	TRMOP.	P1,		;SET TTY CHARACTERISTICS
	  JFCL			;RTCOMP ON 506 MONITOR?
	AOJ	J,		;NEXT ARG.
	SOJG	X,GOGO		;LOOP IF ANY MORE
	MOVE	0,[SAVEAC+1,,T1]
	BLT	0,P
	MOVE	0,SAVEAC
	POPJ	P,
;TABLE MACRO:
;ARGS: KEYWORD,FUNCTION,FLAGS
;FLAGS:	2 IF YES/NO APPLICABLE
;	1 IS "YES" ARG.

	DEFINE FNAMES,<
	X	FILL,2017,0
	X	WIDTH,2012,0
	X	ECHO,2007,2
	X	RTCOMP,2036,3
	X	PAGE,2021,3
	X	TAB,2005,3
	X	FORM,2006,3
	X	GAG,2013,2
	X	BLANK,2025,2
	X	LC,2003,2
	X	SLAVE,2004,3
	X	CRLF,2010,2
>
	DEFINE X (K,F,FL),<
	SIXBIT /K/>

TAB1:	FNAMES
TABLEN==.-TAB1

	DEFINE	X (K,F,FL),
<	XWD	FL,F>

TAB2:	FNAMES

SAVEAC:	BLOCK 20

	END