Apple II: DOS 3 Disk Format

A .DSK file contains all the bytes of an Apple DOS 3 formatted floppy disk. The file does not have a header which can make it difficult to verify. The simplest form of verification is to check the file size.

A typical DOS 3 disk has 35 tracks. Each track has 16 sectors and each sector has 256 bytes. This gives each disk a total of 143,360 bytes.

Sector 0 of track 17 contains the Volume Table of Contents. The VTOC contains the information needed to start traversing the disk and accessing the individual files stored on it.

Volume Table of Contents
ByteLengthDescription

The 2nd and 3rd bytes of the VTOC indicate where the catalog starts. Each catalog sector links to the next catalog sector and holds information for 7 files.

Catalog Sector
ByteLengthDescription

Each catalog sector contains 7 file entries and each file entry uses 35 bytes.

File Entry Bytes
ByteLengthDescription

Each file has a sector list that is used to keep track of all the sectors used to store a file's contents. The first two bytes of a file entry point to the sector that starts the list.

Sector List Sector
ByteLengthDescription

The last 200 bytes of the VTOC holds the sector usage bit maps. A single bit is used to indicate if a sector is available (1) or used (0). There is a bit for each sector on the disk. The bit maps are laid out in big-endian 16-bit integers and separated by 2 unused bytes.

This means, for a typical disk with 16 sectors per track, you read a 16-bit integer. The first integer represents the sectors in track 0. The low bit of the integer represents sector 0 and the high bit represents sector 15. Then you skip 2 bytes and read another 16-bit ineger. The second integer represents the sectors in track 1. You repeat the pattern for each track.

Sector Usage Bit Maps
Byte of VTOCLengthTrack Represented