Google
 

Trailing-Edge - PDP-10 Archives - bb-bt99g-bb - plrlbp.c08
There is 1 other file named plrlbp.c08 in the archive. Click here to see a list.
 REP 1/4	;08C1
	SUBTTL	L$INIT -- Initialization For The Label Processor

	L$INIT::POPJ	P,			;FOR NOW, JUST RETURN
	SUBTTL	L$MDC --	Routine to Process the MDC message
 WIT
	SUBTTL	L$INIT - Initialization For The Label Processor

	L$INIT::MOVEI	S1,0			;GET SEQUENCE ERROR CHECK CODE
		MOVEM	S1,G$SEQC##		;SET IT (DEBUGGING HACK IF NON-ZERO)
		POPJ	P,			;RETURN
	SUBTTL	L$MDC -	Routine to Process the MDC message
 REP 46/6	;08C2
		JUMPF	RVOL.3			;TRIED ALL DENSITIES !!!
		SETZM	G$TERM##		;CLEAR THE ERROR FLAGS
		JRST	RVOL.1			;AND TRY AGAIN
 WIT
		JUMPF	RVOL.6			;TRIED ALL DENSITIES !!!
		SETZM	G$TERM##		;CLEAR THE ERROR FLAGS
		JRST	RVOL.1			;AND TRY AGAIN
	RVOL.6:	MOVEI	S1,.TFD00		;SET DEFAULT DENSITY BECAUSE SOME
		PUSHJ	P,I$SDEN##		; DRIVE DONT DO AUTO-DENSITY DETECT
		JRST	RVOL.3			;FINISH UP
 REP 1/8	;08C3
	SUBTTL	L$MOUN -- Routine to Process Mount Message
 WIT
	SUBTTL	L$RUVL - Read UVL1 record


	; This routine is used by PLRINI to read the owner and protection
	; information stored in the UVL1 record.  This is needed when tapes
	; will be re-initialized (/NEW-VOLUME processing).

	L$RUVL::PUSHJ	P,L$CLEF		;CLEAR PENDING ERRORS
		PUSHJ	P,T$OPEN##		;OPEN
		JUMPF	.POPJ			;RETURN ON FAILURES
		CAIE	LT,LT.SL		;ANSI?
		CAIN	LT,LT.SUL		;ANSI WITH USER LABELS?
		SKIPA				;YES
		$RETT				;NO USEFUL INFO ON THIS TAPE
		PUSHJ	P,T$RDRC##		;READ A RECORD
		JUMPF	.POPJ			;RETURN ON FAILURES
		MOVE	T1,[CPTRI ^D1,0(BUF)]	;CHECK LABEL IDENTIFIER (CP 1-4)
		MOVE	T2,UVLPTR		;POINT TO "UVL1"
		HRRZI	T3,4			;4 CHARACTERS
		HRL	T3,CVTTAB(LT)		;CONVERSION ROUTINE
		PUSHJ	P,STRCMP		;COMPARE
		JUMPT	RUVL1			;UVL1, PROCEED
		MOVEI	S1,'BBL'		;NO MATCH
		PUSHJ	P,T$POS##		;BACKUP THE TAPE
		JUMPF	.POPJ			;RETURN ON FAILURES
		$RETT				;DONE HERE

	; Protection
	RUVL1:	MOVE	T1,[CPTRI ^D5,0(BUF)]	;POINT AT PROT (CP 5-10)
		HRRZI	T2,6			;6 CHARS, NO CONVERT
		HRL	T2,CVTTAB(LT)		;CONVERSION IF NECESSARY
		PUSHJ	P,STROCT		;MAKE IT A NUMBER
		SKIPT				;CHECK FOR JUNK IN LABELS
		MOVE	S2,G$PSTP##		;DEFAULT TO STANDARD FILE PROTECTION
		SKIPGE	S1,TCB.IP(B)		;WAS ONE SPECIFIED?
		MOVE	S1,S2			;OLD TAPE PROT WILL BE USED
		CAILE	S1,777			;IT MUST BE REASONABLE
		MOVE	S1,G$PSTP##		;USE STANDARD FILE PROTECTION
		MOVEM	S1,TCB.IP(B)		;STORE PROTECTION CODE

	; PPN
	RUVL2:	MOVE	T1,[CPTRI ^D11,0(BUF)]	;POINT AT PROJ # (CP 11-16)
		HRRZI	T2,6			;6 CHARS, NO CONVERT
		HRL	T2,CVTTAB(LT)		;CONVERSION IF NECESSARY
		PUSHJ	P,STROCT		;GET A #
		JUMPF	.RETT			;NOT A NUMBER?
		MOVE	P2,S2			;SAVE PROJ # IN P2 FOR NOW
		MOVE	T1,[CPTRI ^D17,0(BUF)]	;POINT AT PROG # (CP 17-22)
		HRRZI	T2,6			;6 CHARS, NO CONVERSION
		HRL	T2,CVTTAB(LT)		;CONVERSION IF NECESSARY
		PUSHJ	P,STROCT		;CHANGE STRING TO OCTAL NUMBER
		JUMPF	.RETT			;NOT A NUMBER
		MOVE	T1,P1			;GET PROT IN T1
		HRRZ	T2,S2			;AND MAKE T2=PPN
		HRL	T2,P2			;...
		MOVEM	T2,TCB.VO(B)		;STORE OWNER (PPN) FOR LATER REFERENCE
		$RETT				;RETURN
	SUBTTL	L$MOUN - Routine to Process Mount Message
 REP 13/8	;08C4
		CAXE	LT,LT.BLP		;Is it bypass labels?
		$RETT				;Keep the ball rolling...
		MOVEI	S1,'REW'		;Get code for rewind
		PJRST	T$POS##			;And leave tape at load point
	SUBTTL	L$FINP -- Routine To Handle Call On First Input
 WIT
		MOVEI	S1,'REW'		;GET REWIND CODE
		JMPUNL	LT,T$POS##		;GO DO A REWIND IF UNLABELED
		MOVEI	S1,1			;ELSE SET INITIAL FILE
		STORE	S1,TCB.PS(B),TP.POS	; SEQUENCE NUMBER TO ONE
		PJRST	I$CLLP##		;AND ZAP THE LABEL PARAMETER BLOCK
	SUBTTL	L$FINP - Routine To Handle Call On First Input
 REP 1/10	;08C5
	SUBTTL	L$FOUT -- Routine to Process First Output Message
 WIT
	SUBTTL	L$FOUT - Routine to Process First Output Message
 REP 14/10	;08C6
		JUMPN	S1,FOUT.7		;YES, GIVE WRITE LOCK ERROR
 WIT
		JUMPN	S1,FOUT.9		;YES, GIVE WRITE LOCK ERROR
 REP 34/10	;08C7
		MOVEI	S1,[ITEXT (<Volume protection prohibits output>)]
 WIT
		TXNE	P2,TS.NOW		;WHOLE TAPE WRITE-PROTECTED?
		JRST	[PUSHJ	P,VPCCHK	;YES--CHECK WITH OPERATOR
			 JUMPF	FOUT.8		;OPR SAID ABORT
			 $RETT]			;DONE
 REP 45/10	;08C8
		MOVEI	S1,[ITEXT (<Volume protection prohibits output>)]
		PUSHJ	P,O$LERR##		;TELL OPR OF PROTECTION FAILURE
						;AND WAIT FOR HIS RESPONSE
		JUMPF	FOUT.7			;HE SAID ABORT
 WIT
		PUSHJ	P,VPCCHK		;QUERY OPERATOR IF NECESSARY
		JUMPF	FOUT.8			;GO ABORT (TERMINATION CODE SET)
						;ELSE PROCEED (TERMINATION CODE ZEROED)
 REP 86/10	;08C9
		ZERO	TCB.BC(B)		;CLEAR BLOCK COUNT
 WIT
		SETZM	TCB.BC(B)		;CLEAR BLOCK COUNT
 REP 99/10	;08C10
	FOUT.6:	SKIPA	S1,[LE.IOP]		;ILLEGAL OPERATION
	FOUT.7:	MOVEI	S1,LE.WLK		;SAY WRITE LOCK ERROR
 WIT
	FOUT.6:	MOVEI	S1,LE.IOP		;ILLEGAL OPERATION
		MOVEM	S1,G$TERM##		;SET TERMINATION CODE
		JRST	FOUT.8			;FINISH UP
	FOUT.7:	MOVEI	S1,LE.VPF		;ASSUME VOLUME PROTECTION FAILURE
		TXNE	P2,TS.EXP		;IS IT UNEXPIRED FILE ???
		MOVEI	S1,LE.UEF		;YES
		TXNE	P2,TS.WLK		;IS IT WRITE-LOCKED?
	FOUT.9:	MOVEI	S1,LE.WLK		;YES
 REP 1/11	;08C11
	SUBTTL	L$CLIN -- Routine to Process Input Close
 WIT
	SUBTTL	L$CLIN - Routine to Process Input Close
 REP 1/12	;08C12
	SUBTTL	L$CLOU -- Routine to Process Close Output
 WIT
	SUBTTL	L$CLOU - Routine to Process Close Output
 REP 17/12	;08C13
		STORE	S1,TCB.BC(B)		;SAVE IT IN TCB
 WIT
		ADDM	S1,TCB.BC(B)		;SAVE IT IN TCB
 REP 1/13	;08C14
	SUBTTL	L$EOT  -- Routine to Process EOT
 WIT
	SUBTTL	L$EOT - Routine to Process EOT
 REP 12/13	;08C15
		STORE	S1,TCB.BC(B)		;STORE IT IN THE TCB
 WIT
		ADDM	S1,TCB.BC(B)		;STORE IT IN THE TCB
 REP 1/14	;08C16
	SUBTTL	L$FEOV -- Process User Request to Force End Of Volume
 WIT
	SUBTTL	L$FEOV - Process User Request to Force End Of Volume
 REP 1/15	;08C17
		SUBTTL	L$TMAR -- Routine Called On Encountering a Tape Mark
 WIT
		SUBTTL	L$TMAR - Routine Called On Encountering a Tape Mark
 REP 1/18	;08C18
	SUBTTL	L$POSI -- MTAPE and TAPOP. Positioning functions
 WIT
	SUBTTL	L$POSI - MTAPE and TAPOP. Positioning functions
 REP 21/18	;08C19
	POS.1:	LOAD	S1,TCB.ST(B)		;Get status
 WIT
	POS.1:	MOVX	S1,TS.ILC		;ZAP THE INHIBIT
		ANDCAB	S1,TCB.ST(B)		; LABEL CLEAR BIT
 REP 54/18	;08C20
		LOAD	S1,TCB.IN(B)		;GET SAVED INFO FROM MESSAGE
		CAIE	S1,POSWBT		;Don't clear params on write blank tape
 WIT
		MOVX	S1,TS.ILC		;BIT TO TEST
		TDNN	S1,TCB.ST(B)		;INHIBIT LABEL PARAMETER CLEARING?
 INS 126/18	;08C21


	; HERE TO STORE TERMINATION CODE AND INHIBIT LABEL PARAMETER CLEAR
	PS.TRM:	MOVEM	S1,G$TERM##		;SAVE TERMINATION CODE
	PS.ILC:	MOVX	S1,TS.ILC		;INHIBIT LABEL PARAMETER BLOCK CLEARING
		IORM	S1,TCB.ST(B)		;DURING POST-POSITIONING CLEANUP
		POPJ	P,			;RETURN
 REP 10/20	;08C22
		JRST	WTM.3			;NO, GIVE ERROR
 WIT
		JRST	WTM.E			;NO, GIVE ERROR
		TXNN	P2,TS.OUT		;DOING OUTPUT?
		JRST	WTM.3			;NO--TRUNCATING TAPE
 REP 16/20	;08C23
		MOVX	S1,LE.EOF		;GET END OF FILE FOR TERMINATION CODE
		STORE	S1,G$TERM		;SET FOR USER
		$RETT				;FINE, EXIT

	WTM.3:	MOVEI	S1,LE.PSE		;FLAG POSITIONING ERROR
 WIT
		JRST	WTM.4			;FINISH UP

	WTM.3:	PUSHJ	P,L$FOUT		;TRUNCATING TAPE IMPLIES WRITE ACCESS
		JUMPF	.RETF			;PROPAGATE ERROR BACK
		MOVEI	S1,'BBL'		;BACKUP OVER
		PUSHJ	P,T$POS##		; THE TAPE MARK
		JUMPF	.RETF			;???
		MOVEI	S1,'BFL'		;BACKUP OVER THE HEADER RECORDS
		PUSHJ	P,T$POS##		; RECORDS WE JUST WROTE
		JUMPF	.RETF			;???
		PUSHJ	P,T$WRTM##		;WRITE A TAPE MARK
		PUSHJ	P,T$WRTM##		;ONE MORE
		MOVEI	S1,'BBL'		;BACKSPACE OVER THE LAST
		PUSHJ	P,T$POS##		; TAPE MARK SO SITTING AT LEOT
		JUMPF	.RETF			;???

	WTM.4:	MOVEI	S1,LE.EOF		;GET END OF FILE FOR TERMINATION CODE
		STORE	S1,G$TERM		;SET FOR USER
		$RETT				;ALL DONE

	WTM.E:	MOVEI	S1,LE.PSE		;FLAG POSITIONING ERROR
 REP 22/22	;08C24
		TXNE	P2,TS.ATM		;EOT
		PJRST	PS.BSF			;YES, DO BACKSPACE FILE OPERATION
 WIT
		TXZ	P2,TS.ATM		;CLEAR AFTER TAPE MARK
		TXO	P2,TS.IUD		;WILL BE IN USER DATA
		MOVEM	P2,TCB.ST(B)		;UPDATE

		JMPUNL	LT,BSR.2		;ONWARD IF UNLABELED
		MOVEI	S1,'BFL'		;NEED TO BACKSPACE
		PUSHJ	P,T$POS##		; OVER THE EOF RECORDS
		JUMPF	.RETF			;CHECK FOR ERRORS
		MOVEI	S1,'BFL'		;AND BACKUP OVER
		PUSHJ	P,T$POS##		; THE TAPE MARK TOO
		JUMPF	.RETF			;CHECK FOR ERRORS
		MOVEI	S1,'SBL'
		PUSHJ	P,T$POS##
		JUMPF	.RETF
		PUSHJ	P,T$RDRC##		;READ EOF1 LABEL
		JUMPF	.RETF			;CAN'T
		PUSHJ	P,VEREOF		;VERRIFY EOF, GET FILE NAME, ETC.
		JUMPF	.RETF			;NO GOOD
		LOAD	S1,TCB.PS(B),TP.POS	;GET POSITION
		SUBI	S1,2			;ACCOUNT FOR EOF CHECK AND FORWARD SKIP
		STORE	S1,TCB.PS(B),TP.POS	;UPDATE
		PUSHJ	P,I$STLP##		;SET LABEL PARAMETERS IN THE MONITOR
		MOVEI	S1,'BBL'		;BACKSPACE OVER
		PUSHJ	P,T$POS##		; THE TAPE MARK
		JUMPF	.RETF			;CAN'T
		MOVEI	S1,'BFL'		;BACKSPACE OVER
		PUSHJ	P,T$POS##		; THE EOF RECORDS
		JUMPF	.RETF			;CAN'T
		MOVE	S1,TCB.ST(B)		;GET STATUS WORD
		TXZ	S1,TS.ATM		;NO LONGER AFTER A TAPE MARK
		TXO	S1,TS.IUD		;POSITIONED IN USER DATA
		MOVEM	S1,TCB.ST(B)		;UPDATE
		PUSHJ	P,PS.ILC		;INHIBIT LABEL CLEAR
		$RETT				;RETURN AND LET USER APPEND TO THE FILE
 REP 43/23	;08C25
	SET.3:	MOVX	S1,<TI.LET>		;GET THE LEOT BIT
		IORM	S1,TCB.IO(B)		;TURN IT ON
		MOVX	S1,TS.ATM		;FLAG AFTER TAPE MARK
		IORM	S1,TCB.ST(B)		;IN THE TCB
		MOVEI	S1,LE.EOF		;RETURN EOF
 WIT
	SET.3:	MOVEI	S1,LE.EOF		;RETURN EOF
 REP 19/24	;08C26
		MOVEM	S1,G$TERM##		;SAVE FOR RELEASE
 WIT
		PUSHJ	P,PS.TRM		;SAVE AND INHIBIT LABEL CLEAR
 REP 23/24	;08C27
		MOVEM	S1,G$TERM##		;SAVE IT FOR RELEASE
 WIT
		PUSHJ	P,PS.TRM		;SAVE AND INHIBIT LABEL CLEAR
 REP 1/29	;08C28
	SUBTTL	L$USRQ -- Routine to Handle Label Request TAPOP.
 WIT
	SUBTTL	L$USRQ - Routine to Handle Label Request TAPOP.
 INS 1/31	;08C29
	SUBTTL	L$ABOR - Monitor request to abort current labeling operation


	; Here when the user types ^C while waiting for some tape labeler function
	; to complete, or when the monitor feels malicious and wants to screw some
	; unsuspecting user.  The intent of this code is to gracefully unwind the
	; TCB and get the user's job of event wait for the labeler.  Under extreme
	; circumstances, this might not work (hardware hangs, etc.).  For each type
	; of pending labeler request and TCB wait state, we'll attempt to unwind in
	; a safe fashion.

	L$ABOR::PUSHJ	P,T$OPEN##		;SO WE CAN DO A LABEL RELEASE
		JUMPF	.RETF			;FAILED
		MOVE	S1,TCB.WS(B)		;GET WAIT STATE CODE
		PUSHJ	P,@ABOTAB(S1)		;DO SPECIAL PRE-ABORT PROCESSING FIRST
		JUMPF	.RETF			;HMMM
		SETZM	TCB.WS(B)		;MARK TCB IDLE
		MOVX	S1,TI.ABO		;GET ABORT FLAG
		ANDCAM	S1,TCB.IO(B)		;CLEAR IT
		MOVEI	S1,LE.LRA		;LABELER REQUEST ABORTED BY RESET UUO
		MOVEM	S1,G$TERM##		;STORE TERMINATION CODE
		PJRST	T$RELE##		;CLEAR LABELER WAIT AND RETURN

	ABOSTP:	$STOP	(AIC,<Abort labeler request from illegal context>)

		EXP	.RETT			;WAITING TO RUN
	ABOTAB:	EXP	.RETT			;IGNORE
		EXP	ABOMNT			;MOUNT WAIT
		EXP	ABOLBL			;LABEL FAILURE (OPR INTERVENTION) WAIT
		EXP	.RETT			;OFFLINE WAIT
		EXP	ABOSTP			;WAITING FOR ANOTHER TCB
		EXP	ABOSTP			;NEW TAPE WAIT OR OPR RESPONSE
	ABOMAX==.-ABOTAB			;LENGTH OF TABLE

	IFN <TW.MAX-ABOMAX>,<
		PRINTX ? Missing abort code for labeler function(s)
		PASS2
		END
	>
	; TCB waiting for a mount
	ABOMNT:	PUSHJ	P,CANMDA		;CANCEL PENDING REEL SWITCH REQUEST
		$RETT				;RETURN


	; TCB waiting for operator intervention on a label failure
	ABOLBL:	MOVX	S1,TS.FSE		;GET A BIT
		ANDCAM	S1,TCB.S2(B)		;CLEAR FILE SEQUENCE ERROR PROCESSING
		MOVEI	S1,ABOTXT		;POINT TO REASON TEXT
		PJRST	O$KWTO##		;CANCEL WTOR AND RETURN

	ABOTXT:	ASCIZ	|Labeler operation aborted by a RESET UUO|
 REP 43/37	;08C30
	VLD.A5:	MOVEI	S1,[ITEXT (<Volume Protection Failure>)]
		PUSHJ	P,O$LERR##		;TYPE ERROR MESSAGE
						;WAIT FOR OPR RESPONSE
		JUMPF	.RETF			;IF ERROR RETURN NOW
 WIT
	VLD.A5:	PUSHJ	P,VPCCHK		;TELL OPR ABOUT VOL PROT FAILURE
		JUMPF	.RETF			;RESPONSE WAS ABORT
 REP 33/43	;08C31
		CAIN	T2,1			;Are we expecting first section?
		 MOVE	T2,S2			;Yes, expect anything
		CAME	T2,S2			;DO LABEL AND TCB AGREE?
		PJRST	HDS.2			;NO, WRONG SEQUENCE NUMBER
 WIT
		CAIN	T2,1			;ARE WE EXPECTING FIRST SECTION?
		MOVE	T2,S2			;YES, EXPECT ANYTHING
		CAMN	T2,S2			;DO LABEL AND TCB AGREE?
		JRST	HDS.1			;ALL IS WELL
		SKIPE	G$SEQC##		;HAVE WE ASKED THE OPERATOR?
		$WTO	(<HDR file sequence warning>,<Label says ^D/S2/ when looking for ^D/T2/>,TCB.OB(B),$WTFLG(WT.SJI))
 DEL 40/43	;08C32
	HDS.2:	MOVEI	S1,[ITEXT (<Incorrect File Sequence Number>)]
		SKIPA				;AFTER MESSAGE, LIKE OTHER ERROR
 INS 13/48	;08C33
		PUSHJ	P,I$BCNT##		;GET BLOCK COUNT SO FAR
		MOVEM	S1,TCB.BC(B)		;SAVE
 REP 44/50	;08C34
		JUMPT	.RETT			;RETURN GOOD
		MOVEI	S1,[ITEXT (<Invalid EOF1 Record>)] ;ASSUME EOF1 LABEL
 WIT
		JUMPF	EFL.0			;ERROR
		MOVX	S1,TS.OUT		;GET OUTPUT FLAG
		TDNE	S1,TCB.ST(B)		;DON'T COPY FILE NAME ON OUTPUT
		$RETT				;EXIT ON OUTPUT
		MOVE	T1,[CPTRI ^D5,0(BUF)]	;POINTER TO THE FILE NAME (CP 5-21)
		MOVE	T2,[POINT 7,TCB.FN(B)]	;WHERE TO STORE THE FILE NAME
		MOVEI	T3,^D17			;SEVENTEEN CHARACTERS
		HRL	T3,CVTTAB(LT)		;CONVERSION TYPE
		PUSHJ	P,STGSTR		;COPY THE STRING
		JUMPT	.RETT			;OK RETURN

	EFL.0:	MOVEI	S1,[ITEXT (<Invalid EOF1 Record>)] ;ASSUME EOF1 LABEL
 REP 49/51	;08C35

	EFS.1:	MOVEI	S1,[ITEXT (<Illegal File Sequence Number>)]
		SKIPA
	EFS.2:	MOVEI	S1,[ITEXT (<Incorrect File Sequence Number>)]
		PJRST	O$LERR##		;TELL THE OPR
						;WAIT FOR HIS ANSWER
 WIT
	EFS.1:	MOVEI	S1,[ITEXT (<Illegal File Sequence Number>)]
		PJRST	O$LERR##		;TELL THE OPR AND WAIT FOR HIS ANSWER

	EFS.2:	SKIPE	G$SEQC##		;HAVE WE ASKED THE OPERATOR?
		$WTO	(<EOF file sequence warning>,<Label says ^D/S2/ when looking for ^D/T2/>,TCB.OB(B),$WTFLG(WT.SJI))
		$RETT				;RETURN AND IGNORE THE ERROR
 REP 153/61	;08C36
		LOAD	T1,TCB.BC(B)		;GET BLOCK COUNT FROM TCB
 WIT
		MOVE	T1,TCB.BC(B)		;GET BLOCK COUNT FROM TCB
 REP 46/63	;08C37
		PUSHJ	P,I$GDEN##		;MAKE SURE WE HAVE THE DENSITY
 WIT
		PUSH	P,T2			;SAVE FROM DESTRUCTION
		PUSHJ	P,I$GDEN##		;MAKE SURE WE HAVE THE DENSITY
		POP	P,T2			;RESTORE BYTE POINTER TO LABEL BUFFER
 REP 57/63	;08C38
		MOVEI	T1,[POINT 7,[ASCIZ /0/]];ASSUME NO REEL SWITCH YET
	;	MOVX	T2,TCB.RS		;GET REEL SWITHC BIT
	;	TDNE	T2,TCB.XX(B)		;DID WE DO ONE?
	;	MOVEI	T1,[POINT 7,[ASCIZ /1/]];YES
 WIT
		PUSH	P,T2			;SAVE FROM DESTRUCTION
		MOVE	T1,[POINT 8,TCB.FV(B)]	;POINT TO THE FIRST REELID
		MOVE	T2,[POINT 8,TCB.VL(B)]	;POINT TO THE CURRENT REELID
		MOVEI	T4,6			;6 CHARACTERS
		HRL	T3,CVTTAB(LT)		;CONVERSION ROUTINE
		PUSHJ	P,STRCMP		;COMPARE
		POP	P,T2			;RESTORE BYTE POINTER TO BUFFER
		MOVE	T1,[POINT 7,[ASCIZ /0/]];ASSUME FIRST REEL IN VOLUME SET
		SKIPT				;IS IT?
		MOVE	T1,[POINT 7,[ASCIZ /1/]];NO--A CONTINUATION REEL
 INS 1/68	;08C39
	SUBTTL	Utility Routines -- Volume protection check


	; This routine is called whenever a volume protection error occurs.
	; The first time, the operator will be asked to abort or proceed
	; with the operation. The operator's response will be memorized
	; in the TCB so succeding errors can be handled without operator
	; intervention.

	VPCCHK:	LOAD	S1,TCB.S2(B),TS.VPC	;GET VOLUME PROTECTION CHECK STATUS
		JRST	@.+1(S1)		;DISPATCH
		EXP	VPCCH0			;ASK
		EXP	VPCCH1			;ABORT
		EXP	VPCCH2			;PROCEED
	VPCCH0:	MOVEI	S1,[ITEXT (<Volume protection failure>)]
		PUSHJ	P,O$LERR##		;TELL OPR OF PROTECTION FAILURE
		JUMPT	VPCCH2			;RESPONSE AS PROCEED
	VPCCH1:	MOVEI	S1,.TSABO		;GET ABORT CODE
		STORE	S1,TCB.S2(B),TS.VPC	;STORE
		MOVEI	S1,LE.VPF		;VOLUME PROTECTION FAILURE
		MOVEM	S1,G$TERM##		;SET TERMINATION CODE
		$RETF				;AND RETURN
	VPCCH2:	MOVEI	S1,.TSPRO		;PROCEED
		STORE	S1,TCB.S2(B),TS.VPC	;STORE
		SETZM	G$TERM##		;GIVE USER THE GREEN LIGHT
		$RETT				;AND PROCEED
 REP 4/72	;08C40
	;The routine does not wait for the request to be answered
 WIT
	;The routine does not wait for the request to be answered.
	;Enter at CANMDA to cancel pending volume switch request.
 REP 9/72	;08C41
	REQMDA:
		MOVEM	S2,RLVOL+.RLVCD		;Save the I/O flag
 WIT

	CANMDA:	MOVEI	S1,%RLABO		;ABORT PENDING REEL SWITCH
		MOVEI	S2,0			;NO JUNK PLEASE

	REQMDA:	MOVEM	S2,RLVOL+.RLVCD		;Save the I/O flag
 REP 17/73	;08C42
		LOAD	S1,TCB.RP(B),TP.RQP	;GET THE REQUEST POSITION
		LOAD	T1,TCB.PS(B),TP.POS	;GET THE ACTUAL POSITION
		CAME	S1,T1			;REQUESTING THE LAST FILE +1 (EOT)
		CAIN	S1,^D99999		;LOOKING FOR EOT
		JRST	POST.2			;YES, WE FOUND IT
		CAMG	S1,T1			;CHECK FOR GOING BACKWARD AT EOT
 WIT
		LOAD	T1,TCB.RP(B),TP.RQP	;GET THE REQUEST POSITION
		LOAD	S2,TCB.PS(B),TP.POS	;GET THE ACTUAL POSITION
		CAME	T1,S2			;REQUESTING THE LAST FILE +1 (EOT)
		CAIN	T1,^D99999		;LOOKING FOR EOT
		JRST	POST.2			;YES, WE FOUND IT
		PUSHJ	P,POSZER		;TELL OPR ABOUT SEQ NUM MISMATCH
		JUMPF	.POPJ			;OPR SAID ABORT
		CAIN	S1,PLR%PR		;PROCEED AND IGNORE SEQUENCE ERRORS?
		JRST	POST.2			;PRETEND AT RIGHT POSITION
		CAMG	T1,S2			;CHECK FOR GOING BACKWARD AT EOT
 INS 37/73	;08C43
		PUSHJ	P,POSZER		;TELL OPR ABOUT SEQ NUM MISMATCH
		JUMPF	.POPJ			;OPR SAID ABORT
		CAIN	S1,PLR%PR		;PROCEED AND IGNORE SEQUENCE ERRORS?
		JRST	POST.1			;PRETEND AT RIGHT POSITION
 INS 1/75	;08C44
	; Routine to notify the operator about a sequence number mismatch.
	POSZER:	MOVE	S1,G$SEQC##		;GET CODE TO PROCESS SEQUENCE ERRORS
		CAIN	S1,PLR%AB		;ABORT USER JOB?
		JRST	PS.BAD			;YES
		CAIE	S1,PLR%PR		;PROCEED AND IGNORE SEQUENCE ERRORS?
		CAIN	S1,PLR%RT		;RETRY SEARCH FOR CORRECT SEQ NUM?
		JRST	POSZ.2			;YES

	POSZ.1:	MOVX	S1,TS.FSE		;GET A BIT
		IORM	S1,TCB.S2(B)		;FLAG FILE SEQUENCE ERROR PROCESSING
		MOVEI	S1,POSTX1		;POINT TO INTRODUCTORY TEXT
		MOVEI	S2,POSTX2		;POINT TO MAIN TEXT
		PUSHJ	P,O$LERT##		;ASK THE OPERATOR WHAT TO DO
		MOVX	S2,TS.FSE		;GET BIT AGAIN
		ANDCAM	S2,TCB.S2(B)		;CLEAR IT
		CAIN	S1,PLR%TY		;WANT TO RETYPE THE MESSAGE?
		JRST	POSZER			;STUPID OPR DOESN'T KNOW HOW TO RESPOND
		JUMPF	PS.BAD			;OPR SAID ABORT

	POSZ.2:	LOAD	S2,TCB.PS(B),TP.POS	;RELOAD CURRENT POSITION
		LOAD	T1,TCB.RP(B),TP.RQP	;RELOAD REQUESTED POSITION
		CAIE	S1,PLR%PR		;OPR TYPE PROCEED?
		$RETT				;NO--RETURN WITH PLR%RT IN S1
		CAML	T1,S2			;WHICH ONE IS SMALLER
		MOVE	T1,S2			;S2 IS
		CAIL	T1,0			;OUT OF RANGE?
		CAILE	T1,^D999		;MUST BE A LEGAL SEQUENCE NUMBER
		MOVEI	T1,1			;MAKE IT REASONABLE
		STORE	T1,TCB.PS(B),TP.POS	;RESET TO CREATE FILE.001
		STORE	T1,TCB.RP(B),TP.RQP	;SET REQUESTED POSITION TO MATCH
		$RETT				;RETURN WITH PLR%PR IN S1

	POSTX1:	ITEXT	(<File sequence number error; label says ^D/TCB.PS(B),TP.POS/ when looking for ^D/TCB.RP(B),TP.RQP/>)
	POSTX2:	ITEXT	(<Type 'RESPOND ^I/number/ ABORT' to terminate this operation
	Type 'RESPOND ^I/number/ PROCEED' to ignore the error and continue
	Type 'RESPOND ^I/number/ RETRY' to search again for correct file>)
 INS 5/81	;08C45
	L$CVTT::
 SUM 246837