	.TITLE	PROGRAM TO CHECK THAT THE RIGHT TAPE IS MOUNTED
CM=-2		/COMMAND INPUT .DAT
TP=17		/TAPE .DAT
TT=-3		/COMMAND OUTPUT .DAT
	.IODEV	CM,TP,TT
	.GLOBL	FSTAT		/FORTRAN .FSTAT ROUTINE
START	.READ	CM,2,BUF,10	/READ FILE NAME AND TAPE #
	.WAIT	CM		/NOT REALLY NECESSARY
TRY	JMS*	FSTAT		/DO THE FSTAT
	JMP	.+1+3
	.DSA	(TP)		/ON THIS .DAT
	.DSA	BUF+2		/NAME IN 5/7
	.DSA	I		/WHERE TO PUT THE RESULT
	LAC	I#		/IS THE FILE THERE?
	SZA			/SKIP IF NO
	JMP	EXIT		/YES, JUST QUIT QUIETLY
	.WRITE	TT,2,ERR,14	/TYPE ERROR
	LAW	777760		/NO, ASK USER TO MOUNT IT
	AND	BUF+6		/ BY TAPE NUMBER
	IAC			/FOR THE ENDING CR
	DAC	MSG+12		/PUT IT IN MESSAGE
	.INIT	TT,1,TRY	/SET UP ^P ADDR
PMPT	.WRITE	TT,2,MSG,14	/TYPE ON CONSOLE TTY
	.WRITE	TT,2,CTLP,10	/TELL HIM TO HIT Y WHEN READY
	.WAIT	TT		/WAIT
	.READ	TT,2,ANS,4	/READ ANSWER
	.WAIT	TT
	LAW	774000		/CHECK HIS REPLY
	AND	ANS+2
	SAD	(131*4000)	/ IS IT A 'Y'
	JMP	TRY		/YES
	JMP	PMPT		/NO, ASK AGAIN
/
/
EXIT	.EXIT			/RIGHT TAPE, CONTINUE
/
/
BUF	.BLOCK	10		/REQUIRED TAPE INFO
MSG	CTLP-MSG/2*1000+2	/ERROR MESSAGE
	0
	.ASCII	'-PLEASE MOUNT TAPE #XX'<15>
CTLP	END-CTLP/2*1000+2	/^P ROMPT MESSAGE
	0
	.ASCII	'-TYPE "Y",CR WHEN READY'<15>
END=.
ERR	ANS-ERR/2*1000+2
	0
	.ASCII	'-WRONG TAPE MOUNTED'<15>
ANS	.BLOCK	4
	.END
