.MCALL .MODULE .MODULE DUPIN2,VERSION=16,COMMENT=,IDENT=NO,GLOBAL=.DPIN2 ; 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. ; Edit History: ; ; 001 28-Jan-80 10:42 Guldenschuh, Chuck cpg [240,148] ; Correct COPY/DEVICE RK: RK1 problem ; (001) ; 002 18-Feb-80 17:52 Metsch, James (29602) [240,122] ; Correct INIT DK: problem ; (002) ; 003 11-Nov-80 11:36 AM Fingerhut, David [240,134] ; Make magtape rewind before a COPY/DEVICE, (Lookup) ; (003) ; 004 15-Jul-81 09:00 AM David Fingerhut [240,134] ; /V with no filespec gives wrong error message ; (004) ; 005 17-Sep-81 09:44 AM David Fingerhut [40,134] ; Illegal cmd if input & output have wldcrds for COP/DEV/FILE ; (005) ; 006 20-Oct-81 03:26 PM David Fingerhut [40,134] ; Give "illegal directory" for uninitialized disk ; (006) ; 007 28-Oct-81 10:32 AM David Fingerhut [40,134] ; Add COPY/DEVICE/REPLACE ; (007) ; 008 10-Nov-81 04:01 PM David Fingerhut [40,134] ; Changes for RTEM ; (008) ; 009 01-Mar-82 09:53 AM David Fingerhut [40,134] ; Use DSTAT to check for multisize volumes ; (009) ; 016 06-Nov-1990 JFW ; bracket error messages with ;+/;ERROR/.../;- .SBTTL Edit History ; CG02 Fix COPY/DEVICE RK0 RK1 DUPIN2 EL26 DUP V04.00A ; CG06 Change MDUP to use .DSTATUS DUPIN2 EL27 DUP V04.00C ; 013 5-JUL-88 George Stevens ; Remove /RETAIN switch from COPY/DEVICE .ENABL LC .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 .ENABL GBL PSECT IMPURE ;Impure data PSECT PURE ;Pure data psect PSECT PUREB ;[byte] Pure data psect PSECT DEVLID ;Option vs. filespec/device type check table PSECT RESTR2 ;Code psect PSECT PATCH ;Patch psect .BLKW 32. PSECT IMPURE STBLK: .BLKW 5 ;.SAVEST/.REOPEN block NONFIL::.BLKW 2 ;Space for non-filestructured lookup ;006 SYSID: .ASCII /DECRT11A / ;System id SYSIDE: .EVEN SYSLOC =: 760 ;Location of system id in home block ;006 .SBTTL FILES - File processing ;+ ; FILES ;- PSECT PURE LBLK: .WORD OCHAN ;Output channel number .WORD OUTFIL ;-> output file name .WORD OUTST ;-> dstatus return block .WORD $OSFLG ;-> output device/filespec flag word ILBLK: .WORD ICHAN ;Input channel number .WORD INFILE ;-> input file name .WORD INST ;-> dstatus return block .WORD $ISFLG ;-> input device/filespec flag word ORIGIN RESTR2 .ENABL LSB FILES:: CALL SPCHEK ;Check the filespecs against given options .IF EQ MDUP CALL FETCH ;Fetch the handlers .IFTF ;EQ MDUP MOV $AFLAG,R5 ;R5 = action options flag word .IFT ;EQ MDUP .IF EQ SDC BIT #FL.SCN,R5 ;Bad block scan? BEQ 1$ ;Branch if not CLR INFILE+2 ;*DCL* ;DCL sends us "TT:=in:*.*/K" BIT #FLG.DV,$OSFLG ;Output file specified? BNE 6$ ;Branch if so. Go process output file ;001 JMP 13$ ; ;001 ;001 .ENDC ;EQ SDC .IFF ;EQ MDUP BIT #FL.BLD,R5 ;Creating MDUP.Mx? BEQ 16$ ;Branch if not BR 6$ ;Go enter it .IFT ;EQ MDUP 1$: BIT #FL.IMA,R5 ;Doing COPY/DEVICE? BNE 101$ ;Branch if so ;007 JMP 10$ ;007 101$: BIT #DEV.MT,$OSFLG ;Is output a magtape? BEQ 102$ ;Branch if not BIT #FL.FIL,$MFLAG ;Doing /FILE? BEQ ILCMND ;Branch if not BIT #FLG.WD,$OSFLG ;Any wildcards? BNE ILCMND ;Branch if so 102$: BIT #DEV.MT,$ISFLG ;Is input a magtape? BEQ 103$ ;Branch if not BIT #FL.FIL,$MFLAG ;Doing /FILE? BEQ ILCMND ;Branch if not BIT #FLG.WD,$ISFLG ;Any wildcards? BNE ILCMND ;Branch if so 103$: .IF NE SDC CMP INFILE,OUTFIL ;Input device and output device the same;007 BEQ ILCMND ;Branch if so. Error .ENDC BIT #FL.FIL,$MFLAG ;File mode copy? ;007 .IF EQ SDC ;007 BNE 2$ ;Branch if so ;007 CMP #R50AST,OUTFIL+2 ;*DCL* ;Is the filename '*'? ;001 BNE ILCMND ;Error CMP INFILE,OUTFIL ;Input device and output device the same;007 BEQ ILCMND ;Branch if so. Error JMP 12$ ;Otherwise it came from DCL 2$: BIT #FLG.WD,$OSFLG ;Any wildcards on output? ;005 BEQ 25$ ;Branch if not ;005 BIT #FLG.WD,$ISFLG ;Any wildcards on input? ;005 BNE ILCMND ;Wildcards on both input & output not ;005 ; allowed with /FILE. ;005 25$: CMP #R50AST,OUTFIL+2 ;Is the output file a wildcard? BEQ 251$ ;Branch if so CMP #R50AST,INFILE+2 ;Is the input file a wildcard? BNE ILCMND ;Wildcard must be on either input or out ; with /FILE. 251$: BIT #FL.WAT,$MFLAG ;/WAIT? ;005 BEQ 3$ ;Branch if not .IFF ;EQ SDC BEQ 12$ ;Branch if not BR 3$ .ENDC ;EQ SDC .IFTF ;EQ MDUP ;+ ;ERROR ILCMND: .ERR #ERAREA,#ILC,LEVEL=FATAL,RETURN=NO ;Else error ; <-F-Illegal command> ;- .IFT ;EQ MDUP 3$: BIT #FLG.WD,$ISFLG ;*DCL* ;Is it wildcarded? BEQ 4$ ;*DCL* ;Branch if not CLR INFILE+2 ;*DCL* ;Else it came from DCL. Ignore it BR 5$ ;*DCL* 4$: BIT #FLG.FL,$ISFLG ;Was an input file specified? BNE 11$ ;Branch if so ;007 5$: BIS #FLG.EN,$OSFLG ;Set the output file entered flag .IFTF ;EQ MDUP 6$: MOV #ILBLK,R5 ;R5 -> input file data CALL 18$ ;Open the input device non-file-structured .IFT ;EQ MDUP .IF EQ SDC BIT #FL.SCN,$AFLAG ;Bad block scan? BEQ 7$ ;Branch if not MOV #-1,R1 ;Output file is big BR 8$ ;Go enter output file .ENDC ;EQ SDC 7$: MOV R3,R0 ;R0 -> .DSTATUS return block MOV #ICHAN,R2 ;R2 = channel number TST REDSW ;Was read end block given? BEQ 73$ ;Branch if not MOV REDEND,R1 ;R1 = Read end block ;001 INC R1 ;Fix for 0 base ;001 BR 75$ ;001 ;001 73$: MOV R4,R1 ;R1 -> $ISFLG ;001 CALL GTDVSZ ;Get the input device size 75$: MOV REDSTR,R0 ;Start block given? ;001 BEQ 8$ ;Branch if not ;001 INC R1 ;Fix for subtract ;001 SUB R0,R1 ;Get number of blocks to read/write ;001 .IFF ;EQ MDUP MOV #<14.*4>,R1 ;Get # blocks for output file .IFTF ;EQ MDUP 8$: MOV #OUTFIL,R2 ;R2 -> output filename BIT #DEV.DK,$OSFLG ;Is output file a disk? ;006 BEQ 85$ ;Branch if not ;006 CALL CHKID ;Check for system id on output device ;006 85$: ADD WRTSTR,R1 ;Add output start block to length BIT #FLG.FL,$OSFLG ; FILESPEC FOR OUTPUT ? BEQ 86$ ; NO, BRANCH MOV #-1,R1 ; FILE SIZE = -1 86$: .ENTER #IOAREA,#OCHAN,R2,R1,#-1 ;006 .IFT ;EQ MDUP BCC 9$ ;Branch if no error. We're done .IFF ;EQ MDUP BCC 24$ ;Done .IFTF ;EQ MDUP TSTB @#S$EERB ;Was it? BEQ 19$ ;Branch if not. Channel in use!! ;+ ;ERROR MOV #FE.OFP,R1 ;- Output file protected. ; <-F-Protected output file already exists dev:filename> CMPB @#S$EERB,#ER.PRO ;Was it protected? BEQ 20$ ;Branch if so MOV #FE.DVF,R1 ;- Device full ; <-F-Device full dev:filename> CMPB @#S$EERB,#ER.IUN ;Invalid unit number? BNE 20$ ;Branch if not MOV #FE.ILD,R1 ;- Illegal device CLR 2(R2) ;Clear the file name word ; <-F-Illegal device dev:> BR 20$ ;Give error ;- .IFT ;EQ MDUP 9$: MOV R0,OUTSZ ; SAVE FILE SIZE in output size MOV #OCHAN,R0 ;R0 = output channel number BR 23$ ;Go get real device name 10$: .IF EQ SDC BIT #FL.ZRO,R5 ;INITIALIZE? BEQ 13$ ;Branch if not BIT #FL.REP,$MFLAG ;Doing /REPLACE? BEQ 1010$ ;Branch if not BIT #,$ISFLG ;Is the device replaceable? BEQ ILCMND ;Branch if not BIT #,$ISFLG ;Is it MSCP? BNE ILCMND ;Branch if so 1010$: BIT #FLG.DV,$OSFLG ;Output specified? BEQ 12$ ;Branch if not BIT #DEV.MT,$OSFLG ;Is it a magtape? BEQ 121$ ;Branch if not. Error 11$: BR 17$ ;Go open the files ;007 ;007 .IFTF ;EQ SDC 12$: BIT #FLG.FL,$ISFLG ;Was an input file specified? BEQ 16$ ;Branch if not CMP #R50AST,INFILE+2 ;Asterisk? ;002 BEQ 16$ ;*DCL* ;Branch if so. Assume DCL put it;002 121$: JMP ILCMND .IFT ;EQ SDC 13$: BIT #,R5 ;CREATE or CREATE/EXTENSION? BEQ 14$ ;Branch if not MOV #OUTFIL,R2 ;R2 -> output filename MOV @R2,INFILE ;Copy the device name CLR INFILE+2 ;Make sure it's non-file-structured MOV #ILBLK,R5 ;R5 -> input file data BR 18$ ;Go look it up 14$: BIT #FL.WBT,R5 ;COPY/BOOT? BNE 15$ ;Branch if so BIT #FL.BOT,R5 ;BOOT? BEQ 16$ ;Branch if not MOV INFILE,OUTFIL ;Copy the device name to the output side 15$: MOV INFILE+2,-(SP) ;Preserve the input filename CALL 16$ ;Go open input and output devices MOV (SP)+,INFILE+2 ;Restore the input filename BR 24$ ; .ENDC ;EQ SDC .IFTF ;EQ MDUP 16$: CLR INFILE+2 ;Do input non-file-structured 17$: CLR OUTFIL+2 ;Do output non-file-structured MOV #LBLK,R5 ;R5 -> output file data CALL @PC ;Do output lookups .ASSUME 18$ EQ . ;*Fall thru to do input lookups and RETURN 18$: MOV (R5)+,R1 ;R1 = channel number MOV (R5)+,R2 ;R2 -> filename MOV (R5)+,R3 ;R3 -> .DSTATUS return block MOV (R5)+,R4 ;R4 -> file flag word TST @R2 ;Any files specified? BEQ 24$ ;Branch if not .LOOKUP #IOAREA,R1,R2,#0 ;Lookup the device/file ;003 BCC 21$ ;Branch if no error ;+ ;ERROR 19$: MOV #FE.CIU,R1 ;Assume channel in use ; <-F-Channel in use dev:filename> TSTB @#S$EERB ;What error was it? BEQ 20$ ;Branch if CIU MOV #FE.FNF,R1 ;File not found ; <-F-File not found dev:filename> CMPB @#S$EERB,#ER.IUN ;Invalid unit number? BNE 20$ ;Branch if not MOV #FE.ILD,R1 ;- Illegal device CLR 2(R2) ;Clear the file name word 20$: .ERR #ERAREA,R1,LEVEL=FATAL,RETURN=NO,FILE=R2 ;- 21$: .IFT ;EQ MDUP TST 2(R2) ;Was a filename specified? BEQ 22$ ;Branch if not MOV R0,DS.SIZ(R3) ;Save the file size in device size word MOV R0,INSZ ; SAVE SIZE IN INSZ BIC #DEV.MS,@R4 ;Files can't be multi-sized volumes 22$: MOV R1,R0 ;R0 = channel number 23$: MOV R2,R1 ;R1 -> filename CALL REALDV ;Get the real device name .ENDC ;EQ MDUP 24$: RETURN .DSABL LSB .SBTTL CHKID - Check the output device for the system id ;006 ;006 ;+ ; CHKID ;006 ; This routine checks the homeblock of the output device to ensure that ;006 ; system id is there. If it is not there, then the disk isn't RT format;006 ; and a .ENTER will cause the system to hang. ;006 ; ; R2 -> CSI specs ;006 ; ; CALL CHKID ;006 ; ; If the routine returns, then everything is OK. ;006 ;- CHKID:: ;006 SAVE05 ;Save 0 - 5 ;006 MOV (R2),NONFIL ;Set up for non-filestructured ;006 CLR NONFIL+2 ; LOOKUP ;006 .LOOKUP #IOAREA,#OCHAN,#NONFIL ;006 BCC 3$ ;Branch if no error ;006 CLR R0 ;Get ready for MOVB ;006 BISB @#S$EERB,R0 ;Get the error byte ;006 BNE 1$ ;Branch if not channel in use ;006 ;+ ;ERROR MOV #FE.CIU,R1 ;Set error code ;006 ; <-F-Channel in use> ;006 CLR R2 ;Don't give filename ;006 BR 8$ ; ;006 ;- 1$: DEC R0 ;File not found?? SHOULD NOT OCCUR!!! ;006 BNE 2$ ;Branch if not ;006 ;+ ;ERROR MOV #FE.FNF,R1 ;Set error code ;006 ; <-F-File not found DEV:> ;006 BR 8$ ; ;006 2$: MOV #FE.SYS,R1 ;Oops! ;006 ; <-F-System error> ;006 CLR R2 ;No filename ;006 BR 8$ ;Go give the error ;006 ;- 3$: .GTCOR #256. ;Get a buffer for the homeblock ;006 BCC 4$ ;Branch if no error ;006 ;+ ;ERROR MOV #FE.NOM,R1 ;Error ;006 ; <-F-Insufficient memory> ;006 CLR R2 ;Don't give filename ;006 BR 8$ ;Go give error ;006 ;- 4$: MOV R0,R1 ;R1 -> Buffer ;006 .READW #IOAREA,#OCHAN,R1,#256.,#HOMBLK ;006 BCC 5$ ;Branch if no error ;006 ;+ ;ERROR MOV #FE.INE,R1 ;006 ; <-F-Input error> ;006 CLR 2(R2) ;Don't give filename ;006 BR 8$ ;Go give error ;006 ;- 5$: MOV #SYSID,R0 ;Point to system id to match MOV #,R3 ;R3 = # of bytes in system id MOV R1,R4 ;R4 -> start of home block ADD #SYSLOC,R4 ;R4 -> start of system id 6$: CMPB (R0)+,(R4)+ ;Is the system id there? BNE 7$ ;Branch if not SOB R3,6$ BR 9$ ;System ID matches 7$: CLR 2(R2) ;Don't give file name ;006 ;+ ;ERROR MOV #ILD,R1 ;006 ; <-F-Illegal directory> ;006 8$: .ERR #ERAREA,R1,LEVEL=FATAL,RETURN=NO,FILE=R2 ;006 ;- 9$: .CLOSE #OCHAN ;Close the channel ;006 RETURN ;006 ;006 .SBTTL SPCHEK - Check file specs for legality ;006 ;006 ;+ ;006 ; SPCHEK ;006 ; This routine checks all file specs for legality with the specified ;006 ; options. The VALID macro creates a table of switches and valid bits ;006 ; with the following format. ;006 ; ;006 ; .WORD option_bit ;006 ; .WORD required_bits_for_input ;006 ; .WORD illegal_bits_for_input ;006 ; .WORD required_bits_for_output ;006 ; .WORD illegal_bits_for_output ;006 ; ;006 ; JSR PC,SPCHEK ;006 ; ;006 ; R0 - R3 modified ;006 ;- ;006 ;006 PSECT DEVLID DEVTBL:: .IF EQ MDUP .IF EQ SDC .WORD FL.CRE!FL.EXT ;CREATE ;CREATE/EXTENSION .WORD 0 ;No required input .WORD FLG.DV ;Input specification illegal .WORD FLG.DV!FLG.FL!DEV.DK ;Output must be a disk file .WORD FLG.WD!DEV.RO ;No wild cards allowed, no read only .WORD FL.UNI!FL.BOT ;INITIALIZE/RESTORE ;BOOT .WORD FLG.DV!DEV.DK ;Input must be disk device .WORD DEV.WO ;Write only devices illegal input .WORD 0 ;No required output .WORD FLG.DV ;Any output specification illegal .IFTF ;EQ SDC .WORD FL.IMA ;COPY/DEVICE .WORD FLG.DV ;Input device required .WORD DEV.WO ;Write only devices illegal input .WORD FLG.DV ;Output device required .WORD DEV.RO ;Read only devices illegal output .IFT ;EQ SDC .WORD FL.SCN ;DIR/BAD .WORD FLG.DV!DEV.DK ;Input must be disk device .WORD DEV.WO ;Write only devices illegal input .WORD 0 ;No required output .WORD DEV.RO ;Read only devices illegal output .WORD FL.SQU ;SQUEEZE .WORD FLG.DV!DEV.DK ;Input device must be a disk .WORD FLG.FL!DEV.WO ;No filename or write only device .WORD 0 ;No output specification required .WORD DEV.RO!DEV.MT!DEV.CT ;No read only, MT or CT devices .WORD FL.WBT ;COPY/BOOT .WORD FLG.DV!FLG.FL!DEV.DK ;Input must be disk file .WORD DEV.WO ;Write only devices illegal input .WORD FLG.DV ;Output device required .WORD DEV.RO!DEV.CT!DEV.SD ;No read only, CT, or strange devices .WORD FL.ONL ;INITIALIZE/VOLUMEID:ONLY .WORD FLG.DV!DEV.DK ;Input must be disk device .WORD DEV.RO!DEV.WO ;No read only, write only devices .WORD 0 ;No output required .WORD DEV.RO ;Read only devices illegal output .WORD FL.ZRO!FL.VPT ;INITIALIZE, VOLUME ;004 .WORD FLG.DV ;Input device required .WORD DEV.RO!DEV.WO ;No read only, write only devices .WORD 0 ;No required output .WORD DEV.RO!DEV.WO!DEV.DK!DEV.CT!DEV.SD ;No read only, write only, ; disk, CT, or strange ; output devices .ENDC ;EQ SDC .IFF ;EQ MDUP .WORD FL.ZRO ;/Z .WORD FLG.DV!DEV.DK ;Input device required, must be disk .WORD DEV.RO!DEV.WO!DEV.CT!DEV.MT!DEV.SD ;Nothing strange .WORD 0 ;No output required .WORD FLG.DV ;Any output illegal .WORD FL.COP ;"dd:A=Mxn:*.*" .WORD FLG.DV!DEV.MT ;Input device required, must be MT .WORD 0 ;Ignore illegal .WORD FLG.DV!DEV.DK ;Output device required, must be disk .WORD DEV.RO!DEV.WO ;Can't be read/write only .ENDC ;EQ MDUP .WORD 0 ;Stopper DVTBSZ = 12 ;Size of a table entry PSECT * SPCHEK:: CALL DSTAT ;Get device statistics CALL SETSPC ;Set up $ISFLG and $OSFLG MOV #DEVTBL,R0 ;R0 -> file spec validity table 1$: TST @R0 ;At the end? BEQ 5$ ;Branch if so. Done BIT (R0)+,$AFLAG ;This option turned on? BNE 2$ ;Branch if so ADD #,R0 ;R0 -> next option flag BR 1$ ;Try for next option 2$: MOV #$ISFLG,R1 ;R1 -> input file spec flag byte CALL 3$ ;Do validity checks TST (R1)+ ;R1 -> output file spec flag byte ;***Depends upon $OSFLG = $ISFLG+2 CALL 3$ ;Do output validity check BR 1$ ;Go check for more options 3$: MOV @R1,R2 ;Copy the flag word MOV (R0)+,R3 ;Copy the required bits COM R3 ;Complement it BIC R3,R2 ;Leave only the required bits COM R3 ;Get required bits back BIC R2,R3 ;Clear required bits we got BNE 4$ ;Branch if we didn't get all required bits BIT (R0)+,@R1 ;Check for illegal bits set BEQ 5$ ;It's ok 4$: JMP ILCMND ; 5$: RETURN .SBTTL SETSPC - Set file bits in flag words ;+ ; SETSPC ; This routine sets the device, file, and wildcard bits in the input and ; output flag words. ; ; JSR PC,SETSPC ; ; R0 - R3 modified ; CMDBUF modified ;- SETSPC:: MOV #$ISFLG,R2 ;R2 -> input specification flag byte MOV #INFILE,R3 ;R3 -> CSI input file spec CALL 1$ ;Set input flag bits TST (R2)+ ;R2 -> output specification flag byte ;***Depends upon $OSFLG = $ISFLG + 2 MOV #OUTFIL,R3 ;R3 -> CSI output file spec ;*Fall thru and return to caller 1$: MOV R3,R0 ;Save the pointer to the filespec for later TST (R3)+ ;Device specified? BEQ 2$ ;Branch if not BIS #FLG.DV,@R2 ;Set the device found flag 2$: .IF EQ MDUP TST @R3 ;File specified? BNE 25$ ;Branch if so BIT #FL.FIL,$MFLAG ; DOING /FILE ? BEQ 5$ ; NO, BRANCH MOV #132500,(R3) ; STUFF IN A '* ' RAD50 MOV #<^R >,2(R3) ; STUFF IN A ' ' RAD50 MOV #132500,4(R3) ; STUFF IN A '* ' RAD50 BR 4$ ; GO SET WILDCARD BIT AND CONTINUE .ENDC ;EQ MDUP 25$: BIS #FLG.FL,@R2 ;Set the file found flag MOV #CMDBUF,R1 ;Point to the filename convert buffer MOV R1,-(SP) ;Save the pointer to the buffer CALL $FNASC ;Convert it to ASCII MOV (SP)+,R0 ;Point to the ASCII filespec 3$: CMP R0,R1 ;Are we done? BEQ 5$ ;Branch if so. No wildcards CMPB @R0,#'% ;Wild character? BEQ 4$ ;Branch if so CMPB (R0)+,#'* ;How about a "*"? BNE 3$ ;Branch if not 4$: BIS #FLG.WD,@R2 ;Set the wildcard flag 5$: RETURN .SBTTL DSTAT - Get device statistics ;+ ; DSTAT ; This routine sets up the device/file flag words $ISFLG and $OSFLG to ; provide a more reasonable format for device type checking than RT-11 ; generally provides. One bit is set in the flag word which indicates ; the device type (disk, magtape, cassette, or other). At this time, ; the multi-size device bit is set. ; ; JSR PC,DSTAT ; ; R0 - R3, R5 modified ; $ISFLG and $OSFLG are modified if an input or output device ; was specified. ;- PSECT PURE SPCBLK: .WORD $OSFLG ; -> output spec flag byte .WORD OUTST ; -> output .DSTATUS return area .WORD OUTFIL ; -> output file spec .WORD $ISFLG ; -> input spec flag byte .WORD INST ; -> input .DSTATUS return area .WORD INFILE ; -> input file spec PSECT PUREB ;MULTI: .BYTE DMID ;RK06/7 device id ;009 ; .BYTE DLID ;RL01/2 device id ;009 ; .BYTE DYID ;RX02 device id ;009 ; .BYTE VSID ;VS device id (RTEM) ;009 ;MSDPS:: .BLKB 5 ;Allow patch space for 5 more mu;009 ; .BYTE 0 ;End of multi-sized volume device table ;009 ;009 MAGS: .BYTE MMID ;TJU16 device id ;**-7 .BYTE MTID ;TM11 device id .BYTE MSID ;TS04 device id .BYTE MUID ;TK50 device id MTDPS:: .BLKB 4 ;Allow patch space for 5 more magtapes .BYTE 0 ;End of magtape device id table ALLREP: .BYTE DLID ;RL01/2 device id ARDPS:: .BLKB 5 ;Allow patch space for 5 more always replaced .BYTE 0 ;End of always replaceable device id table SOMREP: .BYTE DMID ;RK06/7 device id .BYTE DUID ;MSCP device id SRDPS:: .BLKB 5 ;Allow patch space for 5 more sometimes repld .BYTE 0 ;End of sometimes replaceable device id table PSECT * .ENABL LSB DSTAT:: MOV #SPCBLK,R5 ;Get -> parameters CALL @PC ;Get device info .ASSUME 1$ EQ . ;*Fall thru and do it again 1$: MOV (R5)+,R1 ;Get -> flag byte MOV (R5)+,R2 ;Get -> .DSTATUS return area MOV (R5)+,R3 ;Get -> file spec TST @R3 ;File spec given? BEQ 17$ ;Branch if not. Done. .DSTATU R2,R3 ;Get the device info BCC 3$ ;Branch if no error 2$: CLR 2(R3) ;Clear the file name word ;+ ;ERROR .ERR #ERAREA,#FE.ILD,LEVEL=FATAL,RETURN=NO,FILE=R3 ; <-F-Illegal device dev:> ;- 3$: .IF NE MDUP ;CG06+ TST DS.HLA(R2) ;Is the device loaded? BEQ 2$ ;Branch if not. Error MOV R1,-(SP) ;Save R1 MOV DS.SIZ(R2),-(SP) ;Save the device size MOV EXTSIZ,R1 ;Get /T value 4$: DEC R1 ;Count down the multiplier BLE 5$ ;Branch if done ADD @SP,DS.SIZ(R2) ;Bump the size of the device BR 4$ ;Try again 5$: TST (SP)+ ;Clean off the stack MOV (SP)+,R1 ;Restore R1 .ENDC ;NE MDUP ;CG06- BIT #DSH.RO,@R2 ;Read only device? BEQ 6$ ;Branch if not BIS #DEV.RO,@R1 ;Set the bit 6$: BIT #DSH.WO,@R2 ;Write only device? BEQ 7$ ;Branch if not BIS #DEV.WO,@R1 ;Set the bit 7$: TST @R2 ;Is it RT-11 directory structured? BMI 11$ ;Branch if so .IF EQ MDUP CMPB @R2,#CTID ;Is it a cassette? BNE 8$ ;Branch if not BIS #DEV.CT,@R1 ;Set the CT bit BR 17$ ; .ENDC ;EQ MDUP 8$: MOV #MAGS,R3 ;R3 -> Magtape device id list 9$: TSTB @R3 ;Done? BEQ 10$ ;Branch if so CMPB @R2,(R3)+ ;Is this it? BNE 9$ ;Branch if not BIS #DEV.MT,@R1 ;Yep. Done. Set magtape bit BR 17$ 10$: BIS #DEV.SD,@R1 ;Don't know what it is. May be good BR 17$ 11$: BIS #DEV.DK,@R1 ;Remember that it's a disk ; MOV #MULTI,R3 ;R3 -> Device ID's to check for multi-si;009 ;12$: TSTB @R3 ;Done? ;009 ; BEQ 13$ ;Branch if so ;009 ; CMPB @R2,(R3)+ ;Multi-sized volume device? ;009 ; BNE 12$ ;Branch if not ;009 BIT #DSH.MS,@R2 ;Is it multi-size? ;009 BEQ 13$ ;Branch if not ;009 BIS #DEV.MS,@R1 ;Remember if so. ;**-5 13$: MOV #ALLREP,R3 ;R3 -> device id's for always replaceable 14$: TSTB @R3 ;Any more left to check? BEQ 15$ ;Branch if not CMPB @R2,(R3)+ ;Is this it? BNE 14$ ;Branch if not BIS #,@R1 ;Bad blocks always replaceable;SPFUN scan 15$: MOV #SOMREP,R3 ;R3 -> device id's for sometimes replaceable 16$: TSTB @R3 ;Any left to check? BEQ 17$ ;Branch if not CMPB @R2,(R3)+ ;Is the device it? BNE 16$ ;Branch if not BIS #,@R1 ;Bad blocks sometimes replaceable 17$: CMPB #DUID,@R2 ;Is this MSCP? (quick fix for 5.3) BNE 18$ ;Branch if not BIS #,@R1 ;Indicate it's MSCP 18$: RETURN .DSABL LSB .SBTTL FETCH - Fetch handlers .IF EQ MDUP ;+ ; FETCH ; This routine does all handler fetches for DUP. It assumes a call has been ; made to DSTAT and that the dstatus return block is set up. If there is no ; filespec, no fetch is done (of course). ; ; JSR PC,FETCH ; ; R0 - R3, R5 modified ;- PSECT PURE FBLK: .WORD OUTFIL ;-> Output file name .WORD OUTST ;-> Output .DSTATUS block .WORD INFILE ;-> Input file name .WORD INST ;-> Input .DSTATUS block PSECT * FETCH:: MOV #FBLK,R5 ;R5 -> parameters CALL @PC ;Fetch the ouput handler .ASSUME 1$ EQ . ;*Fall thru to do input 1$: MOV (R5)+,R2 ;R2 -> file name MOV (R5)+,R3 ;R3 -> .DSTATUS block TST @R2 ;File there? BEQ 3$ ;Branch if not. Done TST DS.HLA(R3) ;Handler already in core? BNE 3$ ;Branch if so. Done .GTCOR DS.HSZ(R3) ;Get someplace to put the handler BCC 2$ ;Branch if no error ;+ ;ERROR .ERR #ERAREA,#FE.NOM,LEVEL=FATAL,RETURN=NO ; <-F-Insufficient memory> ;- 2$: MOV R0,R1 ;Copy load address .FETCH R1,R2 ;Fetch the handler BCC 3$ ;Branch if ok CLR 2(R2) ;Clear the file name word ;+ ;ERROR .ERR #ERAREA,#FE.FER,LEVEL=FATAL,RETURN=NO,FILE=R2 ; <-F-Fetch error dev:> ;- 3$: RETURN .ENDC ;EQ MDUP .END