.MCALL .MODULE .MODULE DUPVOL,VERSION=08,COMMENT=,IDENT=NO ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .ENABL LC,GBL .SBTTL PSECT definitions .IIF NDF MDUP, MDUP = 0 ;Default to no MDUP .IIF NDF M$UPD, M$UPD = 0 ;Default to no MDUP Update .IIF NDF SDC, SDC = 0 ;Default to no SDCOPY .IIF NDF MINC, MINC = 0 ;Default to no MUTIL PSECT PURE ;Pure data PSECT PUREB ;[byte] Pure data PSECT VOLID ;Code psect PSECT PATCH ;Patch psect .BLKW 32. PSECT PUREB .NLIST BEX MSGVIC: .ASCII \/Volume ID change\<200> MSGVOL: .ASCII \Volume ID? \<200> MSGOWN: .ASCII \Owner? \<200> MSGVID: .ASCIZ \Volume ID: \ MSGONR: .ASCIZ \Owner : \ MSGSIX: .ASCII \six \<200> MSGTEN: .ASCII \ten \<200> MSGTWV: .ASCII \twelve \<200> ;+ ;ERROR .IF EQ MDUP MSGDUP: .ASCII \?DUP-W-\<200> .IFF ;EQ MDUP MSGDUP: .ASCII \?MDUP-W-\<200> .ENDC ;EQ MDUP MSGVER: .ASCII \Volume ID \<200> MSGOER: .ASCII \Owner name \<200> MSGTRU: .ASCII \truncated at \<200> MSGCHR: .ASCIZ \characters\ ;- .LIST BEX PSECT PURE DKVOLS: ;Disk vol id/owner name data .WORD MSGTWV ; -> truncation message for vol id .WORD DK.VLN ; length of vol id .WORD DK.VID ; offset to vol id in homeblock .WORD MSGTWV ; -> truncation message for owner name .WORD DK.VLN ; length of owner name .WORD DK.OWN ; offset to owner name in homeblock MTVOLS: ;Magtape vol id/owner name data .WORD MSGSIX ; -> truncation message for vol id .WORD MT.VLN ; length of vol id .WORD MT.VID ; offset of vol id in VOL1 label .WORD MSGTEN ; -> truncation message for owner name .WORD MT.OLN ; length of owner name .WORD MT.OWN ; offset of owner name in VOL1 label .NLIST BEX HOME0: .WORD HOME2-HOME0-4,351*2 .WORD 1 ;Word 351 ;Pack cluster size .WORD 6 ;Word 352 ;Start block number of directories .RAD50 \V05\ ;Word 353 ;System version number HOME2: .WORD HOME3-HOME2-4,370*2 .ASCII \DECRT11A \ ;Word 370-375 ;Pack format type HOME3: .EVEN .SBTTL VOLID - Set up or print VOLUME ID and OWNER name ;+ ; VOLID ; This routine either sets up or prints the volume id and owner name of a ; disk or magtape. ; ; * NOTE * NOTE * NOTE * NOTE * NOTE * NOTE * NOTE * NOTE * NOTE * NOTE * ; All registers must be preserved because the overlay may be called by the ; INITIALIZE overlay. ; * NOTE * NOTE * NOTE * NOTE * NOTE * NOTE * NOTE * NOTE * NOTE * NOTE * ; ; FL.ONL set in $AFLAG => vol id change ; FL.ZRO set in $AFLAG => called by INITIALIZE and the homeblock or ; VOL1 label is in core pointed to by IBFBEG ; else print the vol id and owner name ; ; JSR PC,VOLID ; ; CMDBUF modified ; IBFBEG may be modified ;- ORIGIN VOLID VOLID:: SAVE05 ;Preserve all registers MOV $OSFLG,R2 ;R2 = output file/device flag MOV #OUTFIL,R3 ;R3 -> output filename MOV #OCHAN,R4 ;R4 = output channel number BIT #FLG.DV,R2 ;Was an output file specified? BNE 1$ ;Yes. We'll do the vol id for it MOV $ISFLG,R2 ;R2 = input file/device flag MOV #INFILE,R3 ;R3 -> input filename MOV #ICHAN,R4 ;R4 = input channel number 1$: MOV #DKVOLS,R5 ;Assume we're doing a disk BIT #FL.ZRO,$AFLAG ;Called via INITIALIZE/VOL? BNE 3$ ;Branch if so BIT #FL.ONL,$AFLAG ;/VOL:ONLY? BEQ 2$ ;Branch if not. No need for "are you sure" SURE #INFILE,#MSGVIC ;Ask if he's sure. BNE 9$ ;Branch if he isn't 2$: BIT #DEV.CT,R2 ;Doing a volume ID on cassette? BNE 9$ ;No-go. Just return. WAIT #WAITIN,#INFILE ;Wait for the device to be mounted 3$: BIT #DEV.MT,R2 ;Are we doing a magtape? BEQ 7$ ;Branch if not .SPFUN #IOAREA,R4,#SF.RWD,#0,#0,#0,#0 ;Rewind the magtape BCC 6$ ;Branch if no error ;+ ;ERROR 4$: MOV #FE.EOF,R1 ;Assume unexpected EOF MOVB @#S$EERB,R0 ;Get the error byte BEQ 5$ ;Branch if EOF MOV #FE.INE,R1 ;Assume input error DEC R0 ;Was it? BEQ 5$ ;Branch if so MOV #FE.CNO,R1 ;Channel not open! 5$: .ERR #ERAREA,R1,LEVEL=FATAL,RETURN=NO,FILE=R3 ; <-F-Unexpected EOF dev:filename> ; <-F-Input error dev:filename> ; <-F-Channel not open dev:filename> ; <-F-Output error dev:filename> ;- 6$: MOV #MTVOLS,R5 ;R5 -> magtape vol id data 7$: BIT #FL.ZRO,$AFLAG ;Initializing the device? BNE 10$ ;Branch if so. Homeblock/VOL1 label in core .GTCOR #512. ;Allocate some memory for I/O buffer BCC 8$ ;Branch if no error ;+ ;ERROR .ERR #ERAREA,#FE.NOM,LEVEL=FATAL,RETURN=NO ;- 8$: MOV R0,IBFBEG ;Save the pointer to the buffer BIC #777,R1 ;Get rid of ugly bits ASR R1 ;Make byte count a word count READ #IOAREA,R4,IBFBEG,R1,#HOMBLK ;Get homeblock or VOL1 label BCS 4$ ;Branch on error BIT #FL.ONL,$AFLAG ;/VOL:ONL? BNE 10$ ;Branch if so CALL PRTLIN ;Ouput vol id and owner name to terminal 9$: BR 12$ ; 10$: CALL GETLIN ;Get and store the vol id and owner BIT #FL.ONL,$AFLAG ;/VOL:ONL? BEQ 12$ ;Branch if not MOV IBFBEG,R5 ;R5 -> homeblock buffer CMP #BAD$ID,DK.RX1(R5) ;Is disk a corrupted DW? BEQ 11$ ;Branch if yes MOV #GOD$ID,DK.RX1(R5) ;Setup RT/RSX word 1 11$: CLR DK.RX2(R5) ;Clear RT/RSX word 2 MOV #HOME0,R0 ;Set up home block part I CALL SETHOM ;Do it MOV #HOME2,R0 ;Set up home block part III CALL SETHOM ;Do it CALL CKSMHB ;Fix checksum on home block WRITE #IOAREA,R4,IBFBEG,R1,#HOMBLK ;Write the homeblock back BCC 12$ ;Branch if no error ;+ ;ERROR MOV #FE.OPE,R1 ;Assume output error CMPB @#S$EERB,#1 ;Was it? BEQ 5$ ;Branch if so ;- BR 4$ ;Else it was something else 12$: RETURN .SBTTL PRTLIN - Print the vol id and owner name ;+ ; PRTLIN ; This routine is called when the /V option was given alone on a line. ; ; R5 -> vol id, owner name data for device ; IBFBEG -> input buffer containing homeblock or VOL1 label ; ; JSR PC,PRTLIN ;- PRTLIN: SAVE05 ;Preserve all registers MOV #MSGVID,R1 ;Print the volume id CALL 1$ ;Go do it MOV #MSGONR,R1 ;Print the owner name ;*Fall thru and return to caller 1$: TST (R5)+ ;Skip the error message word MOV #CMDBUF,R3 ;R3 -> output buffer MOV R3,R4 ;Copy it 2$: MOVB (R1)+,(R4)+ ;Copy first half of line BNE 2$ ;It's ASCIZ TSTB -(R4) ;Back up over the 0 MOV (R5)+,R1 ;R1 = length of vol id or owner name MOV (R5)+,R2 ;R2 offset into buffer to data ADD IBFBEG,R2 ;R2 -> vol id or owner name 3$: MOVB (R2)+,(R4)+ ;Copy the data SOB R1,3$ ;Copy all of it CLRB (R4)+ ;Make the string ASCIZ .PRINT R3 ;Print it RETURN .SBTTL GETLIN - Collect the vol id and owner name ;+ ; GETLIN ; This routine collects the vol id and owner name. If the input is longer ; than allowed, it is truncated. If it is shorter, it is blank padded on ; the right to the maximum number of characters. ; ; R5 -> vol id and owner name data ; IBFBEG -> buffer containing homeblock or VOL1 label ; ; JSR PC,GETLIN ;- GETLIN: SAVE05 ;Preserve all registers MOV #MSGVOL,R1 ;R1 -> vol id prompt MOV #MSGVER,R2 ;R2 -> vol id part of truncation error message CALL 1$ ;Get the vol id MOV #MSGOWN,R1 ;R1 -> owner prompt MOV #MSGOER,R2 ;R2 -> owner part of truncation error message ;*Fall thru and collect owner name 1$: BIS #,@#S$JSW ;Lower case ;Non-terminating .GTLIN MOV #CMDBUF,R3 ;R3 -> input buffer .RCTRLO ;Force lower case (we hope) .GTLIN R3,R1 ;Get the command line MOV (R5)+,R4 ;R4 -> part of truncation error message MOV (R5)+,R1 ;R1 = max allowed length of string MOV (R5)+,R0 ;R0 = offset into buffer for sting ADD IBFBEG,R0 ;R0 -> storage place for string 2$: MOVB (R3)+,(R0)+ ;Store the character BEQ 3$ ;Branch if done SOB R1,2$ ;Get all the characters TSTB @R3 ;Any characters left? BEQ 5$ ;Branch if not. Done ;+ ;ERROR .PRINT #MSGDUP ;Print "?DUP-W- .PRINT R2 ;Print "Volume ID" or "Owner name" .PRINT #MSGTRU ;Print "truncated at" .PRINT R4 ;Print "twelve" or "ten" or "six" .PRINT #MSGCHR ;Print "characters" ;- BISB #UE.WRN,@#S$UERB ;Set the warning bit in the user error byte BR 5$ ; 3$: TSTB -(R0) ;Back up the output pointer 4$: MOVB #BLANK,(R0)+ ;Store a blank SOB R1,4$ ;Till the field is filled 5$: BIC #,@#S$JSW ;No lc; Terminating .GTLIN RETURN .SBTTL SETHOM - Set Up Home Block Buffer ;+ ; SETHOM ; This routine sets up data in the home block buffer. ; ; R0 -> .WORD size of data in bytes ; .WORD offset into home block for data ; .BLKB data ; R5 -> home block buffer ; ; CALL SETHOM ;- SETHOM: SAVE02 ;Save volatile registers MOV (R0)+,R1 ;R1 = size of data to move MOV (R0)+,R2 ;R2 = offset from start of home block ADD R5,R2 ;Make it absolute 1$: MOVB (R0)+,(R2)+ ;Move a byte SOB R1,1$ ;Loop RETURN .END