Introduction
Atari DOS 2.0S, DOS 2.5 and the DOS II of the early disk drives share one file system. It lives in 128-byte sectors and has three parts: a map of free sectors (the VTOC), a directory of up to 64 files, and for each file a chain of sectors in which every sector says where the next one is. The explorer reads it from any image of 128-byte sectors, and from a 256-byte-sector image when the options bar says to try it. Sector numbers here are the Atari’s, counted from 1.
| Sectors | What |
|---|---|
| 1–3 | the boot sectors |
| 360 | the VTOC (volume table of contents) |
| 361–368 | the directory: 8 sectors of 8 entries |
| 1024 | DOS 2.5 enhanced density only: a second VTOC |
| all others | files |
The VTOC, sector 360
| Byte | Size | What |
|---|---|---|
| 0 | 1 | DOS code: 2 for DOS 2.0 and 2.5. The explorer reads a disk as DOS 2 only when it is 2 |
| 1–2 | 2 | total number of sectors DOS can use (707 on a freshly formatted single density disk) |
| 3–4 | 2 | number of free sectors (below sector 720 on a DOS 2.5 disk) |
| 5–9 | 5 | unused |
| 10–99 | 90 | the sector bitmap, below |
| 100–127 | 28 | unused |
The bitmap has one bit per sector, from sector 0 (which does not exist): bit 7 of byte 10 is sector 0, bit 0 of byte 10 is sector 7, bit 7 of byte 11 is sector 8, and so on to sector 719 in byte 99. A set bit means the sector is free. Sector 720 is beyond the bitmap, which is why a single density disk holds 707 data sectors: 720 sectors less the three boot sectors, the VTOC, the eight directory sectors and sector 720.
The explorer compares the free count with the number of set bits it finds, and the bitmap with the sectors the files use: a sector that is in a file and marked free is reported.
DOS 2.5 and enhanced density
An enhanced density disk has 1,040 sectors, more than the 720 that the bitmap above can map. DOS 2.5 puts a second VTOC in sector 1024. The explorer reads the bits for sectors 720 to 1023 from byte 84 of that sector (bit 7 of byte 84 is sector 720) and the number of free sectors above 719 from bytes 122 and 123. These offsets are taken from a published description of DOS 2.5 and match the layout the test disks were built with, but no real DOS 2.5 disk was available to check them. Sectors 1025 to 1040 are beyond both maps and are not used by DOS 2.5.
The directory, sectors 361 to 368
Eight sectors of eight 16-byte entries: 64 files at most. An entry whose flag byte is 0 has never been used. A deleted file keeps its entry with the flag $80 until the slot is reused.
| Byte | Size | What |
|---|---|---|
| 0 | 1 | flags, below |
| 1–2 | 2 | number of sectors in the file |
| 3–4 | 2 | first sector of the file |
| 5–12 | 8 | file name, ATASCII, padded with spaces |
| 13–15 | 3 | extension, ATASCII, padded with spaces |
A name is shown as NAME.EXT; characters with the high bit set (inverse video) are
shown as their plain ASCII form, and any other character that is not printable is shown as
?.
Flag byte
| Bit | Value | Meaning |
|---|---|---|
| 7 | $80 | the file is deleted |
| 6 | $40 | the entry is in use |
| 5 | $20 | the file is locked |
| 1 | $02 | created by DOS 2 (a normal file has the flag $42) |
| 0 | $01 | the file is open for output (a file never closed) |
Other bits are reported by DOS 2.5 (bit 2, files that use sectors above 719) and MyDOS (bit 4, a subdirectory). The explorer shows them in the flags text but they were not verified; see Not described.
Sector chains
A file is a chain of sectors, in no particular order on the disk. The last three bytes of every file sector are a link, so a 128-byte sector holds 125 bytes of the file:
| Byte | What |
|---|---|
| 0–124 | the file’s data |
| 125 | top 6 bits: the file number, the index of the file’s directory entry (0 to 63); low 2 bits: bits 8 and 9 of the next sector number |
| 126 | low 8 bits of the next sector number; 0 with 0 in the bits above ends the file |
| 127 | the number of data bytes used in this sector (125 for all but the last sector) |
The file number lets DOS and recovery tools check that a sector belongs to the file it is read for.
The next sector number has 10 bits, so DOS 2 files can reach sector 1023. The explorer follows each
chain from the directory entry and reports: a sector that says it belongs to another file, a chain
that loops or leaves the disk, a count above 125, bit 7 of the count being set (which a normal
DOS 2 does not write), a sector that two files use, and a sector count that differs from the
directory’s. A file’s bytes are the data bytes of its chain joined up; a file with the
marker FF FF first opens in the XEX viewer.
Other file systems
MyDOS, SpartaDOS and DOS XL read and write disks that look like DOS 2 disks in the first sectors but differ further on. MyDOS reads DOS 2 disks and adds subdirectories and bigger disks; SpartaDOS keeps its directory as a file and maps a file’s sectors in a chain of sector-map sectors, and its boot sector starts differently. These notes are an outline from published descriptions only. The explorer does not decode these file systems: with 256-byte sectors it shows the sectors, and a 128-byte disk whose sector 360 does not start with 2 is reported as not DOS 2. No disk written by them was available to check a decoder against.