DVD.MAC/AU/-BF=DVD.VGN -3,3,/;RAW001/ .ENABL LC .IDENT /V02.00/ ID: .ASCII <15>/DVD -- Version V02.00/ IDLTH=.-ID .EVEN \ -21,21,/;RAW001/ ; Version: V02.00 -27,27,/;RAW001/ ; V02.00 ; ;****************************************************************************** ; ; 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 ; ;****************************************************************************** ; ; RAW001 11/22/82 ; Modified by Rick Webster, Process Control Applications ; MSDGO, Caterpillar Tractor Co. ; Added new switches, /DMO, /NM and /ID. Numbered all ; error messages and added exit with status to exit with ; that error number as status or a status of 1 if successful. % -39,,/;RAW001/ .MCALL F11DF$ ;Define Files 11 table definitions F11DF$ -45,45,/;RAW001/ -50,55,/;RAW001/ .MCALL GLUN$S ;Get lun info .MCALL SPWN$ ;Spawn task .MCALL WTSE$S ;Wait for single event -61,,/;RAW001/ ; TPARS Macros ; .MCALL ISTAT$,STATE$,TRAN$ ; -78,,/;RAW001/ .GLOBL .TPARS ;Table Driven Parser .GLOBL .PCHAR ;TPARS symbol .GLOBL .PNUMB ;TPARS symbol .GLOBL $CBTA ;Convert binary to ascii -89,92,/;RAW001/ .MACRO FATAL MSG,MSGNUM MOV #MSGNUM,EXSTAT TRAP 1 .ASCIZ #Error MSGNUM, MSG# -119,,/;RAW001/ ; ; *** TPARS Macro to invoke the table driven parser ; .MACRO TPARS OPT,KEYPT,LTH,ADDR,STLABL MOV R0,-(SP) MOV R1,-(SP) MOV R2,-(SP) MOV OPT,R1 ;BLANK AND TAB SUPPRESS OPTION MOV KEYPT,R2 ;ADDRESS OF KEY TABLE MOV LTH,R3 ;LENGTH OF STRING TO BE PARSED MOV ADDR,R4 ;ADDRESS OF STRING TO BE PARSED MOV STLABL,R5 ;LABEL OF FIRST STATE CALL .TPARS ;PARSE STRING MOV (SP)+,R2 MOV (SP)+,R1 MOV (SP)+,R0 .ENDM -131,,/;RAW001/ ; Switch bit masks ; DV.DMO = 1 ;Dismount disk DV.IDV = 2 ;Display program version DV.NMS = 4 ;Do not display messages DV.VDS = 10 ;VD to de-assign, entered ; -137,138,/;RAW001/ ERRDPB: QIOW$ IO.WVB,TTYLUN,EV.QIO,,,, SPNDMO: SPWN$ MCR...,,,,,EV.QIO,,GLUNBF,DMOCMD,DMOCML,, -146,146,/;RAW001/ ; SST VECTOR TABLE. -157,161,/;RAW001/ -165,171,/;RAW001/ -178,,/;RAW001/ SWFLAG: .WORD 0 ;Switch flag word for TPARS VDUNIT: .WORD 0 ;VD unit to de-assign EXSTAT: .WORD 0 ;Task exit status CMDLTH: .WORD 0 ;Length of command line GLUNBF: .BLKW 6 ;Get lun input buffer DMOCMD: .ASCII /DMO VD/ ;DMO command for SPWN$ DMUNIT: .ASCII |XX:/DEV| ; " DMOCML=.-DMOCMD .EVEN -192,201,/;RAW001/ \ ; MCR command line in form shown below. ; ; DVD VDn:[/sw] ; ; where: ; ; VDn: Virtual disk to deassign. ; /sw One of the following switches ; ; /ID - Display DVD version. If this switch ; is specified, anything else on the ; command line is ignored. ; /DMO - Dismount the disk (/DEV) before ; deassigning it ; /NM - Do not print informational messages ; ; Output: ; ; Virtual disk deassigned from file or error message ; output to user's terminal. The exit status will contain ; the error message number if an error occurs or 1 if none. % -220,229,/;RAW001/ FATAL ,101 ;DECLARE ERROR -233,257,/;RAW001/ 1000$: MOV $DSW,CMDLTH ;Save cmd line length TPARS #0,#KEYTBL,$DSW,#GETCMD+G.MCRB,#CMDLIN ;Parse cmd line BCC 1300$ ;Branch if syntax OK FATAL ,102 ;DECLARE ERROR ; ; Validate switches ; 1300$: BIT #DV.IDV,SWFLAG ;Program version requested BEQ 1310$ ;No - branch JMP SHOWID ;Yes - go display version and exit 1310$: BIT #DV.VDS,SWFLAG ;VDn specified BNE 1400$ ;Yes - branch FATAL ,103 -261,263,/;RAW001/ 1400$: ALUN$S #TSTLUN,#"VD,VDUNIT ;ASSIGN VIRTUAL DISK BCC 2000$ ; IF CC - OK, CONTINUE FATAL ,104 ;DECLARE ERROR -267,276,/;RAW001/ 2000$: MOV #DMUNIT,R0 ;Output area for $CBTA MOV VDUNIT,R1 ;Number for $CBTA to convert MOV #11010,R2 ;No zero suppress, field width = 2 CALL $CBTA ;Convert unit # to ascii for DMO cmd CLR UCBADR ;Initialize VDn's UCB address CLR EXTADR ;Initialize VDn's Ext. Block Address MOV $HEADR,R5 ;GET OUR TASK HEADER MOV H.LUN(R5),R5 ;GET VD: UCB ADDRESS MOV U.VCB(R5),R0 ;R0 points to volume control block BEQ 2010$ ;Not mounted if equal MOV U.VCB(R5),R0 ;R0 points to volume control block BEQ 2010$ ;Not mounted if equal BIT #DV.DMO,SWFLAG ;Should we try to dismount it? BNE 2001$ ;Yes -branch FATAL ,105 ;DECLARE ERROR 2001$: BITB #US.MDM,U.STS(R5) ;Is it marked for dismount? BEQ 2002$ ;No - branch FATAL ,106 ;Declare error 2002$: TST V.TRCT(R0) ;Is transaction count zero? BEQ 2003$ ;Yes - branch FATAL ,107 ;Declare error 2003$: DIR$ #SPNDMO ;Try to dismount it WTSE$S #EV.QIO ;Wait for completion 2010$: SYSTEM 2200$ ;;ENTER SYSTEM STATE MOV U.NXT(R5),R0 ;;IS VCB ALLOCATED? BEQ 2100$ ;; IF EQ - YES, ERROR MOV R5,UCBADR ;;SAVE UCB ADDRESS BITB #US.MNT,U.STS(R5) ;;IS DISK MOUNTED? BEQ 2100$ ;; IF EQ - YES, CANNOT DEASSIGN -280,305,/;RAW001/ MOV #X.LGTH,R1 ;;GET BLOCK LENGTH CALLR $DEACB ;;DEALLOCATE EXTENSION BLOCK 2100$: RETURN ;;RETURN TO USER STATE 2200$: TST UCBADR ;WAS DISK ALLOCATED? BNE 2300$ ; IF NE - YES, CONTINUE FATAL ,110 ;DECLARE ERROR 2300$: MOV EXTADR,R0 ;WAS EXTENSION BLOCK DEALLOCATED? BNE 3000$ ; IF NE - YES, CONTINUE FATAL ,105 ;DECLARE ERROR -309,309,/;RAW001/ 3000$: 4000$: EXST$S #1 ;Exit with successful status -335,,/;RAW001/ BIT #DV.NMS,SWFLAG ;Message display disabled? BNE 1200$ ;Yes - branch -339,339,/;RAW001/ -343,343,/;RAW001/ MOV #GETCMD+G.MCRB,ERRDPB+Q.IOPL ;Also output cmd in error MOV CMDLTH,ERRDPB+Q.IOPL+2 ; " DIR$ #ERRDPB 1200$: EXST$S EXSTAT ;EXIT TASK SHOWID: MOV #ID,ERRDPB+Q.IOPL ;Put ID message addr. in QIO MOV #IDLTH,ERRDPB+Q.IOPL+2 ;Put ID msg length in QIO DIR$ #ERRDPB ;Display DVD version number EXST$S #1 ;Exit with successful status .PAGE .SBTTL State tables for .TPARS ISTAT$ STATE1,KEYTBL STATE$ CMDLIN TRAN$ $STRNG ;Bypass program name 'DVD' STATE$ TRAN$ 'V,DCHK,CVDUN,DV.VDS,SWFLAG ;Check for VDn: entered TRAN$ '/,GETSW ;No VDn, better be a switch STATE$ DCHK TRAN$ 'D ;Check for D in VDn: STATE$ TRAN$ $NUMBR,CHKCOL,STVDUN ;Check for n in VDn: TRAN$ ':,CHKSW ;Check for VD: with implied n=0 STATE$ CHKCOL TRAN$ ': ;Check for : in VDn: STATE$ CHKSW TRAN$ '/,GETSW ;Check for switch TRAN$ $EOS,$EXIT ;Only exit from TPARS STATE$ GETSW TRAN$ "DMO",CHKSW,,DV.DMO,SWFLAG ;Check for /DMO TRAN$ "NM",CHKSW,,DV.NMS,SWFLAG ;Check for /NM TRAN$ "ID",$EXIT,,DV.IDV,SWFLAG ;Check for /ID STATE$ ;End of state table ; ; TPARS Action routines ; CVDUN: CLR VDUNIT ;Assume VD is unit 0 RETURN STVDUN: MOV .PNUMB,VDUNIT ;Get VD unit to de-assign RETURN /