.Title TAPE_COPY_WRITE ; Program tape copy, write tape part ; Written by: Frank Penner ; January 1983 .PSECT FRANKI,WRT,NOEXE,LONG INFAB: $FAB FAC=GET - ;only puts on in file FNM= ;FAB for in file INRAB: $RAB FAB=INFAB - ;FAB for this RAB UBF=RECBUF - ;address of buffer for I/O USZ=32767 ;size of buffer 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 RECBUF:.BLKB 32767 .PSECT FRANKP,NOWRT,EXE,LONG,SHR ERRORB: JMP ERROR ;for branch out of range .ENTRY START,^M<> ;start of program 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 $OPEN FAB=INFAB - ;open input file ERR=ERRORB $CONNECT RAB=INRAB - ;connect input file ERR=ERRORB AGAIN: $GET RAB=INRAB ;get record CMPL #RMS$_EOF,R0 ;end of file? BEQL EXIT ;if equal yes BLBC R0,ERRORB ;low bit clear error TSTW INRAB+RAB$W_RSZ ;check for 0 byte record BEQL NULLREC ;if 0 write end of file marker $QIOW_S CHAN=CHANMT- ;magtape ,FUNC=#IO$_WRITELBLK- ;write logical block ,IOSB=IOSB- ;status return here ,P1=@INRAB+RAB$L_RBF- ;data comes from here ,P2=INRAB+RAB$W_RSZ ;number of bytes to read BLBC R0,ERROR ;low bit clear error BLBC IOSB,ERRORI ;branch on any other error BRB AGAIN NULLREC:$QIOW_S CHAN=CHANMT- ;magtape ,FUNC=#IO$_WRITEOF- ;write end of file ,IOSB=IOSB ;status return here BLBC R0,ERROR ;low bit clear error BLBC IOSB,ERRORI ;branch on any other error BRW AGAIN EXIT: $CLOSE FAB=INFAB - ;close file ERR=ERROR $QIOW_S CHAN=CHANMT- ;magtape ,FUNC=#IO$_WRITEOF- ;write end of file ,IOSB=IOSB ;status return here BLBC R0,ERROR ;low bit clear error BLBC IOSB,ERRORI ;branch on any other error ERROR: $EXIT_S R0 ;exit with error if any ERRORI: MOVZWL IOSB,R0 ;put io status error in R0 BRB ERROR .END START ;end of program