Google
 

Trailing-Edge - PDP-10 Archives - BB-L014E-BM - autopatch/forio.c05
There are no other files named forio.c05 in the archive.
 REP 2/1	;05C1
		TV	FORIO	I/O ROUTINES,6(2033)

	;COPYRIGHT (C) 1981  BY  DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
 WIT
		TV	FORIO	I/O ROUTINES,6(2130)

	;COPYRIGHT (C) 1981,1982  BY  DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
 INS 451/2	;05C2
	***** End V6 Development *****

	2042	TGS	2-Feb-82	20-17208
		Change NREC(D) to NREC(U) at RNRER1, MOPEND (inside IF20 conditional),
		and MOPEND (inside IF10 conditional) end-of-file routines so record
		counts are correctly incremented/decremented.

	2044	ERD	19-Feb-82	10-32143
		Addition to SIPOS, T format record positioning routine, to clear
		the end of record bit.

	2046	ERD	31-Mar-82	10-32150
		Additions to WRTPG and UOXYZ routines (TOPS-10) to no longer pad
		RANDOM files to block boundary.
		Changes in the URMAP routine to take the error path if READ of an
		IMAGE file, opened in RANDOM mode, is that of record number which is
		larger than largest record number written.
		This edit is removed by Edit 2054.

	2054	ERD	7-May-82
		Removes Edit 2046 which sometimes updates filesize too soon
		causing some subsequent READs to fail if the READ is attempted
		before the file is closed.

	2056	ERD	20-MAY-82	10-32496
		Additions to WRTPG routine (TOPS-10) so that RANDOM files are no 
		longer padded to the block boundary.
		Changes in URMAP routine to cause READs of RANDOM IMAGE 
		mode files to take the error path if the record number being
		read is larger than the largest record number previously
		written.

	2065	EDS	25-Jun-82
		Replace the use of D.TTY with U.TTY and rework logic for UDB.

	2066	TGS	16-Jul-82	10-32825
		Ensure that RANDOM record numbers greater than (2**18)-1 are
		not truncated when calculating starting word number of current
		record.

	2071	RJD	5-Aug-82	20-17861
		Save the current CCOC words before doing terminal input
		and restore them after the input.

	2073	MRB	19-Aug-82	20-17774
		BACKSPACE Gets confused, tries to map in page -1. (Which results
		in an illegal instruction on the PMAP.) This seems to only happin
		for unformatted binary files.
		Modules:
			FOROTS		FORIO

	2120	TGS	26-Oct-82	10-33096
		Addition to Edit 2056 to ensure that EOFN(D) is updated (if output
		is currently in progress) whenever a TOPS10 window is written, as
		well as at end-of-record time.

	2122	TGS	09-Nov-82	10-33095
		Allow ESC to function as a line terminator for TOPS10 TTY input,
		rather than as a non-deletable break character.

	2123	RJD	09-Nov-82	10-33194
		Change ICNT and OCNT to reflect word counts when an APPEND is
		done to an unformatted file.

	2126	MRB	18-NOV-82	20-17953
		Added code to allow the I/O to work properly on magtapes.
		Checks for tape mode to determine byte size.

	2127	MRB	18-Nov-82	10-32947
		Check to see if the user is attempting to recursively call
		IOLST.

	2130	TGS	03-Dec-82	NONE
		Correct edit 2120, which unconditionally updated EOFN(D) with
		BYTN(D) while doing Random output.  Do the update only if BYTN
		is larger than EOFN.

 REP 464/2	;05C3
		INTERN	%UDBAD

 WIT

		EXTERN	%UDBAD				;[2127]
 REP 472/2	;05C4
		EXTERN	%EDDB,U.RERD,U.ERR,D.TTY
	IF20,<	EXTERN	G.PRP,G.PRMPT,%OCCOC,%CCMSK,%CLSOP >
 WIT
		EXTERN	%EDDB,U.RERD,U.ERR,U.TTY	;[2065]
	IF20,<	EXTERN	G.PRP,G.PRMPT,%CLSOP >		;[2071]
 REP 8/9	;05C5
		STORE	T2,OBSIZ(D) >
 WIT
		STORE	T2,OBSIZ(D)	;[2123]
		MOVE	T1,OCNT(D)	;[2123] GET OCNT
		ADDI	T1,4		;[2123]
		IDIVI	T1,5		;[2123] CONVERT IT TO WORDS
		MOVEM	T1,OCNT(D)	;[2123] SAVE IT
		MOVE	T1,ICNT(D)	;[2123] GET ICNT
		ADDI	T1,4		;[2123]
		IDIVI	T1,5		;[2123] CONVERT IT TO WORDS
		MOVEM	T1,ICNT(D)  >	;[2123] SAVE IT
 REP 11/10	;05C6
	CHKUNT:	HRRE	T2,A.UNIT	;GET UNIT
		CAML	T2,[-7]		;RANGE CHECK.  NEGATIVE ARGS ILLEGAL
		CAILE	T2,MAXUNIT	; OR UNIT BEYOND RANGE OF DDBTAB
		  JRST	.+2		;Out of range.
 WIT
	CHKUNT:	HRRE	T2,A.UNIT	;GET UNIT      
		CAML	T2,[-7]		;RANGE CHECK.  NEGATIVE ARGS ILLEGAL
		CAILE	T2,MAXUNIT	; OR UNIT BEYOND RANGE OF DDBTAB
		  JRST	CHKUN1		;[2127]Out of range.
	;[2127]Check to see if there is already I/O in progress,
	;[2127]if there is then somehow we've interupted the flow 
	;[2127]of the I/O processing (like using ERRSET to trap for
	;[2127]I/O errors and then attempting to do more I/O before
	;[2127]the current I/O is finished).
	CHKUDB:	SKIPE	%UDBAD		;[2127]I/O Already in progress?
		$ECALL	IWI,%ABORT	;[2127]Yes, Thats fatal to do.
 REP 19/10	;05C7
		PUSHJ	P,SETERI	;Set %TERR and %TIOS
 WIT
	CHKUN1:	PUSHJ	P,SETERI	;[2127]Set %TERR and %TIOS
 INS 36/21	;05C8
		RFCOC%			;[2071]
		PUSH	P,T2		;[2071] SAVE THE CURRENT
		PUSH	P,T3		;[2071]  CCOC WORDS
 REP 53/21	;05C9
		MOVE	T2,CCOC(D)	;SET ALL CHARS TO SEND LITERALLY
		AND	T2,%CCMSK	; EXCEPT ^I AND ^L, WHICH BEHAVE THE SAME
		OR	T2,%OCCOC	; AS ON INPUT
		MOVE	T3,%OCCOC+1
 WIT
		POP	P,T3		;[2071] RESTORE CCOC WORDS
		POP	P,T2		;[2071]
 REP 86/23	;05C10
	NOTEOL:	CAIE	P4,32		;^Z?
 WIT
	NOTEOL:	CAIG	P4,33		;[2122] EITHER ESCAPE OR ...
		CAIGE	P4,32		;[2122] ^Z?
 INS 91/23	;05C11
	IF10,<	CAIE	P4,33		;[2122] ESCAPE?
		 JRST	DDPB3		;[2122] NO, MUST BE ^Z, SKIP IT
		OUTSTR	%CRLF##		;[2122] YES,SIMULATE CRLF
		SOJA	P3,DIEOR	;[2122] DECR COUNT AND END THE RECORD
	>;END IF10			;[2122]
 REP 61/26	;05C12
	RNRER1:	MOVE	T1,NREC(D)	;GET RECORD NUMBER
 WIT
	RNRER1:	MOVE	T1,NREC(U)	;[2042] GET RECORD NUMBER
 REP 2/30	;05C13
	ETTY:	SKIPN	D,D.TTY		;POINT TO TTY DDB IF OPEN
 WIT
	ETTY:	SKIPE	U,U.TTY		;[2065] POINT TO TTY UDB IF OPEN
		SKIPN	D,DDBAD(U)	;[2065] GET TTY DDB ADDRESS
 INS 17/41	;05C14
		MOVX	T3,D%EOR	;[2044] CLEAR THE END OF RECORD FLAG
		ANDCAM	T3,FLAGS(D)	;[2044] STORE IN DDB
 REP 37/48	;05C15
		IDIVI	T1,5		;CONVERT TO WORD NUMBER
 WIT
	IF10,<	MOVE	T0,FLAGS(D)	;[2120]
		TXNN	T0,D%IO		;[2120][2130] DOING OUTPUT?
		 JRST	FNXTW1		;[2130] NO
		CAMLE	T1,EOFN(D)	;[2130] IS BYTN NOW LARGER THAN EOFN?
		 MOVEM	T1,EOFN(D)	;[2120] YES, UPDATE EOFN(D) WITH BYTN(D)
	>;END IF10
	FNXTW1:	IDIVI	T1,5		;[2130] NO. CONVERT TO WORD NUMBER
 REP 56/48	;05C16
		TXNE	T0,D%RAN	;RANDOM?
 WIT
	IF10,<	TXNN	T0,D%IO		;[2120][2130] DOING OUTPUT?
		 JRST	UNXTW1		;[2130] NO
		CAMLE	T1,EOFN(D)	;[2130] IS BYTN NOW LARGER THAN EOFN?
		 MOVEM	T1,EOFN(D)	;[2120] YES, UPDATE EOFN(D) WITH BYTN(D)
	>;END IF10
	UNXTW1:	TXNE	T0,D%RAN	;[2130] NO. RANDOM?
 INS 11/49	;05C17
		LOAD	T5,TAPM(D)	;[2126]GET THE CURRENT TAPE MODE
		CAIN	T5,TM.IND	;[2126]IS IT INDUSTRY?
		 HRLI	T2,(POINT 8,)	;[2126] THEN BYTE SIZE 8
		CAIN	T5,TM.ANS	;[2126]IS IT ANSI-ASCII?
		 HRLI	T2,(POINT 7,)	;[2126] THEN BYTE SIZE 7
					;[2126]ELSE, BYTE SIZE 36
 REP 22/49	;05C18
		MOVE	P2,WSIZ(D)	;GET FULL WINDOW SIZE
		ADD	P2,T3		;GET # WORDS WE ACTUALLY GOT
 WIT
		MOVN	P2,P1		;[2126]BEGIN WINDOW MINUS END
		ADDI	P2,(T2)		;[2126] BYTE PTR = #WORDS READ
 REP 21/50	;05C19
		IMULI	T1,-1(T3)	;GET WORD NUMBER OF START OF RECORD
 WIT
		SUBI	T3,1		;[2066] ADJUST RECORD NUMBER
		IMUL	T1,T3		;[2066] GET WORD NUMBER OF START OF RECORD
 REP 37/50	;05C20
		IMULI	T1,-1(T3)	;GET WORD NUMBER OF RECORD START
		MOVEM	T1,BYTN(D)	;STORE CURRENT WORD NUMBER

		PUSHJ	P,MAPW		;MAP RECORD START INTO CORE
 WIT
		SUBI	T3,1		;[2066] ADJUST RECORD NUMBER
		IMUL	T1,T3		;[2066] GET WORD NUMBER OF RECORD START
		MOVEM	T1,BYTN(D)	;STORE CURRENT WORD NUMBER

		TXNN	T0,D%IO		;[2056] INPUT OR OUTPUT?
		TXNE	T0,D%BIN	;[2056] BINARY FILE?
		  JRST	NOECHK		;[2056] MAP RECORD INTO CORE
		CAML	T1,EOFN(D)	;[2056] COMPARE WITH FILE SIZE
		  JRST	RNRER1		;[2056] RECORD NOT WRITTEN

	NOECHK:	PUSHJ	P,MAPW		;[2056] MAP RECORD START INTO CORE
 REP 46/53	;05C21
		IMULI	T3,PSIZ		;GET # WORDS TO END OF THIS PAGE
		CAMLE	T3,LKPB+.RBSIZ(D) ;LARGER THAN WHAT'S THERE?
		 MOVEM	T3,LKPB+.RBSIZ(D) ;YES. UPDATE IT
 WIT
		PUSH	P,P1		;[2056] STORE P1
		MOVE	T0,FLAGS(D)	;[2056] GET DDB FLAGS
		MOVE	T5,EOFN(D)	;[2056] GET NO. BYTES IN CURRENT FILE
		TXNN	T0,D%UNF	;[2056] FORMATTED?
		  IDIVI	T5,5		;[2056] YES, CONVERT BYTES TO WORDS
		CAMLE	T5,LKPB+.RBSIZ(D);[2056] CURRENT FILE LARGER THAN FILESIZE?
		  MOVEM	T5,LKPB+.RBSIZ(D);[2056] SAVE ONLY IF LARGER
		IMULI	T3,PSIZ		;[2056] BLOCK NO. TIMES BLOCKSIZE
		CAMGE	T5,T3		;[2056] CURRENT BYTES GREATER?
		  SUBM	T3,T5		;[2056] YES, SUBT. CURRENT BYTES FROM TOTAL
		POP	P,P1		;[2056] RESTORE P1
 REP 56/53	;05C22
		HRLI	T4,-PSIZ	;PUT COUNT IN LH
		SETZ	T5,		;ZERO TO END COMMAND LIST
 WIT
		CAIL	T5,PSIZ		;[2056] LESS THAN BLOCKSIZE?
		  JRST	[HRLI T4,-PSIZ	;[2056] NO, BLOCKSIZE IN LH
			 JRST WRTPG1]	;[2056] CONTINUE
		MOVEI	T0,PSIZ		;[2056] FILE ENDS IN THIS BLOCK
		SUBM	T0,T5		;[2056] NUMBER OF WORDS LEFT IN THIS BLOCK
		MOVNS	T5		;[2056] NEGATE
		HRL	T4,T5		;[2056] PUT COUNT IN LH
	WRTPG1:	SETZ	T5,		;[2056] ZERO TO END COMMAND LIST
 REP 114/59	;05C23
		MOVE	T1,BYTN(D)	;YES. GET WORD # OF NEXT WINDOW
		SUB	T1,WSIZ(D)	;GET WORD # OF THIS WINDOW
		JUMPLE	T1,%POPJ	;IF BEG OF THIS WINDOW IS 0, LEAVE
		SUB	T1,WSIZ(D)	;GET WORD # OF PREVIOUS WINDOW
		MOVEM	T1,BYTN(D)	;SAVE IT
		PUSHJ	P,UNXTW		;GET PREVIOUS WINDOW
		ADD	P1,WSIZ(D)	;POINT TO END OF WINDOW
		SETZ	P2,		;AND CLEAR COUNT
 WIT
		PUSHJ	P,%PTOF		;[2073]Get the file page number
		PUSHJ	P,%FTOP		;[2073]Get the page mapped in
		ADDI	P1,1		;[2073]Point to the correct byte
		SUBI	P2,1		;[2073]Num of bytes left in file

 REP 78/60	;05C24
	MOPEND:	AOS	NREC(D)		;INCR REC #
 WIT
	MOPEND:	AOS	NREC(U)		;[2042] INCR REC #
 REP 3/69	;05C25
	MOPEND:	AOS	NREC(D)		;INCR REC #
 WIT
	MOPEND:	AOS	NREC(U)		;[2042] INCR REC #
 REP 21/79	;05C26
	%UDBAD: BLOCK	1		;DDB ADDRESS "STACK"
 WIT
	;%UDBAD: BLOCK	1		;[2127]MOVED TO FOROTS. DDB ADDRESS
 REP 26/79	;05C27
	LIOPDL==100
 WIT
	LIOPDL==200			;[2127] IOPDL size.
 SUM 104407