.Title TAPE_COPY_READ ; Program tape copy, read tape part ; Written by: Frank Penner ; January 1983 .PSECT FRANKI,WRT,NOEXE,LONG OUTFAB: $FAB FAC=PUT - ;only puts on out file FNM= ;FAB for out file OUTRAB: $RAB FAB=OUTFAB - ;FAB for this RAB RBF=TAPEBUF ;address of buffer for I/O COMMLD: .ASCID / / ;space for typed in tape drive name PROMPTD:.ASCID /tape drive name: / ;prompt string CHANMT: .WORD 0 ;space for terminal channel number IOSB: .QUAD 0 TAPEBUF:.BLKB 32767 .PSECT FRANKP,NOWRT,EXE,LONG,SHR ERRORB: JMP ERROR ;for branch out of range .ENTRY START,^M<> ;start of program CLRL R3 ;clear end of file flag PUSHAW COMMLD ;address of word to get read byte count PUSHAL PROMPTD ;address of prompt string descriptor PUSHAL COMMLD ;address of descriptor to get command CALLS #3,G^LIB$GET_FOREIGN ;use run time library to get command BLBC R0,ERRORB ;low bit clear error $ASSIGN_S DEVNAM=COMMLD- ,CHAN=CHANMT ;assign typed tape drive to a chan BLBC R0,ERRORB ;low bit clear error $CREATE FAB=OUTFAB - ;create output file ERR=ERRORB $CONNECT RAB=OUTRAB - ;connect output file ERR=ERRORB AGAIN: $QIOW_S CHAN=CHANMT- ;magtape ,FUNC=#IO$_READLBLK- ;read logical block ,IOSB=IOSB- ;status return here ,P1=TAPEBUF- ;data goes here ,P2=#32767 ;number of bytes to read BLBC R0,ERROR ;low bit clear error CMPW #SS$_ENDOFFILE,IOSB ;end of file? BEQL EOF ;if equal yes BLBC IOSB,ERRORI ;branch on any other error CLRL R3 ;clear end of file flag EOFRET: ;come here from one end of file $RAB_STORE RAB=OUTRAB - ;put length of read tape block RSZ=IOSB+2 ;in out file RAB $PUT RAB=OUTRAB ;write log record BLBC R0,ERROR ;low bit clear error BRW AGAIN EOF: TSTL R3 ;check end of file flag BNEQ EXIT ;if not equal, 2 end of files in a row INCL R3 ;set eof flag JMP EOFRET ;only one eof, go do more EXIT: $CLOSE FAB=OUTFAB - ;close file ERR=ERROR ERROR: $EXIT_S R0 ;exit with error if any ERRORI: MOVZWL IOSB,R0 ;put error status in R0 BRB ERROR ;take normal exit .END START ;end of program