SpartaDOS X Reference Manual

Technical Information




C h a p t e r    7 — Technical Information

Index


Directory Structure

The directory is a special file that contains information about a group of files and subdirectories. Each directory entry is 23 bytes in length and contains the file name, time/date, length, the number of the first sector map, and the entry status. The first entry is different from the others; it contains information about the directory itself. The following is a list of this information given as offsets into the first entry:
 

1 The sector number of the first sector map of the parent directory. A 0 indicated that this is the main (or root) directory of the disk (2 bytes).
3 The length of the directory (in bytes). This is the length of the directory file, not the number of entries (3 bytes).
6 The name of the directory padded with spaces (8 bytes).

When a directory is opened in unformatted or raw mode (see Programming With SpartaDOS X) the file is positioned to the second entry (that of the first file or subdirectory). To read the first entry you must POINT to the beginning of the file after opening it.

The rest of the directory entries are the same. They are 23 bytes long and provide the following information (given as offsets into the entry):

0 Status byte. The bits of this byte, if SET (1), represent the status of the directory entry as follows:
B0 - Entry is protected.
B1 - Entry is hidden.
B2 - Entry is archived.
B3 - Entry is in use.
B4 - Entry is deleted.
B5 - Entry is a subdirectory.
B7 - Entry is open for write.

Notes: bits 1 and 2 are not supported by earlier versions of SpartaDOS. Bits 3 and 4 should always be opposites. Bit 5 should never be changed! A status byte of 0 indicates the end of the directory. Bits 6 is not used and should not be, since it may be cleared as other operations are performed.

1 The sector number of the first sector map of the file or subdirectory (2 bytes).
3 The length of the file in bytes (3 bytes).
6 The name of the file or subdirectory, padded with spaces if necessary (8 bytes).
14 The extension of the file or subdirectory, padded with spaces if necessary (3 bytes).
17 The date the file or directory was created in DD/MM/YY format (3 bytes).
20 The time the file or directory was created in HH/MM/SS 24 hour military format (3 bytes).
Exploring Disks The best way to become familiar with the SpartaDOS disk format is to use a sector editor and a test floppy to explore. DiskRx, the SpartaDOS disk editor included in the SpartaDOS Toolkit, is an excellent sector editor tailored specifically for SpartaDOS disks. It will identify boot, bit map, sector map, directory, and data sectors. A good understanding of SpartaDOS disk structure and DiskRx can prove to be invaluable for recovering files from disks with bad sectors or damaged directories. Exploring disks can also be a lot of fun.

Previous page

Next page