Directory Manipulation Routines
Generalized Routines -- DIRF and DIRFS
Buffer Allocation Routine -- DBUFFER
Disk Parameter Information Extraction Routine -- DPARAMS
Free Space Computation Routine -- DFREE
File Size Computation Routine -- FSIZE
Directory Load Routines -- DIRLOAD and DIRSLOAD
Directory Alphabetization Routine -- DIRALPHA
Directory Entry Selection Routine -- DIRSEL
Directory Pack Routine -- DIRPACK
:Directory Manipulation Routines
Thi� se� o� SYSLI� routine� concern� itsel� wit� th� loadin� �
o� an� acces� o� � dis� director� fo� th� genera� purpose� o� th� �
user. Included in this set of routines are the functions of:
1. Preallocation of buffer space for the routines
2. Two routines which load all undeleted directory
entries into a buffer, constantly checking for
memory overflow as they go
DIRLOAD loads the first entry for each file
(this is the faster of the two)
DIRSLOAD loads the last entry for each file
(this routine is required if the
user wishes to compute file sizes)
3. A routine to determine the amount of free space on
the disk
4. A routine to compute the size of a file in K
5. A routine to sort a loaded directory by file name
and type or by file type and name
6. A routine to select (by marking) a set of directory
entries which match a given ambiguous file spec
7. A routine to pack the loaded directory, leaving in
it only those entries marked by the select routine
:Generalized Routines -- DIRF and DIRFS
Routine Name: DIRF and DIRFS
Function�
Thi� routin� initialize� th� buffe� area�� load� � dis� �
directory�� select� � se� o� file� fro� th� loade� director� �
specifie� b�� th� user'� ambiguou� fil� nam� an� � passe� fla� �
(whic� indicate� i� Syste� file� ar� selected�� Non-syste� file� �
ar� selected�� al� use� area� ar� t� b� covered�� an� wha� �
particula� use� are� i� t� b� covere� i� al� use� area� ar� no� �
selected)� pack� th� directory� an� alphabetize� th� director� b� �
fil� nam� an� fil� type.
I� DIR� i� used�� th� processin� proceed� faste� sinc� onl� �
th� firs� entr� o� eac� fil� i� loade� int� th� memor�� buffer� �
Fil� sizin� informatio� i� no� include� i� thi� load� however.
I� DIRF� i� used� th� processin� i� somewha� slower� bu� th� �
las� entr� fo� eac� fil� i� loade� rathe� tha� th� first�� Fil� �
sizin� informatio� i� containe� i� thi� entry��� an䠠 thi� �
informatio� ca� b� use� b� th� FSIZ� routine.
Inputs: HL points to a dynamic buffer which extends from
after the user's code and buffer areas to the
end of the TPA
DE points to the first byte of the FCB used to
specify the ambiguous file name; only the chars
in the FN and FT fields are significant, so this
need not be a true FCB and may be as short as 12
bytes
A is the selection flag, structured as follows:
Bit 7 - If Set, Select Non-System Files
Bit 6 - If Set, Select System Files
Bit 5 - If Set, Select All User Areas
Bits 4-0 - If Bit 5 is Cleared, contains number
of User Area to Select
Outputs: HL points to the first file entry in the buffer;
each file entry is 16 bytes long
BC contains the number of files selected
����� A contains an error flag; A=0 and Zero Flag Set
����� (Z) indicates TPA overflow error during load of
����� directory entries; A<>0 and NZ indicates load OK
Registers Affected: HL, BC, PSW
SYSLIB Routines Called: DBUFFER, DIRLOAD, DIRSEL, DIRPACK,
DIRALPHA
Special Error Conditions: As outline for the A register
����� above.
:Buffer Allocation Routine -- DBUFFER
Routine Name: DBUFFER
Function:
Thi� routin� allocate� th� buffe� spac� necessar�� fo� �
th� se� o� director� function� i� general�� I� particular�� i� �
allocate� th� necessar� spac� fo� th� alphabetizatio� functio� a� �
wel� a� th� loade� director� itself�� Thi� routin� mus� b� use� �
i� th� DIRALPH�� routin� i� t� b� late� use� t� sor� th� �
directory�� thi� routin� allocate� al� th� spac� necessar�� b� �
DIRALPH� t� sor� th� routin� (pointe� space)� I� thi� routin� i� �
called� i� i� no� necessar� t� cal� th� DPARAM� routine.
Inputs: HL points to the beginning address of a dynamic
����� buffer area which extends to under the CCP
Outputs: HL points to the first byte at which the directory
����� entries are to be loaded
����� A=0 and Zero Flag is Set (Z) if the CCP is
����� already overrun; else, A<>0 and NZ
Registers Affected: HL, PSW
SYSLIB Routines Called: DPARAMS
Special Error Conditions: As indicated by A reg and Z flag
:Disk Parameter Information Extraction Routine -- DPARAMS
Routine Name: DPARAMS
Function:
Thi� routin� extract� necessar� informatio� fro� th� Dis� �
Paramete� Bloc� (DPB� an� store� i� awa� i� som� globa� buffer� �
use� b� othe� Dis� Director� Routines� Th� informatio� extracte� �
i� no� o� genera� concer� b� th� programmer�� AL� TH� PROGRAMME� �
NEEDӠ T� KNO� I� THA� THI� ROUTIN� MUS� B� CALLE� A� LEASԠ ONC� �
BEFOR� TH� DIRLOA� O� DIRSLOA� ROUTIN� I� CALLED� I� th� DBUFFE� �
routin� i� called�� the� i� i� no� necessar�� t� cal� DPARAM� �
again.
Fo� th� informatio� o� th� reader� th� followin� informatio� �
i� extracted:
����� BLKSHF <-- Block Shift Factor (1 Byte)
����� BLKMSK <-- Block Mask (1 Byte)
����� EXTENT <-- Extent Mask (1 Byte)
����� BLKMAX <-- Max Number of Blocks on Disk (2 Bytes)
����� DIRMA� <-- Ma� Numbe� o� Di� Entrie� (� Bytes)
Thi� routin� automaticall� adjust� fo� version� 1.� an� 2.� �
o� CP/� an� i� compatabl� wit� bot� version� o� CP/M.