.MCALL .MODULE .MODULE DIRT11,VERSION=16,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. .SBTTL Abstract and Edit History ;+ ; ; ; DIR (Directory Program) ; ; Module DIRT11 ; ; This module contains routines which are very RT-11 dependent. ; ; Edit History: ; ; 001 05-May-80 13:27 Fingerhut, David [240,134] ; DIR/OUT: with output file full gives wrong error message. ; (001) ; 002 01-Oct-80 10:49 AM Kent, Jeff [240,94] ; CHANGE ODF TO OPF ; (002) ; ; (013) 20-Jun-89 Code to do logical to physical device translation ; MBG for input device checks. ; ; (014) 02-Nov-1990 bracket error messages in ;+/;ERROR/.../;- ; JFW ; ; (015) 29-Nov-91 MBG Added error checking for /OUT to volume with ; invalid directory. ; ; (016) 17-JUN-1997 TDS Bob Schor's fix for the extraneous NUL when ; doing a /VOLUMEID also eliminated the need for ; the code that got rid of the LF produced ; in formatting the Volume/Owner string. ; ;- .SBTTL System Definitions .LIBRARY "SRC:SYSTEM" .MCALL .SYCDF .ERRDF .SYCDF ;RT-11 System Communication area .ERRDF ;EMT error codes ORIGIN RT11 ;CG09 BUPOFF = 252 ;Offset to BUP ID on backup volumes (tape and disk) BUPID: .ASCIZ /BUP/ ;BUP ID .SBTTL INIT- Startup initialization ;+ ; ; INIT ; This routine does the start up and restart initialization for DIR. ; It first releases all handlers and purges all channels. It then does ; a .SETTOP to the high address of the program, resets CTRL/O and resets ; some pointers. No attempt is made to preserve any registers, and none ; are assumed to be set up on entry. ; ;- XTERNL GBLDAT GBLDAT GBLDAT GBLDAT ;MG01 .MCALL ...CMY ...CMZ .ENABL LSB INIT:: ...CMZ MOV #HICHAN,R1 ;Get our highest channel number ;CG02+ 1$: .PURGE R1 ; and purge the channel DEC R1 ;Count down BGE 1$ ; and continue until done ;CG02- MOV #FSPEC,R1 ;Point to the filespecs 2$: TST @R1 ;Anything there? BEQ 3$ ;Branch if not .RELEAS R1 ;Else release the handler 3$: ADD #OUSPSZ,R1 ;Bump the pointer to next spec CMP #,R1 ;Are we thru with the output specs? BHIS 2$ ;Branch if not ;CG01 TST -(R1) ;Else input specs are 1 word shorter. CMP #,R1 ;Are we done? BHI 2$ ;Branch if not ;CG01 MOV LIMIT+2,R0 ;Get our hi limit MOV R0,FREEND ; and remember it. .SETTOP ;Ask for that much CMP FREEND,R0 ;Did we get it? BEQ 4$ ;Branch if so. ;+ ;ERROR TOSMAL::$ERROR NOM,LEVEL=FATAL,RETURN=NO ;- 4$: .RCTRLO ;Reset CTRL/O ...CMY MOV #CLRLST,R1 ;Point to the list of things to be cleared 5$: CLR @(R1)+ ;Clear it TST @R1 ;Anything left BNE 5$ ;Branch if so. MOV #OBUF,OLOC ;Set up the output buffer pointer MOV #1,NXTDSG ;Set up pointer to first directory seg. .QSET #XQUE,#1 ;Set up extra queue element .GTIM #IOAREA,#TIME ;Get time of day (and maybe cause date roll) .DATE ;Get the current system date CALL CONDAT ;Convert it to a useful format MOV TDAY,DAY ;Save the converted form MOV TMON,MON ; MOV TYEAR,YEAR ; MOV DAY,UDAY ;Date for /DATE MOV MON,UMON MOV YEAR,UYEAR MOV DAY,KDAY ;Date for /BEFORE MOV MON,KMON MOV YEAR,KYEAR MOV DAY,JDAY ;Date for /SINCE MOV MON,JMON MOV YEAR,JYEAR RETURN .DSABL LSB .SBTTL FILCHK- Check For legal file specifications ;+ ; ; FILCHK ; This routine checks for the following: ; 1) More than one output file. ; 2) Wildcard specification in the output filename. ; 3) More than one input device. ; It also sets up the default input and output specifications ; if none were given. ; ;- XTERNL <$R50ASC> GBLDAT GBLDAT .ENABL LSB FILCHK:: MOV #,R0 ;Point R0 at the first input spec TST FSPEC ;Any output file given? BNE 1$ ;Branch if so MOV #R50TT,FSPEC ;Else default to TT: 1$: TST @R0 ;How about an input file? BNE 2$ ;Branch if there MOV #R50DK,@R0 ;Else default to DK: 2$: TST FSPEC+2 ;Output filename given? BNE 3$ ;Branch if not MOV @R0,FSPEC+2 ;Default to the input device name. 3$: MOV FSPEC+OUSPSZ,-(SP) ;More than 1 output spec? BIS FSPEC+,(SP)+ BEQ 4$ ;Branch if not ;+ ;ERROR ILCMD:: $ERROR ILC,LEVEL=FATAL,RETURN=NO ;That's not allowed ;- 4$: MOV #3,R3 ;Check for wildcards on output side MOV #FSPEC+2,R2 ;Convert 3 words of RAD50 to ASCII MOV #PATS,R1 ;Store the ASCII here 5$: MOV (R2)+,R0 ;Get a word of the filename CALL $R50ASC ; and convert it DEC R3 ;Count down BNE 5$ ;Do it 3 times MOV #11,R3 ;Now check 9. characters MOV #PATS,R0 ;Point to the ASCII 6$: CMPB #PRCENT,@R0 ;Is it a '%'? BEQ ILCMD ;Branch if so. No good on output CMPB #ASTERK,(R0)+ ;How about a '*'? BEQ ILCMD ;Branch if no good DEC R3 ;Count down... BNE 6$ ;Loop until done MOV #,R0 ;Point to the input filespecs MOV @R0,R1 ;Get the device name 7$: TST 2(R0) ;Any filename there? BNE 8$ ;Branch if so MOV #R50STR,2(R0) ;Else make it a star... MOV #R50STR,6(R0) ;Make the type a star, also 8$: ADD #INSPSZ,R0 ;Point to the next one CMP #,R0 ;Are we done yet? BLOS 9$ ;Branch if so. Command is good, so far. TST @R0 ;Anything there? BEQ 8$ ;Branch if not ;;;; Following 2 lines removed for later physical device name check ;;; CMP @R0,R1 ;Are they the same? ;;; BNE ILCMD ;Branch if not. Illegal command. BR 7$ ;Check them all. 9$: RETURN .DSABL LSB .SBTTL FETCH- Fetch handlers ;+ ; ; FETCH ; This routine does the handler fetches for DIR. ; NOTE: ; The TT handler is never FETCHed. DIR does .PRINT's ; if the output device is TT:. ; ;- GBLDAT GBLDAT GBLDAT GBLDAT GBLDAT .ENABL LSB FETCH:: MOV FREEND,FREEST ;Set up pointer to free core MOV FREEND,R5 ; 10$: MOV #FSPEC,R1 ;Get pointer to file specs 20$: TST @R1 ;Anything there? BEQ 120$ ;Branch if not .DSTATU #IOAREA,R1 ;Find out what it is BCC 40$ ;Branch if no error 30$: CLR 2(R1) ;Clear first word of filename ;+ ;ERROR $ERROR IDV,LEVEL=FATAL,RETURN=NO,FILE=R1 ;- 40$: MOV IOAREA,R3 ;Get the status and device id number BMI 100$ ;Branch if it's random access. CMP #FSPEC,R1 ;Are we doing an output file? BEQ 70$ ;Branch if yes. BIT #20000,R3 ; PRINTER ? BNE 30$ ; YES, ERROR BIT #NRTDIR,R3 ;Is it directory structured? BEQ 30$ ;Branch if not. Illegal device. CMPB #CTIDEN,R3 ;Is it a cassette? BNE 50$ ;Branch if not MOV SP,DEVCT ;Else remember it 50$: CMPB #MTIDEN,R3 ;Magtape? BEQ 60$ ;Branch if so. CMPB #MMIDEN,R3 ;Magtape? BEQ 60$ ;Branch if so CMPB #MUIDEN,R3 ;Magtape? BEQ 60$ ;Branch if so CMPB #MSIDEN,R3 ;Magtape? BNE 100$ ;Branch if not 60$: MOV SP,DEVMT ;Remember it. BR 100$ 70$: CMPB #TTIDEN,R3 ;Output to TT:? BNE 80$ ;Branch if not MOV SP,DEVTT ;Remember it. BR 120$ ; 80$: TST R3 ;Is the output device sequential? BMI 90$ ;Branch if not MOV SP,DEVSEQ ;Else set the flag 90$: CMPB #LPIDEN,R3 ;Output to LP:? BNE 100$ ;Branch if not MOV SP,DEVLP ;Remember it. 100$: TST IOAREA+4 ;Is the handler already loaded BNE 120$ ;Branch if so ADD IOAREA+2,R5 ;Add in the handler size TST (R5)+ ;Bump it a little MOV R5,R0 ;Ask for that much room .SETTOP ; CMP R0,R5 ;Did we get it? BHIS 110$ ;Branch if so JMP TOSMAL ;Else tell the user no room 110$: .FETCH FREEST,R1 ;Fetch the handler BCS 30$ ;Branch if error MOV R5,FREEST ;Save the new free core pointer 120$: ADD #OUSPSZ,R1 ;Bump the file spec pointer CMP #,R1 ;Into the input specs yet? BHIS 20$ ;Branch if not TST -(R1) ;Input specs are one word shorter CMP R1,# ;Done? BLO 20$ ;Branch if not MOV R5,FREEPT ;Save the free core pointer ; Now we do the physical device name check to ensure user has not ; specified more than one input device. MOV #,R0 ;R0 -> Input spec list MOV @R0,-(SP) ;Get the first input spec CALL LTRANP ; and translate it to physical MOV (SP)+,R1 ;R1 = Physical device of first spec 130$: ADD #INSPSZ,R0 ;R0 -> Next input spec CMP R0,# ;At end of input list? BHIS 140$ ;Yep... TST @R0 ;Anything to translate? BEQ 130$ ;Nope... MOV @R0,-(SP) ;No, get an input device spec CALL LTRANP ; translate it to physical CMP (SP)+,R1 ;Same as the first? BEQ 130$ ;Yep... JMP ILCMD ;Nope, report error 140$: RETURN .DSABL LSB .SBTTL LTRANP - Logical to physical device translation ;+ ; ; LTRANP ; Performs the translation of a logical device name to a ; physical one. Handler for device must have been already ; LOADed or .FETCHed. Makes use of the SYSLIB routine, ; $DEVTR, to complete the translation. Works with 64-unit ; support. ; ; Call: ; (SP) contains RAD50 logical device name (placed on stack ; prior to CALL ; ; eg: ; MOV #device_name,-(SP) ; CALL LTRANP ; ; Return: ; (SP) contains RAD50 physical device name ; ;- LTRANP: MOV R0,-(SP) ;Save a few registers MOV R1,-(SP) MOV 6(SP),NFSLBK ;Place device name in lookup block .LOOKU #IOAREA,#ICHAN,#NFSLBK,#-1 ;Open it non-file-structured BCS 10$ .CSTAT #IOAREA,#ICHAN,#CSTABK ;Get info on the channel BCS 10$ .CLOSE #ICHAN ;Close the channel MOV CSTABK+12,R0 ;R0 = Device name MOV CSTABK+10,R1 ;R1 = Unit number CALL $DEVTR ;Complete the translation MOV R0,6(SP) ;Return physical device name 10$: MOV (SP)+,R1 ;Restore previously saved registers MOV (SP)+,R0 RETURN .SBTTL DEFALT- Set up defaults ;+ ; ; DEFALT ; This routine sets up some default values based upon the input command ; line. ; ;- GBLDAT GBLDAT GBLDAT GBLDAT GBLDAT DEFALT:: TST SWQ ;Want deleted files? BEQ 10$ ;Branch if not CLR SWS ;No sorts then MOV SP,SWM ;Turn on 'empties only' MOV SP,SWB ;Turn on starting block number 10$: TST SWA ;Alphabetic sort? BEQ 20$ ;Branch if not MOV SNAM,SWS ;Else set it up 20$: TST SWC ;Did he specify a column count? BNE 40$ ;Branch if so TST SWF ;Fast listing? BEQ 30$ ;Branch if not MOV DEFAST,SWC ;Yes. Use default fast column count BR 40$ ; 30$: MOV DEFLST,SWC ;Use default normal column count 40$: MOV #D,DEFTYP ;Default output type is decimal MOV DEFELD,DEFSIZ ; on a 5 column field TST SWO ;Want numbers in octal? BEQ 50$ ;Branch if not MOV #O,DEFTYP ;Else remember it INC DEFSIZ ;Field size is 6 50$: TST SWS ;Are we sorting? BEQ 70$ ;Branch if not MOV @#S$RMON,R0 ;Get the pointer to the Resident Monitor MOV F$USR(R0),R0 ;Get pointer to base of USR TST -(R0) ;Get below it CMP FREEPT,R0 ;Are we already above it? BLO 60$ ;Branch if not MOV #-2,R0 ;Else ask for all the memory we can get 60$: .SETTOP ;Do the askin' MOV R0,FREEND ;Save our hi limit 70$: TST SWT ;Protected files wanted? BEQ 80$ ;If not, branch CLR SWU ;No unprotected files BR 100$ ; 80$: TST SWU ;Unprotected files wanted? BEQ 90$ ;If not, branch CLR SWT ;No protected files BR 100$ ; 90$: MOV SP,SWT ;Turn both protected and MOV SP,SWU ;unprotected files 100$: MOV SWM,-(SP) ;Are we only listing unused areas BIS SWQ,(SP)+ ; in one form or the other? BEQ 110$ ;Branch if not MOV #,R0 ;If so, need '*.*'. Point to 1st file spec MOV #R50STR,(R0)+ ;Put in the * CLR (R0)+ ;Clear the next word MOV #R50STR,@R0 ;Fill in the file type CLR SWT ;No protected or CLR SWU ;unprotected files 110$: RETURN .SBTTL FILES- Do .ENTER's and .LOOKUP's ;+ ; ; FILES ; This routine ; 1) .ENTER's the output file ; 2) .LOOKUP's the input device ; 3) If the input device is MT or disk, formats the owner ; name and volume ID ; 4) If the input device is CT or MT, positions the tape ; ;- XTERNL GBLDAT GBLDAT GBLDAT GBLDAT GBLDAT PSECT $$$FMT ;CG09+ .NLIST BEX FMTVOL: .ASCIZ \ Volume ID: [S[/\ FMTOWN: .ASCIZ \ Owner : [S[/\ .LIST BEX PSECT * ;CG09- .ENABL LSB FILES:: TST DEVTT ;Is the output device TT:? BNE 50$ ;Branch if so. We'll use .PRINT .SERR ;We'll handle hard errors .ENTER #IOAREA,#OCHAN,#FSPEC,FSPEC+10,#-1 ;Enter the output file BCC 50$ ;Branch if no error TSTB @#$ERRBY ;Is it negative? BGE 20$ ;Branch if not CMPB @#$ERRBY,#ER.DIR ;Error due to invalid directory? BNE 10$ ;Nope... $ERROR ILD,LEVEL=FATAL,RETURN=NO,FILE=#FSPEC ;Yes, 'Invalid directory...' ;+ ;ERROR 10$: $ERROR WER,LEVEL=FATAL,RETURN=NO,FILE=#FSPEC ;'Output error...' ;- 20$: CMPB @#$ERRBY,#ER.PRO ;Error due to protected file? BNE 30$ ;Nope... ;+ ;ERROR $ERROR PFE,LEVEL=FATAL,RETURN=NO,FILE=#FSPEC ;'Protected file already...' ;- 30$: CMPB @#$ERRBY,#ER.FUL ;Error due to output device full? BNE 40$ ;Nope... ;+ ;ERROR $ERROR OPF,LEVEL=FATAL,RETURN=NO ;Else give error ;002 40$: $ERROR DNA,LEVEL=FATAL,RETURN=NO ;Else give error ;**-1 ;- 50$: .HERR ;Let monitor trap hard errors MOV FSPEC+INSPST,LKBLK ;Set up for the .LOOKUP CLR LKBLK+2 ; non-file structured .LOOKUP #IOAREA,#ICHAN,#LKBLK,#0 ; BCC 60$ ;Branch if no error ;+ ;ERROR $ERROR RER,LEVEL=FATAL,RETURN=NO,FILE=#LKBLK ;- 60$: TST DEVCT ;Is the input device a cassette? BEQ 70$ ;Branch if not JSR R5,SPFUN ;Issue a special function request .BYTE 377,SP.RW ; to rewind the cassette BR 160$ ;Return 70$: TST DEVMT ;Input a magtape? BEQ 150$ ;Branch if not JSR R5,SPFUN ;Rewind the magtape .BYTE 377,SP.RW ; CALL READMT ;Read a record BCC 80$ ;Branch if no error CALL CHCKSB ;Check for a short record BEQ 80$ ;Branch if it was. We'll use it ;+ ;ERROR INERR:: $ERROR ERD,LEVEL=FATAL,RETURN=NO ;- 80$: CMP #MT.VOL,IBUF ;VOL1 label? BEQ 90$ ;Branch if so ;+ ;ERROR ILDIR:: $ERROR ILD,LEVEL=FATAL,RETURN=NO ;Else bad directory ;- 90$: MOV #IBUF+MT.OWN,R3 ;Point to the owner name CMPB #MT.VP1,(R3)+ ;Is it a PRE-V5.5 DEC written magtape? BNE 100$ ;Branch if not. CMP #MT.VP2,(R3)+ ;Written on an 11? BEQ 110$ ;Branch if so 100$: MOV SP,MABBAD ;Flag that it may be bad ; NEG SWV ;Don't do vol id/owner ;MG02 ; BR 130$ ;Go position the tape MOV #IBUF+MT.OWN,R3 ;Back up to owner field ;RH01 110$: MOV R3,-(SP) ;Save R3 for volid CALL BAKCHK ;PRE-V5.4A BACKUP tape? MOV (SP)+,R3 ;Restore R3 BCC 120$ ;If not, branch ;+ ;ERROR BUPFIL: $ERROR BKF,LEVEL=INFORM,RETURN=NO ;- 120$: FORMAT #IBUF+1000,,<#IBUF+MT.VID,#MT.VLN>,#FMTVOL FORMAT ,,,#FMTOWN 130$: CALL READMT ;Position to the first HDR label BCC 140$ ;Branch if no error CALL CHCKSB ;Check for a short block read error BNE ILDIR ;Some other error 140$: CMP #MT.HDR,IBUF ;HDR1 label? BNE 130$ ;Branch if not. Try again BR 180$ 150$: .READW #IOAREA,#ICHAN,#IBUF,#400,#HOMBLK ;Read the home block BCS INERR ;Branch on error ; CMP #R50V3A,IBUF+DK.VAL ;Is it a V3 or later disk? ; BEQ 170$ ;Branch if so. BR 170$ ;Continue 160$: MOV SP,MABBAD ;Remember that it may be a bad directory NEG SWV ;Don't print a volid ;MG02 BR 180$ ;Done 170$: CALL BAKCHK ;BACKUP volume? BCS BUPFIL ;If yes, branch FORMAT #IBUF+1000,,<#IBUF+DK.VID,#DK.VLN>,#FMTVOL FORMAT ,,<#IBUF+DK.OWN,#DK.OLN>,#FMTOWN 180$: ;The code below is now extraneous, as Bob Schor's fix ;016 ;to DIRMAN.MAC got rid of the extra NUL that was causing ;016 ;a .PRINT to the console to do a CRLF on. ;016 ; TST DEVTT ;Listing going to console? ;016 ; BEQ 190$ ;Branch if not ;016 ; TST SWV ;Want vol id? ;016 ; BEQ 190$ ;Branch if not ;016 ; DEC R2 ;Back up buffer pointer ;016 ; CLRB -(R2) ; and make vol id/owner an ASCIZ string.;016 190$: RETURN .DSABL LSB .SBTTL CHEKIT- Process the directory entry ;+ ; ; CHEKIT ; This routine is the 'brain' of the program. It determines what to ; do with a directory entry based on the options given in the command ; line. ; INPUTS: ; R0 is non-zero if the entry matched an input specification ; R5 -> 1st word of a directory entry ; ;- XTERNL GBLDAT GBLDAT GBLDAT GBLDAT .ENABL LSB ;CG09 CHEKIT:: BIT #DS.EOS,@R5 ;End-of-segment entry? BNE 70$ ;Branch if so BIT #,@R5 ;Empty or tentative entry? BNE 50$ ;Branch if so INC DCNT ;Bump count of files in this segment TST R0 ;Was this entry a match? BEQ 90$ ;Branch if not TST SWT ;Protected entry wanted? BEQ 5$ ;If no, branch TST SWU ;Unprotected also wanted? BNE 10$ ;If yes, branch BIT #DS.PRO,@R5 ;Protected entry? BEQ 90$ ;If not, branch 5$: TST SWU ;Unprotected entry wanted? BEQ 10$ ;If not, branch BIT #DS.PRO,@R5 ;Is it unprotected? BNE 90$ ;No, branch 10$: INC FCNT ;Bump total file count ADD DE.LEN(R5),TBLOCK ;Bump the total block count MOV SWM,-(SP) ;See if only listing empties BIS SWQ,(SP)+ ;/EMPTY and /DELETED options BNE 90$ ;Branch if /M or /Q 20$: TST SWN ;Doing a summary? BEQ 30$ ;Branch if not TST SWL ;Should we list files anyway? BEQ 90$ ;Branch if not 30$: TST SWS ;Doing a sort? BEQ 40$ ;Branch if not CALL SAVBLK ;Save the filename for later BR 90$ ; 40$: CALL OUTFIL ;Else output the filename BR 90$ ; and return 50$: ADD DE.LEN(R5),EBLOCK ;Bump the free block count TST SWQ ;Doing /Q? BEQ 60$ ;Branch if not BIC #,@R5 ;Fake a permanent file BIS #DS.PRM,@R5 ; for OUTFIL BR 40$ ; 60$: MOV SWM,-(SP) ;Are we listing unused area? BIS SWE,(SP)+ ;/M or /E BEQ 90$ ;Branch if not BR 30$ ;Else go check for sort. ;CG08 70$: TST SWN ;Doing a summary? BEQ 100$ ;Branch if not CALL LINCHK ;Setup buffer pointer 80$: CLR COLCNT ;Start over in columns if listing files MOV RBLK,R0 ;Get the physical block # of segment SUB #4,R0 ; and convert it to a segment number ASR R0 ; FORMAT ,<[U6 Files in segment [U[/[/>, PRTIT #BUFFER ;Output the line CLR DCNT ;Clear segment file count BR 100$ ;No length to add in 90$: ADD DE.LEN(R5),SBLOCK ;Bump starting block count 100$: RETURN .DSABL LSB ;CG09 .SBTTL SETUP- Convert input specifications to ASCII ;+ ; ; SETUP ; This routine sets up the conversion of the input file specs ; to ASCII. ; ;- XTERNL GBLDAT SETUP:: MOV #PATS,R1 ;Point to storage for ASCII filenames MOV #INSPST,R3 ;Offset to start of input specs in FSPEC 1$: TST FSPEC(R3) ;Filespec there? BEQ 2$ ;Branch if not. Done MOV #FSPEC+2,R0 ;Point to filename, ADD R3,R0 ; offset by where we've gotten to CALL RTOA ;Convert it to ASCII INC INSPCS ;Bump the count of input filespecs ADD #INSPSZ,R3 ;Bump the pointer CMP #SPCSIZ,R3 ;Are we done yet? BHI 1$ ;Branch if not 2$: RETURN .SBTTL CLOSE- Cleanup at end of directory ;+ ; ; CLOSE ; This routine does the cleanup when a directory is finished. ; ;- XTERNL GBLDAT GBLDAT GBLDAT .ENABL LSB ;CG09 CLOSE:: TST SWS ;Are we doing a sort? BEQ 1$ ;Branch if not CALL SRTDRV ;Else go sort the entries 1$: .RCTRLO ;Reset ^O so user gets statistics TST SWN ;Doing a summary? BEQ 2$ ;Branch if not FORMAT #BUFFER,<[U6 Available segments, [U in use[/[/>, PRTIT #BUFFER ;Output the buffer MOV SP,NEWLIN ;Indicate no needed 2$: CALL LINCHK ;Set up line buffer 3$: MOV DEFTYP,R0 ;Get the format type CLR R3 ;0 length field as default TST SWO ;Octal output? BEQ 4$ ;Branch if not MOV #6,R3 ;Else use 6 character field 4$: ;/// TST SWM ;Unused entries only? BEQ 100$ ;Branch if not CLR FCNT ;Clear the file count CLR TBLOCK ; and the total block count 100$: ;/// FORMAT ,< [U Files, [** Blocks[/>, MOV DEVCT,-(SP) ;Input from cassette BIS DEVMT,(SP)+ ; or magtape? BNE 5$ ;Branch if so FORMAT ,< [** Free blocks[/>, 5$: PRTIT #BUFFER ;Output the line CALL CLRBUF ;Clear the output buffer .WAIT #ICHAN ;Wait for possible rewind RETURN .DSABL LSB ;CG09 .SBTTL LINCHK- Set up for a new line ;+ ; ; LINCHK ; This routine sets up the line buffer for a new line. ; ;- GBLDAT LINCHK:: MOV #BUFFER,R2 ;Point to the output line buffer TST NEWLIN ;Time to start a new line? BNE 1$ ;Branch if already done MOVB #CR,(R2)+ ;Put a in the buffer MOVB #LF,(R2)+ ; and a MOV SP,NEWLIN ;Flag no new line needed 1$: RETURN .SBTTL BAKCHK - Check for a BACKUP volume ;+ ; BAKCHK ; This routine checks if the user tried to use DIR on a ; BACKUP volume (tape or disk). If so, it will set the C bit ; and direct the user to type DIR/BACKUP. BUP handles directories ; on BACKUP volumes. ;- BAKCHK:: MOV #IBUF+BUPOFF,R3 ;Point to BUP ID CMP BUPID,(R3) ;Is it a BACKUP volume? BNE 90$ ;If not, branch SEC ;Yes, flag it BR 100$ 90$: CLC ;No error 100$: RETURN .END