Google
 

Trailing-Edge - PDP-10 Archives - tops10_integ_tools_v4_10jan-86 - 70,6067/tvaxv1/gtvr09.mar
There are 7 other files named gtvr09.mar in the archive. Click here to see a list.
	.TITLE	GTVR09 - FILE INPUT ROUTINE
;	READ INPUT COMMAND OR FILE NAME FROM INPUT FILE
;
;	IN	R0 = ADDR RAB
;		R1 = ADDR INPUT AREA
;
;	OUT	R0 = LENGTH INPUT, -1 = EOF
;
;	ENTRIES:	GTVR09 = STOP ON ESC,ESC
;			GTVR09R = STOP ON CR OR END OF RECORD
;
	INIT	GTVR09
	BSBW	INITR
	MOVL	R0,R7
	MOVL	R1,R6
	MOVL	R6,WINPA
	TSTW	WLL(R8)
	IF.	*EQ		;NO PREVIOUS INPUT
		MOVL	#-1,WOLL
		BSBW	GETR
	ENDIF.
	CLRL	WOLL
	BITB	#WXTRUNC,WSTAT(R8)
	IF.	*ON		;PREVIOUS TOO LONG
		BICB2	#WXTRUNC,WSTAT(R8)
		INCL	WOLL
		MOVB	#^A'I',(R6)+
	ENDIF.
ME1:	MATCHC	#2,WESC,WLL(R8),@WADDR(R8)
	IF.	*EQ		;ESC,ESC FOUND
		SUBL2	WADDR(R8),R3		;INPUT LENGTH
		ADDL3	WOLL,R3,R0
		CMPW	#2048,R0
		IF.	*LT		;TOO LONG
			MOVW	WOLL,R0
			MOVL	WINPA,R1
			BSBW	GWRITR2		;LOG IN BATCH
			MOVW	WESC,(R6)
			MOVL	WOLL,R0
			BISB2	#WXTRUNC,WSTAT(R8)
			RET
		ENDIF.
		SUBL2	R3,WLL(R8)
		ADDL2	R3,WOLL
		SUBL2	#2,WOLL		;DO NOT COUNT ESC,ESC
		MOVC3	R3,@WADDR(R8),(R6)
		MOVL	R1,WADDR(R8)	;ADVANCE PTR
		MOVW	WOLL,R0
		MOVL	WINPA,R1
		BSBW	GWRITR2		;LOG IN BATCH
		MOVL	WOLL,R0		;LENGTH
		RET
	ELSE.			;NO MATCH
		ADDL3	WOLL,WLL(R8),R0
		CMPW	#2046,R0
		IF.	*LT		;TOO LONG
			MOVW	WOLL,R0
			MOVL	WINPA,R1
			BSBW	GWRITR2		;LOG IN BATCH
			MOVW	WESC,(R6)
			MOVL	WOLL,R0
			BISB2	#WXTRUNC,WSTAT(R8)
			RET
		ENDIF.
		ADDL2	WLL(R8),WOLL
		INCL	WOLL
		MOVC3	WLL(R8),@WADDR(R8),(R6)
		MOVL	R3,R6
		MOVB	#CR,(R6)+		;EXTRA CR FOR END OF REC
		BSBW	GETR		;READ WITH COMMAND EXIT ON EOF
		BRW	ME1
	ENDIF.
;
;
	.ENTRY	GTVR09R,^M<R2,R3,R4,R5,R6,R7,R8,R9>
	BSBW	INITR
	MOVL	R0,R7
	MOVL	R1,R6
	MOVL	R6,WINPA
	TSTW	WLL(R8)
	IF.	*EQ		;NO PREVIOUS INPUT
		MOVL	#-1,WOLL
		BSBW	GETR
	ENDIF.
	CLRL	WOLL
	LOCC	#CR,WLL(R8),@WADDR(R8)
	IF.	*EQ			;NOT FOUND CR
		MOVC5	WLL(R8),@WADDR(R8),#0,#60,(R6)
		MOVL	WLL(R8),R1
		CLRL	WLL(R8)
	ELSE.			;CR FOUND
		SUBL2	WADDR(R8),R1		;LENGTH
		PUSHL	R1
		MOVC5	R1,@WADDR(R8),#0,#60,(R6)
		POPL	R1
		CLRL	WLL(R8)
	ENDIF.
	CMPW	R1,#60
	IF.	*LT
		MOVL	R1,WOLL
	ELSE.
		MOVL	#60,WOLL
	ENDIF.
	MOVW	WOLL,R0
	MOVL	WINPA,R1
	BSBW	GWRITR2		;LOG IN BATCH
	MOVL	WOLL,R0
	CLRW	GERRN		;CLEAR ERROR
	RET
;
GETR:
	CLRL	WLL(R8)
	MOVL	@WIADDR(R8),RAB$L_UBF(R7)
	MOVW	#2048,RAB$W_USZ(R7)
	$GET	RAB=(R7)
	IF.	*ERROR		;EOF OR ERROR
		MOVW	WESC,(R6)
		BITB	#GXEXEC,GSTAT
		IF.	*ON		;	;E COMMAND OUTPUT
			MOVL	WOLL,R0
			RET
		ENDIF.
		BICB2	#GX2COM,GSTAT2
		BISB2	#GXCTLL,GSTAT	;FORCE ^L
		CALLS	#0,GTVR02	;MAKE SCREEN
		MOVL	WOLL,R0
		RET
	ENDIF.
	MOVW	RAB$W_RSZ(R7),WLL(R8)
	MOVL	@WIADDR(R8),WADDR(R8)
	RSB
;
;	FIND BASE FOR WORK FIELDS
;
INITR:
	MOVAB	WIPAR1,R8
	TSTL	WRAB(R8)
	IF.	*EQ		;NOT USED
		MOVL	R0,WRAB(R8)
		RSB
	ENDIF.
	CMPL	R0,WRAB(R8)
	IF.	*EQ		;SAME
		RSB
	ENDIF.
	MOVAB	WIPAR2,R8
	MOVL	R0,WRAB(R8)
	RSB
WLL=0
WADDR=4
WRAB=8
WIADDR=12
WSTAT=16
WXTRUNC=^X80				;INPUT TOO LONG
WIPAR1:	.BLKL	3
	.LONG	GIBUF3A
	.BLKB
WIPAR2:	.BLKL	3
	.LONG	GIBUF4A
	.BLKB
WOLL:	.BLKL
WESC:	.BYTE	27,27
WINPA:	.BLKL
CR=13
	.END