Google
 

Trailing-Edge - PDP-10 Archives - integ_tools_tops20_v7_30-apr-86_dumper - tools/tvaxv1/gtvr03.mar
There are 7 other files named gtvr03.mar in the archive. Click here to see a list.
	.TITLE	GTVR03 - READ FILE ROUTINE
;	ENTRY GTVR03I
;		SCAN IN COMMAND LINE FOR INPUT FILE NAME
;		AND READ FILE
;
;
	.MACRO	MOVSP	P1
	MOVL	GTTAB,R1
	MOVL	P1*4(R1),R1
	MOVC3	(R1),2(R1),(R8)
	MOVL	R3,R8
	.ENDM
	INIT	GTVR03I
	PUSHAL	WPLL
	CALLS	#1,LIB$GET_FOREIGN	;GET COMMAND LINE
	CMPB	WIFNM,#SPACE
	IF.	*NE			;INPUT PRESENT
		LOCC	#SPACE,WPLL,WIFNM
		SUBW3	R0,WPLL,WILL
		MOVW	WILL,WOLL
		MOVC3	WILL,WIFNM,WOFNM
		MOVW	#2,R0
		MOVAB	WYNK,R1
		BSBW	GTVR08WE
		MOVW	WILL,R0
		MOVAB	WIFNM,R1
		BSBW	GTVR08W		;WRITE ;Y + FILENAME
		BSBW	D89I		;INITIAL YANK
	ENDIF.
	RET
WPLL:	.LONG	60			;LL COMMAND INPUT
WPADD:	.LONG	WIFNM			;ADDR COMMAND INPUT
;
;	GTVR03C		DO ; COMMANDS
;	IN	R6,GSILL(R11)	COMMAND CHAR
;
GTVR03C:: PUSHR	#^M<R7,R8,R9>
	DECW	GSILL(R11)
	BITB	#GXVAL,GSTAT
	IF.	*ON			;VALUE PRESENT
		BICB2	#GXVAL,GSTAT
		CASEB	(R6)+,#32,#90
DC1:		.WORD	D32-DC1		;SPACE
		.REPEAT	32
		.WORD	DERRV-DC1
		.ENDR
		.WORD	D64X-DC1	;A
		.REPEAT	17
		.WORD	DERRV-DC1
		.ENDR
		.WORD	D83X-DC1	;S
		.WORD	DERRV-DC1
		.WORD	DERRV-DC1
		.WORD	D86X-DC1	;V
		.REPEAT	3
		.WORD	DERRV-DC1
		.ENDR
		.WORD	D90X-DC1	;Z
		.REPEAT	6
		.WORD	DERRV-DC1
		.ENDR
		.WORD	D64X-DC1	;a
		.REPEAT	17
		.WORD	DERRV-DC1
		.ENDR
		.WORD	D83X-DC1	;s
		.WORD	DERRV-DC1
		.WORD	DERRV-DC1
		.WORD	D86X-DC1	;v
		.REPEAT	3
		.WORD	DERRV-DC1
		.ENDR
		.WORD	D90X-DC1	;z
DERRV:		MOVW	#25,GERRN
		RET
	ENDIF.
	CASEB	(R6)+,#32,#90
DC:	.WORD	D32-DC			;SPACE
	.REPEAT	32
	.WORD	DERR-DC
	.ENDR
	.WORD	D64-DC			;A
	.WORD	DERR-DC
	.WORD	DERR7-DC		;C
	.WORD	DERR7-DC		;D
	.WORD	D69-DC			;E
	.WORD	DERR-DC			;70
	.WORD	D71-DC			;G
	.WORD	D72-DC			;H
	.REPEAT	4
	.WORD	DERR-DC			;71-76
	.ENDR
	.WORD	DERR7-DC		;M
	.WORD	DERR7-DC		;N
	.WORD	DERR-DC			;O
	.WORD	D80-DC			;P
	.WORD	DERR-DC			;Q
	.WORD	DERR7-DC		;R
	.WORD	D83-DC			;S
	.WORD	DERR-DC			;84
	.WORD	D85-DC			;U
	.WORD	D86-DC			;V
	.WORD	DERR7-DC		;W
	.WORD	D88-DC			;X
	.WORD	D89-DC			;Y
	.WORD	D90-DC			;Z
	.REPEAT	6
	.WORD	DERR-DC
	.ENDR
	.WORD	D64-DC			;a
	.WORD	DERR-DC			;b
	.WORD	DERR7-DC		;c
	.WORD	DERR7-DC		;d
	.WORD	D69-DC			;e
	.WORD	DERR-DC			;70
	.WORD	D71-DC			;g
	.WORD	D72-DC			;h
	.REPEAT	4
	.WORD	DERR-DC			;71-76
	.ENDR
	.WORD	DERR7-DC		;m
	.WORD	DERR7-DC		;n
	.WORD	DERR-DC			;o
	.WORD	DERR7-DC		;p
	.WORD	DERR-DC			;q
	.WORD	DERR7-DC		;r
	.WORD	D83-DC			;s
	.WORD	DERR-DC			;84
	.WORD	D85-DC			;u
	.WORD	D86-DC			;v
	.WORD	DERR7-DC		;w
	.WORD	D88-DC			;x
	.WORD	D89-DC			;y
	.WORD	D90-DC			;z
DERR:	MOVW	#8,GERRN
	RET
DERR7:	MOVW	#7,GERRN		;NOT YET SUPPORTED
	RET
;
D32:					;SPACE
	TSTL	GEXP1
	IF.	*GES			;SEARCH NOT FOUND
		MOVL	R6,R1
		CLRW	WLEVC
D3201:		SCANC	GSILL(R11),(R1),GSCT,#8
		MOVW	R0,GSILL(R11)
		IF.	*NE		;SOME FOUND
			MATCHC	#1,(R1),#WSKPTL,WSKPT
			DECL	R1
			CASEB	(R3),#0,#5
D3202:			.WORD	D32A-D3202	; ;
			.WORD	D32B-D3202	;I
			.WORD	D32C-D3202	;R
			.WORD	D32B-D3202	;S
			.WORD	D32D-D3202	;<
			.WORD	D32E-D3202	;>
D32A:			INCL	R1		; ;
			DECW	GSILL(R11)	;SKIP ONE MORE
			BRW	D3203
D32B:			BSBW	SKPE1
			BSBW	SKPE		;I,S
			BRW	D3203
D32C:			BSBW	SKPE1
			BSBW	SKPE
			BSBW	SKPE		;R
			BRW	D3203
D32D:			INCW	WLEVC		;<
			BRW	D3203
D32E:			DECW	WLEVC		;>
			IF.	*LTS		;END OF LOOP
				MOVL	GWINC(R8),GWICC(R8)	;SET END OF LOOP
				MOVL	R1,R6
				BRW	DX	;EXIT
			ENDIF.
D3203:			INCL	R1
			DECW	GSILL(R11)
			IF.	*GTS		;NOT END OF INPUT
				BRW	D3201
			ENDIF.
		ENDIF.
		MOVL	R1,R6
		BRW	DX		;EXIT
	ENDIF.
	BRW	DX
WLEVC:	.BLKW				;NR OF <>
WSKPT:	.BYTE	^A';',0,^A'I',1,^A'R',2,^A'S',3,^A'<',4,^A'>',5
	.BYTE	^A'i',1,^A'r',2,^A's',3
WSKPTL=.-WSKPT
;
D64:					;A	SPACE TO TABS
	MOVL	#MAX,R0
	CLRL	R1
	MOVB	#2,WLINEF		;TRANSLATE SPACE TO TAB
	BSBW	LINER
	BRW	DX
D64X:					;A + VALUE
	MOVL	GFPTR,R1
	MOVL	GEXP1,R0		;NR OF LINES
	MOVB	#2,WLINEF		;TRANSLATE SPACE TO TAB
	BSBW	LINER
	BRW	DX
;
D69:					;E
	BITB	#GXEXEC,GSTAT
	IF.	*ON			;ALREADY E COMM ACTIVE
		MOVW	#31,GERRN
		RET
	ENDIF.
	MOVW	#40,GERRN
	MOVW	GERRN,WERRNF		;SAVE IT
	CALLS	#0,GTVR02
D6901:	BSBW	FILN			;GET FILE NAME
	MOVB	WOLL,DEXF+FAB$B_FNS
	$OPEN	FAB=DEXF
	$CONNECT RAB=DEXR
	ON_ERROR D6909
	CLRW	GI2LL			;NO PREVIOUS INPUT
	BISB2	#GXEXEC,GSTAT
D6902:	MOVL	GEBUFFA,R1
	MOVAB	DEXR,R0			;ADDR RAB
	CALLS	#0,GTVR09		;READ COMMAND
	TSTL	R0
	IF.	*LTS			;EOF
		$CLOSE	FAB=DEXF
		CLRW	GI2LL		;NO PREVIOUS INPUT
		BICB2	#GXEXEC,GSTAT
		MOVW	WERRN,GERRN
		CLRW	WERRN		;RESET ERROR
		BRW	DX
	ENDIF.
	MOVW	R0,WINLL		;SAVE IT
	MOVL	GEBUFFA,R1
	CALLS	#0,GTVR04		;EXECUTE IT
	TSTW	GERRN
	IF.	*NE
		MOVW	GERRN,WERRN
		CLRW	GERRN
	ENDIF.
	CALLS	#0,GTVR02
	MOVW	WINLL,GI2LL
	MOVL	GEBUFFA,R1		;SWAP BUFFERS
	MOVL	GIBUF2A,GEBUFFA
	MOVL	R1,GIBUF2A
	BRW	D6902
D6909:	MOVL	#2,R0
	BSBW	ERRW
	BRW	D6901			;FILE OPEN ERROR
WERRN:	.BLKW
;
WINLL:	.BLKW
;
;
D71:					;G
	MOVL	GIBUF2A,R1
	MOVZWL	GI2LL,R0
	IF.	*LES			;NO PREVIOUS INPUT
		MOVW	#29,GERRN
		RET
	ENDIF.
	BSBW	GINSRX			;INSERT PREVIOUS INPUT
	BRW	DX
;
;
D72:	BRW	GEXIT			;H DO CNTR/C EXIT
;
;
D80:					;P
	INCL	GFPTR
	CMPL	GFPTR,GFCNT
	IF.	*GT			;TOO FAR
		MOVL	GFCNT,GFPTR
		MOVW	#20,GERRN
		RET
	ENDIF.
	ADDL3	GFPTR,GFBUFFA,R1
	DECL	R1
	CMPL	GFPTR,GHPTR
	IF.	*GT			;PASSED HOLE
		ADDL2	GHCNT,R1
	ENDIF.
	CLRL	GEXP1
	MOVB	(R1),GEXP1
	BISB2	#GXVAL,GSTAT		;INDICATE VALUE
	BRW	DX
;
;
D83X:					;S + VALUE
	MOVL	GFPTR,R1
	MOVL	GEXP1,R0		;NR OF LINES
	BSBW	FILO
	BRW	DX
D83:					;S
	MOVL	#MAX,R0
	CLRL	R1
	BSBW	FILO
	BRW	DX
;
D85:					;U
	MOVL	#MAX,R0
	CLRL	R1
	BSBW	FILO
	CLRL	GFPTR
	CLRL	GFCNT
	CLRL	GHPTR			;CLEAR BUFFER
	MOVL	#8192,GHCNT		;INITIAL VALUE
	BRW	DX
;
;
D86:					;V
	MOVL	#MAX,R0
	CLRL	R1
	MOVB	#1,WLINEF		;TRANSLATE TO LOWERCASE
	BSBW	LINER
	BRW	DX
D86X:					;V + VALUE
	MOVL	GFPTR,R1
	MOVL	GEXP1,R0		;NR OF LINES
	MOVB	#1,WLINEF		;TRANSLATE TO LOWERCASE
	BSBW	LINER
	BRW	DX
;
D88:					;X
	MOVL	#MAX,R0
	CLRL	R1
	BSBW	FILO
	BRW	GEXIT			;STOP
;
D89I:					;INITIAL YANK
	PUSHR	#^M<R7,R8,R9>
	MOVW	#40,GERRN
	CALLS	#0,GTVR02
	MOVAB	WNOTE+1,R6		;SET R6
	BRW	D8902			;AFTER INITIAL DISPLAY, YANK
WNOTE:	.ASCII	\A\
D89:					;Y
	BITB	#WXIOPEN,WSTAT
	IF.	*ON			;INPUT FILE OPEN
		BRW	D8903
	ENDIF.
	MOVW	#40,GERRN
	MOVW	GERRN,WERRNF		;SAVE IT
	CALLS	#0,GTVR02
D8901:	BSBW	FILN			;GET FILE NAME
	MOVW	WOLL,WILL
	MOVC3	WOLL,WOFNM,WIFNM
D8902:	BSBW	FILI.O			;OPEN THE FILE
	IF.	*NE			;NOT OK
		BSBW	ERRW
		BRW	D8901
	ENDIF.
D8903:	BSBW	FILR			;READ THE FILE
	EDIT	GFCNT,9,GERR13+2
	MOVW	#-13,GERRN		;DISPLAY CURRENT BUFFER COUNT
	BRW	DX
;
D90:					;Z
	MOVL	#MAX,R0
	CLRL	R1
	MOVB	#0,WLINEF		;TRANSLATE TO UPPERCASE
	BSBW	LINER
	BRW	DX
D90X:					;Z + VALUE
	MOVL	GFPTR,R1
	MOVL	GEXP1,R0		;NR OF LINES
	MOVB	#0,WLINEF		;TRANSLATE TO UPPERCASE
	BSBW	LINER
	BRW	DX
;
DX:	POPR	#^M<R7,R8,R9>
	RSB
	.PAGE
SKPE1:					;SETUP FOR SKIP
	CMPB	-1(R1),#^A'@'
	IF.	*NE			; NOT SPECIAL
		CMPW	-2(R1),#^A'@:'
		IF.	*NE		;NOT SPECIAL
			MOVB	#ESC,WSKPE
			RSB
		ENDIF.
	ENDIF.
	MOVB	1(R1),WSKPE
	INCL	R1
	DECW	GSILL(R11)
	RSB
;
;	SKIP	TO NEXT ESCAPE
;	IN	R1 = ADDR,GSILL = LL
;
SKPE:	INCL	R1
	DECW	GSILL(R11)
	IF.	*GTS			;NOT END OF INPUT
		LOCC	WSKPE,GSILL(R11),(R1)
		MOVW	R0,GSILL(R11)
	ENDIF.
	RSB
WSKPE:	.BLKB
	.PAGE
WLINEF:	.BLKB				;FUNCTION TO DO PER LINE
WLCNT:	.BLKL				;NR OF LINES TO DO
WREMLL:	.BLKL
WUTAB::					;LOWER TO UPPERCASE TABLE
AAA=0
	.REPEAT	256
	.BYTE	AAA
AAA=AAA+1
	.ENDR
.=WUTAB+97
AAA=65
	.REPEAT	26
	.BYTE	AAA
AAA=AAA+1
	.ENDR
.=WUTAB+256
WLTAB::					;UPPER TO LOWERCASE TABLE
AAA=0
	.REPEAT	256
	.BYTE	AAA
AAA=AAA+1
	.ENDR
.=WLTAB+65
AAA=97
	.REPEAT	26
	.BYTE	AAA
AAA=AAA+1
	.ENDR
.=WLTAB+256
	.PAGE
;
;	IN	R0 = NR OF LINES TO DO
;		R1 = START BYTE NR
;
LINER:	PUSHR	#^M<R6,R7,R8>
	ADDL3	R1,GFBUFFA,R6
	MOVL	R6,R7
	ADDL2	GHCNT,R6
	MOVL	R0,WLCNT
	BSBW	GMOVHOLR		;SHIFT THE HOLE
	MOVL	GFCNT,WREMLL
LINE1:	CMPL	WREMLL,G64K
	IF.	*LT
		MOVL	WREMLL,R8
		CLRL	WREMLL
	ELSE.
		MOVL	G64K,R8
		SUBL2	G64K,WREMLL
	ENDIF.
LINE2:	LOCC	#CRX,R8,(R6)
	IF.	*NE			;FOUND END OF LINE
		INCL	R1
	ELSE.				;MAY BE END OF BUFFER
		TSTL	WREMLL
		IF.	*NE		;NOT END OF BUFFER
			SUBL3	R6,R1,R0
			ADDL2	R0,WREMLL	;INCLUDE REMAINDER
			BRW	LINE1
		ENDIF.
	ENDIF.
	SUBL3	R6,R1,R0
	SUBL2	R0,R8
	CASEB	WLINEF,#0,#2
LINEC:	.WORD	LINE.0-LINEC		;TO UPPER
	.WORD	LINE.1-LINEC		;TO LOWER
	.WORD	LINE.2-LINEC		;SPACE TO TABS
;
;	R6 = ADDR START LINE
;	R7 = START HOLE
;	R0 = LENGTH LINE INCLUDING END-OF-LINE
;
LINE.0:
	MOVTC	R0,(R6),#0,WUTAB,R0,(R6)
	MOVL	R1,R6
	BRW	LINE.X
LINE.1:
	MOVTC	R0,(R6),#0,WLTAB,R0,(R6)
	MOVL	R1,R6
	BRW	LINE.X
LINE.2:
	BSBW	TABR
LINE.X:
	TSTL	R8
	IF.	*EQ			;END OF THIS BLOCK
		TSTL	WREMLL
		IF.	*NE		;NOT ALL ENDED
			DECL	WLCNT
			IF.	*NE
				BRW	LINE1
			ENDIF.
		ENDIF.
	ELSE.
		DECL	WLCNT
		IF.	*NE		;MORE LINES  TOO GO
			BRW	LINE2
		ENDIF.
	ENDIF.
	POPR	#^M<R6,R7,R8>
	RSB
;
;	IN	R6 = START ADDR
;		R7 = START HOLE ADDR
;		R0 = LENGTH LINE
;	OUT	R6 = END OF LINE
;		R7 = NEW START OF HOLE
;		GFCNT,GHCNT,GHPTR,GFPTR
TABR:
	MOVW	R0,WLL
	CMPB	#CRX,-1(R6)[R0]
	IF.	*EQ			;END OF LINE PRESENT
		DECW	WLL
		MOVB	#1,WCRX
	ELSE.
		CLRB	WCRX
	ENDIF.
TABR1:	CMPW	WLL,#8
	IF.	*GE			;MORE THEN 8
		MOVW	#8,WLL2
	ELSE.
		MOVW	WLL,WLL2
	ENDIF.
	LOCC	#9,WLL2,(R6)
	IF.	*NE			;TAB FOUND
		SUBL3	R0,WLL2,R0	;LENGTH
		INCL	R0
		SUBW2	R0,WLL
		ADDL2	R0,GHPTR
		MOVC3	R0,(R6),(R7)
		MOVL	R1,R6
		MOVL	R3,R7
	ELSE.				;NO TAB
		MOVL	WLL2,R0
TABR2:		CMPB	#32,-1(R6)[R0]
		IF.	*EQ
			SOBGTR	R0,TABR2
		ENDIF.
		CMPW	WLL2,R0
		IF.	*EQ		;NO TAB TO ADD
			MOVC3	WLL2,(R6),(R7)
			ADDL2	WLL2,GHPTR
		ELSE.
			ADDL2	R0,GHPTR
			SUBL3	R0,WLL2,R1
			DECL	R1
			SUBL2	R1,GFCNT
			ADDL2	R1,GHCNT
			MOVC3	R0,(R6),(R7)
			MOVB	#9,(R3)+	;TAB
			INCL	GHPTR
		ENDIF.
		MOVL	R3,R7
		ADDL2	WLL2,R6
		SUBL2	WLL2,WLL
	ENDIF.
	TSTW	WLL
	IF.	*NE			;NOT END OF INPUT
		BRW	TABR1
	ENDIF.
TABR3:	CMPB	-1(R7),#9
	IF.	*EQ			;TRAILING TAB
		DECL	R7
		DECL	GHPTR
		INCL	GHCNT
		DECL	GFCNT
		BRW	TABR3
	ENDIF.
	TSTB	WCRX
	IF.	*NE			;END OF LINE PRESENT
		INCL	R6
		MOVB	#CRX,(R7)+
		INCL	GHPTR
	ENDIF.
	MOVL	GHPTR,GFPTR
	RSB
WLL:	.BLKL
WLL2:	.BLKL
WCRX:	.BLKB
;
;
	.PAGE
;
;
;	IN	R0 = NR OF LINES TO WRITE
;		R1 = START BYTE NR
;
FILO:					;WRITE BUFFER TO FILE
	MOVL	R0,WLPCS
	MOVL	R1,WSAVST		;SAVE START
	MOVW	#41,GERRN
	MOVL	GOBUFFA,R8
	MOVSP	0			;HOME
	MOVB	#13,(R8)+
	MOVC3	#21,WLF,(R8)
	MOVL	R3,R8			;21 * LF
	MOVB	#^A/*/,(R8)+
	MOVSP	1			;CLEAR
	SUBL3	GOBUFFA,R8,R1
	CALLS	#0,GTVR07		;MOVE ERROR MESSAGE
	CLRW	GERRN
	BSBW	GWRITR			;WRITE IT
FILO1:	BSBW	FILN
	MOVB	WOLL,DOUTF+FAB$B_FNS
	$CREATE FAB=DOUTF
	$CONNECT RAB=DOUTR
	ON_ERROR FILO3			;OPEN ERROR
	CLRL	R1
	BSBW	GMOVHOLR		;SHIFT THE HOLE
	ADDL3	GHCNT,GFBUFFA,R7
	MOVL	GFCNT,R8		;NR OF CHAR
	MOVB	#GCRX,(R7)[R8]		;SET CR AT END OF BUFFER
	ADDL2	WSAVST,R7
	MOVL	WLPCS,WLPC		;SET LOOP COUNT
FILO2:	MOVL	R7,DOUTR+RAB$L_RBF
	TSTL	R8
	IF.	*GTS			;NOT END OF BUFFER
		LOCC	#GCRX,#2000,(R7)
		IF.	*EQ		;RECORD TOO BIG
			MOVL	#4,R0
			BSBW	ERRW
			ADDL2	#2000,R7
			SUBL2	#2000,R8
			MOVW	#2000,DOUTR+RAB$W_RSZ
			INCL	WLPC
		ELSE.			;CR FOUND
			SUBW3	R0,#2000,R0
			MOVW	R0,DOUTR+RAB$W_RSZ
			INCL	R0
			ADDL2	R0,R7
			SUBL2	R0,R8
		ENDIF.
		$PUT	RAB=DOUTR
		ON_ERROR FILO4
		SOBGTR	WLPC,FILO2
	ENDIF.
	$CLOSE	FAB=DOUTF
	RSB
FILO3:	MOVL	#2,R0			;OPEN ERROR
	BSBW	ERRW
	BRW	FILO1
FILO4:	MOVL	#3,R0			;WRITE ERROR
	BSBW	ERRW
	$CLOSE	FAB=DOUTF
	$ERASE	FAB=DOUTF
	BRW	FILO1
WSAVST:	.BLKL
WLPC:	.BLKL
WLPCS:	.BLKL
WLF:
	.REPEAT	21
	.BYTE	10
	.ENDR
	.PAGE
FILI.O:					;OPEN INPUT FILE
	MOVB	WOLL,DINF+FAB$B_FNS
	$OPEN	FAB=DINF
	$CONNECT RAB=DINR
	IF.	*ERROR
		MOVL	#2,R0
	ELSE.
		BISB2	#WXIOPEN,WSTAT
		CLRL	R0
	ENDIF.
	RSB
;
FILR:					;READ THE FILE
	ADDL3	GFCNT,GHCNT,R7		;APPEND FILE
	ADDL2	GFBUFFA,R7
	MOVL	GFBUFFA,R8
	ADDL2	#GBUFS*512-2000,R8	;END OF BUFFER FOR READ
FIL1:	CMPL	R7,R8
	IF.	*GT			;NOT ENOUGH ROOM IN BUFFER
		MOVW	#11,GERRN
		RET
	ENDIF.
	MOVL	R7,DINR+RAB$L_UBF
	$GET	RAB=DINR
	IF.	*ERROR			;EOF
		$CLOSE	FAB=DINF
		BICB2	#WXIOPEN,WSTAT
		CLRL	R0		;READ OK
		RSB
	ENDIF.
	MOVZWL	DINR+RAB$W_RSZ,R0
	ADDL2	R0,GFCNT
	INCL	GFCNT
	ADDL2	R0,R7
	MOVB	#GCRX,(R7)+		;INDICATE END OF LINE
	BRW	FIL1
	.ALIGN	LONG
DINF:	$FAB	MRS=2000,RAT=CR,RFM=VAR,FNA=WOFNM,BLS=2048,FAC=<GET>
DINR:	$RAB	FAB=DINF,USZ=2000
DOUTF:	$FAB	MRS=2000,RAT=CR,RFM=VAR,FNA=WOFNM,BLS=2048,FAC=<PUT>
DOUTR:	$RAB	FAB=DOUTF
DEXF:	$FAB	MRS=2000,RAT=CR,RFM=VAR,FNA=WOFNM,BLS=2048,FAC=<GET>
DEXR:	$RAB	FAB=DEXF,USZ=2000
WSTAT:	.BLKB
WXIOPEN=^X80				;INPUT FILE OPEN
	.PAGE
FILN:					;GET FILE NAME
	BITB	#GXEXEC,GSTAT
	IF.	*ON			; COMMAND FILE EXEC
		MOVAB	WOFNM,R1
		MOVAB	DEXR,R0
		CALLS	#0,GTVR09R	;READ FILE NAME
		TSTL	R0
		IF.	*GTS		;INPUT PRESENT
			CMPB	WOFNM,WDUM
			IF.	*NE		;NOT ABORTED
				MOVW	R0,WOLL
				RSB
			ENDIF.
		ENDIF.
		MOVW	#24,GERRN
		RET			;ABORTED
	ENDIF.
FILN0:	MOVAB	WOFNM,R1
	MOVB	#1,R0			;FUNCTION 1
	CALLS	#0,GTVR01
	CASEB	WOFNM,#8,#2
FT:	.WORD	FILN1-FT		;ESC = 8
	.WORD	FILN2-FT		;CR = 9
	.WORD	FILN3-FT		;^G = 10
	BRW	FILN4
FILN1:					;ESC
	CMPB	-1(R6),#^A'E'
	IF.	*EQ			;NO INPUT DEFAULT FOR EXECUTE
		BRW	FILN101
	ENDIF.
	TSTW	WILL
	IF.	*NE			;INPUT FILE NAME PRESENT
		MOVC3	WILL,WIFNM,WOFNM
		MOVW	WILL,WOLL
		MOVL	GOBUFFA,R3
		MOVC3	WILL,WIFNM,(R3)
		SUBL3	GOBUFFA,R3,R1
		BSBW	GWRITR		;DISPLAY FILE NAME
		MOVL	GOBUFFA,R1
		MOVB	#2,R0
		CALLS	#0,GTVR01	;GET CR
		CMPB	@GOBUFFA,#13
		IF.	*NE		;ABORT
			BRW	FILN3
		ENDIF.
	ELSE.
FILN101:	MOVL	#1,R0		;NO INPUT FILE NAME
		BSBW	ERRW
		BRW	FILN0
	ENDIF.
	BRW	FILN201
;
FILN2:					;CR OR END OF LINE
	TSTW	WILL
	IF.	*EQ			;NO DEFAULT
		BRW	FILN101
	ELSE.
		CMPB	-1(R6),#^A'E'
		IF.	*EQ		; EXEC FILE
			BRW	FILN101
		ENDIF.
	ENDIF.
	MOVW	WILL,WOLL
	MOVC3	WILL,WIFNM,WOFNM
FILN201:
	MOVW	WOLL,R0
	MOVAB	WOFNM,R1
	BSBW	GTVR08W			;WRITE FILE NAME
	RSB
;
FILN3:					;^G
	MOVW	#1,R0
	MOVAB	WDUM,R1
	BSBW	GTVR08W			;WRITE ABORT TO LOGFILE
	MOVW	#24,GERRN
	RET
;
;
FILN4:					;NOT IMMEDIATE INPUT
	MOVW	R0,WOLL
	MOVAB	WOFNM,R1
	BSBW	GTVR08W			;WRITE FILE NAME
	RSB
	.PAGE
WERRNF:	.BLKW
;
WDUM:	.BYTE	10			;^G TRANSLATED TO INTERNAL NR
WIOSB:	.BLKL	2
WTERMC:	.BLKB
WILL:	.BLKW
WIFNM:	.BYTE	SPACE
	.BLKB	59
WOLL:	.BLKW
WOFNM:	.BLKB	70
	.PAGE
;	WRITE FILE ERROR MESSAGE TO TERMINAL
ERRW:
	MOVL	GOBUFFA,R8
	MOVL	WSTART,(R8)+
	MOVL	ERRTA[R0],R2
	MOVAB	2(R2),R1
	MOVZWL	(R2),R0
	BSBW	GWRITR2			;WRITE ALSO IN BATCH
	MOVC3	(R2),2(R2),(R8)
	MOVL	R3,R8
	MOVSP	2			;CLEAR REST OF LINE
	MOVSP	4			;CURSOR UP
	MOVB	#13,(R8)+
	MOVW	#^X0909,(R8)+		;CR,TAB,TAB TO CORR POS
	MOVSP	2			;CLEAR LINE
	SUBL3	GOBUFFA,R8,R1		;LENGTH OF OUTPUT
	BSBW	GWRITR			;WRITE TO TERMINAL
	RSB
	.MACRO	ERR,P1,P2
ORG=.
MA1=P1*4
.=ERRTA+MA1
	.LONG	ORG
.=ORG
MA1=%LENGTH(P2)
	.WORD	MA1
	.ASCII	/P2/
	.ENDM
ERRTA:	.BLKL	6
	ERR	1,<no input file name given>
	ERR	2,<file cannot be opened>
	ERR	3,<error during write>
	ERR	4,<record more than RPPP charL split>
	ERR	5,<no recognition on vax>
WSTART:	.BYTE	13,10,9,9
WYNK:	.ASCII	\;Y\
BS=8					;BACK SPACE TERMINAL
CR=13
SPACE=32
ESC=27
MAX=10000000
CRX=128
	.END