.MCALL .MODULE .MODULE PIPINI,VERSION=26,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. ; Edit History: ; ; 001 22-Jan-80 22:20 Guldenschuh, Chuck cpg [240,148] ; Correct various errors: ; 1) "Files xxxxed" header not printed on /QUERY ; 2) QAR's N11-03238 (A43), B35, B36 - Copies from TT:, PC: fail ; 3) QAR B111 - PIP doesn't handle non-RT directory devices correctly ; 4) Some .ENTER errors cause system crash with /WAIT ; (001) ; 002 28-Jan-80 10:18 Guldenschuh, Chuck cpg [240,148] ; More corrections for QAR B111 ; (002) ; 003 29-Jan-80 06:39 Guldenschuh, Chuck cpg [240,148] ; Correct 002 corrections ; (003) ; 004 31-Jan-80 04:08 Guldenschuh, Chuck cpg [240,148] ; Fix COPY TT: FOO.FOO bug (again) ; (004) ; CG02 Correct /EXCLUDE processing PIPINI EL27 PIP X07.00B ; 005 19-Feb-80 11:20 Fingerhut, David [240,134] ; QAR B177: PIP could not handle factoring from MT:. ; (005) ; 006 03-Oct-80 11:46 AM Metsch, James (29602) [240,122] ; Clean up and fix PRINT/DELETE producing ; erroneous error messages if QUEUE not running ; (006) ; 007 09-Feb-81 09:40 AM Lorraine Ricard [240,83] ; add print header flag PRNTHD to initialization list ; (007) ; 008 11-Mar-81 03:28 PM David Fingerhut [240,134] ; Put in /SINCE option ; (008) ; 009 20-Mar-81 10:34 AM David Fingerhut [240,134] ; Put in /Verify option ; (009) ; 010 07-Apr-81 10:50 AM David Fingerhut [240,134] ; Fix /EXCL to work with multiple input devices ; (010) ; 011 05-Jun-81 01:48 PM David Fingerhut [240,134] ; Put in COPY/MULTIVOL ; (011) ; 012 30-Jun-81 10:47 AM David Fingerhut [240,134] ; MT: input-copy files in physical order ; (012) ; 013 14-Jul-81 10:16 AM David Fingerhut [240,134] ; 1 filespec with no options gives [1,23]No device XXXXXX ; (013) ; 014 21-Jul-81 10:43 AM David Fingerhut [240,134] ; /POS:3 on MT input doesn't work. SPR 39290 ; (014) ; 015 27-Aug-81 03:35 PM David Fingerhut [40,134] ; Allow "N" for 'Continue' during /WAIT ; (015) ; 016 13-Oct-81 02:53 PM David Fingerhut [40,134] ; Input file > output volume during /MULTIVOL ; (016) ; 017 05-Nov-81 04:17 PM David Fingerhut [40,134] ; Add /PROTECT (/F) and /NOPROTECT (/Z) ; (017) ; 018 06-Nov-81 03:12 PM David Fingerhut [40,134] ; Add /BEFORE ; (018) ; 019 06-Jan-82 02:42 PM David Fingerhut [40,134] ; Add .SFDAT and /PROTECT support ; (019) ; 020 15-Jan-82 10:05 AM David Fingerhut [40,134] ; Allow COPY/DELETE to disk ; (020) ; 021 02-Feb-82 01:38 PM David Fingerhut [40,134] ; add /NOERR (/X) ; (021) ; 022 14-Apr-82 11:00 AM David Fingerhut [40,134] ; PROTECT RK: without filename is invalid ; (022) ; 023 30-May-89 R. Hamilton ; Check for new LOOKUP error, INVALID UNIT ; ; (017) 08-Jun-89 Incomplete definitions for /ASCII and /BINARY ; MBG mutual exclusion list. Did not include /VERIFY ; although /VERIFY excluded /ASCII and /BINARY ; ; (019) 16-Jun-89 Incorrect exclusion list excludes COPY/MULTI/DEL ; MBG while allowing COPY/DEL/MULTI. Fixed to allow both ; forms. KMON will reject DELETE/MULTI. ; ; (020) 02-Nov-1990 bracket error messages in ;+/;ERROR/.../;- ; JFW ; ; 024 13-Oct-1996 Handle 4-digit years and epochs ; Tim Shoppa ; ; 025 7-Oct-1998 Gripe if user enters a date field more than once. ; Tim Shoppa ; ; 026 25-Oct-1998 Make 1972 and 72 be legal years ; Tim Shoppa .ENABL LC,GBL .SBTTL PSECT definitions ;+ ; The PSECT's are defined here to give them the desired ordering. ; Consider the ordering critical. Several of the PSECT's contain ; stoppers for lists in the previous PSECT. ;- PSECT ...AFL ; PSECT ...MFL ; PSECT IMPURE ;Impure data PSECT PURE ;Pure data psect PSECT PUREB ;[byte] Pure data psect PSECT CLEAR0 ;List of items to cleared on start-up CLRLS0:: ; Reference label PSECT CLEAR1 ;List of blocks to be cleared on start-up .WORD 0 ; Stopper for CLRLS0 CLRLS1:: ; Reference label PSECT SETIT0 ;List of blocks to set to a value on start-up .WORD 0 ; Stopper for CLRLS1 SETLS0:: ; Reference label PSECT SWITAB ;Valid option character table (SWITCH macro) .WORD 0 ; Stopper for SETLS0 SWTLST:: ; Reference label PSECT FLGTBL ;Flag word table (SWITCH macro) .WORD 0 ; Stopper for SWTLST FLGTAB:: ; Reference label PSECT BITTBL ;Table of option flag bits (SWITCH macro) BITABL:: ; Reference label PSECT EXCTBL ;Table of option mutual exclusion bits EXCLST:: ; Reference label PSECT PROCES ;Table of option processing routines PROTBL:: ; Reference label PSECT .LIBC. ;Library code psect PSECT RESTR1 ;Main code psect PSECT PATCH ;Patch psect .BLKW 32. ;Root patch space PSECT IMPURE STBLK: .BLKW 5 ;.SAVEST/.REOPEN block .SBTTL Option definitions ;+ ; SWITCH ; The following macro is used to define all options for PIP. The first ; is the CSI switch. The second argument is the option processing ; routine to call when the switch is encountered. This routine checks ; for validity of arguments, sets the appropriate flag bit, and checks ; for mutual exclusion of options. The next argument is the flag word ; in which to set the flag bit. $AFLAG is for action options, and ; $MFLAG for modification options. The fourth argument is the routine ; which will execute the command for this option. The final argument is ; the list of mutually exclusive options. This is not used in the ; modification options, since they can all be valid at the same time. ; ; The table is broken into three sections. The first section consists ; of actions which can have other actions associated. THIS SECTION IS ; ORDER DEPENDENT. Actions are executed in the same order as they are ; defined in the option table. The next section is the rest of the ; action options. The third section is the modification options. ;- .MACRO SWITCH CHAR,PROC,ABIT,FLAG,EXC .DSABL CRF BS ABIT ;Define flag bit for /'CHAR option EX.'CHAR = ABIT PSECT SWITAB .BYTE ''CHAR PSECT FLGTBL .WORD FLAG PSECT BITTBL .WORD ABIT PSECT PROCES .IF NB PROC .WORD PROC .IFF .WORD 0 .ENDC ..EXC. = 0 .IF NB .IRPC ARG, ;009 .IF DF EX.'ARG ..EXC. = ..EXC. ! EX.'ARG .ENDC .ENDM .ENDC PSECT EXCTBL .WORD ..EXC. ;Exclusion bits for /'CHAR option .ENABL CRF .ENDM SWITCH .BSECT ...AFL,GLOBAL=YES SWITCH A SETASC FL.ASC $AFLAG ;009 SWITCH B SETBIN FL.BIN $AFLAG ;009 SWITCH D SETDEL FL.DEL $AFLAG ;020 SWITCH E ,, FL.WAT $AFLAG SWITCH F SETPRO FL.PRO $AFLAG ;020 SWITCH H ,, FL.VER $AFLAG ;009 SWITCH K COPIES FL.CPS $AFLAG SWITCH N ,, FL.NRP $AFLAG SWITCH O ,, FL.OPD $AFLAG SWITCH R SETREN FL.REN $AFLAG SWITCH U ,, FL.CON $AFLAG SWITCH V ,, FL.MUL $AFLAG SWITCH Z SETPRO FL.UNP $AFLAG ;020 ;020 BS FL.COP ;Default action (COPY) .BSECT ...MFL,GLOBAL=YES SWITCH C GETDAT FL.CUR $MFLAG ;008 SWITCH G ,, FL.IGN $MFLAG SWITCH I GETDAT FL.SIN $MFLAG ;008 SWITCH J GETDAT FL.BEF $MFLAG ;018 SWITCH M MAGPOS FL.MTI $MFLAG SWITCH P ,, FL.EXC $MFLAG SWITCH Q SETLOG FL.QRY $MFLAG ;001 SWITCH S ,, FL.SLO $MFLAG SWITCH T GETDAT FL.DAT $MFLAG SWITCH W SETLOG FL.LOG $MFLAG SWITCH X GETVAL FL.NOE $MFLAG ;021 SWITCH Y ,, FL.YES $MFLAG .SBTTL List of things to clear on start-up and restart ;+ ; CLRLST ; The following list contains the addresses of all items which must be ; cleared on start-up and restart. ;- PSECT CLEAR0 .WORD $AFLAG ;Action option flag word .WORD $MFLAG ;Modification option flag word .WORD ACTION ;-> action routine (DOCOPY, DOREN, DODEL) .WORD COPRTN ;-> copy routine to use (IMAGE, ASCII, BINARY) .WORD KOPIES ;Number of copies .WORD IFILNO ;Input file sequence number .WORD OFILNO ;Output file sequence number .WORD SCCNT ;CTRL/C intercept count .WORD PRNTHD ;Print header flag ;007 .WORD FLGWRD ;Flag word for MT input copy physical ;012 .WORD MNTFLG ;Flag word for WAITCK ;015 PSECT CLEAR1 .WORD FREMLH, 2 ;-> 1st word of free memory .WORD PDEV, 3 ;Table of volumes mounted on which units .WORD DEFEXT, 4 ;Default extensions .WORD DEVSTS, 7 ;Device/file flag words .WORD PNAME, 7 ;Physical device name table .SBTTL INIT - Start-up initialization ;+ ; INIT ; This next section of code cleans up for a restart. It purges all ; channels, releases all handlers, resets memory to the program high ; limit, gets the time-of-day and the date (to cause date roll-over). ;- ORIGIN RESTR1 .ENABL LSB INIT:: MOV #17,R0 ;Get overlay channel ;006 MOV #PIPLKB,R1 ;Point to first word of LOOKUP block ;006 CALL REALDV ;Store RAD50 device name we are running ;006 MOV #HICHAN,R1 ;Get the highest channel in use 1$: .CLOSE R1 ;Close any file opened on it ;Note: This is a .CLOSE rather than a .PURGE ; to solve a couple problems with MT's. DEC R1 ;Decrement the count BPL 1$ ;Loop until done MOV #OUTFIL,R1 ;Point to the CSI file specs 2$: TST @R1 ;Anything there? BEQ 3$ ;Branch if not .RELEAS R1 ;Release the handler 3$: ADD #OUSPSZ,R1 ;Bump the pointer to the next spec CMP #,R1 ;Thru with the output file specs? BHIS 2$ ;Branch if not TST -(R1) ;Input specs are 1 word shorter CMP #,R1 ;Thru with input specs? BHIS 2$ ;Branch if not MOV LIMITS+2,R0 ;Get pointer to 1st word of free memory .SETTOP ;Settop to that MOV #CLRLS0,R1 ;Point to list of things to clear 4$: CLR @(R1)+ ;Clear it TST @R1 ;Done? BNE 4$ ;Branch if not MOV #CLRLS1,R1 ;Point to list of blocks to be cleared 5$: MOV (R1)+,R0 ;Get the address BEQ 10$ ;Branch if done MOV (R1)+,R2 ;Get the size of the block 6$: CLR (R0)+ ;Clear a word SOB R2,6$ ; BR 5$ ; .IF NE 0 ; This next section of code is commented out because there is currently ; no need for it. But if there ever is... 7$: MOV #SETLS0,R1 ;Point the list of blocks to be set 8$: MOV (R1)+,R0 ;Get the address BEQ 10$ ;Branch if done MOV (R1)+,R2 ;Get the number of words to be set MOV (R1)+,R3 ; and the value 9$: MOV R3,(R0)+ ;Set the value SOB R2,9$ ;Loop BR 8$ ; .ENDC ;NE 0 10$: .GVAL #IOAREA,#S.VER ;Get the system version number BIC #^C377,R0 ;Clear the update number CMP R0,#5 ;Is it the right version? VERCHK::BGE 12$ ;Branch if so ;+ ;ERROR 11$: .ERR #ERAREA,#WVR,LEVEL=FATAL,RETURN=YES ; <-F-Wrong version of RT-11> ;- CLR R0 ;Hard exit .EXIT ;Get out quick 12$: MOV #15.,R0 ;Point to overlay channel MOV #SYSDEV,R1 ;Storage area for system device name CALL REALDV ;Go make it real BCS 11$ ;Wrong version!!! MOV SYSDEV,PDEV+VOL.SY ;Save it in the physical device name table .GTIM #IOAREA,#TIME ;Get time-of-day (and maybe cause date roll) .DATE ;Get the date MOV R0,DATE ;Save it MOV R0,OUTDAT ;for /SETDATE default CALL CONDAT ;Convert it to something useable ;008 MOV TDAY,DAY ;Save converted day, mon, year ;008 MOV TMON,MON ;008 MOV TYEAR,YEAR ;008 MOV TDAY,UDAY ;Set up defaults for /DATE MOV TMON,UMON ;008 MOV TYEAR,UYEAR ;008 CLR UDATSB MOV TDAY,SDAY ;Set up defaults for /SETDATE MOV TMON,SMON MOV TYEAR,SYEAR CLR SDATSB MOV TDAY,BDAY ;Set up defaults for /BEFORE MOV TMON,BMON MOV TYEAR,BYEAR CLR BDATSB MOV TDAY,IDAY ;Set up defaults for /SINCE MOV TMON,IMON MOV TYEAR,IYEAR CLR IDATSB .RCTRLO ;Reset CTRL/O CALL NOSCCA ;Reset ^C intercept ;Must be done after CLRLST .CSISPC #OUTFIL,#DEFEXT,#0,#CMDBUF ;Get the command line BCS 13$ ;Try again on error TSTB CMDBUF ;Anything there? BNE 14$ ;Branch if not .PRINT #VERSON ; else print the version 13$: JMP RETRY ; and restart 14$: BR 15$ ;*DBG* .PRINT #CMDBUF ;*DBG* 15$: CALL DECODE ;Parse the command line BIT #FL.DAT,$MFLAG ;Doing /SETDATE? BEQ 154$ ;Branch if not CALL DATCON ;Convert /SETDATE date to RT format 154$: CALL DEFALT ;Set up any defaults and do some more command ; checking CALL FILES ;Do any file processing CALL INITDM ;Initialize dynamic memory BIT #PO.COP,FLGWRD ;Do physical order copying? ;012 BNE 155$ ;Yes; Do copy in physical order ;012 BIT #FL.EXC,$MFLAG ;Doing /EXCLUDE? ;CG02 BEQ 16$ ;Branch if not ;CG02 155$: CALL SETEXC ;Else do setup for that thingy ;012 16$: .GTCOR # ;Allocate the directory/expansion buffer BCC 18$ ;Branch if no error ;+ ;ERROR 17$: .ERR #ERAREA,#FE.NOM,LEVEL=FATAL,RETURN=NO ; <-F-Insuffuent memory> ;- 18$: MOV R0,$DIRBF ;Save the pointer to the buffer MOV #-2,R1 ;Default to large buffers BIT #FL.SLO,$MFLAG ;Doing things slowly? BEQ 19$ ;Branch if not MOV #512.,R1 ;Else use small buffers (1 block) BIT #,$AFLAG ;/VERIFY,/ASCII or /BINAR;009 BEQ 19$ ;Branch if not ASL R1 ;Need 2 buffers, otherwise 19$: .GTCOR ;Allocate I/O buffers BCS 17$ ;Branch if strange error ROR R1 ;R1 = number of words allocated CLRB R1 ;Clear low byte SWAB R1 ;R1 = number of blocks allocated BEQ 17$ ;Branch if not enough MOV $AFLAG,R2 ;R2 = switch flag word 1 BIC #^C,R2 ;009 ;Leave only /VERIFY,/ASCII and /BINARY ;009 BEQ 20$ ;Branch if neither specified ROR R1 ;Cut buffer in half BEQ 17$ ;Branch if not enough 20$: MOV R0,IBUFF ;Save -> input buffer MOV R0,OBUFF ;Save -> default output buffer MOV R1,IBFSIZ ;Save size of buffer in blocks MOV R1,OBFSIZ ;Save output buffer size, also SWAB R1 ;R1 = size of buffer in words ASL R1 ;R1 = size of buffer in bytes ADD R1,R0 ;R0 -> past input buffer MOV R0,IBUFE ;Save it TST R2 ;/ASCII or /BINARY? BEQ 21$ ;Branch if not MOV R0,OBUFF ;Else it's also the output buffer -> ADD R1,R0 ;R0 -> output buffer 21$: MOV R0,OBUFE ;Save it BIT #FL.VER,$AFLAG ;Doing /VERIFY? ;009 BEQ 22$ ;No ;009 MOV OBUFF,VBUFF ;Output buffer becomes verification buff;009 MOV IBUFF,OBUFF ;Input and output use same buffer ;009 MOV IBUFE,OBUFE ;and same ends ;009 22$: RETURN ;009 .DSABL LSB .SBTTL Command line processing routines .SBTTL DECODE - Command line parsing ;+ ; DECODE ; This routine processes the command line. It determines whether or ; not an option is valid, and if so, dispatches to the routine defined ; by the SWITCH macro for further processing. The routines are passed ; the following information: ; ; R0 = The value for the switch or 0 ; R1 = The switch ; ; R4 and R5 must not be modified by the processing routines. ; ; JSR PC,DECODE ; ; R0 - R5 modified ;- .ENABL LSB DECODE:: MOV (SP)+,R5 ;Save the return address MOV (SP)+,R4 ;Get the number of switches BEQ 6$ ;Branch if none 1$: CLR R0 ;Clear index MOV #SWTLST,R2 ;Point to the option character table MOV (SP)+,R1 ;Get the option BMI 2$ ;Branch if there was a value CLR -(SP) ; else fake one 2$: CMPB R1,(R2)+ ;Is this the option? BEQ 3$ ;Branch if so INC R0 ;Bump the index TSTB @R2 ;Any more options there? BNE 2$ ;Branch if so. Try again MOVB R1,ERROPT ;Store the invalid option ;+ ;ERROR MOV #ILO,R1 ;Set up error message .ERR #ERAREA,R1,LEVEL=FATAL,RETURN=NO,ASCII=#ERROPT ; <-F-Invalid option> ;- 3$: ASL R0 ;Make it a word index BIT EXCLST(R0),@FLGTAB(R0) ;Any bits we don't like set? BEQ 4$ ;Branch if not. ;+ ;ERROR ILCMND: .ERR #ERAREA,#ILC,LEVEL=FATAL,RETURN=NO ; <-F-Invalid command> ;- 4$: BIS BITABL(R0),@FLGTAB(R0) ;Set our bit. MOV PROTBL(R0),R3 ;R3 -> option processing routine MOV (SP)+,R0 ;Get the value TST R3 ;Is there a routine to execute? BEQ 5$ ;None. Done for this option JSR PC,@R3 ;Call the routine 5$: SOB R4,1$ ;Count down 6$: MOV R5,-(SP) ;Restore the return address RETURN .DSABL LSB .SBTTL Option processing routines ;+ ; These routines are called by DECODE to complete processing of an ; option. They are generally taking care of any value passed. R4 and ; R5 must not be modified by any of the switch processing routines. ; ; R0 = The value for the switch or 0 ; R1 = The switch ; ; JSR PC,@R3 ; ; R0 - R3 modified ;- .SBTTL SETLOG - Handle /LOG (/W) SETLOG: INC PRNTHD ;Say we have to print the header RETURN .SBTTL SETASC - Handle /ASCII (/A) SETASC: MOV #COPASC,COPRTN ;Set up pointer to correct copy routine RETURN .SBTTL SETBIN - Handle /BINARY (/B) SETBIN: MOV #COPBIN,COPRTN ;Set up pointer to correct copy routine RETURN .SBTTL SETDEL - Handle DELETE command (/D) SETDEL: MOV #DODEL,ACTION ;Set up pointer to correct action routine RETURN .SBTTL GETDAT - Handle /SINCE (/I) and /BEFORE (/J) ;018 GETDAT: JSR PC,SD ;Validate and save date ;008 RETURN .SBTTL SETREN - Handle RENAME command (/R) ;008 ;008 SETREN: MOV #DOREN,ACTION ;Set up pointer to correct action routin;008 RETURN SETPRO: MOV #DOPROT,ACTION ;Set up pointer to correct action routin;020 RETURN ;020 ;020 .SBTTL COPIES - Handle /COPIES (/K) ;008 ;008 COPIES: MOV R0,KOPIES ;Save the number of copies ;008 RETURN ;008 .SBTTL GETVAL - Handle /INFO (/X) GETVAL: MOV R0,INFOX ;Save the value RETURN .SBTTL MAGPOS - Handle /POSITION (/M) MAGPOS: BIC #100000,R1 ;Clear the value bit, if present CMP R0,#<^RREW> ;/POSITION:REWIND? BNE 1$ ;Branch if not CLR R0 ;=> /M:0 BR 2$ ; 1$: CMP R0,#<^RNOR> ;/POSITION:NOREWIND? BNE 2$ ;Branch if not MOV #-1,R0 ;=> /M:-1 2$: SWAB R1 ;Get file number in low byte CMPB R1,#2 ;Was it specified on input side? BLE 3$ ;Branch if not MOV R0,IFILNO ;Save the input file sequence number BR 4$ ; 3$: MOV R0,OFILNO ;Save the output file sequence number 4$: RETURN .SBTTL DEFALT - Default value setup ;+ ; DEFALT ; This routine processes some of the default values for options and does ; some more command line validation. ; ; JSR PC,DEFALT ; ; R0,R5 modified ;- DEFALT:: BIT #FL.WAT,$AFLAG ;Doing /WAIT? BEQ 11$ ;Branch if not CALL FGCHEK ;Check for FG loaded BEQ 11$ ;Branch if OK to proceed JMP RETRY ;Abort the operation 11$: MOV #$AFLAG,R5 ;R5 -> action flag word TST ACTION ;Any action to perform? BEQ 1$ ;Branch if not - Do default ;020 BIT #,@R5 ;doing one of these? ;020 BEQ 2$ ;Branch if not ;020 TST OUTFIL ;Output file specified? BEQ 2$ ;Branch if not ;020 BIT #FL.REN,@R5 ;Doing RENAME? ;020 BEQ 1$ ;Branch if not ;020 MOV #DOREN,ACTION ;Do rename and not protect ;020 BR 2$ ;Don't do defaults ;020 1$: MOV #DOCOPY,ACTION ;Else do a copy ;020 BIS #FL.COP,@R5 ;Remember to do it TST COPRTN ;/ASCII or /BINARY specified? ;020 BNE 2$ ;Branch if so MOV #COPIMA,COPRTN ;Image mode copy BR 3$ 2$: BIT #FL.DEL,$AFLAG ;Doing /DELETE without COPY? BEQ 3$ ;Branch if not BIT #,$AFLAG ;Doing /PROT or /UNPROT? BEQ 3$ ;Branch if not ;+ ;ERROR .ERR #ERAREA,#ILC,LEVEL=FATAL,RETURN=NO ; <-F-Invalid Command> ;- 3$: BIT #,$AFLAG ;/VERIFY, /ASCII, /BINARY, or /CONCAT? ;009 BNE 4$ ;Branch if so BIT #FL.IGN,$MFLAG ;/IGNORE? BEQ 5$ ;Branch if not 4$: BIS #FL.SLO,$MFLAG ;All force /SLOWLY 5$: .HERR ;Let monitor catch ugly errors ;001 BIT #FL.WAT,@R5 ;Doing /WAIT? ;001 BEQ 6$ ;Branch if so ;001 .SERR ;We'll handle the ugly ones, in that cas;001 6$: RETURN ;001 .SBTTL INITDM - Initialize dynamic memory ;+ ; INITDM ; This routine sets up the dynamic memory list head. It is used so that ; the equivalent routine in the utilities library will be placed in the ; overlay, rather than the root. ; ; JSR PC,INITDM ; ; R0 = size of free memory ;- INITDM:: MOV R1,-(SP) ;Preserve R1 MOV #FREMLH,R1 ;R1 -> free memory list head MOV @#S$HLMT,@R1 ;Set up the first word of free space ADD #2,@R1 ;Bump it past us .GVAL #IOAREA,#S.USRL ;R0 = USR load address TST -(R0) ; - 2 CMP R0,@R1 ;Are we already above the USR? BHI 1$ ;Branch if not MOV #-2,R0 ;Else ask for everything 1$: .SETTOP ;Request the memory SUB @R1,R0 ;Get the size of dynamic memory MOV @R1,R1 ;R1 -> first block of memory CLR (R1)+ ;No link to next BIC #3,R0 ;Down to a 4 byte boundary MOV R0,@R1 ;Save the size MOV (SP)+,R1 ;Restore R1 RETURN .SBTTL FILES - File processing ;+ ; FILES ;- FILES:: CALL DSTAT ;Get .DSTATUS info, fetch handlers BIT #,$AFLAG ;/PROTECT or /NOPROTECT? ;019 BEQ 110$ ;Branch if not ;019 TST OUTFIL ;Output file specified? ;019 BNE 110$ ;Branch if specified MT OK for input ;019 BIT #,DEVSTS+2 ;These ;019 BEQ 110$ ; aren't allowed ;019 JMP ILCMND ;Go give message ;019 110$: MOV #OUTFIL,R5 ;R5 -> CSI file spec ;019 BIT #FL.MUL,$AFLAG ;Doing /MULTIVOL? BEQ 111$ ;Branch if not ;016 CALL GTOVSZ ;Get the output volume size ;016 111$: MOV #FNAME,FPTR ;Set start of FNAME table ;016 TST @R5 ;Any output files? BEQ 6$ ;Branch if not. No wildcard checks MOV #DEVSTS,R0 ;R0 -> device/file flag words MOV (R0)+,R1 ;R1 = output file flag word BIT #FLG.WM,R1 ;Embedded wild card? BEQ 2$ ;Branch if not ;+ ;ERROR 1$: .ERR #ERAREA,#IUW,LEVEL=FATAL,RETURN=NO,FILE=R5 ; <-F-Invalid use of wildcards DEV:FILENAME> ;- 2$: BIT #FL.CON,$AFLAG ;/CONCATENATE? BEQ 3$ ;Branch if not BIT #,R1 ;Any wildcard at all BNE 1$ ;Branch if so. Invalid BR 6$ ;Don't do any other checks 3$: BIT #,R1 ;Output device CT, disk, or magtape BEQ 6$ ;Branch if not. Don't check wildcards BIC #^C,R1 ;Leave only wildcard bits MOV #6,R4 ;R4 = loop count 4$: MOV (R0)+,R2 ;R2 = input file flag word BEQ 5$ ;Branch if no file BIC #^C,R2 ;Leave only wildcard bits BEQ 5$ ;Branch if none. Filename is ok BIC R1,R2 ;Any in the input that aren't in the output? BNE 1$ ;Branch if so. Error 5$: SOB R4,4$ ;Check them all 6$: MOV OUTFIL+OUSPSZ,R5 ;Get second output file device word BIS OUTFIL+,R5 ;Is 2nd or 3rd output file specified? BEQ 7$ ;Branch if not ;+ ;ERROR .ERR #ERAREA,#TMO,LEVEL=FATAL,RETURN=NO ; <-F-Too many output files specified> ;- 7$: MOV #OUTFIL,R5 ;R5 -> CSI filespecs MOV #PNAME,R1 ;R1 -> area for physical device name storage CLR R2 ;R2 = channel number MOV #DEVSTS,R3 ;R3 -> device/file flag words 8$: MOV #DEFEXT,R4 ;R4 -> area for non-file-structured lookup CLR 2(R4) ;Clear filename word CLR 4(R4) ;Clear 2nd filename word CLR 6(R4) ;Clear filetype MOV @R5,@R4 ;Get device name BEQ 15$ ;Branch if none. No need to lookup file MOV #-1,MTERR ;Set up default file sequence number CMP R5,#OUTFIL ;Is this the output file spec? BEQ 9$ ;Branch if so BIT #DEV.MT,@R3 ;Is this spec a magtape? BEQ 9$ ;Branch if not BIT #FL.EXC,$MFLAG ;Doing /EXCLUDE? ;012 BNE 85$ ;Then don't do physical order copy ;012 BIS #PO.COP,FLGWRD ;Magtape input; do copy/physical ;012 85$: TST IFILNO ;/POSITION value > 0 ;012 BLE 9$ ;Branch if not MOV IFILNO,MTERR ;Else use that value 9$: .LOOKUP #IOAREA,R2,R4,MTERR ;Lookup the device BCC 14$ ;Branch if no error CLR R0 ;Get ready for MOVB BISB @#S$EERB,R0 ;Get the error byte BNE 10$ ;Branch if not channel in use ;+ ;ERROR MOV #FE.CIU,R1 ;Set error code ; <-F-Channel in use> CLR R4 ;Don't give filename BR 13$ ; 10$: DEC R0 ;File not found?? SHOULD NOT OCCUR!!! BNE 11$ ;Branch if not MOV #FE.FNF,R1 ;Set error code ; <-F-File not found DEV:> BR 13$ ; 11$: DEC R0 ;Device in use? BNE 12$ ;Branch if not MOV #DIU,R1 ;Set error code ; <-F-Device in use DEV:> BR 13$ ; 12$: DEC R0 ; code = 3? BEQ 129$ ; not possible. DEC R0 ; code = 4? BEQ 129$ ; not possible. DEC R0 ; code = 5? BEQ 129$ ; not possible. DEC R0 ; code = 6? (invalid unit no.) BNE 129$ MOV #DIE,R1 ;Set error ; <-F-Directory input error DEV:> BR 13$ 129$: MOV #FE.SYS,R1 ;Oops! ; <-F-System error> CLR R4 ;No filename 13$: .ERR #ERAREA,R1,LEVEL=FATAL,RETURN=NO,FILE=R4 ;- 14$: MOV R2,R0 ;R0 = channel number CALL REALDV ;Convert logical to physical BCS 12$ ;Branch on error 15$: CMP R5,#OUTFIL ;Output file spec? ;006 BNE 16$ ;Branch if not .CLOSE R2 ;Close the channel MOV #INFILE,R5 ;R5 -> input file specs BR 17$ ; 16$: BIT #,@R3 ;STRANGE DEVICE OR MT? ;005 ;005 BEQ 165$ ;Branch if not .CLOSE R2 ;Close the channel. Expand will do it ;001 165$: MOV (R1),@FPTR ;Save physical device name ;010 ADD #2,FPTR ;Update pointer ;010 ADD #INSPSZ,R5 ;Point to next spec ;010 17$: TST (R1)+ ;Go to next entry in PNAME INC R2 ;Bump the channel number TST (R3)+ ;Go to next device/file flag word CMP R5,#ENDSPC ;Any more specs? BLO 8$ ;Branch if so RETURN .SBTTL DSTAT - Get device statistics ;+ ; DSTAT ; This routine sets up the device/file flag words 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). ; ; JSR PC,DSTAT ; ; R0 - R3, R5 modified ;- PSECT PUREB MAGS: .BYTE MMID ;MM device id .BYTE MTID ;MT device id .BYTE MSID ;MS device id .BYTE MUID ;MU device id MTDPS:: .BLKB 5 ;Allow patch space for 5 more magtapes .BYTE 0 ;End of magtape device id table PSECT * DSTAT:: MOV #DEVSTS,R1 ;R1 -> device/file flag words MOV #STATUS,R2 ;R2 -> .DSTATUS info return blocks MOV #OUTFIL,R3 ;R3 -> CSI filespecs 1$: TST @R3 ;File spec given? BEQ 12$ ;Branch if not. Done. .DSTATU R2,R3 ;Get the device info BCC 2$ ;Branch if no error CLR 2(R3) ;Clear the file name word ;+ ;ERROR .ERR #ERAREA,#FE.ILD,LEVEL=FATAL,RETURN=NO,FILE=R3 ; <-F-Invalid device dev:> ;- 2$: MOV R3,-(SP) ;Save R3 for later CMP #OUTFIL,R3 ;Doing output file? ;016 BNE 25$ ;No ;016 MOV DS.SIZ(R2),OVSIZE ;Save output device size ;016 BIT #DSH.MS,@R2 ;Multisize device? ;016 BEQ 25$ ;Branch if not ;016 24$: BIS #DEV.MS,@R1 ;Set the bit ;016 25$: BIT #DSH.ND,@R2 ;Is it non-RT-structure? ;016 BEQ 26$ ;No - it's Rt-structure ;016 BIS #DEV.DR,@R1 ;Set the bit ;016 26$: BIT #DSH.RO,@R2 ;Read only device? ;016 BEQ 3$ ;Branch if not BIS #DEV.RO,@R1 ;Set the bit 3$: BIT #DSH.WO,@R2 ;Write only device? BEQ 4$ ;Branch if not BIS #DEV.WO,@R1 ;Set the bit 4$: TST @R2 ;Is it RT-11 directory structured? BMI 10$ ;Branch if so CMPB @R2,#CTID ;Is it a cassette? BNE 5$ ;Branch if not BIS #DEV.CT,@R1 ;Set the CT bit BR 11$ ; 5$: MOV #MAGS,R3 ;R3 -> Magtape device id list 6$: TSTB @R3 ;Done? BEQ 7$ ;Branch if so CMPB @R2,(R3)+ ;Is this it? BNE 6$ ;Branch if not BIS #DEV.MT,@R1 ;Yep. Done. Set magtape bit BR 11$ 7$: CMPB @R2,#LPID ;Is it a lineprinter? BNE 8$ ;Branch if not BIS #DEV.LP,@R1 ;Say so BR 11$ ; 8$: CMPB @R2,#TTID ;Is it the console terminal? BNE 9$ ;Branch if not BIS #DEV.TT,@R1 ;Set the flag bit 9$: BIT #DSH.ND,@R2 ;Is it non-RT directory structured? BNE 95$ ;Branch if so ;001 MOV @SP,R3 ;R3 -> CSI spec ;001 TST (R3)+ ;Skip device name ;001 CLR (R3)+ ;Clear filename to prevent 'Invalid wild;001 CLR (R3)+ ;Clear other half ;001 CLR (R3)+ ;Clear filetype ;001 BR 11$ ; 95$: BIS #DEV.SD,@R1 ;It's a strange device ;001 BR 11$ ; ;001 ;001 10$: BIS #DEV.DK,@R1 ;Remember that it's a disk 11$: MOV (SP)+,R3 ;Restore pointer to CSI filespecs CALL SETSPC ;Set file spec bits CALL SPCHEK ;Check bits against options CALL FETCH ;Fetch handlers 12$: TST (R1)+ ;R1 -> next device/file flag word CMP R3,#OUTFIL ;Doing the output file? BNE 13$ ;Branch if not ADD #,R3 ;R3 -> 1st input spec BR 14$ ; 13$: ADD #INSPSZ,R3 ;R3 -> next input spec 14$: CMP R3,#ENDSPC ;Done? BLO 1$ ;Branch if not 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. ; ; R1 -> file/device specification flag word ; R3 -> CSI filespec ; ; JSR PC,SETSPC ; ; CMDBUF modified ;- SETSPC:: JSR PC,$SAVAL ;Save all registers MOV R1,R2 ;R2 -> file/device specification flag word MOV R3,R0 ;R0 -> CSI filespec TST @R0 ;Device specified? BEQ 1$ ;Branch if not BIS #FLG.DV,@R2 ;Set the device found flag 1$: TST 2(R0) ;File specified? BEQ 10$ ;Branch if not 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 2$: CMP R0,R1 ;Are we done? BHIS 9$ ;Branch if so CMPB (R0)+,#': ;Scan past the device name BNE 2$ ;Branch if we haven't yet MOV R0,-(SP) ;Save the beginning of the string MOV #FLG.WF,R5 ;Set up for a wild file 3$: CMPB @R0,#'% ;Wild character? BEQ 6$ ;Branch if so CMPB @R0,#'* ;Wild field? BEQ 8$ ;Branch if so 4$: CMPB (R0)+,#'. ;Past filename yet? BNE 5$ ;Branch if not MOV R0,@SP ;Save start of filetype MOV #FLG.WE,R5 ;Set up to flag it 5$: CMP R0,R1 ;Done with string? BLO 3$ ;Branch if not BR 9$ ; 6$: BIS R5,@R2 ;Flag name or type as wildcarded 7$: BIS #FLG.WM,@R2 ;"%" is always embedded BR 4$ ; 8$: BIS R5,@R2 ;Flag name or type as wildcarded CMP R0,@SP ;At beginning of string? BNE 7$ ;Branch if not. Embedded wildcard CMPB 1(R0),#BLANK ;Blank following? BEQ 4$ ;Branch if so. End of filename CMPB 1(R0),#'. ;Is it a "."? BEQ 4$ ;Branch if so BR 7$ ;Must be embedded 9$: TST (SP)+ ;Clean stack 10$: RETURN .SBTTL SD- /I,/C,/J ;018 ;+ ; SD ;008 ; This routine handles user specified dates for /I,/J and /C. ;018 ; It no longer quits working in the year 2000. (Nor does the ;024 ; rest of RT!) ;024 ; NOTE: ;008 ; This routine is called by GETDAT. It must not modify R2. ;008 ;- DAYFLG =100000 ;025 MONFLG =40000 ;025 YEAFLG =20000 ;025 SD:: ;008 MOV R2,-(SP) ;Save R2 MOV R4,-(SP) ;Save R4 ;025 MOV #SDATE,R2 ;R2 -> /SETDATE storage area MOV #SDATSB,R4 ;R4 -> /SETDATE set bits ;025 CMPB #'T,R1 ;Doing /SETDATE? BEQ 1$ ;Branch if so MOV #BDATE,R2 ;R2 -> /BEFORE storage area MOV #BDATSB,R4 ;R4 -> /BEFORE set bits ;025 CMPB #'J,R1 ;Doing /BEFORE? BEQ 1$ ;Branch if so MOV #IDATE,R2 ;R2 -> /SINCE storage area MOV #IDATSB,R4 ;R4 -> /SINCE set bits ;025 CMPB #'I,R1 ;Doing /SINCE? BEQ 1$ ;Branch if so MOV #UDATE,R2 ;R2 -> /DATE storage area MOV #UDATSB,R4 ;R4 -> /DATE set bits ;025 1$: MOV R1,R3 ;Put switch word in R3 ;008 TST R3 ;Was a value given? ;008 BGE 7$ ;Branch if not. We're through. ;008 TST R0 ;Check the value for validity ;008 BLE 40$ ;No good. Flag as invalid. ;025 CMP #31.,R0 ;Is it a day? ;008 BLT 2$ ;Branch if not ;008 BIT #DAYFLG,(R4) ;Have we already set the day? ;025 BNE 40$ ; if so, flag as error ;025 MOV R0,4(R2) ;Else save it in DAY BIS #DAYFLG,(R4) ;and mark that we've set the day ;025 BR 7$ ; and return to caller ;008 ;008 2$: CMP #2099.,R0 ;Is it too big for a 4-digit year? ;024 BLT 4$ ;Branch if so ;024 CMP #1972.,R0 ;Is it big enough for a 4-digit year? ;024 BLE 3$ ;Yes, go to 4-digit year code ;024 CMP #99.,R0 ;Is it too big for a 2-digit year? ;024 BLT 4$ ;Branch if so ;024 CMP #72.,R0 ;Is it big enough for a 2-digit year? ;024 BLE 310$ ;Yes, branch to 2-digit year code ;024 BR 40$ ;Otherwise illegal number ;024 3$: SUB #1900.,R0 ;Bring it into range 72.-199. ;024 310$: BIT #YEAFLG,(R4) ;Have we already set the year? ;025 BNE 40$ ; if so, invalid date string ;025 MOV R0,(R2) ;Save it in YEAR BIS #YEAFLG,(R4) ;Mark that we've set the year ;025 BR 7$ ;Return ;008 ;008 4$: MOV #MONTHS+2,R3 ;Point to RAD50 month names. ;008 CLR R1 ;Initialize counter. ;008 5$: INC R1 ;Bump counter ;008 CMP (R3)+,R0 ;Is this one it? ;008 BEQ 6$ ;Branch if so ;008 TST @R3 ;Anything left? ;008 BNE 5$ ;Branch if so ;008 40$: JMP ILCMND ;Else give error. (date no good) ;008 ;008 6$: BIT #MONFLG,(R4) ;Have we already set the month? ;025 BNE 40$ ; if so, invalid date string ;025 MOV R1,2(R2) ;Save it in MONTH BIS #MONFLG,(R4) ;Mark that we've set the month ;025 7$: MOV (SP)+,R4 ;Restore R4 ;025 MOV (SP)+,R2 ;Restore R2 RETURN ;008 ;008 .SBTTL DATCON - User specified to RT11 date conversion ;+ ; DATCON ; Converts user specified date into RT11 format. ; ; Input ; SYEAR, SMON, and SDAY contain the date as set by SD. ; ; CALL DATCON ; ; Output ; OUTDAT contains the date in RT format. ;- DATCON:: MOV SMON,R1 ;R1 = month ASL R1 ;Shift ASL R1 ; month ASL R1 ; left ASL R1 ; five ASL R1 ; bits ADD SDAY,R1 ;Add in the day ASL R1 ;Shift ASL R1 ; month and day ASL R1 ; left ASL R1 ; five ASL R1 ; bits MOV R1,OUTDAT ;Save our work so far ;024 MOV SYEAR,R0 ;Get the year ;024 SUB #72.,R0 ;Base year on 1972 ;024 MOV R0,R1 ;Make copies to pick off bits ;024 BIC #^c<000037>,R1 ;R1 now has low 5 bits of year ;024 ASL R0 ;Move age bits ;024 SWAB R0 ; to bits 14-15 ;024 BIC #^c<140000>,R0 ; and mask them off ;024 ADD R0,R1 ;add them together ;024 ADD R1,OUTDAT ;Save the date ;024 RETURN .SBTTL SPCHEK - Check file specs for legality ;008 ;008 ;+ ;008 ; SPCHEK ;008 ; This routine checks all file specs for legality with the specified ;008 ; options. The table is set up as follows: ;008 ; ;008 ; .WORD option_bit ;008 ; .WORD required_bits_for_input ;008 ; .WORD Invalid_bits_for_input ;008 ; .WORD required_bits_for_output ;008 ; .WORD Invalid_bits_for_output ;008 ; ;008 ; R1 -> device/file flag word ;008 ; ;008 ; JSR PC,SPCHEK ;008 ;- ;008 ;008 PSECT PURE DEVTBL:: .WORD FL.COP!FL.ASC!FL.BIN!FL.CON ;/ASCII or /BINARY or /CONCATENATE .WORD FLG.DV ;Input device required .WORD DEV.WO ;Can't be write only .WORD FLG.DV ;Output device required .WORD DEV.RO ;Can't be read only .WORD FL.REN ;RENAME .WORD FLG.DV ;Input must be specified ;003 .WORD DEV.WO!DEV.RO!DEV.MT!DEV.CT!DEV.TT ;Can't be read only ;003 ; write only, MT, CT, or TT ;003 .WORD FLG.DV!FLG.FL ;Output device and file required .WORD DEV.CT!DEV.MT!DEV.RO ;Output can't be magtape or cassette .WORD FL.DEL ;DELETE ;019 .WORD FLG.DV!FLG.FL ;Must have input device and file .WORD DEV.WO!DEV.RO!DEV.MT ;Input can't be read/write only or MT .WORD 0 ;No output required .WORD DEV.RO ;Output can't be read only ;020 ;020 .WORD FL.CPS ;/COPIES .WORD FLG.DV ;Input device must be specified .WORD DEV.WO ;Input can't be write only .WORD FLG.DV ;Output must be specified .WORD DEV.DK!DEV.RO ;Output can't be disk or read only .WORD FL.NRP!FL.OPD ;/NOREPLACE or /PREDELETE .WORD FLG.DV ;Input must be specified .WORD DEV.WO ;Input can't be write only .WORD FLG.DV ;Output device must be specified;003 .WORD DEV.WO!DEV.RO!DEV.MT!DEV.CT!DEV.TT ;Output can't ;003 ; be read only, write only, ;003 ; MT, CT, or TT ;003 ;009 .WORD FL.VER ;/VERIFY ;009 .WORD FLG.DV ;Input must be specified ;009 .WORD DEV.WO ;Input can't be write only ;009 .WORD FLG.DV ;Output device must be specified;009 .WORD DEV.WO!DEV.RO!DEV.TT ;Output can't be read only, ;009 ;write only, or TT ;009 ;009 .WORD FL.MUL ;/MULTIVOL ;011 .WORD FLG.DV ;Input must be specified ;011 .WORD DEV.WO!DEV.CT!DEV.MT ;Input can't be write only ;011 ;MT or CT ;011 .WORD FLG.DV ;Output device must be specified;011 .WORD DEV.RO!DEV.CT!DEV.TT ;Output can't be read only, CT ;011 ;or TT ;011 ;011 .WORD FL.PRO!FL.UNP ;/PROTECT, /UNPROTECT ;019 .WORD FLG.DV!FLG.FL ;Must have input dev and file ;022 .WORD DEV.WO ;Input can't be write only ;**-1 .WORD 0 ;No output required ;019 .WORD DEV.WO!DEV.RO!DEV.MT!DEV.CT ;Output can't be RO, WO, ;019 ;MT or CT ;019 ;019 .WORD 0 ;Stopper DVTBSZ = 12 ;Size of a table entry PSECT * SPCHEK:: JSR R2,$SAVVR ;Save R0 - R2 MOV R3,-(SP) ;Save R3 MOV #DEVTBL,R0 ;R0 -> file spec validity table 1$: TST @R0 ;At the end? BEQ 6$ ;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$: CMP R1,#DEVSTS ;Doing an input filespec? BNE 3$ ;Branch if so CMP (R0)+,(R0)+ ;Else skip input file bits 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 Invalid bits set BEQ 5$ ;It's ok 4$: JMP ILCMND ; ; <-F-Invalid command> 5$: CMP R1,#DEVSTS ;Doing an input filespec? BEQ 1$ ;Branch if not CMP (R0)+,(R0)+ ;Else skip output file bits BR 1$ 6$: MOV (SP)+,R3 ;Restore R3 RETURN .SBTTL FETCH - Fetch handlers ;+ ; 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). ; ; R2 -> .DSTATUS return block ; R3 -> CSI filespec ; ; JSR PC,FETCH ;- FETCH:: JSR R2,$SAVVR ;Save R0 - R2 TST DS.HLA(R2) ;Handler already in core? BNE 2$ ;Branch if so. Done .GTCOR DS.HSZ(R2) ;Get someplace to put the handler BCC 1$ ;Branch if no error ;+ ;ERROR .ERR #ERAREA,#FE.NOM,LEVEL=FATAL,RETURN=NO ; <-F-Insufficient memory> ;- 1$: MOV R0,R1 ;Copy load address .FETCH R1,R3 ;Fetch the handler BCC 2$ ;Branch if ok CLR 2(R3) ;Clear the file name word ;+ ;ERROR .ERR #ERAREA,#FE.FER,LEVEL=FATAL,RETURN=NO,FILE=R3 ;006 ; <-F-Fetch error dev:> ;- 2$: RETURN .SBTTL REALDV - Get the real device name ;+ ; REALDV ; This routine returns the real device name of the device associated with ; a channel. ; ; R0 = channel number ; R1 -> location to place the RAD50 device name ; ; CALL REALDV ; ; C-bit = 0 => success ; R0 random ; (R1) = RAD50 device and unit number ; ; C-bit = 1 => failure - cannot happen ;- REALDV:: MOV R0,-(SP) .CSTAT #IOAREA,(SP)+,#CSTAT ;Get channel status BCC 1$ ;Branch if channel is open ;+ ;ERROR .ERR #ERAREA,#FE.CNO,LEVEL=FATAL,RETURN=NO ; ;- 1$: MOV R2,-(SP) ;Save R2 MOV R1,-(SP) ;Save buffer pointer MOV CSTAT+8.,R1 ;Copy the unit number MOV CSTAT+10.,R0 ;Copy physical device name CALL $DEVTR ;Translate to RAD50 device spec MOV (SP)+,R1 ;Restore buffer address MOV R0,@R1 ;Store RAD50 device spec in buffer MOV (SP)+,R2 ;Restore R2 CLC RETURN .SBTTL SETEXC - Setup for /EXCLUDE processing ;CG02+ ;+ ; SETEXC ; This routine sets up area TESTNM for MATCH3. It is only entered if ; /EXCLUDE was specified or if there is a magtape input. If any input ;012 ; is from MT, then the files will be copied in the physical order they ;012 ; reside on the volumes. The EXCLUDE matching will be used for this. ;012 ; ; PNAME contains physical device names of input devices ; ; CALL SETEXC ;- SETEXC:: CALL $SAVAL ;Save all registers MOV #TESTNM,R4 ;R4 -> area for ASCII filenames CLRB @R4 ;Mark the end of the list MOV #INFILE,R5 ;R5 -> CSI input filespecs 1$: MOV R4,R1 ;R1 -> area to store it. MOV R5,R0 ;R0 -> filespec TST (R0)+ ;Anything there? ;R0 -> filename BEQ 2$ ;Branch if not. Try the next one CALL RTOA ;Convert RAD50 to ASCII in our format ADD #11.,R4 ;Bump -> ASCII area ;006 CLRB @R4 ;Mark the end of the list 2$: ADD #INSPSZ,R5 ;Bump -> filespec ;006 CMP R5,#ENDSPC ;Are we at the end of the filespecs? BLO 1$ ;Branch if not. Try again. MOV #INFILE,R3 ;R3 -> 1st input filespec MOV #PNAME+2,R1 ;R1 -> physical device name for 1st spec 3$: MOV R1,R2 ;R2 -> physical device name MOV R3,R0 ;R0 -> CSI filespec 4$: ADD #INSPSZ,R0 ;R0 -> next filespec TST (R2)+ ;R2 -> next physical device name CMP R2,#PNAME+<7*2> ;Hit the end yet? BHIS 5$ ;Branch if so CMP @R1,@R2 ;Two devices the same? BNE 4$ ;Branch if not. Try next set CLR @R0 ;Say no filespec there CLR @R2 ;No physical device name, either BR 4$ ;Try the next one 5$: TST (R1)+ ;R1 -> next physical device name ADD #INSPSZ,R3 ;R3 -> next input file spec CMP R1,#PNAME+<7*2> ;At the end yet? BLO 3$ ;No. Try again RETURN ;CG02- .END