.MCALL .MODULE
.MODULE DIR1ST,VERSION=02,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.
; Directory Program
;
; Modification History
;
; Who Date Module Reason
;
; CG 15-Nov-76 V03 version done
;
; CG 01-Nov-77 ALL V03B version done
;
; CG01 09-Feb-79 DIRT11 Fix handler .RELEASE code
;
; CG02 09-Feb-79 DIRT11 Force .PURGE before .RELEASE
;
; CG03 09-Feb-79 DIRT11 Correct output file size on .ENTER
; Force magtape .ENTER's to EOT
;
; CG04 09-Feb-79 DIRSRT Fix sort bug
;
; CG05 09-Feb-79 DIROUT Fix magtape, cassette buffer dump bug
;
; CG06 09-Feb-79 DIRERR Fix $ERROR buffer dump bug
;
; CG07 10-Feb-79 DIRDAT Add /VOLUMEID[:ONLY] support
; DIRMAN
; DIRSWT
;
; CG08 10-Feb-79 DIRT11 Add protection flag; Side effect is
; DIRSRT that now /FULL or /FREE are valid with
; DIROUT /SORT; i.e. they will list free areas
; DIRDAT when a sort goes on.
;
; CG09 12-Feb-79 DIRPRE New FORMAT routine and macro. Some support
; DIRMAN routines moved to ULBLIB.
; DIRT11
; DIROUT
; DIR1ST
;
; MG01 13-Aug-79 DIRDAT Modified $ERROR macro and added code to
; DIRERR support the setting of the user program
; DIRMAN error status byte (53). Also added code
; DIROUT to check for errors in 'ENTER' and 'CLOSE'
; DIRPRE due to protected files.
; DIRSRT
; DIRT11
; DIR1ST
;
; MG02 10-Oct-79 DIR1ST Fixed bug which caused a full directory
; DIRMAN to by given when VOL:ONL was requested
; DIRT11 and the volume did not have a valid
; VOLID on it.
;
; MG03 11-Oct-79 DIR1ST Fixed sort bug due to signed branch in place
; DIRSRT of unsigned branch.
;
; MG04 11-Oct-79 DIR1ST Fixed bug which would overwrite memory if
; DIRMT file name from magtape had more than 6
; characters.
;
; CG10 31-Oct-79 DIRMT Complete MG04 fix.
;
; V04.00 16-NOV-79 ALL Copyright statement update
; -MBG-
;
; V05.00 30-SEP-82 ALL Copyright statement update
; -LAB-
;-
.SBTTL RT-11 DIRECTORY PROGRAM
.ENABL LC
.SBTTL General comments
;+
;
; This module generates no code. For Version 4, its purpose was to
; place the correct ident in the save image and as a collection point
; for general information about DIR. For Version 5, the correct ident
; is placed in the save image by the .MODULE macro. This module
; is left in DIR for the documentation it contains.
;
; The macros used by DIR are defined in the prefix file DIRPRE.MAC.
; They are .NLIST'ed there to save paper. They are listed below for
; documentation purposes.
;
; The assembly and linking procedure is:
;
; MACRO/OBJECT:DIR1ST DIR1ST
; MACRO/OBJECT:DIRDAT DIRPRE+DIRDAT
; MACRO/OBJECT:DIRMAN DIRPRE+DIRMAN
; MACRO/OBJECT:DIRT11 DIRPRE+DIRT11
; MACRO/OBJECT:DIRSWT DIRPRE+DIRSWT
; MACRO/OBJECT:DIRMAT DIRPRE+DIRMAT
; MACRO/OBJECT:DIRDK DIRPRE+DIRDK
; MACRO/OBJECT:DIRMT DIRPRE+DIRMT
; MACRO/OBJECT:DIRCT DIRPRE+DIRCT
; MACRO/OBJECT:DIRSUP DIRPRE+DIRSUP
; MACRO/OBJECT:DIRSRT DIRPRE+DIRSRT
; MACRO/OBJECT:DIROUT DIRPRE+DIROUT
; MACRO/OBJECT:DIRERR DIRPRE+DIRERR
; LINK/PROMPT/EXECUTE:DIR DIR1ST,DIRDAT,DIRMAN,DIRT11
; DIRSWT,DIRMAT,DIRDK,DIRMT,DIRCT
; DIRSUP,DIRSRT,DIROUT,DIRERR,ULBLIB//
;
; The order of the files in the link command makes no particular difference,
; except, DIR1ST and DIRDAT must be the first two files, in that order.
;
; Code enclosed by ';///' is there for compatability with V03, and
; should be removed (with appropriate documentation changes) for the
; next release.
;
;-
.MCALL .READW, .SETTOP,.ENTER, .LOOKUP,.DATE, .WRITW, .PRINT
.MCALL .GTIM, .PURGE, .CLOSE, .WAIT, .CSISPC,.SPFUN, .DSTATUS
.MCALL .RELEAS,.FETCH, .RCTRLO,.GVAL, .EXIT
;+ ;CG09+
;
; This macro generates calls to the formatting routine. The arguments
; are:
; BUFFER - a pointer to an output buffer. If not specified,
; R0 is assumed to point the output buffer.
; PICTUR - an ASCII string enclosed in '<>', containing the
; format string and/or formatting directives. See
; comments in file RESRC1.MAC.
; ARGUMENTS- values contained in '<>' to satisfy any formatting
; directives. SP addressing is not valid.
;
;-
.MACRO FORMAT BUFFER,PICTUR,ARGUMENTS,LAB1
.IF NB
PSECT $$$FMT
...FMT = .
.ASCIZ \PICTUR\
PSECT *
MOV R0,-(SP)
.ENDC
...ARG = 0
..ARGC = 0
.IRP ARG,
..ARGC = ..ARGC +1
.ENDM
..LOOP = ..ARGC
.REPT ..ARGC
..LOP1 = ..LOOP
.IRP ARG,
..LOP1 = ..LOP1 -1
.IF EQ ..LOP1
MOV ARG,-(SP)
...ARG = ...ARG +1
.ENDC
.ENDM
..LOOP = ..LOOP -1
.ENDR
.IF NB
MOV #...FMT,-(SP)
.IFF
.IF NB LAB1
MOV LAB1,-(SP)
.IFF
.ERROR ;No FORMAT string specified
.ENDC
.ENDC
...ARG = ...ARG +1
MOV #<...ARG*2>,-(SP)
.IF NB BUFFER
MOV BUFFER,R0
.IFF
MOV R2,R0
.ENDC
.GLOBL $FORMAT
JSR PC,$FORMAT
MOV R0,R2
MOV (SP)+,R0
.ENDM FORMAT
.MACRO UNORG
.ENDM UNORG
.MACRO ORIGIN SECT,LIST
.MACRO UNORG
.LIST BEX
PSECT SECT,
.ENDM UNORG
PSECT ,
.NLIST BEX
.ENDM ORIGIN
.MACRO PSECT SECT,LIST
.LIST BEX
.IF IDN SECT,<*>
UNORG
.NLIST BEX
.MEXIT
.IFF
.IF NB
.PSECT SECT,LIST
.IFF
.PSECT SECT
.ENDC
.ENDC
.NLIST BEX
.ENDM PSECT ;CG09-
;+
;
; Macro GBLDAT
; This macro defines data referenced by a routine to be global. The argument
; is:
; ARGS - a list of items to be declared global, enclosed in '<>'.
;
;-
.MACRO GBLDAT ARGS
.DSABL CRF
.GLOBL ARGS
.ENABL CRF
.ENDM GBLDAT
;+
;
; Macro PRTIT
; PRTIT causes a line buffer to be dumped to the output buffer via WRITIT.
; Its arguments are:
; BUFF - Pointer to the line buffer.
; If absent, R1 is assumed.
; LEN - Length of the string. If absent, it will be calculated.
; END - End of the string. If absent, R2 is assumed
;
;-
.MACRO PRTIT BUFF,LEN,END
.DSABL CRF
.IIF NB , MOV BUFF,R1
.IIF NB , MOV LEN,R2
.IIF NB , MOV END,R2
.IIF B , SUB R1,R2
.GLOBL WRITIT
.ENABL CRF
JSR PC,WRITIT
.ENDM PRTIT
;+
;
; Macro TITLE
;
;-
.MACRO TITLE NAME,SUBTTL,VERSION,EDIT
.TITLE NAME'.0'EDIT
.NLIST
.LIST ME
.LIST
.SBTTL NAME'SUBTTL
.IDENT \X'VERSION'.'EDIT\
.NLIST
.NLIST ME
.LIST
.ENDM TITLE
;+
;
; Macro XTERNL
; This macro declares a list of external routines called by the following
; routine. The argument is:
; ARGS - a list of routine names or entry points called by this
; routine, enclose in '<>'.
;
;-
.MACRO XTERNL ARGS
.DSABL CRF
.GLOBL ARGS
.ENABL CRF
.ENDM XTERNL
;+
;
; Macro $ERROR
; This macro generates calls to the error message processor. The
; arguments are:
; NAME - the 3 character name of the error message, as defined
; by macro ERMSG.
; LEVEL - the level of error. Only the first character is used.
; RETURN- 'YES' or 'NO'. 'YES' implies return to the next instruction
; after giving the error. Anything else implies that the
; program should be restarted.
; FILE - the address of a device/filename block in RAD50 which is
; to be printed following the error message.
; ASCII - the address of an ASCII character which is to be printed
; in the error message
;
;-
.MACRO $ERROR NAME,LEVEL,RETURN,FILE,ASCII
.GLOBL ERROR, NAME'...
.IF NB
MOV FILE,R3
.IFF
CLR R3
.ENDC
.IF NB
MOV ASCII,R2
.IFF
CLR R2
.ENDC
JSR R5,ERROR
.BYTE 'NAME'...
...X.. = 0
...... = 0
.IRPC ..X...,
.IF EQ ......
.IIF IDN ..X..., ...X.. = 200
...... = 1
.ENDC
.ENDM
...... = 0
.IRPC ..X...,
.IF EQ ......
.BYTE ...X..+ERR$$'..X...
...... = 1
.ENDC
.ENDM
.ENDM $ERROR
;+
;
; Macro .SAVRG
;
;-
.MACRO .SAVRG
.DSABL CRF
.GLOBL $SAVRG
.ENABL CRF
JSR R5,$SAVRG
.ENDM .SAVRG
.END