Following the file allocation tables is an area known in MS-DOS versions 2.0 and later as the root directory. (Under MS-DOS version 1, it was the only directory on the disk.) The root directory contains 32-byte entries that describe files, other directories, and the optional volume label (Figure 10-5). An entry beginning with the byte value E5H is available for reuse; it represents a file or directory that has been erased. An entry beginning with a null (zero) byte is the logical end-of-directory; that entry and all subsequent entries have never been used.
Figure 10-5. Format of a single entry in a disk directory. Total length is 32 bytes (20H bytes).
Please refer to the printed book for this figure.
Notes for Figure 10-5
1.The first byte of the filename field of a directory entry may contain the following special information:
Value Meaning 00H Directory entry has never been used; end of occupied portion of directory. 05H First character of filename is actually E5H. 2EH Entry is an alias for the current or parent directory. If the next byte is also 2EH, the cluster field contains the cluster number of the parent directory (zero if the parent directory is the root directory). E5H File has been erased.
2.The attribute byte of the directory entry is mapped as follows:
Bit Meaning 0 Read-only; attempts to open file for write or to delete file will fail. 1 Hidden file; excluded from normal searches. 2 System file; excluded from normal searches. 3 Volume label; can exist only in root directory. 4 Directory; excluded from normal searches. 5 Archive bit; set whenever file is modified. 6 Reserved. 7 Reserved.
3.The time field is encoded as follows:
Bits Contents 00H—04H Binary number of 2-second increments (0—29, corresponding to 0—58 seconds) 05H—0AH Binary number of minutes (0—59) 0BH—0FH Binary number of hours (0—23)
4.The date field is encoded as follows:
Bits Contents 00H—04H Day of month (1—31) 05H—08H Month (1—12) 09H—0FH Year (relative to 1980)
5.The file-size field is interpreted as a 4-byte integer, with the low-order 2 bytes of the number stored first.
The root directory has a number of special properties. Its size and position are fixed and are determined by the FORMAT program when a disk is initialized. This information can be obtained from the boot sector's BPB. If the disk is bootable, the first two entries in the root directory always describe the files containing the MS-DOS BIOS and the MS-DOS kernel. The disk bootstrap routine uses these entries to bring the operating system into memory and start it up.
Figure 10-6 shows a partial hex dump of the first sector of the root directory on a bootable PC-DOS 3.3 floppy disk.
0 1 2 3 4 5 6 7 8 9 A B C D E F
0000 49 42 4D 42 49 4F 20 20 43 4F 4D 27 00 00 00 00 IBMBIO COM'....
0010 00 00 00 00 00 00 00 60 72 0E 02 00 54 56 00 00 .......'r...TV..
0020 49 42 4D 44 4F 53 20 20 43 4F 4D 27 00 00 00 00 IBMDOS COM'....
0030 00 00 00 00 00 00 00 60 71 0E 18 00 CF 75 00 00 .......'q....u..
0040 43 4F 4D 4D 41 4E 44 20 43 4F 4D 20 00 00 00 00 COMMAND COM ....
0050 00 00 00 00 00 00 00 60 71 0E 36 00 DB 62 00 00 .......'q.6..b..
0060 42 4F 4F 54 44 49 53 4B 20 20 20 28 00 00 00 00 BOOTDISK (....
0070 00 00 00 00 00 00 A1 00 21 00 00 00 00 00 00 00 ........!.......
0080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
.
.
.
Figure 10-6. Partial hex dump of the first sector of the root directory for a PC-DOS 3.3 disk containing the three system files and a volume label.