Technical information

© Jean Louis-Guérin V1.2a September 2014 Page 48 / 69
medium, not by a fixed number of entries. The TOS initially allocates only a single cluster for the
directory, allocating additional clusters only when they are needed. Every directory except the Root
Directory has two entries when it is created. The first entry specifies the directory itself, and the
second entry specifies its parent directory (the directory that contains it). These entries use the special
directory names “.” (An ASCII period) and “..” (Two ASCII periods) respectively.
The TOS gives programs access to files in the file system. Programs can read from and write to
existing files, as well as create new ones. Files can contain any amount of data, up to 4GB or the limits
of the data region on a partition. Apart from its contents, every file has a name (possibly with an
extension), access attributes, and an associated date and time. This information is stored in the file's
directory entry, not in the file itself.
The Root Directory is located just after the FATs. Each entry in the Root Directory is described by
the following 32 bytes long structure:
Name
Bytes
Contents
FNAME
8
Specifies the name of the file or directory. If the file or directory was created by using a name
with fewer than eight characters, space characters (ASCII $20) fill the remaining bytes in the
field. The first byte in the field can be a character or one of the following values:
$00: The directory entry has never been used. The TOS uses this value to limit the
length of directory searches.
$05: The first character in the name has the value $E5.
$2E: The directory entry is an alias for this directory or the parent directory. If the
remaining bytes are space characters (ASCII 20h), the SCLUSTER field contains the
starting cluster for this directory. If the second byte is also $2E (and the remaining bytes
are space characters), SCLUSTER contains the starting cluster number of the parent
directory, or zero if the parent is the root directory.
$E5: The file or directory has been deleted.
FEXT
3
Specifies the file or directory extension. If the extension has fewer than three characters,
space characters (ASCII $20) fill the remaining bytes in this field.
ATTRIB
1
Specifies the attributes of the file or directory. This field can contain some combination of the
following values:
$01: Specifies a read-only file.
$02: Specifies a hidden file or directory.
$04: Specifies a system file or directory.
$08: Specifies a volume label. The directory entry contains no other usable information
(except for date and time of creation) and can occur only in the root directory.
$10: Specifies a directory.
$20: Specifies a file that is new or has been modified.
All other values are reserved. (The two high-order bits are set to zero.) If no attributes
are set, the file is a normal file.
RES
10
Reserved; do not use.
FTIME
2
Specifies the time the file or directory was created or last updated. The field has the following
form:
Bits 0-4: Specifies two-second intervals. Can be a value in the range 0 - 29.
Bits 5-10: Specifies minutes. Can be a value in the range 0 - 59.
Bits 11-15: Specifies hours. Can be a value in the range 0 - 23.
FDATE
2
Specifies the date the file or directory was created or last updated. The field has the following
form:
Bits 0-4: Specifies the day. Can be a value in the range 1 through 31.
Bits 5-8: Specifies the month. Can be a value in the range 1 through 12.
Bits 9-15: Specifies the year, relative to 1980.
SCLUSTE
R
2
Specifies the starting cluster of the file or directory (index into the FAT)
FSIZE
4
Specifies the maximum size of the file, in bytes.