Atari 8-bit Disk Formats

By Ken Siders, Last Update: July 27, 1998

Disclaimer: This document is a work in progress. Please mail any corrections to atari@columbus.rr.com Most of this information has been derived from my work on AtrUtil, a windows 95 Disk Image Utility. Information comes from a variety of documents and Usenet.

Atari Dos 2.x - Single Density
Atari Dos 2.5 - Enhanced Density
Mydos 4.5x
KBoot Image
 Sparta Dos
Other Dos's
 
 



Atari Dos 2.x - Single Density

Sector Ranges

Sectors Function
1 to 3 Boot Sectors
4 to 359 Data Sectors
360 VTOC
361 to 368 Directory Sectors
369 to 719 Data Sectors
720 Unused

Boot Sectors

On start up the first three sectors are read and they contain information on how to boot the disk. For Atari Dos Disks sector 1 has the following special bytes (The remaining bytes are just the code to load DOS.SYS) :
Byte Offset Function
0 Unused. Usually 0 for Atari Dos
1 Number of sectors to boot. For Atari Dos this is 3. The first three sectors are enough to get as loaded into memory to load the DOS.SYS.
2 to 3 Boot Load Address. For Atari Dos it is 1792 ($700)
4 to 5 Initialization Address. Called after booting requested number of sectors. 
6 to 8 JMP to Boot Continuation Address. This should be a 6502 jump instruction (76/$4C) followed by the address to jump to after booting the requested number of sectors.
9 Maximim number of files that can be open at once. This value can be set by POKEing location 1801 and writing DOS. Default is 3.
10 Drive Bits. There is one bit for each drive. Bit 0 is drive D1:, Bit 1 is Drive D2:, etc. This can be set by poking location 1803 and writing DOS. The Default is 3 to include only drives 1 and 2.

Data Sectors

Each data sector holds up to 125 bytes of data and the remaining three bytes hold a link to the next sector, which file the sector belongs to and how many bytes of data in the sector. The number of bytes in the sector may be less than 125 if it is the last sector in the file or it was the last sector in the file before an append operation.
Byte Offset Function
0 to 124 File Data
125 (left 6 bits) File #0 to 63 (which corresponding directory this sector belongs to.) Incorrect values will give Error #164 (File # Mismatch)
125 (right two bits) and 126 Link to next sector. 10 bits allow for 1024 sectors. The two bits at offset are the most significant byte.
127 Number of bytes in sector. Can be up to 125 bytes.

VTOC (Volume table of Contents)

This consists of 10 special purpose bytes and 90 bytes used to hold a sector bit map to track used sectors. 720 sectors / 8 bits per byte requires 90 bytes. The bytes in the VTOC are as follows:
Byte Offset Function
0 Dos code. This seems to be 2 for Atari Dos (Mapping the Atari Revised Edition claims it is 0) 
1 to 2 Total number of available sectors on the disk (used and unused). This should be 707 on a freshly formatted Atari Dos disk.
3 to 4 Number of currently unused sectors. This can range from 0 to 707.
5 to 9 Unused
10 to 99 Bitmap for sectors 0 to 719. A bit value of 0 means in use, a value of 1 means the sector is free. Sector 0 doesn't exist. Sectors 1 to 3 are reserved for booting the disk, sector 360 is the VTOC, and sectors 361 to 368 are the directory sectors. Sector 720 is unused because sector 0 is used in the map, with 90 bytes there is only enough bits to map sectors 0 through 719. The number of available sectors can be calcualted 721-1-3-1-8-1=707 bytes. (721 bits are used since we started counting at 0.)
100-127 Unused. These should all be set to 0 so the sectors are marked as used and therefore unavailable. Note: Mydos uses the first bit of byte 100 to allow sector 720 to used for a total of 708 free sectors.

Directory Sectors

Each entry is 16 bytes so there can be 8 entries per sector. There are 8 sectors, so 8 sectors times 8 entries = a maximum of 64 files.
Byte Offset Function
0 Flag Byte
1 to 2 Total number of sectors in file. Can be up to 65535 although obviously there can only be up to 707 on the disk
3 to 4 Starting sector number. Can be 1 to 65535 although obviously the hightest usable sector is sector 719.
5 to 12 8 character filename padded with spaces at end
13 to 15 3 character filename extension padded with spaces at end

Directory Sectors Flag Byte

Five bits are used to keep various file attributes. The normal value for an unused entry is $0. The normal value for a non-locked properly closed file is $42. If the "Deleted" bit is set or the "Open for Output" bit is set the file will not appear in the directory. $43 is the normal value for a file that was open for output but not closed. This file will not appear in the directory and will in fact waste some sectors.
Bit/Value Function
0/$01 File Opened for Output.
1/$02 File Created by Dos 2.
5/$20 File Locked (appears with '*' in directory).
6/$40 File In use (normal)
7/$80 File Deleted

Unused Sector

Sector 720 is usused because only 90 sectors will allocated for a bitmap and sector 0 doesn't actually exist but wastes one of those bytes. Mydos uses one more byte in the VTOC and can make use of sector 720. It is the only major difference between Mydos single density disk format and Atari single density disk format.
 



Atari Dos 2.5 - 1050 Double (Enhanced) Density

Sector Ranges

Sectors Function
1 to 3 Boot Sectors
4 to 359 Data Sectors
360 VTOC
361 to 368 Directory Sectors
369 to 1023 Data Sectors
1024 VTOC2
1025-1040 Unused

Boot Sectors

There is no difference in the special boot bytes on a single density Atari Dos Disk and an Enhanced Density formated disk. On start up the first three sectors are read and they contain information on how to boot the disk. For Atari Dos Disks sector 1 has the following special bytes (The remaining bytes are just the code to load DOS.SYS) :
Byte Offset Function
0 Unused. Usually 0 for Atari Dos
1 Number of sectors to boot. For Atari Dos this is 3. The first three sectors are enough to get as loaded into memory to load the DOS.SYS.
2 to 3 Boot Load Address. For Atari Dos it is 1792 ($700)
4 to 5 Initialization Address. Called after booting requested number of sectors. 
6 to 8 JMP to Boot Continuation Address. This should be a 6502 jump instruction (76/$4C) followed by the address to jump to after booting the requested number of sectors.
9 Maximim number of files that can be open at once. This value can be set by POKEing location 1801 and writing DOS. Default is 3.
10 Drive Bits. There is one bit for each drive. Bit 0 is drive D1:, Bit 1 is Drive D2:, etc. This can be set by poking location 1803 and writing DOS. The Default is 3 to include only drives 1 and 2.

Data Sectors

Each data sector holds up to 125 bytes of data and the remaining three bytes hold a link to the next sector, which file the sector belongs to and how many bytes of data in the sector. The number of bytes in the sector may be less than 125 if it is the last sector in the file or it was the last sector in the file before an append operation.
Byte Offset Function
0 to 124 File Data
125 (left 6 bits) File #0 to 63 (which corresponding directory this sector belongs to.) Incorrect values will give Error #164 (File # Mismatch)
125 (right two bits) and 126 Link to next sector. 10 bits allow for 1024 sectors (Thats why only all 1040 sectors are not available). The two bits at offset are the most significant byte.
127 Number of bytes in sector. Can be up to 125 bytes.

VTOC (Volume table of Contents)

This consists of 10 special purpose bytes and 90 bytes used to hold a sector bit map to track used sectors for sectors 0 through 719 on the disk (for compability reasons with Dos 2.0) Sector 1024 is used to track the remaining sectors. The bytes in the VTOC are as follows:
Byte Offset Function
0 Dos code. This is 2 for Atari Dos. 
1 to 2 Total number of available sectors on the disk below sector 720(used and unused). This should be 707 on a freshly formatted Atari Dos disk.
3 to 4 Number of currently unused sectors below sector 720. This can range from 0 to 707.
5 to 9 Unused
10 to 99 Bitmap for sectors 0 to 719. A bit value of 0 means in use, a value of 1 means the sector is free. Sector 0 doesn't exist. Sectors 1 to 3 are reserved for booting the disk, sector 360 is the VTOC, and sectors 361 to 368 are the directory sectors. Sector 720 through 1023 are tracked in sector 1023.
100-127 Unused. These should all be set to 0 so the sectors are marked as used and therefore unavailable.

VTOC2 (Volume table of Contents - Part II)

This is a continuation of the VTOC since the VTOC at sector 360 would only be able to handle 944 sectors.
Byte Offset Function
0 to 83 Repeat of sectors 48 to 719. I would only use the values in sector 360 for these since Dos 2.0 will not update this sector if the disk is written to.
84 to 121 Bitmap of sectors 720 to 1023. Bit set equals available.
122 to 123 Number of free sectors above sector 719. This should be 304 on a freshly formatted disk.
124 to 127 Unused. These should all be set to 0.

Directory Sectors

Each entry is 16 bytes so there can be 8 entries per sector. There are 8 sectors, so 8 sectors times 8 entries = a maximum of 64 files.
Byte Offset Function
0 Flag Byte
1 to 2 Total number of sectors in file. Can be up to 65535 although obviously it can't be anywhere near that big.
3 to 4 Starting sector number. Can be 1 to 65535 although obviously the hightest usable sector is much less.
5 to 12 8 character filename padded with spaces at end
13 to 15 3 character filename extension padded with spaces at end

Directory Sectors Flag Byte

Five bits are used to keep various file attributes. The normal value for an unused entry is $0. The normal value for a non-locked properly closed file is $42 if the file is accessible from Dos 2.0. If it is not the normal value is $03. This will keep the file from showing up under Dos 2.0. Dos 2.5 will display this file within the "<" and ">" symbols if the appropriate directory function is used. $43 I believe still always indicates a file that was open for ouput and not closed which will not show up in the directory. If the "Deleted" bit is set or the "Open for Output" bit is set the file will not appear in the directory.
Bit/Value Function
0/$01 File Opened for Output. (Also will be set for Files using sectors above sector 719 but bit 6 will not be set. This is to make a Dos 2.5 file using extended sectors invisible to Dos 2.0)
1/$02 File Created by Dos 2.
5/$20 File Locked (appears with '*' in directory).
6/$40 File In use (normal). This will not be set if the file is usable only by Dos 2.5 and not Dos 2.0 (It is located above the sector 719 threshold)
7/$80 File Deleted
 

Unused Sectors

Sectors 1025 to 1040 are unused because sector links are only 10 bits and can only hold a value up to 1023.
 



MyDos 4.5x

Sector Ranges

Sectors Function
1 to 3 Boot Sectors
4 to (360-#vtoc_sectors) Data Sectors
(360-#vtoc_sectors+1) to 360 VTOC
361 to 368 Directory Sectors
369 to total # sectors Data Sectors

Boot Sectors

There is no real important difference in the special boot bytes on a MyDos disk and an Atari Dos Disk. On start up the first three sectors are read and they contain information on how to boot the disk. For MyDos Disks sector 1 has the following special bytes (The remaining bytes are just the code to load DOS.SYS) :
Byte Offset Function
0 Unused. Usually 0.
1 Number of sectors to boot. For Atari Dos this is 3. The first three sectors are enough to get as loaded into memory to load the DOS.SYS.
2 to 3 Boot Load Address. Same as Atari Dos: 1792 ($700)
4 to 5 Initialization Address. Called after booting requested number of sectors. 
6 to 8 JMP to Boot Continuation Address. This should be a 6502 jump instruction (76/$4C) followed by the address to jump to after booting the requested number of sectors.
9 Maximim number of files that can be open at once. This value can be set by POKEing location 1801 and writing DOS. Default is 3.

Data Sectors

Each data sector holds up to 125(SD)/253(DD) bytes of data and the remaining three bytes hold a link to the next sector, and the number of bytes in the sector. For small images that are Atari Dos compatable, the file# is also stored within the last three bytes. Slashes seperate single density and true double density (256 bytes sector) values. A flag byte in the directory indicates if the file is Atari Dos compatable or not.
Atari Dos Compatable (less than 1024 sectors)
Byte Offset Function
0 to 124/252 File Data
125/253 (left 6 bits) File #0 to 63 (which corresponding directory this sector belongs to.) Incorrect values will give Error #164 (File # Mismatch)
125/253 (right two bits) and 126/254 Link to next sector. 10 bits allow for 1024 sectors. The two bits at offset are the most significant byte.
127/255 Number of bytes in sector. Can be up to 125/253 bytes.
MyDos Compatable (1024 or more sectors)
Byte Offset Function
0 to 124/252 File Data
(125 to 126)/(253 to 254) Link to next sector. All 16 bits are available allowing for up to 65536 sectors. 
127/255 Number of bytes in sector. Can be up to 125/253 bytes.

VTOC (Volume table of Contents)

The first vtoc sector consists of 10 special purpose bytes and 118 bytes used to hold a sector bit map to track used sectors for sectors 0 through 943(max) on the disk. Sectors 359 and down are used to store additional sectors. For sectors 359 or less, all 256 bytes in each sector may be used on double density disks and sectors are always allocated in pairs on single density disks (excluding the first sector which is for Atari Dos compatability). The bytes in the first VTOC sector are as follows:
Byte Offset Function
0 code indicating #of vtoc sectors code. For single density the # of vtoc sectors is (code * 2)-3. Note: this is always an odd number( sectors after the first vtoc sector are always allocated in pairs).  For double density #vtoc_sectors = code-1.
1 to 2 Total number of available sectors on the disk.
3 to 4 Number of currently unused sectors.
5 to 9 Unused
10 to 127 Bitmap for sectors 0 to 943. A bit value of 0 means in use, a value of 1 means the sector is free. Sector 0 doesn't exist. Sectors 1 to 3 are reserved for booting the disk, sector 360 and possibly some below it are used to hold the VTOC, and sectors 361 to 368 are the directory sectors. Sectors above 943 are tracked in sector 359, 358, etc.

Directory Sectors

Each entry is 16 bytes so there can be 8 entries per sector. There are 8 sectors, so 8 sectors times 8 entries = a maximum of 64 files.
Byte Offset Function
0 Flag Byte
1 to 2 Total number of sectors in file. Can be up to 65535.
3 to 4 Starting sector number. Can be 1 to 65535.
5 to 12 8 character filename padded with spaces at end
13 to 15 3 character filename extension padded with spaces at end

Directory Sectors Flag Byte

Bit/Value Function
0/$01 File Opened for Output.
1/$02 File Created by Dos 2.
2/$04 File doesn't use file# in sector links (not Atari Dos compatible)
4/$10 File is actually a directory (all other bits clear except possible bit 5.
5/$20 File Locked (appears with '*' in directory).
6/$40 File In use (normal).
7/$80 File Deleted

KBoot Disk

KBoot disks are created with my AtrUtil win 95 utility or MakeAtr Dos utility.  They contain a minimally sized ATR image that contains three boot sectors and the original file.  Note: Only single density disks (128 byte sectors) are supported.  This allows each executable to be stored in an ATR file to itself without wasting much space.  No menu disks or H: drives are necessary, just install the KBoot ATR in drive 1 and boot.

Sector Ranges

Sectors Function
1 to 3 Boot Sectors
4 to ??? Data Sectors

Boot Sectors

Sectors 1 to 3 contain necessary information to boot the disk and load the executable file located at sector 4 and above.
The function of the first 13 bytes of sector one is indicated in the table, the remaining bytes of sector one, as well as sectors two and three contain the code to load the file.
Byte Offset Function
0 Unused. Usually 0.
1 Number of sectors to initially boot.  This is set to three which is enough to get the loader into memory 
2 to 3 Boot Load Address. 1792 ($700)
4 to 5 Initialization Address. Called after booting requested number of sectors. 
6 to 8 JMP to Boot Continuation Address. This is a 6502 jump instruction (76/$4C) followed by the address to jump to after booting the requested number of sectors. This routine will then load the actual file which is located at sectors 4 and above
9 to 11 Number of bytes to load (number of bytes in original executable)  This is a three byte value.  The least significant byte is stored first.
12 Unused.  Set to 0

Data Sectors

Each sector holds a full 128 bytes of data -- there is no sector link information stored in a sector. The file contains all of the bytes verbatim from the original file including the $FF $FF header, multiple load segments, initialization, and run addresses.  The file should be processed exactly as it would be by Dos.  The last sector may only be partially filled and may be padded with random data.  The length to load is determined from sector 1, bytes 9 to 11.  Extracting the original file is easy.  If processing from an ATR file read and verify the 16 byte ATR header.  Read the first three sectors (384 bytes).  Get the length from bytes 9 to 11.  Read that many bytes from the KBoot file and write to the output file.  Done.
 
 

SpartaDos

Sector Ranges

Sectors Function
1 to 3 Boot Sectors
4-?  Bitmap Sectors  Does not necessarily have to start at sector 4, the sector number is at offset 16/17 in sector 1 
varies Main Directory Sector Map
varies Main Directory
varies Data Sectors

Boot Sectors

On start up the first three sectors are read and they contain information on how to boot the disk. For SpartaDos Disks sector 1 has the following special bytes:
Byte Offset Function
0 Unused. Usually 0.
1 Number of sectors to boot. For Atari Dos this is 3. The first three sectors are enough to get as loaded into memory to load the DOS.SYS.
2 to 3 Boot Load Address. Same as Atari Dos: 1792 ($700)
4 to 5 Initialization Address. Called after booting requested number of sectors. 
6 to 8 JMP to Boot Continuation Address. This should be a 6502 jump instruction (76/$4C) followed by the address to jump to after booting the requested number of sectors.
7 $80 for Sparta Dos.  (note: this is also the low byte of the boot continuation adress)
9/10 First sector of sector map for main directory.
11/12 Total number of sectors on disk
13/14 Number of free sectors on disk
15 #of bitmap sectors (used to track free sectors)  One byte is needed for every 8 sectors.
16/17 Sector for first bitmap (usually 4?)
18/19 First available sector (to save time from having to search though bitmap)
20/21 First available directory sector.  This is the sector the next new directory entry will need to be added to.
22-29 Volume Name (8 characters - padded with spaces)
30 bits 0-6: Number of Tracks.  bit 7:Set for double sided.
31 Size of sectors.  128 for 128 bytes/ 0 for 256 bytes.
32 Dos major version $11 for sparta 1.1.  $20 for sparta 3.2.
38 Sequence Number.  Incremented whenever a file is opened for write?
39 Random Number - filled in at format.
40/41 First sector map for file being booted.
42 Write Lock Flag?
43-47 Reserved.

Data Sectors

The entire sector can be used for data unlike Atari Dos.  There is no link information necessary like with Atari Dos.  The link information is maintained in the sector map for the file.
 

Bitmap

This is a simple map of every sector on the disk.  One bit is used per sector so 8 bytes are available per byte.  There are as many bytes allocated for the bitmap is as necessary to track every sector on the disk.
 

Directory Sectors (root and subdirectories)

Each entry is 23 bytes and entries can span sector boundries.  Sectors are not necessarily contigous.  The sectors are determine from the sector map for the directory which is simply a sector list.  The first directory entry is a special entry that holds information about the directory itself.  It's format is as follows:
Byte Offset Function
0 ?
1 to 2 Sector of first map of parent directory.  For the Root directory this is 0.
3,4,5 Length of directory in bytes.
6-13 Directory Name (8 characters padded with spaces).  This will be MAIN for the root directory
14-22 Unused

The format of each 23 byte directory entry is.
Byte Offset Function
0 Flag Byte
1 to 2  First sector of file's sector map.
3,4,5 Length of file in bytes.
6-13 File Name (8 characters padded with spaces)
14-16 File Extension (8 characters padded with spaces.)
17-22 Time and Date Stamp.  Format????

Directory Sectors Flag Byte

Bit/Value Function
0/$01 File is Write Protecter.
3/$08 Directory entry is in use.  (contains a file or directory entry)
4/$10 File has been deleted.
5/$20 Subdirectory flag.

 Sector Maps

Sector maps are used for directories and files to hold a list of sectors used for directories or files.  The sector maps sectors themselves are not necessary located in contigous sectors.  The first four sector bytes of each map has a pointer to the previous and next sector map.  Sector maps allow files to be deleted or written over much faster than in Atari Dos since the entire file does not have to be traced through.  It also allows directories to grow in size (although a limit is set I believe which varies between the disk versions and SpartaDos X.
 
Byte Offset Function
0 to 1 Pointer to next sector map.
2 to 3 Pointer to previous sector map.
4 to 127/255 Every 2 bytes holds a sector number for the file or directory.