Chapter
4
I
MS-DOS
Disk
Allocation
MS-DOS
Disk
Directory
FORMAT builds the root directory for all disks. Its location on
disk and the maximum number
of
entries are dependent on the
media.
Since directories other than the root directory are regarded
as
files by MS-DOS, there is no limit to the number
of
entries they
may contain.
All directory entries are 32 bytes in length, and are in the fol-
lowing format:
OOH-07H Filename.
8
characters, left-aligned and padded, if
necessary, with blanks. The first byte
of
this field
indicates the file status as follows:
OOH
E5H
2EH
The directory entry has never been used.
This is used to limit the length
of
directory
searches, for performance reasons.
The directory entry has been used, but the
file has been erased.
The entry is for a directory. If the second
byte is also 2EH, then the cluster field con-
tains the cluster number
of
this directory’s
parent directory (0000H if the parent direc-
tory is the
root
directory). Otherwise, bytes
OIH through OAH are all spaces, and the
cluster field contains the cluster number
of
this directory.
Any other character is the first character
of
a
filename.
08H-0AH Filename extension.
OB File Attribute. The attribute byte is mapped as
follows:
OIH File is marked read only. An attempt to
open the file
for
writing using the Open
File function call (function call 3DH) re-
sults in an error code returned. This value
can be used along with other values below.
Attempts to delete the file with the Delete
File (13H) or Delete
a
Directory Entry
(41H) function call will also fail.
166