Google
 

Trailing-Edge - PDP-10 Archives - tops10_integ_tools_v4_10jan-86 - 70,6067/tvaxv2/gtvr01.mar
There are 7 other files named gtvr01.mar in the archive. Click here to see a list.
	.TITLE	GTVR01
;	AUTHOR: P. VAN DER MEIJ
;	DATE:   8-JAN-81
;
;	THIS ROUTINE PERFORMS TERMINAL INPUT 
;	FOR TV
;
;	IN	R0 = FUNCTION
;			0 - NORMAL INPUT
;			1 - FILE NAME
;			2 - END OF FILE NAME
;		R1 = ADDR INPUT BUFFER
;
;	OUT	R0 = LL
;			FUNCTION 1: R0=0 IF ESC, CR OR ^G
;
;	TERMINATORS ARE		FUNCTION 0:
;		- IN POSITION 1 : LF,BS,SPACE,^
;		- AFTER INPUT	: 2* ESCAPE
;		ARE ADDED AT END OF INPUT AND INCLUDED IN LL
;	TERMINATORS ARE		FUNCTION 1:
;		- IN POSITION 1 : ESC,^G,CR
;		- AFTER INPUT   : CR
;	TERMINATORS ARE		FUNCTION 2:
;		- IN POSITION 1 : CR,^G
;
;	LINE ADMINISTRATION
LANTAB=0				;HL1 - NR OF TABS
LASTAT=LANTAB+1				;XL1 - STATUS	
LAXSL=^X80				;START OF LINE
LAXEL=^X40				;END OF LINE
LAXFL=^X20				;FIRST LINE
LANCHR=LASTAT+1				;HL2 - NR OF CHARS
	.MACRO	MOVSP	P1
	MOVL	GTTAB,R1
	MOVL	P1*4(R1),R1
	MOVC3	(R1),2(R1),(R8)
	MOVL	R3,R8
	.ENDM
	.PAGE
	INIT	GTVR01
	MOVL	R1,WIADDR
	MOVB	R0,WIFUN		;FUNCTION
	CASEB	R0,#0,#2
XIN:	.WORD	XIN0-XIN
	.WORD	XIN1-XIN
	.WORD	XIN2-XIN
XIN2:	MOVW	#1,WIRL
	CLRW	WIPL
	BRW	XINX
XIN0:	MOVW	#80,WIRL
	MOVW	#24,WIPL
	MOVW	#^X2A00,WIFL		;*
	BRW	XINX
XIN1:	MOVW	#57,WIRL		;MAX 57 CHAR
	CLRW	WIPL
	MOVW	#^X0909,WIFL		;2 TABS
XINX:					;END INITIALISATION
	BITB	#GX2COM,GSTAT2
	IF.	*ON			;INPUT FROM FILE
		MOVL	WIADDR,R1
		MOVAB	GIN_RAB,R0
		TSTB	WIFUN
		IF.	*EQ			;FUNCTION 0
			CALLS	#0,GTVR09	;GET INPUT
		ELSE.
			CALLS	#0,GTVR09R
		ENDIF.
		TSTL	R0
		IF.	*LTS			;EOF ON INPUT
			BITB	#GX2TER,GSTAT2
			IF.	*ON		;ALSO ON TERMINAL
				BICB2	#GX2COM,GSTAT2
			ELSE.
				BRW	GEXIT	;EXIT
			ENDIF.
		ELSE.			;NOT EOF
			RET
		ENDIF.
	ENDIF.
	MOVL	WIADDR,R6
	MOVL	R6,ISTA			;SAVE START OF INPUT
	CLRW	ILCNT
	CLRL	INTAB
	CLRB	ITERMC
	MOVAB	LTAB,R7
	CLRL	(R7)
	MOVB	#LAXFL+LAXSL+LAXEL,LASTAT(R7)
	BITB	#WXTRUNC,WSTAT
	IF.	*ON			;PREVIOUS > 20 LINES INPUT
		BICB2	#WXTRUNC,WSTAT
		SUBW3	#2,WIRL,IRCNT
		CLRB	IPTERMC
		MOVL	GOBUFFA,R8
		MOVB	#^A'I',(R8)+
		MOVB	#^A'I',(R6)
		MOVSP	1		;CLEAR
		SUBW3	#1,WIRL,IRCNT	;SET MAX LINE SIZE
		BRW	TERMR
	ENDIF.
L0:	SUBW3	#1,WIRL,IRCNT
	BITB	#WXREAD,WSTAT
	IF.	*ON			;PREVIOUS START
		BICB2	#WXREAD,WSTAT
		BITB	#GXTERM,GSTAT
		IF.	*ON		;PREVIOUS COMMAND CANCEL
			$HIBER_S
			BICB2	#GXTERM,GSTAT
			BRW	L0
		ELSE.			;NEW INPUT
			$HIBER_S
			BICB2	#GXTERM,GSTAT
		ENDIF.
		MOVB	WINCH,(R6)	;FIRST CHAR
	ELSE.
		$QIOW_S	CHAN=SIN_FAB+FAB$L_STV,-
			FUNC=#IO$_TTYREADALL+IO$M_NOECHO,IOSB=IIOSB,-
			P1=(R6),P2=#1,,P4=ITERM1
		ON_ERROR GRERR
	ENDIF.
	MOVB	ITERMC,IPTERMC		;SAVE PREVIOUS TERMINATOR
	MOVTC	#1,(R6),#0,GTERTAB,#1,ITERMC
	CASEB	WIFUN,#0,#2
L00:	.WORD	L00.0-L00
	.WORD	L00.1-L00
	.WORD	L00.2-L00
L00.0:					;FUNCTION 0
	CASEB	ITERMC,#1,#2
L01.0:	.WORD	L02.0-L01.0		;SPACE
	.WORD	L02.0-L01.0		;BS
	.WORD	L02.0-L01.0		;LF
	MOVL	GOBUFFA,R8
	CMPB	(R6),#32
	IF.	*GE			;NOT CTR CHAR
		MOVB	(R6),(R8)+	;ECHO INPUT
	ENDIF.
	MOVSP	1			;CLEAR
	BRW	TERMR			;DO TRICK
L02.0:	MOVL	#1,R0
	RET
;
L00.1:					;FUNCTION 1
	CASEB	ITERMC,#8,#2
L01.1:	.WORD	L02.1-L01.1		;ESC = 8
	.WORD	L02.1-L01.1		;CR = 9
	.WORD	L02.1-L01.1		;^G = 10
	MOVL	GOBUFFA,R8
	MOVB	(R6),(R8)+		;ECHO INPUT
	BRW	TERMR
L02.1:	MOVL	#1,R0
	MOVB	ITERMC,@ISTA
	RET
;
L00.2:					;FUNCTION 2
	MOVL	#1,R0
	CMPB	(R6),#13
	IF.	*EQ
		RET
	ENDIF.
	CMPB	(R6),#7
	IF.	*EQ
		RET
	ENDIF.
	MOVB	#7,@GOBUFFA
	MOVW	#1,R1
	BSBW	GWRITR			;BELL
	$QIOW_S	CHAN=SIN_FAB+FAB$L_STV,-
		FUNC=#IO$_TTYREADALL+IO$M_NOECHO,IOSB=IIOSB,-
		P1=(R6),P2=#1,,P4=ITERM1
	ON_ERROR GRERR
	BRW	L00.2	
;
;
;
;

L1:	TSTW	IRCNT
	IF.	*EQ				;ND OF TERMINAL LINE
		BICB2	#LAXEL,LASTAT(R7)
		BSBW	INCRL			;ADVANCE 1 LINE IN ADM
		MOVB	#LAXEL,LASTAT(R7)	;SET END OF LINE
	ENDIF.
	$QIOW_S	CHAN=SIN_FAB+FAB$L_STV,-
		FUNC=#IO$_TTYREADALL+IO$M_TRMNOECHO,IOSB=IIOSB,-
		P1=(R6),P2=IRCNT,,P4=ITERM2
	ON_ERROR GRERR
	MOVB	ITERMC,IPTERMC		;SAVE PREVIOUS TERMINATOR
	MOVZWL	IIOSB+2,R1
	IF.	*NE			;SOME INPUT
		CLRB	IPTERMC		;CLEAR PREVIOUS TERMINATOR
		ADDW2	R1,LANCHR(R7)
		SUBW2	R1,IRCNT
		ADDL2	R1,R6
	ENDIF.
	CMPW	IRCNT,IIOSB+2
	IF.	*EQ			;NO TERMINATOR FOUND
		CLRB	ITERMC
	ELSE.
		MOVTC	#1,IIOSB+4,#0,GTERTAB,#1,ITERMC
		MOVB	IIOSB+4,(R6)	;TERMINATOR TO INPUT
	ENDIF.
	MOVL	GOBUFFA,R8
	BRW	TERMR
;
;
TERMR:
	TSTB	WIFUN
	IF.	*EQ
		BRW	TERMR.0		;FUNCTION 0
	ENDIF.
TERMR.1:
	CASEB	ITERMC,#0,#14
T1.1:	.WORD	TERM0-T1.1
	.WORD	TERM0-T1.1
	.WORD	TERM2-T1.1
	.WORD	TERM3-T1.1
	.WORD	TERM4-T1.1
	.WORD	TERM5-T1.1
	.WORD	TERM6-T1.1
	.WORD	TERM7-T1.1
	.WORD	TERM8-T1.1
	.WORD	TERM9.1-T1.1
	.WORD	TERM10.1-T1.1
	.WORD	TERM11-T1.1
	.WORD	TERM99-T1.1		;END OF LINE
	.WORD	TERM13-T1.1
	.WORD	TERM14-T1.1
	BRW	TERM0
TERM9.1:				;CR
	SUBL3	ISTA,R6,R0
	RET
;
TERM10.1:				;^G
	MOVB	ITERMC,@ISTA
	CLRL	R0
	RET
;
TERMR.0:
	CASEB	ITERMC,#0,#14
T1:	.WORD	TERM0-T1
	.WORD	T1-T1
	.WORD	TERM2-T1
	.WORD	TERM3-T1
	.WORD	TERM4-T1
	.WORD	TERM5-T1
	.WORD	TERM6-T1
	.WORD	TERM7-T1
	.WORD	TERM8-T1
	.WORD	TERM9-T1
	.WORD	TERM10-T1
	.WORD	TERM11-T1
	.WORD	TERM12-T1
	.WORD	TERM13-T1
	.WORD	TERM14-T1
TERM0:					;NOT TERMINATED
	INCW	LANCHR(R7)
	INCL	R6
	DECW	IRCNT
	BRW	TERM99
;
;
;
TERM2:					;BS
TERM13:					;ALL OTHER ^....
	BITB	#GXHP,GSTAT2
	IF.	*ON			;HP
		MOVW	ESCY,(R8)+	;ON
		MOVB	(R6)+,(R8)+	;INPUT CHAR
		MOVC3	#6,ESCZ,(R8)
		MOVL	R3,R8		;OFF
	ELSE.
		MOVB	GNONDIS,(R8)+
		INCL	R6
	ENDIF.
	DECW	IRCNT
	IF.	*EQ			;END OF LINE
		MOVW	CRLF,(R8)+
	ENDIF.
	INCW	LANCHR(R7)
	BRW	TERM99
;
;
;
TERM3:					;LF
;	CMPW	ILCNT,#2
;	IF.	*LT
;		MOVSP	4		;CURSOR UP
;	ELSE.
;		MOVSP	5		;SCROLL UP
;	ENDIF.
	BITB	#GXHP,GSTAT2
	IF.	*ON
		MOVW	ESCY,(R8)+
		MOVB	#10,(R8)+	;LF
		MOVC3	#6,ESCZ,(R8)
		MOVL	R3,R8		;OFF
	ELSE.
		MOVB	GNONDIS,(R8)+
	ENDIF.
	DECW	IRCNT
	INCW	LANCHR(R7)
	MOVB	#10,(R6)+
	BRW	TERM99
;
;
;
TERM4:					;^U
	MOVB	#13,(R8)+		;CR TO TERMINAL
TERM401: SUBB2	LANTAB(R7),INTAB
	MOVZWL	LANCHR(R7),R1
	SUBL2	R1,R6			;ADJUST  INPUT PTR
	BITB	#LAXSL,LASTAT(R7)
	IF.	*OFF			;NOT AT START OF LINE
TERM402:	BSBW	DECLR		;1 LINE BACK
		BRW	TERM401
	ENDIF.
	TSTW	LANCHR(R7)
	IF.	*EQ				;AT EMPTY LINE
		BITB	#LAXFL,LASTAT(R7)
		IF.	*ON			;AT BEGIN
			MOVW	WIFL,(R8)+
			MOVB	#7,(R8)+	;BELL
		ELSE.				;NOT BEGIN
			BRW	TERM402		;BACK MORE
		ENDIF.
	ELSE.
		BITB	#LAXFL,LASTAT(R7)
		IF.	*ON
			MOVW	WIFL,(R8)+
		ENDIF.
	ENDIF.
	MOVSP	1			;CLEAR
	CLRB	LANTAB(R7)
	CLRW	LANCHR(R7)
	BISB2	#LAXEL,LASTAT(R7)	;SET END OF LINE
	MOVW	#80,IRCNT
	BRW	TERM99
;
;
;
TERM5:					;^R
	CMPL	R6,ISTA
	IF.	*EQ			;AT START
		MOVB	#7,(R8)+	;BELL
		BRW	TERM99
	ENDIF.
	MOVB	#13,(R8)+		;CR
TERM501: MOVZWL	LANCHR(R7),R1
	SUBL2	R1,R6
	BITB	#LAXSL,LASTAT(R7)
	IF.	*OFF			;NOT AT START OF LINE
		BSBW	DECLR
		BRW	TERM501
	ENDIF.
TERM502: BSBW	MOVLR
	BITB	#LAXEL,LASTAT(R7)
	IF.	*OFF			;NOT AT END OF LINE
		ADDL2	#4,R7
		INCW	ILCNT
		DECL	R6
		CMPB	(R6)+,#9	;HT
		IF.	*NE
			MOVW	CRLF,(R8)+
		ENDIF.
		BRW	TERM502
	ENDIF.
	BRW	TERM99
;
;
;
TERM6:					;^C
	BRW	GEXIT			;STOP
;
;
;
TERM7:					;DEL
	CMPL	R6,ISTA
	IF.	*EQ			;NO INPUT PRESENT
		MOVB	#7,(R8)+	;BELL
		BSBW	TOUTR
		BRW	L0
	ENDIF.
	DECL	R6
	TSTW	LANCHR(R7)
	IF.	*EQ			;AT START OF LINE
		BSBW	DECLR		;1 LINE BACK
		BISB2	#LAXEL,LASTAT(R7)
		DECW	LANCHR(R7)
		MOVZWL	LANCHR(R7),R1
		SUBL2	R1,R6
		BSBW	MOVLR		;MOVE LINE TO OUTPUT
		MOVSP	2		;TO END OF LINE
		CMPB	#9,(R6)		;HT DELETED
		IF.	*EQ		;YES
			DECB	LANTAB(R7)
			DECL	INTAB
			MOVL	INTAB,R2
			MOVB	ITTAB[R2],IRCNT
		ELSE.
			CMPB	#13,(R6)	;CR DELETED
			IF.	*EQ
				BSBW	SETRR	;SET READ COUNT
			ELSE.
				MOVW	#1,IRCNT
			ENDIF.
		ENDIF.
	ELSE.
		DECW	LANCHR(R7)
		CMPB	(R6),#9
		IF.	*EQ			;HT
			DECL	INTAB
			MOVL	INTAB,R2
			CLRL	R0
			MOVB	ITTAB[R2],R0
			ADDW2	R0,IRCNT
TERM702:		MOVB	#8,(R8)+	;BS
			SOBGTR	R0,TERM702
		ELSE.
			INCW	IRCNT
			MOVB	#8,(R8)+
		ENDIF.
		MOVSP	2		;ERASE TO END OF LINE
	ENDIF.
	BRW	TERM99
;
;
;
TERM8:					;ESC
	DECW	IRCNT
	INCW	LANCHR(R7)
	INCL	R6			;ESC TO INPUT
;	CMPL	R8,GOBUFFA
;	IF.	*NE			;NOT FIRST OUTPUT
;		MOVL	GOBUFFA,R8
;		CMPB	(R8),#27
;		IF.	*EQ		;FIRST NO ECHO ESCAPE
;			MOVB	#^A'$',(R8)+
;		ELSE.
;			MOVW	#^A\P$\,(R8)+	;NEUTRALISE ESC ECHO
;		ENDIF.
;		MOVSP	1		;CLEAR
;	ELSE.
;		MOVW	#^A\P$\,(R8)+	;$ TO TERMINAL
;	ENDIF.
	MOVB	#^A'$',(R8)+
	CMPB	-1(R6),-2(R6)
	IF.	*EQ			;SECOND ESC IN ROW
		BSBW	TOUTR
		$QIO_S	CHAN=SIN_FAB+FAB$L_STV,-
			FUNC=#IO$_TTYREADALL+IO$M_NOECHO,IOSB=IIOSB,-
			ASTADR=GTVR01A,-
			P1=WINCH,P2=#1,,P4=ITERM1
		ON_ERROR GRERR
		BISB2	#WXREAD,WSTAT
		SUBL3	ISTA,R6,R0	;SET LENGTH
		SUBL2	#2,R0		;DELETE ESC,ESC
		RET
	ENDIF.
	BRW	TERM99
;
;
;
TERM9:					;CR
	MOVW	CRLF,(R8)+		;CR LF TO TERMINAL
	INCL	R6			;CR TO INPUT
	INCW	LANCHR(R7)
	BSBW	INCRL
	MOVB	#LAXSL+LAXEL,LASTAT(R7)
	BRW	TERM99
;
;
;
TERM10:					;^G
	CMPB	ITERMC,IPTERMC
	IF.	*EQ			;2* IN ROW
		BRW	TERM4		;AS ^U
	ELSE.
		MOVB	#7,(R8)+	;BELL
		BRW	TERM99
	ENDIF.
;
;
;
TERM11:					;HT
	MOVB	#9,(R8)+
	INCL	R6			;HT IN INPUT
	INCW	LANCHR(R7)
	MOVZWL	IRCNT,R1		;REMAINING IN LINE
	ASHL	#-3,R1,R2
	ASHL	#3,R2,R2
	SUBL2	R2,R1			;MODULO 8
	IF.	*EQ
		MOVB	#8,R1
	ENDIF.
	MOVL	INTAB,R2
	MOVB	R1,ITTAB[R2]		;SAVE NR CHAR SKIPPED BY TAB
	INCL	INTAB
	INCB	LANTAB(R7)
	SUBW2	R1,IRCNT		;SET REMAINING IN LINE
	BRW	TERM99
;
;
;
TERM12:					;END OF LINE
	MOVW	CRLF,(R8)+
	BRW	TERM99
;
;
TERM14:					;^W
	CMPL	R6,ISTA
	IF.	*EQ			;NO INPUT
		MOVB	#7,(R8)+
		BRW	TERM99
	ENDIF.
	MOVB	#13,(R8)+
TERM1401: CMPL	R6,ISTA
	IF.	*EQ			;NO INPUT
		MOVSP	1		;CLEAR
		MOVW	WIFL,(R8)+
		BRW	TERM99
	ENDIF.
	TSTW	LANCHR(R7)
	IF.	*EQ			;EMPTY LINE
		BSBW	DECLR
	ENDIF.
	DECL	R6
	DECW	LANCHR(R7)
	CMPB	(R6),#9
	IF.	*EQ			;HT DETECTED
		DECB	LANTAB(R7)
		DECL	INTAB
		BRW	TERM1401
	ENDIF.
	MATCHC	#1,(R6),#WT14L,WT14
	IF.	*EQ			;STILL A TERMINATOR
		BRW	TERM1401
	ENDIF.
TERM1402: CMPL	R6,ISTA
	IF.	*NE			;STILL INPUT PRESENT
		DECL	R6
		MATCHC	#1,(R6),#WT14L,WT14
		IF.	*NE			;NO TERMINATOR
			DECW	LANCHR(R7)
			IF.	*EQ		;EMPTY LINE
				CMPL	R6,ISTA
				IF.	*NE	;NOT FIRST LINE
					MATCHC	#1,-1(R6),#WT14L,WT14
					IF.	*EQ	;TERMINATOR
						MOVSP	1	;CLEAR
						BRW	TERM99
					ENDIF.
					BSBW	DECLR
					BRW	TERM1402
				ELSE.
					BRW	TERM1401
				ENDIF.
			ENDIF.
			BRW	TERM1402
		ENDIF.
		INCL	R6
	ENDIF.
	MOVZWL	LANCHR(R7),R1
	SUBL2	R1,R6
	BSBW	MOVLR			;REDISPLAY CURRENT LINE
	BSBW	SETRR			;SET READ LENGTH
	MOVSP	1			;CLEAR
	BRW	TERM99
WT14:	.BYTE	13,9,^A/ /		;CR,HT,SPACE
WT14L=.-WT14
;
;
TERM99:					;END OF INTERPRETATION
	BSBW	TOUTR
	CMPL	R6,ISTA
	IF.	*EQ			;AT START OF LINE
		BRW	L0
	ELSE.
		BRW	L1
	ENDIF.
;
;
TOUTR:
	SUBL3	GOBUFFA,R8,R1
	IF.	*NE			;SOME OUTPUT TO DO
		BSBW	GWRITR
	ENDIF.
	RSB
;
;
DECLR:					;SET SCREEN POSITION 1 LINE BACK
	SUBL2	#4,R7
	DECW	ILCNT
	CMPW	ILCNT,#2
	IF.	*LT
		MOVSP	4
	ELSE.
		MOVSP	5		;SCROLL UP
	ENDIF.
	RSB
;
;
SETRR:					;SET NR OF CHAR REMAINING IN LINE
	BITB	#LAXFL,LASTAT(R7)
	IF.	*ON			;AT FIRST LINE
		SUBW3	#1,WIRL,IRCNT
	ELSE.
		MOVW	WIRL,IRCNT
	ENDIF.
	SUBW2	LANCHR(R7),IRCNT
	CLRL	R0
	MOVB	LANTAB(R7),R0
	CLRL	R1
	TSTL	R0
	IF.	*NE			;HT PRESENT IN LINE
SETR1:	SUBL3	R0,INTAB,R2
		MOVB	ITTAB[R2],R1
		DECL	R1
		SUBW2	R1,IRCNT
		SOBGTR	R0,SETR1
	ENDIF.
	RSB
;
;
;
;
;	IN	R6 = INPUT ADDR
;	OUT	R6 UPDATED
MOVLR:
	MOVW	LANCHR(R7),MOVLL
	BITB	#LAXFL,LASTAT(R7)
	IF.	*ON
		MOVW	WIFL,(R8)+
	ENDIF.
	BICB2	#MOVSON,MOVSW
MOVL1:	SCANC	MOVLL,(R6),MOVSCT,#1
	SUBW3	R0,MOVLL,R0
	IF.	*NE			;SOME TEXT
		SUBW2	R0,MOVLL	;REMAINING LENGTH
		MOVC3	R0,(R6),(R8)
		MOVL	R1,R6
		MOVL	R3,R8
		BICB2	#MOVSON,MOVSW
	ENDIF.
	TSTW	MOVLL
	IF.	*EQ			;END OF LINE
		RSB
	ENDIF.
	CMPB	#27,(R6)
	IF.	*EQ			;ESCAPE
		MOVB	#^A\$\,(R8)+
		INCL	R6
		BICB2	#MOVSON,MOVSW
	ELSE.
		BITB	#GXHP,GSTAT2
		IF.	*ON			;HP
			BITB	#MOVSON,MOVSW
			IF.	*ON		;PREVIOUS DISPLAY ON
				SUBL2	#6,R8
			ELSE.
				BISB2	#MOVSON,MOVSW
				MOVW	ESCY,(R8)+
			ENDIF.
			MOVB	(R6)+,(R8)+
			MOVC3	#6,ESCZ,(R8)
			MOVL	R3,R8		;OFF
		ELSE.
			MOVB	GNONDIS,(R8)+
			INCL	R6
		ENDIF.
	ENDIF.
	DECW	MOVLL
	IF.	*NE			;NOT END OF LINE
		BRW	MOVL1
	ENDIF.
	RSB
MOVLL:	.BLKW
MOVSCT:	
	.REPEAT	32
	.BYTE	1
	.ENDR
.=MOVSCT+9
	.BYTE	0			;HT NO DISPLAY ON
.=MOVSCT+256
MOVSW:	.BYTE	1
MOVSON=^X80				;DISPLAY FUNCTIONS BEEN ON
;
;
INCRL:					;ADVANCE ONE TERMINAL LINE
	INCW	ILCNT
	CMPW	ILCNT,WIPL
	IF.	*GT			;MORE THEN MAX LINES
		SUBL3	ISTA,R6,R0
		TSTB	WIFUN
		IF.	*EQ		;FUNCION 0
			BISB2	#WXTRUNC,WSTAT
		ENDIF.
		RET
	ENDIF.
	BITB	#GXHP,GSTAT2
	IF.	*OFF
		CMPW	ILCNT,#3
		IF.	*EQ
			BISB2	#GXCTLL,GSTAT
		ENDIF.
	ENDIF.
	ADDL2	#4,R7
	CLRL	(R7)
	MOVW	WIRL,IRCNT
	RSB
;
LTAB:	.BLKL	25
ILCNT:	.BLKW				;TERMINAL LINE COUNT
ISTA:	.BLKL
IRCNT:	.BLKW
INTAB:	.LONG	0
ITTAB:	.BLKB	256
	.ALIGN	LONG
ITERM1:	.LONG	.+4
	.LONG	0,0
ITERMC:	.BLKB
IPTERMC: .BLKB
ITERM2:	.LONG	.+4
	.WORD	16,0
	.LONG	ITMASK
ITMASK:
.MACRO	TER,P1
WA1=P1/32
WA2=WA1*32
WA2=P1-WA2
WA2=1@WA2
.IIF	EQ	WA1	,WM0=WM0!WA2
.IIF	EQ	WA1-1	,WM1=WM1!WA2
.IIF	EQ	WA1-2	,WM2=WM2!WA2
.IIF	EQ	WA1-3	,WM3=WM3!WA2
.ENDM
WM0=0
WM1=0
WM2=0
WM3=0
	TER	127			;DEL
	.LONG	-1,WM1,WM2,WM3
;
;	TERMINATORS FOR FILE NAME READ
;		GTVR03
WM0=0
	TER	13			;CR
	TER	7			;^G
	TER	27			;ESC
GTERMF:: .LONG	.+4,0,WM0
IIOSB:	.BLKL	2
GTERTAB::	
	.REPEAT	32
	.BYTE	13
	.ENDR
.=GTERTAB+32	
	.BYTE	1			;SPACE
.=GTERTAB+^A/^/
	.BYTE	1			;^
.=GTERTAB+8	
	.BYTE	2			;BS
.=GTERTAB+10	
	.BYTE	3			;LF
.=GTERTAB+21	
	.BYTE	4			;^U
.=GTERTAB+18	
	.BYTE	5			;^R
.=GTERTAB+3	
	.BYTE	6			;^C
.=GTERTAB+127	
	.BYTE	7			;DEL
.=GTERTAB+27	
	.BYTE	8			;ESC
.=GTERTAB+13	
	.BYTE	9			;CR
.=GTERTAB+7	
	.BYTE	10			;^G
.=GTERTAB+9	
	.BYTE	11			;HT
.=GTERTAB	
	.BYTE	12			;END OF READ LINE
.=GTERTAB+23
	.BYTE	14			;^W
.=GTERTAB+256
ESCY:	.BYTE	27,^A\Y\		;DISPLAY FUNC ON
ESCZ:	.BYTE	27,^A\Z\,8,8,27,^A\K\	;DISPLAY OFF
CRLF:	.BYTE	10,13			;CR / LF
WINCH:	.BLKB	1			;FIRST CHAR READ
WSTAT:	.BLKB
WXTRUNC=^X80				;PREVIOUS INPUT > 24 LINES
WXREAD=^X40				;READ DONE
WIADDR:	.BLKL
WIRL:	.BLKW
WIPL:	.BLKW
WIFUN:	.BLKB
WIFL:	.BLKW				;2 BYTES FO FIRST PROMPT
	.PAGE
;	AST INPUT COMPLETION ROUTINE
	.ENTRY	GTVR01A,^M<R2,R3>
	CMPB	WINCH,#7		;^G
	IF.	*EQ
		BISB2	#GXTERM,GSTAT	;TERMINATE
	ENDIF.
	$WAKE_S
	RET
	.END