AVD.MAC/AU/-BF=AVD.VGN -3,3,/;RAW002/ \ .ENABL LC .NLIST BEX .IDENT /V02.00/ ID: .ASCIZ /%NAVD -- Version V02.00/ .EVEN -29,,/;RAW002/ ; ; ;****************************************************************************** ; ; This software is provided on an "as is" basis only. Caterpillar Tractor Co., ; disclaims all warranties on the program, including without limitation, all ; implied warranties of merchantablity and fitness. ; ; Full permission and consent is hereby given to DECUS and to the DECUS ; special interest groups to reproduce, distribute, and publish and permit ; others to reproduce in whole or in part, in any form and without restriction ; this program and any information relating thereto ; ;****************************************************************************** ; ; V02.00 ; RAW001 1/14/82 ; Modified by Rick Webster, Process Control Applications ; MSDGO, Caterpillar Tractor Co. ; The VD driver required that I/O request lengths be a ; multiple of 4 even if the real disk driver did not. ; This is now eliminated by copying the modulo bits ; from the U.CTL byte of the real disk to U.CTL of the ; newly assigned virtual disk. ; ; RAW002 10/11/82 ; Modified by Rick Webster, Process Control Applications ; MSDGO, Caterpillar Tractor Co. ; Added capability of searching for an offline virtual ; disk unit if no explicit VD was specified in command ; line. Changed messages to upper and lower case, plus ; added message numbers. Used the exit with status to ; report error message numbers as well as the disk unit ; that was selected if the search was performed by AVD. ; Added a check so that the same file can not be assigned ; to different VD units simultaneously. Changed AVD so that ; it no longer locks files. Added switches to allow ; creation of RX01, RX02, RL01 and RL02 size virtual disks. ; Also added a switch to disable printing of messages. ; Added placement control via the /PL switch. This patch ; was taken from the patch on the Fall '81 DECUS tape ; submitted in UIC [370,20] by L.M. Fraser. ; ; ; % -41,,/;RAW002/ .MCALL DCBDF$ ;Define DCB offsets DCBDF$ -47,47,/;RAW002/ .MCALL EXST$S ;EXIT WITH STATUS -90,,/;RAW002/ .GLOBL $EDMSG ;Edit message -106,,/;RAW002/ .GLOBL $DEVHD ;Device list head -112,115,/;RAW002/ .MACRO FATAL MSG,MSGNUM MOV #MSGNUM,EXSTAT TRAP 1 .ASCIZ #Error MSGNUM, MSG# -142,,/;RAW002/ ; ; *** EDMWRT MACRO TO USE $EDMSG TO FORMAT A MESSAGE ; .MACRO EDMWRT INSTR,ARGBLK MOV R0,-(SP) MOV R1,-(SP) MOV R2,-(SP) MOV INSTR,R1 ;ADDRESS OF INPUT STRING MOV ARGBLK,R2 ;ADDRESS OF ARGUMENT BLOCK CALL EDMWRT ;GO CALL $EDMSG AND OUTPUT MESSAGE MOV (SP)+,R2 MOV (SP)+,R1 MOV (SP)+,R0 .ENDM -159,,/;RAW002/ FL.RL1 = 10 ;Create RL01 image FL.RL2 = 20 ;Create RL02 image FL.RX1 = 40 ;Create RX01 image FL.RX2 = 100 ;Create RX02 image FL.NMS = 200 ;Disable AVD messages FL.IDV = 400 ;Report program vesion number FL.PLA = 1000 ;Specify placement control ; EX.ALL = 20 ;Placement control enable bit ; -173,,/;RAW002/ EDMQIO: QIOW$ IO.WVB,TTYLUN,EV.QIO,,,,<0,0,0,0,0,0> -179,181,/;RAW002/ ASNMSG: .ASCIZ /%NAVD -- VD%Q: has been assigned to file %X%N/ FAAMSG: .ASCIZ /%NAVD -- File %X, already assigned to VD%Q:%N/ .EVEN ; ; SST VECTOR TABLE. -201,,/;RAW002/ CSI$SW RL01,FL.RL1,,SET,,,EXACT CSI$SW RL02,FL.RL2,,SET,,,EXACT CSI$SW RX01,FL.RX1,,SET,,,EXACT CSI$SW RX02,FL.RX2,,SET,,,EXACT CSI$SW NM,FL.NMS,,SET,, CSI$SW ID,FL.IDV,,SET,, CSI$SW PL,FL.PLA,,SET,,PLAVAL -204,,/;RAW002/ PLAVAL: CSI$SV ASCII,PLASTR,8. CSI$ND -217,,/;RAW002/ ; Placement control prefix for create list (must be first) ; PLALST: .BYTE 16,6 .WORD PLACE ; -228,,/;RAW002/ ; Placement control block ; PLACE: .BYTE 0,0 ;Placement by exact LBN, no report .WORD 0 ;High block number .WORD 0 ;Low block number .BLKW 4 ;Info return area (not used) ; -241,241,/;RAW002/ WATATT: .BYTE 200 ;MARK CONTIGIOUS -250,,/;RAW002/ FAAERR: .WORD 0 ;Flag, set UCBLTH: .WORD 0 ;UCB length CMDLTH: .WORD 0 ;Length of command line EXSTAT: .WORD 0 ;Exit status VDUNIT: .WORD 0 ;VD unit number SCHFLG: .WORD 0 ;Flag, set if auto VD search desired ARGBLK: .BLKW 12. ;Argument block for $EDMSG PLASTR: .BLKB 8. ;Disk location string PLABLK: .BLKW 2 ;Disk location number -270,280,/;RAW002/ \ ; MCR command line in form shown below. ; ; AVD VDn:=file[/sw] ; or ; AVD file[/sw] ; ; The first form will assign a particular VD unit to ; the file. The second form will assign the first ; available offline VD to the file. ; ; VDn: Virtual disk to assign. ; file File to be used as virtual disk ; /sw Switches - one of following ; ; /CR:n Create file with n blocks ; /RK Create file with 4800 blocks (RK05) ; /RO Allow only read access ; /NM Do not print messages ; /RL01 Create file with 10240 blocks (RL01) ; /RL02 Create file with 20480 blocks (RL02) ; /RX01 Create file with 494 blocks (RX01) ; /RX02 Create file with 988 blocks (RX02) -284,285,/;RAW002/ ; Virtual disk assigned to file or error message ; output to user's terminal. Exit status will contain ; the error message number (101 - 121 octal) if an error ; occurred. If an auto VD search is done, the exit ; status will contain the unit selected plus 200 octal. ; Otherwise exit status will be 1 if no errors occur. % -306,306,/;RAW002/ FATAL ,101 ;DECLARE ERROR -311,,/;RAW002/ MOV $DSW,CMDLTH ;Save length of command line -315,315,/;RAW002/ FATAL ,102 ;DECLARE ERROR -321,325,/;RAW002/ BCC 1205$ ; IF CC - OK, CONTINUE FATAL ,103 ;DECLARE ERROR 1205$: CLR SCHFLG ;Assume auto search not desired BITB #CS.EQU,C.STAT(R0) ;IS THERE AN EQUAL SIGN? BEQ 1210$ ;No - branch to auto search JMP 1300$ ;Yes - branch 1210$: INC SCHFLG ;Auto search is desired CSI$2 #CSIBLK,OUTPUT,#SWTTAB ;Get file specification & switches BCC 1212$ ;Branch if successful 1211$: JMP 1510$ ;Go output error message 1212$: BIT #FL.IDV,CSIBLK+C.MKW1 ;Program version requested BEQ 1213$ ;No - branch JMP SHOWID ;Yes - go display version and exit 1213$: BITB #CS.MOR!CS.WLD,C.STAT(R0) ;Better not be more files or wildcards BNE 1211$ ;There was, go display error MOV $DEVHD,R5 ;R5 points to device list head 1215$: CMP D.NAM(R5),#"VD ;Is this a VD DCB? BEQ 1220$ ;Yes - branch MOV D.LNK(R5),R5 ;No - get next DCB BNE 1215$ ;Any left? FATAL ,104 ;No - output error 1220$: MOVB D.UNIT+1(R5),R2 ;R2 has highest unit number BIC #177400,R2 ;Clear out sign extend, if any MOVB D.UNIT(R5),R3 ;R3 has lowest unit number BIC #177400,R3 ;Clear out sign extend, if any SUB R3,R2 ;R2 now has the number of INC R2 ; VD units to search MOV D.UCBL(R5),UCBLTH ;Save UCB length MOV D.UCB(R5),R5 ;R5 points to first UCB 1225$: BITB #US.OFL,U.ST2(R5) ;Is this VD offline? BEQ 1250$ ;No - keep looking MOVB U.UNIT(R5),R1 ;Yes, R1 gets unit number MOV R1,EXSTAT ;Save for use in exit status ALUN$S #TSTLUN,#"VD,R1 ;Assign lun to VD to be assigned BCS 1230$ ;Branch on error JMP 1600$ ;Branch on success 1230$: FATAL ,105 ;Display error 1250$: ADD UCBLTH,R5 ;Step to next VD UCB SOB R2,1225$ ;Any left? FATAL ,106 ;No - output error -331,331,/;RAW002/ BIT #FL.IDV,CSIBLK+C.MKW1 ;Program version requested BEQ 1301$ ;No - branch JMP SHOWID ;Yes - go display version and exit 1301$: BITB #CS.NMF!CS.DIF!CS.MOR,C.STAT(R0) ;IS OUTPUT ONLY DEVICE? -343,343,/;RAW002/ 1310$: FATAL ,107 -349,349,/;RAW002/ FATAL ,105 ;DECLARE ERROR -357,357,/;RAW002/ 1510$: FATAL ,110 ;DECLARE ERROR -367,367,/;RAW002/ FATAL ,111 ;DECLARE ERROR -385,390,/;RAW002/ FATAL ,112 ;DECLARE ERROR 2030$: TST EXTADR ;WAS EXTENSION BLOCK ALLOCATED? BNE 3000$ ; IF NE - YES, CONTINUE FATAL ,113 ;DECLARE ERROR ; ; IF /CR, /RK, /RL01, /RL02, /RX01 or RX02 specified, create new file. -400,400,/;RAW002/ JMP 3030$ ; IF NO NULL, BAD SIZE STRING -410,413,/;RAW002/ 3003$: MOV #4800.,R0 ;Assume RK05 to be created BIT #FL.RK5,CSIBLK+C.MKW1 ;IS RK05 CREATION REQUESTED? BNE 3009$ ;Yes - branch MOV #10240.,R0 ;Assume RL01 to be created BIT #FL.RL1,CSIBLK+C.MKW1 ;Is RL01 creation requested? BNE 3009$ ;Yes - branch MOV #20480.,R0 ;Assume RL02 to be created BIT #FL.RL2,CSIBLK+C.MKW1 ;Is RL02 creation requested? BNE 3009$ ;Yes - branch MOV #494.,R0 ;Assume RX01 to be created BIT #FL.RX1,CSIBLK+C.MKW1 ;Is RX01 creation requested? BNE 3009$ ;Yes - branch MOV #988.,R0 ;Assume RX02 to be created BIT #FL.RX2,CSIBLK+C.MKW1 ;Is RX02 creation requested? BEQ 4000$ ;No - branch 3009$: CLR R1 ; CLEAR HIGH ORDER SIZE -417,417,/;RAW002/ MOVB R1,FILFDB+F.HIBK+0 ; AND HIGH-PART ALSO -420,,/;RAW002/ ; BIT #FL.PLA,CSIBLK+C.MKW1 ;Placement desired? BEQ 3019$ ;If eq, no MOV #PLALST,CREDPB+Q.IOPL+2 ;Change attribute list pointer BISB #EX.ALL,CREDPB+Q.IOPL+5 ;Enable placement function MOV #PLASTR,R4 ;Point to location string MOV R4,R5 ;Copy address MOV #8.,R3 ;Set max length 3011$: TSTB (R4)+ ;Check string BEQ 3012$ ;Found end SOB R3,3011$ ;Look at all of'em BR 3040$ ;Better not get here 3012$: SUB R5,R4 ;Calc length DEC R4 ;Correct count MOV #PLABLK,R3 ;Set output addr CALL .DD2CT ;Convert to binary BCS 3040$ ;Report error MOV (R3)+,R1 ;Get high part CMP R1,#10 ;Check high block number BHI 3040$ ;Error if GT MOV R1,PLACE+2 ;Save it away MOV (R3)+,PLACE+4 ;Store low block number 3019$: -425,426,/;RAW002/ 3021$: FATAL ,114 ;DECLARE ERROR 3030$: FATAL ,115 ;DECLARE ERROR 3040$: FATAL ,116 -432,432,/;RAW002/ 4001$: FATAL ,117 ;DECLARE ERROR -440,440,/;RAW002/ 4011$: FATAL ,120 ;DECLARE ERROR -450,450,/;RAW002/ FATAL ,121 ;DECLARE ERROR -459,462,/;RAW002/ CLR FAAERR ;Assume file not already assigned MOV $DEVHD,R0 ;R0 gets device list head 40401$: CMP D.NAM(R0),#"VD ;Is this DCB for the VD's? BEQ 40402$ ;Yes - branch MOV D.LNK(R0),R0 ;No - check next DCB BNE 40401$ ;if non-zero, still more to check FATAL ,104 ;Got a problem, better give up 40402$: SYSTEM 4050$ ;;Enter system state MOVB D.UNIT+1(R0),R2 ;;R2 gets highest unit number BIC #177400,R2 ;;Clear out sign extend, if any MOVB D.UNIT(R0),R3 ;;R3 gets lowest unit number BIC #177400,R3 ;;Clear out sign extend, if any SUB R3,R2 ;;R2 gets the number of units INC R2 ;; to check MOV D.UCBL(R0),UCBLTH ;;Save UCB length MOV D.UCB(R0),R0 ;;R0 get first UCB address 40403$: BITB #US.OFL,U.ST2(R0) ;;Is this VD offline? BNE 40405$ ;;Yes - Go check next one MOVB U.UNIT(R0),VDUNIT ;;Save VD unit number MOV U.NXT(R0),R3 ;;R3 points to extension block ADD #X.FNB,R3 ;;R3 points to saved filename block ;; ;; The following code will check the filename block ;; stored in all currently assigned VD's to see if ;; the file ID, device name, and device unit, match ;; the one currently being assigned. If this occurs ;; an error message will be output and the VD will ;; not be assigned ;; CMP N.FID(R1),N.FID(R3) ;;Does file ID match BNE 40405$ ;;No - go check next unit CMP N.FID+2(R1),N.FID+2(R3) ;;Maybe, check further BNE 40405$ ;;No - go check next unit CMP N.FID+4(R1),N.FID+4(R3) ;;Maybe, check further BNE 40405$ ;;No - go check next unit CMP N.DVNM(R1),N.DVNM(R3) ;;Does device name match? BNE 40405$ ;;No - go check next unit CMP N.UNIT(R1),N.UNIT(R3) ;;Does unit number match BNE 40405$ ;;No - go check next unit INC FAAERR ;; to another unit BR 4045$ ;;Go output error and exit 40405$: ADD UCBLTH,R0 ;;Step to next UCB SOB R2,40403$ ;;Branch if there are any left MOV #S.FNB/2,R2 ;;GET SIZE OF FILENAME BLOCK 4041$: MOV (R1)+,(R4)+ ;;STORE FILENAME BLOCK SOB R2,4041$ ;;LOOP TILL DONE -474,474,/;RAW001/ MOVB U.CTL(R0),R0 ;;GET CONTROL BYTE OF REAL DISK BICB #^C,R0 ;;CLEAR ALL BUT LENGTH MODULO BITS BICB #UC.LGH,U.CTL(R5) ;;CLEAR LENGTH MODULO BITS FOR VD BISB R0,U.CTL(R5) ;;MAKE VD MODULO MATCH REAL MODULO -475,475,/;RAW002/ 4045$: RETURN ;;RETURN TO USER STATE 4050$: TST FAAERR ; error? BEQ 4060$ ;No - branch MOV #FILFDB+F.FNB,R1 ;Get filename block address MOV N.FNAM(R1),ARGBLK ;Put file name, extension and MOV N.FNAM+2(R1),ARGBLK+2 ; version in ARGBLK MOV N.FNAM+4(R1),ARGBLK+4 ; to be displayed MOV N.FTYP(R1),ARGBLK+6 ; " MOV N.FVER(R1),ARGBLK+10 ; " MOV VDUNIT,ARGBLK+12 ;Put VD unit number in message EDMWRT #FAAMSG,#ARGBLK ;Tell user the unit number FATAL < >,300 ;Declare error 4060$: TST SCHFLG ;Was auto search done? BEQ 4070$ ;No - just exit with status of 1 MOV EXSTAT,ARGBLK ;Yes, get unit number of selected VD ADD #200,EXSTAT ;Add 200 for exit status BIT #FL.NMS,CSIBLK+C.MKW1 ;Are messages disabled? BNE 4065$ ;Yes - branch MOV #FILFDB+F.FNB,R1 ;Get filename block address MOV N.FNAM(R1),ARGBLK+2 ;Put file name, extension and MOV N.FNAM+2(R1),ARGBLK+4 ; version in ARGBLK MOV N.FNAM+4(R1),ARGBLK+6 ; to be displayed MOV N.FTYP(R1),ARGBLK+10 ; " MOV N.FVER(R1),ARGBLK+12 ; " EDMWRT #ASNMSG,#ARGBLK ;Tell user the disk that was selected 4065$: EXST$S EXSTAT ;Exit status has unit num. + 200. 4070$: EXST$S #1 ;ALL DONE, EXIT ; SHOWID: EDMWRT #ID,#ARGBLK ;Display AVD version number EXST$S #1 ;Exit with successful status -509,509,/;RAW002/ 1000$: CMP EXSTAT,#300 ;File already assigned error? BNE 1010$ ;No - branch ADD VDUNIT,EXSTAT ;Yes - add unit number to exit status BR 1200$ ;No message displayed for this one 1010$: BIT #FL.NMS,CSIBLK+C.MKW1 ;Message display disabled? BNE 1200$ ;Yes - branch MOV #ERRSTR,R0 ;GET START OF VARIABLE ERROR -514,514,/;RAW002/ -518,518,/;RAW002/ MOV #GETCMD+G.MCRB,ERRDPB+Q.IOPL ;Also output the command MOV CMDLTH,ERRDPB+Q.IOPL+2 ; that was entered DIR$ #ERRDPB 1200$: EXST$S EXSTAT ;EXIT TASK ; ; ** EDMWRT ** Subroutine to use $EDMSG to output a message. ; EDMWRT::MOV #50$,R0 ;R0 has output buffer address MOV R0,EDMQIO+Q.IOPL ;Put address in QIO CALL $EDMSG ;Format the message MOV R1,EDMQIO+Q.IOPL+2 ;Put char. count in QIO DIR$ #EDMQIO ;Output message RETURN 50$: .BLKW 128. ; ; ** END OF EDMWRT ; /