.TITLE SRDLST-LIST THE DIRECTORY .IDENT -6.4- ; NOV-83 .ENABL LC ;+ ; ; **SRD--SORT DIRECTORY ; ; THIS MODULE CREATS A SELECTIVE LISTING OF THE FILE ; ; ; THIS TASK WILL SORT A RSX11M DIRECTORY ; THEN CREATE A LISTING WITH MANY SELECTION OPTIONS ;- ; ; MODIFICATIONS: ; ; BT001 - 01-DEC-81 ; IMPLEMENT /ZE SWITCH TO FIND ZERO USED BLOCK FILES; ; WHEN HEADER ATTRIBUTES SHOW 0 BLOCKS ALLOCATED, CALCULATE VALUE ; FROM RETRIEVAL POINTERS, AND INCLUDE IN DIRECTORY TOTAL ; ; RBD001 13-JUL-82 ; Lower case messages for 'M Version 4.0 fans ; ; BT002 - 18-May-83 ; Merged in /SM, /HD, and /BK switches from Glen Everhart's ; Fall 1982 version; ; Correct bug which caused version number selection to fail ; to list the proper files in many cases. ; ; CEF001 - 1-June-83 ; ADD .PSECT FOR DATA & CODE ; ; ; VERSION 6.4 - 07-Nov-83 (;BT003) ; ; Bob Turkelson ; SRD Working Group ; ; Allow specification of major and minor sort keys in any order ; in the /SR:x:x:x switch, also allowing the sort to be either ; ascending or descending for any key (file name, type, version ; date). Ascending and descending capability adopted from ; changes by Dave Sides (Sachs/Freeman Assoc., Inc., c/o ; JHU/Applied Physics Laboratory)(;DJS001). Ideas for ; specifying sort keys came from the version of SRD in the ; U. S. Forest Service collection of programs appearing on the ; Spring 1982 SIG tape. The implementation here is quite ; different. ; Search forward in the sorted directory to determine the number ; of versions when highest or obsolete version selection is ; required, and remember where a new file name and type is ; found. Necessary to take care of ascending version ; numbers. (Replaces code which compared each entry with ; both the previous and the next entries.) A check for end ; of directory is performed. (Previously possible to get a ; memory protection violation error when checking last entry ; of a dense directory which exactly filled the last block.) ; Added the command file generation switch /CM, taken from the ; version of SRD submitted to the Spring 1982 SIG tape in the ; U. S. Forest Service collection of programs. ; Added the /PA switch to pack the file names (remove any blanks). ; Added the /TB switch to include in the summary the number of ; blocks used/allocated even if it would not otherwise appear. ; Added the /GT:n switch to select files with allocated sizes of ; at least n. blocks. ; Added the /FI:n switch to select by file ID. ; Added the /FO:[g,m] switch to select files by file owner, with ; /FO defaulting to files owned by the directory being listed; ; may be negated to select files with different file owners. ; Added the /ER switch to display files which produce errors ; when attempting to read their headers. ; Reference double word (rather than single word) values in the ; file headers to report a file's used and allocated blocks. ; For files with multiple headers, calculate the number of ; allocated blocks from the retrieval pointers (as has been ; done for any file when the header attributes show zero blocks ; allocated). Read each extension header into a buffer which ; starts at the beginning of the retrieval pointer area of the ; buffer for the first header. Only 51. additional words are ; needed for the buffer since the overlap is 205. words. ; Temporarily do not report errors when reading extension ; headers - treat the file as if it had a single header - unless ; the temporary switch /H2 is specified. A bug in RSX-11M V4.0 ; and RSX-11M-PLUS V2.0 causes a privilege violation reading an ; extension header unless you are in a privileged UIC or in the ; file owner's UIC. We recently determined that this does not ; occur in RSX-11M V3.2, and this problem has been corrected in ; V4.1 and RSX-11M-PLUS V2.1. ; When the date stored in the file header is corrupt, issue a ; non-fatal diagnostic message. (Previously the same fatal ; message was issued for this situation as was given for when ; an invalid date was specified in the command line.) ; Eliminate the extra zero byte appearing at the end of the UIC ; line. ; In diagnostic messages which refer to specific files include ; the UIC and file name in the message. ; Never "select" a file with a header read error. No further ; selection checks are performed for such a file. ; Do not "select" a file when a corrupt date is detected in ; the file header if file selection by date is requested. ; Make sure the UIC line for the directory appears when issuing ; a diagnostic for a header read error or for a corrupt date ; in the header. ; Set a flag bit in FLAGS$ at the beginning of SRDLST if the ; switches require a header read. Testing this bit where that ; information is needed eliminates duplicate code. ; Form a UIC string when the directory is opened in SRDOPR for ; use in UIC headings and diagnostic messages. ; Code for converting the file name to ASCII moved to a new ; routine CVTNAM within SRDLST. ; Calculation of end-of-file block number is done once rather ; than three times. ; ; ; ; SYSTEM MACRO CALLS ; ;CEF001 .PSECT SRDATA,D,RW,LCL,REL,CON ;CEF001 ; ;CEF001 ; .MCALL FHDOF$,CALLR,DIR$,QIOW$S,WTSE$S,PUT$S,GCMLD$ GCMLD$ FHDOF$ DEF$L DTSTR: .BYTE 40,2,'-,3,'-,2,' ,2,':,2,' ,0 .EVEN FUTABL: .BYTE H.UFAT+F.EFBK ; FCS's end of file double word ;BT003 .BYTE 14.,0,0 ; SIZE,LEADING CHAR,TRAILING CHAR ;**-1 .WORD SIZECV ; CONVERSION ROUTINE .BYTE 2,6,0,0 .WORD CLMCV ; Contiguous/Locked etc. .BYTE H.PROG,10.,'[,'] .WORD UICCV ; OWNER UIC CONVERSION .BYTE H.FNUM,12.,'(,') ; FILE NUMBER .WORD FIDCV .BYTE H.FPRO,22.,'[,'] .WORD FPROCV .WORD 0 ; END OF TABLE MITABL: .BYTE H.UFAT+F.EFBK ; FCS's end of file double word ;BT003 .BYTE 14.,0,0 ; SIZE,LEADING CHAR,TRAILING CHAR ;**-1 .WORD SIZECV ; CONVERTION ROUTINE .BYTE 2,6,0,0 .WORD CLMCV ; Contiguous/Locked etc. .BYTE H.FNUM,12.,'(,') ; FILE NUMBER .WORD FIDCV .WORD 0 ; End of Table ; FPSTR: .ASCIZ /RWED/ TERMRS: .ASCII \.;\ ; FILE-NAME FIELD TERMINATORS QBUF$: .ASCII " [Y/N/G/Q] ? _"<10> ; /SD PROMPT MESSAGE SUFFIX QBUFS$=.-QBUF$ QBF1$: .ASCII <15><12><11>"Are you sure [Y/N] ? _"<10> ; GO VERIFICATION MSG ;RBD001 QBF1S$=.-QBF1$ .EVEN .PAGE ;CEF001 .SBTTL SRDLST GENERATE LISTING - CODE ;CEF001 .PSECT SRDCOD,I,RO,REL,CON,LCL ;CEF001 ; ;CEF001 ; SRDLST:: ; DIRECTORY IS SORTED,NOW GENERATE LISTING ; LSTDIR: CLR VRSRM$ ; Zero number of file versions remaining ;BT003 BIC #HDFL,FLAGS$ ; Flag header listing not yet printed ;BT003 BIS #RDHDFL,FLAGS$ ; Set flag to read file header ;BT003 BIT #MISW!FUSW!DASW,SWMSK$ ; /MI, /FU, or any date switch used? ;BT003 BNE 20$ ; NE - yes, will need to read file headers ;BT003 BIT #COSW!LOSW!MUSW!ZESW,SWMS2$ ; /CO, /MU, or /ZE specified? ;BT003 BNE 20$ ; NE - yes, will need to read file headers ;BT003 BIT #GTSW!ERSW!TBSW!FOSW,SWMS3$ ; /GT, /ER, /TB or /FO specified? ;BT003 BNE 20$ ; NE - yes, will need to read file headers ;BT003 BIC #RDHDFL,FLAGS$ ; Clear flag - will not need file headers ;BT003 20$: ;BT003 MOV DIRBF$,R5 ;SET START OF DIRECTORY BUFFER ;**-1 UNPACK: CMP R5,UFDFDB+F.BKDS+2 ; At end of buffer? BHIS 10$ ; If HIS yes - end TST (R5) ;ANY THING REMAINING TO UN-PACK? BNE UNP1 ;CONTINUE ; 10$: BIT #CMSW,SWMS3$ ; Generating command lines? ;BT003 BNE 2$ ; NE - yes, omit summary lines ;BT003 MOV #FILMSG,R0 ; LIST OUT FILE COUNTS MOV NUMFS,R1 BNE 1$ ; DON'T SHOW ZERO SELECTED IF WILDCARD UIC TST NXUIC$ BNE 2$ 1$: MOV #33012,R2 CALL $CBTA MOV #FTMSG,R0 MOV NUMFT,R1 MOV #33012,R2 CALL $CBTA TST UFDFDB+F.BDB ; IS DIRECTORY STILL OPEN ??? BNE 21$ ; YES--DON'T PRINT TOTALS YET BIT #SMSW,SWMS3$ ; WAS THE /SM SUMMARY SWITCH SELECTED? ;BT002 BEQ 21$ ; IF EQ NO - DON'T OUTPUT THE SUMMARY ;BT002 PUT$S #LSTFDB,#FILMSG,#FMLEN ; SHOW SELECTED BLOCKS USED/ALLOCATED BIT #RDHDFL,FLAGS$ ; Were headers read? ;BT003 BEQ 21$ ; NO ;**-1 MOV #SBAREA,R0 MOV #TBLKU,R1 CLR R2 CALL $CDDMG MOVB #'.,(R0)+ MOVB #'/,(R0)+ MOV #TBLKA,R1 CLR R2 CALL $CDDMG MOVB #'.,(R0)+ MOV R0,R2 SUB #SBMSG,R2 PUT$S #LSTFDB,#SBMSG,R2 21$: MOV #LINBUF,LSTFDB+F.NRBD+2 2$: RETURN UNP1: INC NUMFT MOV R5,READHD+Q.IOPL ; SET FILE ID POINTER INCASE HEADER IS NEEDED CLR LENNTV ; Zero length of name-type-version ;BT003 BIT #FISW,SWMS3$ ; Search for a particular File ID? ;BT003 BEQ 5$ ; EQ - no, proceed ;BT003 MOV #FIBUF$,R1 ; Point to list of File IDs specified ;BT003 3$: CMP (R5),(R1)+ ; Is this the File ID we want? ;BT003 BEQ 5$ ; EQ - yes ;BT003 TST (R1) ; Was another File ID specified? ;BT003 BNE 3$ ; NE - yes, check them all ;BT003 ADD #D.SIZ,R5 ; No, advance pointer to next entry ;BT003 BR UNPACK ; Process next entry ;BT003 5$: ;BT003 ADD #D.FNAM,R5 ; POINT AT FILE-NAME PORTION ;**-1 BIT #SVSW,SWMSK$ ; Version selection needed? ;BT003 BEQ CKHV ; EQ - no, proceed ;BT003 DEC VRSRM$ ; Decrement number of file versions remaining ;BT003 BGT CKHV ; No need to do anything if not a new file name ;BT003 MOV #1,VRSRM$ ; Different file name - count this version ;BT003 MOV R5,R3 ; Copy place in directory, at file name ;BT003 MOV R3,R2 ; Copy again ;BT003 ADD #D.SIZ,R2 ; Point to file name field of next entry ;BT003 10$: CMP R2,UFDFDB+F.BKDS+2 ; Beyond end of buffer? ;BT003 BHIS 30$ ; HIS - yes, we have reached the end ;BT003 MOV #4,R1 ; Number of words in name and type ;BT003 20$: CMP (R3)+,(R2)+ ; Is the next entry the same? ;BT003 BNE 30$ ; NE - no, name is different in next entry ;BT003 SOB R1,20$ ; Check whole name and type ;BT003 INC VRSRM$ ; Name is same - count it ;BT003 SUB #<4*2>,R3 ; Point back to first file name ;BT003 ADD #D.SIZ-<4*2>,R2 ; Point to file name following one just checked ;BT003 BR 10$ ; Check if that one has the same name ;BT003 ; ;BT003 ; Here we know the total number of versions for this file. ;BT003 ; Set the threshold for for the new/obsolete versions requested. ;BT003 ; ;BT003 30$: MOV VRSCT$,R2 ; Get value specified in /SV, /NV, /OV, or /PU ;BT003 BNE 40$ ; NE - non-zero specified ;BT003 INC R2 ; If no value specified, use 1 ;BT003 40$: MOV R2,R1 ; First assume ascending version number - set ;BT003 ; ; threshold (number of versions from bottom) ;BT003 ; ; to value specified in switch ;BT003 CMP R2,#-1 ; Looking for last version? ;BT003 BNE 60$ ; NE - no ;BT003 BIT #ASCVER,FLAGS$ ; Are version numbers ascending? ;BT003 BEQ 50$ ; EQ - no ;BT003 MOV VRSRM$,R1 ; For "last version," ascending - set ;BT003 DEC R1 ; threshold to total minus 1 ;BT003 BR 70$ ; Proceed ;BT003 50$: MOV #1,R1 ; For "last version," descending - set to 1 ;BT003 BR 70$ ; Proceed ;BT003 60$: BIT #ASCVER,FLAGS$ ; Are version numbers ascending? ;BT003 BNE 70$ ; NE - yes ;BT003 NEG R1 ; For descending - set threshold to ;BT003 ADD VRSRM$,R1 ; total minus number of versions ;BT003 70$: MOV R1,VRSLMT ; Store threshold ;BT003 CKHV: BIT #HVSW,SWMS2$ ; Selecting versions higher than? ;BT003 BEQ CVAS ; BR IF NO ;**-1 MOV LVNUM$,R1 ; GET LOWEST VERSION TO SELECT BNE 20$ ; BR IF USER GAVE VALUE MOV #2,R1 ; ELSE USE 2 AS LOW LIMIT 20$: CMP (R5),R1 ; VERSION HIGH ENOUGH? BHIS CVAS ; BR IF SELECTING THIS VERSION ADD #,R5 ; ADVACE POINTER TO NEXT ENTRY JMP UNPACK ; Look at next entry ;BT003 ; ;**-1 ; CONVERT DIRECTORY ENTRY TO ASCII ; CVAS: CALL CVTNAM ; Convert file name to ASCII at start of record ;BT003 BIT #SESW,SWMSK$ ; IS THIS A SELECTIVE LIST? ;**-14 BEQ CKVRSN ; BR IF NO-CK FOR VERSION SELECTION MOV #SEBUF$,R2 ; SET SELECTION STRING ADDRESS MOV LSTFDB+F.NRBD+2,R1 ; SET START OF NAME CALL SRDTST ; LOOK FOR A MATCH... BCC FOUND ; GOT A MATCH! FAILED: BIT #NESW,SWMSK$ ; NEGATED TESTS? BNE CKVRSN ; YES JMP UNPACK ; NO, GET NEXT FILE. FOUND: BIT #NESW,SWMSK$ ; NEGATED TESTS? BEQ CKVRSN ; NO JMP UNPACK ; YES, GET NEXT FILE. ; ; SEE IF VERSION SELECTION IS REQUIRED ; CKVRSN: BIT #SVSW,SWMSK$ ; Version selection needed? ;BT003 BEQ CKDATE ; EQ - no, proceed with date checks ;BT003 CMP VRSCT$,#-1 ; Looking for last version? ;BT003 BEQ 30$ ; EQ - yes, use reverse side of threshold line ;BT003 BIT #OVDSVA,FLAGS$ ; Versions (ascending, highest /SV) or ;BT003 ; ; (descending, lowest /OV) ? ;BT003 BNE 20$ ; NE - yes ;BT003 10$: CMP VRSRM$,VRSLMT ; Are we above threshold line? ;BT003 BGT CKDATE ; HI - yes, proceed ;BT003 JMP UNPACK ; Otherwise, get the next entry ;BT003 20$: CMP VRSRM$,VRSLMT ; Are we below threshold line? ;BT003 BLE CKDATE ; LOS - yes, proceed ;BT003 JMP UNPACK ; Otherwise, get the next entry ;BT003 30$: BIT #OVDSVA,FLAGS$ ; Versions (ascending, highest /SV) or ;BT003 ; ; (descending, lowest /OV) ? ;BT003 BEQ 20$ ; EQ - yes, check for below threshold line ;BT003 BR 10$ ; Check for above threshold line ;BT003 CKDATE: BIC #HDRERR,FLAGS$ ; Clear header read error indicator ;BT003 BIT #RDHDFL,FLAGS$ ; Do we need to read file header? ;BT003 BNE 10$ ; NE - yes ;BT003 JMP LSTENT ; Otherwise, proceed ;BT003 10$: CLR HDBUF$ ; ;**-63 MOV #HDBUF$,HDPTR$ ; Set up to use main header buffer ;BT003 15$: ;BT003 DIR$ #READHD ; READ THE FILE HEADER BCC 20$ CALL ALERR BR 10$ 20$: WTSE$S #EFN1 CMPB IOSB$,#IS.SUC ; OKAY? BEQ 60$ ;BT003 BIS #HDRERR,FLAGS$ ; Indicate header read error ;BT003 MOVB IOSB$,IOSBSV ; Save I/O status block byte to issue diagnostic;BT003 ; ; message after heading is printed ;BT003 BIT #ERSW,SWMS3$ ; /ER switch specified? ;BT003 BEQ 45$ ; EQ - no, just print file name ;BT003 INC NUMFS ; Count this file ;BT003 45$: ;BT003 ; ;BT003 ; ;BT003 ; The code in this section is temporary -- there is apparently a problem ;BT003 ; reading an extension header if you are a non-privileged non-file owner. ;BT003 ; ;BT003 CMP HDPTR$,#HDBUF$ ; Is this the first header for this file? ;BT003 BEQ 50$ ; EQ - yes ;BT003 BIT #H2SW,SWMS3$ ; Report errors with extension headers? ;BT003 BNE 50$ ; NE - yes ;BT003 ; For now, ignore extension header; process as we would a single header file ;BT003 BIC #HDRERR,FLAGS$ ; Turn off the error flag we set ;BT003 MOV #HDBUF$,HDPTR$ ; Point back to the first header area ;BT003 BR 70$ ; Then process as single header file ;BT003 ; ;BT003 ; --- End of temporary section --- ;BT003 ; ;BT003 ; ;BT003 50$: ;BT003 JMP LSTENT ; Print file name (with heading, if needed) ;BT003 60$: BIT #ERSW,SWMS3$ ; /ER switch specified? ;BT003 BNE REJECT ; NE - yes, reject since file header valid ;BT003 ; ;BT003 ; Handle multi-header files ;BT003 ; ;BT003 TST HDBUF$+S.HDHD+S.IDHD+M.EFNU ; Are there extension headers? ;BT003 BEQ 70$ ; EQ - no, proceed ;BT003 CALL ABCALC ; Add the file blocks allocated by the retrieval;BT003 ; ; pointers in this header to the total for this ;BT003 ; ; file ;BT003 MOV HDPTR$,R1 ; Get pointer to current header buffer ;BT003 TST S.HDHD+S.IDHD+M.EFNU(R1) ; Does this header have an extension? ;BT003 BEQ 80$ ; EQ - no, proceed ;BT003 CLR S.HDHD+S.IDHD+M.EFSQ+2(R1) ; Zero word to create 3 word ;BT003 ; ; file id/seq number block ;BT003 ADD #S.HDHD+S.IDHD+M.EFNU,R1 ; Point to file id/seq number block ;BT003 MOV R1,READHD+Q.IOPL ; Set pointer in header read QIO parameter list;BT003 MOV #HDBF2$,HDPTR$ ; Use extension header buffer area ;BT003 BR 15$ ; Now read the extension header ;BT003 ; ;BT003 ; Obtain file blocks allocated ;BT003 ; ;BT003 70$: MOV #HDBUF$+H.UFAT,R1 ; Pointer to user attributes ;BT003 MOV F.HIBK(R1),ALOCSZ ; Get file blocks allocated, high order word ;BT003 MOV F.HIBK+2(R1),ALOCSZ+2 ; Get file blocks allocated, low word ;BT003 BNE 80$ ; NE - non-zero blocks indicated (low order) ;BT003 CALL ABCALC ; Calculate allocation from retrieval pointers ;BT003 ; ; since the value in the header may be incorrect;BT003 ; ; for headers showing zero blocks allocated ;BT003 ; ;BT003 ; Obtain file blocks used ;BT003 ; ;BT003 80$: MOV #HDBUF$+H.UFAT,R1 ; Pointer to user attributes ;BT003 MOV F.EFBK(R1),USEDSZ ; Get file blocks used, high order word ;BT003 MOV F.EFBK+2(R1),USEDSZ+2 ; Get file blocks used, low order word ;BT003 BEQ 90$ ; EQ - zero blocks used (low order word) ;BT003 TST F.FFBY(R1) ; Is first free byte zero ;BT003 BNE 90$ ; NE - no, value does not need adjusting ;BT003 DEC USEDSZ+2 ; Otherwise don't count the last block ;BT003 ; ;BT003 ; Check file owner with /FO:grp:mem switch values ;BT003 ; A zero for either switch value means a wildcard. ;BT003 ; Zero for both (that is, simply /FO) means this directory - SRDOPR has ;BT003 ; filled in the values. ;BT003 ; ;BT003 90$: ;BT003 CKFO: BIT #FOSW,SWMS3$ ; File owner check (/FO or /-FO) specified? ;BT003 BEQ CKCLM ; EQ - no ;BT003 TSTB FOGRP$ ; Is group a wildcard? ;BT003 BEQ 10$ ; EQ - yes ;BT003 CMPB FOGRP$,HDBUF$+H.PROJ ; Does the group match? ;BT003 BNE FODIF ; NE - no ;BT003 10$: TSTB FOMEM$ ; Is member a wildcard? ;BT003 BEQ FOMAT ; EQ - yes ;BT003 CMPB FOMEM$,HDBUF$+H.PROG ; Does the member match? ;BT003 BNE FODIF ; NE - no ;BT003 BR FOMAT ; A match ;BT003 FODIF: BIT #NOFOSW,FLAGS$ ; /-FO specified? ;BT003 BNE CKCLM ; NE - yes, do not reject ;BT003 JMP UNPACK ; Otherwise, reject ;BT003 FOMAT: BIT #NOFOSW,FLAGS$ ; /-FO specified? ;BT003 BEQ CKCLM ; EQ - no, do not reject ;BT003 JMP UNPACK ; Otherwise, reject ;BT003 CKCLM: ;**-13 MOV #" ,CLMFLD ; BLANK CLM FILE CHARACTERISTICS MOV #" ,CLMFLD+2 ; FIELD MOVB HDBUF$+H.UCHA,R1 ; GET USER-CONTROLLED FILE CHARACTERISTICS BITB #COFLAG,R1 ; IS CONTIGUOUS FLAG SET? BEQ 20$ ; NO - BRANCH MOVB #'C,CLMFLD ; INSERT CONTIGUOUS SYMBOL BR 30$ ; PROCEED 20$: BIT #COSW,SWMS2$ ; CONTIGUOUS SWITCH SPECIFIED? BNE REJECT ; YES - REJECT FILE 30$: BITB #LOFLAG,R1 ; IS FILE LOCKED? BEQ 40$ ; NO - BRANCH MOVB #'L,CLMFLD+1 ; INSERT LOCKED SYMBOL BR 50$ ; PROCEED 40$: BIT #LOSW,SWMS2$ ; LOCKED SWITCH SPECIFIED? BNE REJECT ; YES - REJECT FILE 50$: TST HDBUF$+S.HDHD+S.IDHD+M.EFNU ; HEADER EXTENSIONS? BEQ 60$ ; NO - BRANCH MOVB #'M,CLMFLD+2 ; INSERT MULTI-HEADER SYMBOL BR CKZE ; PROCEED ;BT001 60$: BIT #MUSW,SWMS2$ ; MULTI-HEADER SWITCH SPECIFIED? BEQ CKZE ; PROCEED ;BT001 REJECT: JMP UNPACK ; UNPACK THE NEXT ENTRY CKZE: BIT #ZESW,SWMS2$ ; ZERO USED BLOCKS FILE SWITCH SET? ;BT001 BEQ CKGT ; EQ - no, proceed ;BT003 TST USEDSZ ; Any blocks used (high order word)? ;BT003 BNE REJECT ; NE - yes, reject file ;BT003 TST USEDSZ+2 ; Any blocks used (low order word)? ;BT003 BNE REJECT ; NE - yes, reject file ;BT003 CKGT: BIT #GTSW,SWMS3$ ; /GT switch specified? ;BT003 BEQ CKD1 ; EQ - no ;BT003 20$: CMP ALOCSZ,GTBUF$+2 ; Is file size larger or equal to /GT: value? ;BT003 BHI CKD1 ; HI - yes ;BT003 BLO REJECT ; LO - no, reject file ;BT003 CMP ALOCSZ+2,GTBUF$ ; Is file size larger or equal to /GT: value? ;BT003 BLO REJECT ; LO - no, reject file ;BT003 CKD1: ;BT003 MOVB HDBUF$,R1 ;GET OFFSET TO IDENT AREA IN HEADER ;**-11 ASL R1 ;MAKE AWORD OFFSET ; FOR DATE SELECT, USE REVISION DATE (IF EVER REVISED), OR ; CREATION DATE (IF NEVER REVISED). THIS ADDR IN R1. ADD #HDBUF$,R1 ; POINT AT IDENT AREA BIT #RDSW,SWMS2$ ; USE REVISION DATE ?? BEQ 5$ ; NO !!!! TST I.RVNO(R1) ; EVER REVISED ?? BEQ 5$ ; NO--USE CREATION DATE ADD #,R1 ; YES--USE REVISION DATE 5$: ADD #,R1 MOV R1,R3 ; SAVE THIS ADDRESS BIT #DASW,SWMSK$ ; DOING DATE SELECTION? BEQ LSTENT ; NO-LIST IT CALL CVDATE ; CONVERT DATE TO INTEGER BCC 7$ ; CC - no error in date format ;BT003 BIS #DATERR,FLAGS$ ; Indicate file date corrupt in file header ;BT003 BR LSTENT ; Proceed ;BT003 7$: ;BT003 CMP R2,AFBUF$ ; AFTER GIVEN DATE? BLO 100$ ; IF LO NO - IGNORE THIS ONE ;BT001 BNE 1$ ; If not the same OK - carry on TST AFBUF$+2 ; An After Time given? BNE 1$ ; If NE yes - sort it out there BIT #AFSW,SWMSK$ ; Equality included? BNE 100$ ; IF NE NO - IGNORE THIS ONE ;BT001 ; 1$: CMP R2,BEBUF$ ; BEFORE GIVEN DATE? BHI 100$ ; IF HI NO - IGNORE THIS ONE BNE 2$ ; If not the same OK - carry on TST BEBUF$+2 ; A Before Time given? BNE 2$ ; If NE Yes - sort it out there BIT #BFSW,SWMSK$ ; Equality included? BEQ 2$ ; If EQ OK - carry on ; 100$: JMP UNPACK ; Check the next one ; 2$: MOV R3,R1 ; GET BACK ADDRESS OF DATE ADD #I.CRTI-I.CRDT,R1 ; POINT AT CREATION TIME MOV R3,R4 ; SAVE ADDRESS OF CREATION DATE CALL CVTIME ; CONVERT IT MOV R3,R1 ; SAVE TIME MOV R4,R3 ; RESTORE ADDRESS OF DATE CMP R2,AFBUF$ ; SAME DATE AS AFTER DATE? BNE 10$ ; IF NE NO - CHECK FOR BEFORE TST AFBUF$+2 ; AFTER TIME SPECIFIED? BEQ 10$ ; IF EQ NO - OMIT CHECK CMP R1,AFBUF$+2 ; AFTER GIVEN TIME? BLO 100$ ; IF LO NO - IGNORE IT BNE 10$ ; If not the same OK - carry on BIT #AFSW,SWMSK$ ; Equality included? BNE 100$ ; If NE no - omit it ; 10$: CMP R2,BEBUF$ ; SAME DAY AS BEFORE DAY? BNE LSTENT ; IF NE NO - MUST BE OK TST BEBUF$+2 ; BEFORE TIME SPECIFIED? BEQ LSTENT ; NO - WE MUST BE OK CMP R1,BEBUF$+2 ; YES - BEFORE GIVEN TIME? BHI 100$ ; IF HI NO - IGNORE IT BNE 15$ ; If not the same OK - carry on BIT #BFSW,SWMSK$ ; Equality included? BNE 100$ ; If NE no - omit it ; 15$: .ENABLE LSB LSTENT: ;BT003 BIT #CMSW,SWMS3$ ; Generating command lines? ;BT003 BEQ 1$ ; EQ - no ;BT003 CALL CMMAKE ; Generate the command line ;BT003 JMP UNPACK ; Proceed to next entry ;BT003 1$: BIT #HDFL,FLAGS$ ; Has header been listed? ;BT003 BEQ 2$ ; IF EQ NO - LIST IT ;**-1 JMP LSTE1 ; OTHERWISE, BRANCH AROUND ;BT002 2$: ;BT002 BIS #,FLAGS$ ; FLAG AS PRINTED MOV LSTFDB+F.NRBD+2,R0 ; RESET POINTER TO TOP OF BUFFER ;**-2 BIT #SPSW,SWMSK$ ; THIS LISTING GETTING SPOOLED? BEQ 4$ ; BR IF NO MOV (PC)+,(R0)+ ; INSERT A FORM FEED .BYTE 15,14 ; CR/FF CALL PUTLST ; Output it 4$: MOV #" *,(R0)+ ; FLAG NEW ENTRY MOV #"* ,(R0)+ ; THAT MAKES LISTING EASIER TO READ MOV ,(R0)+ ; COPY DEVICE NAME INTO LISTING MOV ,R1 ; GET UNIT NUMBER ASR R1 ASR R1 ASR R1 ; DIVIDE BY 10(OCTAL) BEQ 6$ ; BR IF UNIT LESS THAN 10(OCTAL) ADD #'0,R1 ; MAKE PRINTABLE MOVB R1,(R0)+ ; INSERT INTO LISTING 6$: MOV ,R1 ; GET UNIT BACK BIC #177770,R1 ; REDUCE TO <0-7> ADD #'0,R1 ; ADD IN ASCII BIAS MOVB R1,(R0)+ ; INSERT IN LISTING MOVB #':,(R0)+ ; NOW DELINIT DEVICE NAME MOV #UICHD,R1 ; Point to UIC string formed in SRDOPR ;BT003 8$: MOVB (R1)+,(R0)+ ; Copy in string ;BT003 BNE 8$ ; NE - not at end yet ;BT003 DEC R0 ; Backup over zero byte ;BT003 MOVB #' ,(R0)+ ; SEPARATE ;**-7 MOV #TDBUF$,R1 ; POINT AT DATE 10$: MOVB (R1)+,(R0)+ ; FILL IN DATE CMP R1,# ; FINISH DATE? BLO 10$ ; BR IF NO MOVB #' ,(R0)+ ; ADD A SPACE MOV #TDTIM$,R1 ; POINT AT TIME 12$: MOVB (R1)+,(R0)+ ; FILL IN TIME CMP R1,# ; FINISH TIME? ;BT003 BLO 12$ ; BR IF NO ;**-1 PTNAM: CALL PUTLS1 ;PRINT THAT ; PUT COMMAND LINE TST CMDBLK+G.CMLD BEQ 15$ BIT #HDSW,SWMS3$ ; /HD HEADER SWITCH SPECIFIED? ;BT002 BEQ 15$ ; IF EQ NO - OMIT COMMAND LINE ;BT002 PUT$S #LSTFDB,CMDBLK+G.CMLD+2,CMDBLK+G.CMLD MOV #LINBUF,LSTFDB+F.NRBD+2 MOV #LINBUF,R0 ; **** GIVE MSG IF WE HAVE TO DO IT IN PIECES**** 15$: TST UFDFDB+F.BDB ; IS DIRECTORY OPEN??? BEQ 11$ ; NO DIAG 0 ; YES--PUT MESSAGE 11$: SUB #,R5 ; Back up to current directory entry ;BT003 CALL CVTNAM ; Convert file name to ASCII as start of record ;BT003 JMP LSTE1 ; Continue with this entry ;BT003 .DSABL LSB ;**-15 LSTE1: BIT #HDRERR,FLAGS$ ; Was there a header read error? ;BT003 BEQ 12$ ; EQ - no, proceed ;BT003 CMP HDPTR$,#HDBUF$ ; Was this an extension header read? ;BT003 BEQ 4$ ; EQ - no ;BT003 DIAG XHDRD ; Issue msg indicating extension header error ;BT003 4$: CMPB IOSBSV,#IE.SQC ; Was error file id/seq number check? ;BT003 BNE 6$ ; NE - no ;BT003 DIAG SQCHK ; Issue diagnostic ;BT003 BR 10$ ;BT003 6$: CMPB IOSBSV,#IE.PRI ; Was error privilege violation? ;BT003 BNE 8$ ; NE - no ;BT003 DIAG HDPRV ; Issue diagnostic ;BT003 BR 10$ ;BT003 8$: DIAG HDRE ; Issue diagnostic for some other header error ;BT003 10$: JMP UNPACK ; Move on to next directory entry ;BT003 ; ;BT003 12$: BIT #DATERR,FLAGS$ ; Do we know file date is corrupt? ;BT003 BEQ 15$ ; EQ - no ;BT003 DIAG BADDH ; File date corrupt in file header ;BT003 BIT #DASW,SWMSK$ ; Are we doing date selection? ;BT003 BEQ 15$ ; EQ - no, go ahead - list the file ;BT003 JMP UNPACK ; Do not list it if doing date selection ;BT003 ; ;BT003 15$: INC NUMFS ; Count the file ;BT003 BIT #RDHDFL,FLAGS$ ; Was the file header read? ;BT003 BEQ 18$ ; EQ - no ;BT003 ADD ALOCSZ+2,TBLKA+2 ; Add file allocation size double word ;BT003 ADC TBLKA ; to total ;BT003 ADD ALOCSZ,TBLKA ;BT003 ADD USEDSZ+2,TBLKU+2 ; Add file blocks used double word ;BT003 ADC TBLKU ; to total ;BT003 ADD USEDSZ,TBLKU ;BT003 18$: ;BT003 BIT #LISW!MISW!FUSW,SWMSK$ ; JUMP OUT IF LISTING NOT WANTED;**-13 BNE 20$ JMP PUT1 ; 20$: BIT #,SWMSK$ ;FULL or Medium LISTING BEQ PUT1 ;BR IF NO MOV LSTFDB+F.NRBD+2,R1;START OF LINE BUF ADD #20.,R1 ;POINT AT END OF NAME FIELD ; 30$: MOVB #' ,(R0)+ ; Pad with spaces CMP R0,R1 ; Enough? BLOS 30$ ; No - do another BIT #,SWMSK$ ; Just a Date type one? BEQ 90$ ; If EQ yes - just do dates MOV #FUTABL,R3 ; FORMAT TABLE ADDRESS BIT #FUSW,SWMSK$ ; REALLY BIG LISTING BNE 40$ ; If NE yes - get UICs & suchlike BIT #M2SW,SWMS2$ ; Type 2 Middle Size? BEQ 90$ ; If EQ no - just get Revision Date MOV #MITABL,R3 ; No - Change Table Address ; 40$: MOVB (R3)+,R4 ; PICK UP NEXT OFFSET BEQ 90$ ; BR WHEN END ADD #HDBUF$,R4 ; ADJ FOR ADDRESS OF BUFFER MOVB (R3)+,R1 ; PICK UP SIZE OF FIELD 50$: MOV R1,R2 ; COPY THAT ADD R0,R2 ; FIND HOW BIG THE LINE WILL BE MOV LINSZ$,-(SP) ; PUSH MAX SIZE OF RECORD ADD LSTFDB+F.NRBD+2,(SP) ; ADD IN START OF RECORD CMP R2,(SP)+ ; WILL IT GET TOO BIG? BLOS 60$ ; BR IF NO CALL PUTLST ; WRITE IT OUT MOV (PC)+,(R0)+ ; INSERT SOME SPACE .BYTE 40,40 ; 2 SPACES BR 50$ ; TRY AGAIN 60$: MOV R2,-(SP) ; PUSH END OF BUFFER MOVB (R3)+,(R0)+ ; INSERT LEADING CHAR BNE 70$ ; BR IF NOT A NULL DEC R0 ; BACK UP OVER NULL 70$: MOVB (R3)+,-(SP) ; SAVE TRAILING CHAR FOR LATER MOV (R4)+,R1 ; PICK UP 16 BIT ARG CALL @(R3)+ ; DISPATCH TO ROUTINE MOVB (SP)+,(R0)+ ; COPY TRAILING CHAR BNE 75$ ; Branch if not a Null DEC R0 ; Back up over a null ; 75$: MOV (SP)+,R1 ; GET END OF FIELD ADDRESS 80$: CMP R0,R1 ; IS RECORD UP TO END OF FIELD BHIS 40$ ; BR WHEN FIELD IS FULL MOVB #40,(R0)+ ; SPACE FILL BR 80$ ; TRY AGAIN ;;;; PRINT REVISION DATE & TIME 90$: BIT #RDSW,SWMS2$ ; Selection by Revision Date? BEQ 100$ ; If EQ no - do Creation Date BIT #FUSW,SWMSK$ ; Getting both anyway? BNE 100$ ; If NE yes - do Creation Date BIT #MISW,SWMSK$ ; Definitely only getting one? BEQ 110$ ; If EQ yes - do Revision Date BIT #M2SW,SWMS2$ ; Middle Size type that shows only one? BNE 110$ ; If NE yes - do Revision Date ; 100$: MOVB HDBUF$,R3 ASL R3 ADD #HDBUF$,R3 ADD #I.CRDT,R3 CALL PUTDTM ; INSERT DATE AND TIME BIT #,SWMSK$ ; Full or Middle Listing? BEQ PUT1 ; If EQ no - we've had enough BIT #FUSW,SWMSK$ ; Full Listing? BNE 110$ ; If NE yes - we want Revision Date BIT #M2SW,SWMS2$ ; Type 2 Middle Listing? BNE PUT1 ; If NE yes - we don't want Revision Date ; 110$: MOVB HDBUF$,R3 ASL R3 ADD #HDBUF$,R3 MOV I.RVNO(R3),R4 BEQ PUT1 ; NEVER REVISED, FORGET IT ADD #I.RVDT,R3 CALL PUTDTM CMP R4,#1 ; Not really revised if <1 BEQ PUT1 ; So ignore it MOV R4,R1 CLR R2 MOVB #'(,(R0)+ CALL $CBDMG MOVB #'.,(R0)+ MOVB #'),(R0)+ PUT1: BIT #SDSW,SWMSK$ ; Doing Selective Delete? BNE 10$ ; If NE yes - list in Read with Prompt BIT #LISW!MISW!FUSW,SWMSK$ ; Doing a listing? BEQ 5$ ; If EQ no - carry on CALL PUTLST ; OUTPUT THE LINE ; 5$: BIT #DESW,SWMSK$ ; ALWAYS DELETE BNE 80$ ; YES-DON'T BOTHER TO ASK JMP UNPACK ; Nope - go away 10$: MOV LSTFDB+F.NRBD+2,R2 ;GET ADDRESS OF BUFFER. SUB R2,R0 ; COMPUTE LENGTH OF BUFFER. MOV #PRMPT,R1 ; POINT TO PROMPT STRING. MOV (PC)+,(R1)+ ; START OUT AT BEGINNING OF LINE. .BYTE 15,12 ; 20$: MOVB (R2)+,(R1)+ ; MOVE IN THE FILENAME. SOB R0,20$ ; MOVE ALL OF IT. MOV #QBUF$,R2 ; POINT TO MESSAGE SUFFIX FOR QUESTION PROMPT MOV #QBUFS$,R0 ; GET LENGTH OF MESSAGE SUFFIX 30$: MOVB (R2)+,(R1)+ ; MOVE IT INTO PLACE SOB R0,30$ ; LOOP UNTIL THROUGH SUB #PRMPT,R1 ; COMPUTE LENGTH OF PROMPT STRING. 40$: CLRB LINBUF ; ERASE ANY PREVIOUS YES RESPONSES .IF DF R$$11M & R$$M30 ; ON RSX11M VERSION 3.0 OR EARLIER? QIOW$S #IO.WVB,#TTYLUN,#EFN1,,,,<#PRMPT,R1,#0> QIOW$S #IO.RVB,#TTYLUN,#EFN1,,#IOSB$,,<#LINBUF,#4> .IFF QIOW$S #IO.RPR,#TTYLUN,#EFN1,,#IOSB$,,<#LINBUF,#4,,#PRMPT,R1,#0> .ENDC MOV LSTFDB+F.NRBD+2,R0 ; RECOVER BUFFER ADDR TSTB IOSB$ ; ANY ERR-MUST BE EOF BGT 60$ ; BR IF NO ERR 50$: RETURN ; *** EXIT THIS RUN ### 60$: BICB #40,LINBUF ; CONVERT TO UPPER CASE CMPB #'Y,LINBUF ; WAS THE ANSWER YES? BEQ 80$ ; IF YES, DELETE THE FILE CMPB #'G,LINBUF ; WAS THE ANSWER GO? BNE 70$ ; IF NO, CHECK FOR QUIT .IF DF R$$11M & R$$M30 ; ON RSX11M VERSION 3.0 OR EARLIER? QIOW$S #IO.WVB,#TTYLUN,#EFN1,,,,<#QBF1$,#QBF1S$,#0> ; ASK IF SURE QIOW$S #IO.RVB,#TTYLUN,#EFN1,,#IOSB$,,<#LINBUF,#4> ; READ RESPONSE .IFF QIOW$S #IO.RPR,#TTYLUN,#EFN1,,#IOSB$,,<#LINBUF,#4,,#QBF1$,#QBF1S$,#0> .ENDC TSTB IOSB$ ; ANY ERRORS? BLE 50$ ; IF YES, RETURN BICB #40,LINBUF ; CONVERT TO UPPER CASE CMPB #'Y,LINBUF ; SURE? BNE 40$ ; IF NOT, PROMPT AGAIN BIC #SDSW,SWMSK$ ; CLEAR SELECTIVE DELETE FLAG BIS #DESW,SWMSK$ ; SET DELETE SWITCH BR 80$ ; START TO DELETE THE FILES 70$: CMPB #'Q,LINBUF ; WAS THE ANSWER QUIT? BEQ 50$ ; IF YES, RETURN BR UNPK1 ; NO FOR THIS FILE; SEE ABOUT ABOUT NEXT FILE 80$: MOV R5,R0 ; COPY PLCE IN DIRECTORY BUFFER MOV #UFDFDB+F.FNB+N.FVER+2,R1 ; POINT AT FILE NAME BLOCK END MOV #8.,R2 ; SET NUMBER OF WORDS IN DIRECTORY ENTRY 90$: MOV -(R0),-(R1) ; COPY THE DATA SOB R2,90$ ; DO ALL MOV #UFDFDB,R0 ; POINT AT FDB PROPER MOV SAVDID,F.FNB+N.DID(R0) ; RESTORE MOV SAVDID+2,F.FNB+N.DID+2(R0) ; DIRECTORY ID MOV SAVUNM,F.FNB+N.UNIT(R0) ; DEVICE UNIT NUMBER MOV SAVDVN,F.FNB+N.DVNM(R0) ; ---AND FINALLY NAME CALL .DLFNB BCC UNPK1 ; BR IF DELETE WORKED DIAG FDEL ; ISSUE DIAGNOSTIC MESSAGE UNPK1: JMP UNPACK ; DO THE NEXT PUTDTM: MOV #DTSTR,R2 ;DATE-TIME FORMAT STRING MOVB (R2)+,(R0)+ ;ONE MORE 4$: MOVB (R2)+,R1 ;GET NEXT SIZE BEQ 8$ 6$: MOVB (R3)+,(R0)+ ;COPY DATE SOB R1,6$ ;COUNT FIELD MOVB (R2)+,(R0)+ ;TERMINATOR BR 4$ 8$: RETURN ; SIZECV: CLR R2 ; SET ZERO SUPPRESS FLAG MOV #USEDSZ,R1 ; Point to file size used double word ;BT003 CALL $CDDMG ; Convert size to decimal ;BT003 MOVB #'.,(R0)+ ; Indicate decimal value ;BT003 MOVB #'/,(R0)+ ; Insert a separator ;BT003 CLR R2 ; Set zero suppress flag ;BT003 MOV #ALOCSZ,R1 ; Point to file allocation size double word ;BT003 CALL $CDDMG ; Convert size to decimal ;BT003 MOVB #'.,(R0)+ ; INDICATE DECIMAL. ;**-14 RETURN ; AND RETURN. ; ;BT001 ;ABCALC---CALCULATE ALLOCATED BLOCKS FROM RETRIEVAL POINTERS IN CASE VALUE ;BT001 ; STORED IN HEADER IS INCORRECT (E.G. FILE NOT PROPERLY CLOSED) ;BT001 ; Called when value in header is zero, or for a multi-header file. ;BT003 ; Stores number of allocated blocks in ALOCSZ double word. ;BT003 ; Destroys R1 and R2. ;BT003 ABCALC: CLR R1 ; START WITH 0 BLOCKS ;**-2 MOV HDPTR$,R2 ; Get pointer to header buffer area in use ;BT003 MOVB S.HDHD+S.IDHD+M.USE(R2),R2 ; Get number of words of ptrs in use ;BT003 BEQ 60$ ; IF EQ - ALLOCATION IS REALLY 0 ;**-1 ASR R2 ; CONVERT TO # OF RETRIEVAL PTS IN USE ;BT001 BIC #177600,R2 ; CLEAR ANY SIGN EXTENSION FROM MOVB AND ASR ;BT001 MOV R0,-(SP) ; SAVE R0 ;BT001 MOV R4,-(SP) ; SAVE R4 ;BT001 MOV HDPTR$,R4 ; Get pointer to header buffer area in use ;BT003 ADD #S.HDHD+S.IDHD+M.RTRV,R4 ; Point to start of retrieval pointer ;BT003 20$: MOV (R4)+,R0 ; GET FIRST RETRIEVAL POINTER WORD ;**-1 CLRB R0 ; CLEAR NON-COUNT PORTION ;BT001 SWAB R0 ; COUNT - 1 ;BT001 INC R0 ; COUNT FOR THIS POINTER ;BT001 ADD R0,R1 ; ADD THIS TO TOTAL FOR THIS FILE ;BT001 TST (R4)+ ; ADVANCE TO NEXT RETRIEVAL POINTER ;BT001 SOB R2,20$ ; PROCESS NEXT ONE ;BT001 MOV (SP)+,R4 ; Restore R4 ;BT003 MOV (SP)+,R0 ; RESTORE R0 ;**-5 60$: CMP HDPTR$,#HDBUF$ ; Are we using the first header for this file? ;BT003 BNE 70$ ; NE - no ;BT003 MOV R1,ALOCSZ+2 ; Store the allocated size ;BT003 CLR ALOCSZ ; Zero high word ;BT003 BR 80$ ; ;BT003 70$: ADD R1,ALOCSZ+2 ; Add to sum of sizes of previous headers ;BT003 ADC ALOCSZ ; Sum is a double word ;BT003 80$: RETURN ;BT003 ; ;BT003 ; CVTNAM - converts file name pointed to by R5 in the directory to ASCII ;BT003 ; at the beginning of the record. ;BT003 ; At entry: R5 - address of entry in directory ;BT003 ; At exit: R0 - location in output record following file name ;BT003 ; R1, R2, R3 are destroyed ;BT003 ; ;BT003 CVTNAM: ;BT003 MOV LSTFDB+F.NRBD+2,R0 ; Point to start of record ;BT003 MOV #3,R3 ; Number of RAD50 words in name portion ;BT003 20$: MOV (R5)+,R1 ; Get a RADIX-50 word ;BT003 CALL $C5TA ; Convert to ASCII ;BT003 DEC R3 ; Count number of entries done ;BT003 BGT 20$ ; GT - Still converting name portion ;BT003 BIT #PASW,SWMS3$ ; Pack the name-type-version field? ;BT003 BEQ 26$ ; EQ - no ;BT003 24$: CMPB #' ,-(R0) ; Is there a blank here? ;BT003 BEQ 24$ ; EQ - yes, check previous character ;BT003 INC R0 ; Advance over non-blank found ;BT003 CMP R0,LSTFDB+F.NRBD+2 ; Did we back up beyond start of string? ;BT003 BHIS 26$ ; HIS - no ;BT003 MOV LSTFDB+F.NRBD+2,R0 ; Name field null - point to start of rec ;BT003 26$: TST R3 ; Have we done the type field yet? ;BT003 BMI 30$ ; MI - yes ;BT003 MOV R0,LENNMF ; Store current location, then ... ;BT003 SUB LSTFDB+F.NRBD+2,LENNMF ; Calculate length of file name part ;BT003 MOVB #'.,(R0)+ ; Separate name and type ;BT003 BR 20$ ; Do type ;BT003 30$: MOV R0,LENTYF ; Store current location, then ... ;BT003 SUB LSTFDB+F.NRBD+2,LENTYF ; Calculate length of file name and type ;BT003 SUB LENNMF,LENTYF ; Calculate length of file type part ;BT003 MOVB #';,(R0)+ ; Separate type and version ;BT003 MOV (R5)+,R1 ; Now get version ;BT003 CLR R2 ; Set leading zero suppress flag ;BT003 CALL $CBOMG ; Convert to ASCII ;BT003 CLRB (R0) ; Insert null after version number ;BT003 MOV R0,LENNTV ; Store current location, then ... ;BT003 SUB LSTFDB+F.NRBD+2,LENNTV ; Calculate length of name-type-version ;BT003 RETURN ;BT003 ; ;BT003 ; ;BT003 ; CMMAKE generates the command line requested by the /CM switch ;BT003 ; ;BT003 CMMAKE: ;BT003 BIS #FLFL,FLAGS$ ; Must set file-written flag ;BT003 MOV LSTFDB+F.NRBD+2,R0 ; Point to start of record (file name) ;BT003 MOV R0,R1 ; Copy pointer ;BT003 MOV #PRMPT,R3 ; Point to buffer to hold name-type-version ;BT003 MOV LENNTV,R4 ; Get length of name-type-version ;BT003 10$: MOV (R1)+,(R3)+ ; Copy each byte of name-type-version to buffer ;BT003 SOB R4,10$ ; Repeat for entire string ;BT003 MOV LSTFDB+F.NRBD+2,R0 ; Point to start of record ;BT003 TSTB CMBUF$ ; Processor name entered in /CM: switch value? ;BT003 BEQ 20$ ; EQ - no ;BT003 CLR R2 ; Clear counter ;BT003 MOV #CMBUF$,R3 ; Point to first /CM: switch value ;BT003 15$: MOVB (R3)+,(R0)+ ; Copy each character in switch value to record ;BT003 INC R2 ; Count number of characters in processor name ;BT003 TSTB (R3) ; At end of switch value string? ;BT003 BNE 15$ ; NE - no ;BT003 MOVB #' ,(R0)+ ; Insert a blank ;BT003 DEC R2 ; Was there just one character present? ;BT003 BNE 20$ ; NE - no ;BT003 CMPB #'@,-(R3) ; Was the character @ ? ;BT003 BNE 20$ ; NE - no ;BT003 DEC R0 ; If so, do not insert the blank ;BT003 20$: MOV CMFLG$,R1 ; Get /CM flag word, with bit definitions ;BT003 ; (from low order): outfile, listfile, type, ;BT003 ; version, second file ;BT003 ASR R1 ; Outfile specified? ;BT003 BCC 30$ ; CC - no ;BT003 CALL INSRT ; Insert outfile name ;BT003 30$: ASR R1 ; Listfile specified? ;BT003 BCC 40$ ; CC - no ;BT003 MOVB #',,(R0)+ ; Insert a comma ;BT003 CALL INSRT ; Insert listfile name ;BT003 40$: BIT #3,CMFLG$ ; Do we need to insert an equal sign? ;BT003 BEQ 50$ ; EQ - no ;BT003 MOVB #'=,(R0)+ ; Insert an equal sign ;BT003 50$: CALL INSRT ; Insert file name ;BT003 ASR R1 ; File type specified? ;BT003 BCC 55$ ; CC - no ;BT003 MOV LENTYF,R2 ; Get length of type string (including .) ;BT003 52$: MOVB (R3)+,(R0)+ ; Move type string ;BT003 SOB R2,52$ ; Do entire string ;BT003 BR 60$ ; Proceed ;BT003 55$: ADD LENTYF,R3 ; Move pointer to ; version number ;BT003 60$: ASR R1 ; Version number specified? ;BT003 BCC 70$ ; CC - no ;BT003 MOV LENNTV,R2 ; Get number of characters in name-type-version ;BT003 SUB LENNMF,R2 ; Calculate number in just type-version fields ;BT003 SUB LENTYF,R2 ; Calculate length of ; version string ;BT003 62$: MOVB (R3)+,(R0)+ ; Move version string ;BT003 SOB R2,62$ ; Do entire string ;BT003 70$: ASR R1 ; Second file specified? ;BT003 BCC 80$ ; CC - no ;BT003 MOVB #',,(R0)+ ; Insert a comma ;BT003 CALL INSRT ; Insert second file name ;BT003 MOVB #';,(R0)+ ; Insert ; ;BT003 MOVB #'0,(R0)+ ; Insert version number 0 ;BT003 80$: CALL PUTLS1 ; Output line ;BT003 RETURN ;BT003 ; ;BT003 ; INSRT ----- Insert file name into output buffer ;BT003 ; ;BT003 INSRT: ;BT003 MOV #PRMPT,R3 ; Get address of file name buffer ;BT003 MOV LENNMF,R2 ; Get length of file name ;BT003 BEQ 20$ ; EQ - file name null ;BT003 10$: MOVB (R3)+,(R0)+ ; Copy file name string ;BT003 SOB R2,10$ ; Do entire string ;BT003 20$: RETURN ;BT003 ; ;**-1 UICCV: MOV R1,-(SP) ; SAVE UIC CLRB R1 ; REMOVE PROGRAMMER NUMBER SWAB R1 ; GET PROGECT INTO LO BYTE CLR R2 ; SUPPRESS ZERO'S CALL $CBOMG ; CONVERT THAT MUCH CLR R1 ; GET READY FOR UNSIGNED--- BISB (SP)+,R1 ; MOVE BYTE OF PROGRAMMER NUMBER CLR R2 ; ZERO SUPPRESS MOVB #',,(R0)+ ; SEPARATE WITH COMMA CALLR $CBOMG ; COVERT FOR OUTPUT ; CLMCV: MOV #CLMFLD,R2 ; GET ADDRESS OF CONTIG-LOCKED-MULTIHDR FIELD MOV #4,R1 ; BYTE COUNT 30$: MOVB (R2)+,(R0)+ ; MOVE FIELD TO OUTPUT LINE SOB R1,30$ ; MOVE ALL OF IT RETURN ; FIDCV: CLR R2 ; SUPPRESS ZEROS CALL $CBOMG ; CONVERT TO OCTAL MOVB #',,(R0)+ ; SEPARATE MOV (R4),R1 ; GET SEQ NUMBER CLR R2 ; SET ZERO SUPPRESS AGAIN! CALLR $CBOMG ; CONVERT THAT ; FPROCV: MOV #4,R2 ; NUMBER OF FILELDS TO CONVERT 10$: MOV #FPSTR,R3 ; FORMAT STRING 20$: ASR R1 ; MOVE 1 BIT INTO C BCS 30$ ; BR IF NOT ACTIVE MOVB (R3),(R0)+ ; INSERT A DESRIPTOR CHAR 30$: INC R3 ; ADJ FORMAT STRING TSTB (R3) ; END OF LIST BNE 20$ ; BR IF NO MOVB #',,(R0)+ ; INSERT A SEPARATOR SOB R2,10$ ; LOOP? DEC R0 ; NO-BACK UP OVER LAST COMMA ; 40$: RETURN ; ;PUTLST---PUT A RECORD INTO LISTING FILE ; PUTLST: BIT #BKSW,SWMS3$ ; /BK INITIAL BLANKS SWITCH SPECIFIED? ;BT002 BEQ PUTLS1 ; IF EQ NO - OMIT THE 2 BLANKS ;BT002 SUB #2,LSTFDB+F.NRBD+2 ; 2 LEADING SPACES PUTLS1: SUB LSTFDB+F.NRBD+2,R0 ;FIND LENGTH OF LINE MOV R0,LSTFDB+F.NRBD ;SET LENGTH INTO FDB PUT$S #LSTFDB ;WRITE THE LINE MOV #LINBUF,LSTFDB+F.NRBD+2 BCC 10$ FERR PUTE ;???CAN'T DO PUT??? 10$: MOV #LINBUF,R0 ;GET RECORD BUFFER RETURN .END