Introduction
The WOZ format, named for Steve Wozniak and designed by the makers of the Applesauce disk reader, holds a disk as the bits a drive head would see on each track, so that copy-protected disks, disks with
unusual timing and the spaces between sectors survive. It comes in two versions, WOZ1 and WOZ2, and covers 5.25-inch disks (the Disk II) and 3.5-inch disks. It is the format most Apple II preservation work now uses.
The tracks of ordinary DOS 3.3 and ProDOS disks are read into sectors the way a NIB is, so the same file systems are shown inside.
The header and the chunks
| Offset | Size | Meaning |
|---|---|---|
| 0 | 4 | WOZ1 or WOZ2 |
| 4 | 4 | FF 0A 0D 0A: a byte with the high bit set, a line feed, a carriage return, a line feed. A transfer that strips the high bit or changes line ends damages it, so a damaged file is noticed at once |
| 8 | 4 | CRC-32 of everything from byte 12 to the end of the file (little-endian) |
| 12 | … | Chunks: a 4-letter id, a 4-byte size, then the data |
The chunks are INFO, TMAP, TRKS and (optionally) META, and in version 2.1 WRIT and FLUX. The CRC is the ordinary CRC-32 (polynomial $EDB88320); the viewer's own routine was checked against Node's zlib.crc32, and the CRC and the field layout of version 2 against how KEGS reads a WOZ 2 (woz.c, which also checks the CRC).
INFO
| Offset | Size | Meaning |
|---|---|---|
| 0 | 1 | INFO version: 1, 2 or 3 |
| 1 | 1 | Disk type: 1 = 5.25-inch, 2 = 3.5-inch |
| 2 | 1 | Write protected (1) |
| 3 | 1 | Synchronised: the tracks were imaged in step with each other (1) |
| 4 | 1 | Cleaned: the MC3470 fake bits were removed (1) |
| 5 | 32 | Creator, UTF-8, padded with spaces |
| 37 | 1 | (version 2) disk sides |
| 38 | 1 | (version 2) boot sector format: 0 unknown, 1 16-sector, 2 13-sector, 3 both |
| 39 | 1 | (version 2) optimal bit timing in 125 ns units: 32 for 5.25-inch, 16 for 3.5-inch |
| 40 | 2 | (version 2) compatible hardware, one bit a model: $0001 Apple ][, $0002 Apple ][ Plus, $0004 Apple //e (unenhanced), $0008 Apple //c, $0010 Apple //e Enhanced, $0020 Apple IIgs, $0040 Apple //c Plus, $0080 Apple ///, $0100 Apple /// Plus; 0 means unknown (source: the Applesauce WOZ 2.1 reference) |
| 42 | 2 | (version 2) required RAM in kilobytes |
| 44 | 2 | (version 2) the largest track, in 512-byte blocks |
| 46 | 2 | (version 3) the flux block: the number of the 512-byte block, counted from the start of the file, where the FLUX chunk begins (it always has a block to itself); 0 when the file has no flux chunk |
| 48 | 2 | (version 3) the largest flux track, in 512-byte blocks. A file uses flux data only when the INFO version is 3 or more and both of these two fields are not zero (source: the Applesauce WOZ 2.1 reference) |
TMAP
160 bytes: for each quarter-track position of the head (track × 4, then +1, +2, +3 for the quarter tracks after it), the index of the track entry in TRKS, or $FF when nothing is recorded there. A normal disk fills
the whole-track slots and the quarter tracks next to them point at the same entry. (A 3.5-inch disk is indexed by track and side instead.)
TRKS
In WOZ1, 6,656 bytes for each track: 6,646 bytes of bit stream, then the number of bytes used (2), the number of bits (2), the splice point (2), the splice nibble (1), the splice bit count (1) and 2 reserved. In WOZ2 the chunk starts with 160 entries of 8 bytes (first 512-byte block counted from the start of the file, number of blocks, number of bits), and the tracks follow from block 3, each on a block boundary, so a track can be any length.
Reading a track. The bits are taken most significant bit first. A Disk II controller makes a byte when the high bit of its shift register is a 1, so bits are shifted in and, when eight bits since the first 1 are in, a byte is out and the register is cleared; zero bits in front of a 1 are skipped. This is what makes a self-sync FF with two extra zero bits (10 bits) come out as FF.
The viewer reads each track twice round, so a field across the end of the track is found, and then decodes the sectors the same way as for a NIB.
FLUX tracks (WOZ 2.1)
Version 2.1 of the specification (still the signature WOZ2, with INFO version 3) can keep a track as flux timings instead of bits, for imaging at a level below the bits. A second chunk, FLUX, holds 160 bytes laid out exactly like TMAP (one entry for each quarter-track position, the index of the track entry in TRKS or $FF); it has valid entries only for tracks stored as flux, and a track that is flux should be $FF in TMAP. If a badly made file has an entry in both for one track, the FLUX one is used. A flux track is an ordinary TRKS entry, except that its bit count is really a byte count.
The flux data is encoded as in the Applesauce .A2R format: each byte is the time since the previous flux transition, in ticks of 125 ns. The normal 4 µs between neighbouring 1 bits is about 32 ticks, so 101 is about 64 ticks and 1001 about 96. The value 255 means add the next byte as well: 255, 255, 10 is 255 + 255 + 10 = 520 ticks. A flux stream is looped, so there is no jump in time where the end joins the start (source: the Applesauce WOZ 2.1 reference, fetched as raw HTML into samples/woz/sources/).
Turning the timings into bits is not defined by the specification; the viewer does what a disk controller's data separator does. A transition after n bit cells is n − 1 zero bits and a one bit, where n is the interval divided by the current cell length and rounded; the cell length starts at the INFO optimal bit timing (32 ticks) and follows the intervals with 5% of each error, held within 15% of nominal. The stream is run once round to settle and the second lap is kept. The bits then go through the same reading as any track (the register that makes a disk byte at each high bit, 6-and-2 or 5-and-3 fields). This is our reading, not a reference implementation: Applesauce and the emulators that read flux use their own, and a heavily copy-protected track (weak bits, deliberately odd timing) may come out differently.
Checks the viewer makes on a flux file. A flux track's count is in bytes, so it must fit in 512 bytes for each block of the entry (a bit track: 4,096 bits for each block). A FLUX chunk needs INFO version 3 with FLUX Block and Largest Flux Track both non-zero; the specification says a reader must use both. In the real Applesauce file FLUX Block times 512 is the byte offset of the FLUX chunk's header (1360 × 512 = 696,320, where the chunk id FLUX stands), Largest Flux Track is the largest flux entry in blocks (71) and Largest Track the largest bit entry (13); the viewer reports any of the three that disagrees with the chunks. A flux track that comes to fewer than 30,000 bits (a 5.25-inch track is about 50,000; a track with a 1-byte count is one bit) is reported and not counted as a whole track. The 30,000 limit is ours, not the specification's.
What was compared. The real WOZ 2.1 test disk (prodos-users-disk.woz2.1-flux.woz, a ProDOS disk in which every other track, 0, 2, 4 and so on, is flux): all 18 flux tracks decode with good checksums on all 16 sectors, together with the 17 bit tracks 560 of 560 sectors, and the ProDOS volume /USERS.DISK reads with 8 files and no problem. A separate reader written for the test, with fixed 32-tick cells and no loop, gives the same 288 sectors on the 18 flux tracks. Built files: flux made from a known disk with up to 6 ticks (nearly a fifth of a cell) of jitter decodes to the same disk image.
What is in a 5.25-inch track
Once read into disk bytes a track is the same as a NIB track, and described the same way there; in short:
- Gaps of
$FFself-sync bytes (10 bits each on a real disk) between the fields. - Address field:
D5 AA 96, the volume, track, sector and a checksum each as two 4-and-4 bytes, thenDE AA EB. The sector number is the physical position, not the DOS or ProDOS logical sector. - Data field:
D5 AA AD, 342 values and a checksum in the 6-and-2 encoding, thenDE AA EB.
A 13-sector disk's address field starts D5 AA B5 and its data field is in the 5-and-3 encoding, 410 values; the viewer decodes it and reads the disk as 35 tracks of 13 sectors with DOS 3.2. The real WOZ 2 DOS 3.2 master (dos32-system-master-13sector.woz2.woz) decodes all 455 of 455 sectors with good checksums and shows its 14 catalogue entries.
META
UTF-8 text, one line for each item, a key and a value with a tab between (title, subtitle, publisher, developer, copyright, version, language, requires_ram, requires_machine, notes, side, side_name, contributor, image_date). The viewer shows the lines as a table.
In the explorer
The tree has the header (with the CRC checked), every chunk with its fields, the TMAP slots, the track entries and each 5.25-inch track as its fields (gaps, address fields, data fields) with the byte positions rounded from the bit positions. The table of tracks lists the bits, the nibbles read, the sectors decoded and the problems; the metadata and the chunks are tables. A WOZ with a wrong CRC opens with the problem reported. The FLUX chunk's 160 slots are listed like the TMAP's, and a flux track is shown as its fields like any other (its node says how many flux bytes became how many bits). Where a field of a track starts in the second lap of the stream (the stream begins inside it) the sector is found there.
Not described
Known, not yet covered
- Viewer: 3.5-inch disks are listed by track entry with their bit counts, but their GCR sectors (524 bytes, a different 6-and-2 scheme with a three-part checksum) are not decoded.
- Viewer: the
WRITchunk (WOZ 2.1, the instructions for writing the disk back to a real floppy) is listed and its bytes shown, not decoded.WRITis not described on this page: the structure is in the specification and has not been read into the page. - Reference: the way flux timings are turned into bits is our own data separator (see above), not a documented algorithm; flux on a 3.5-inch disk is not read.
- Viewer: only the whole-track slot of each track is decoded; quarter tracks that hold other data and tracks that are different on each read (copy protection with weak bits) are not shown separately.
- Viewer: a track read with a fixed bit position cannot show the real timing (the optimal bit timing field is shown, not used).
Unknown
- Reference and viewer: three real
.wozfiles were read (the WOZ 1 DOS 3.3 System Master, the WOZ 2 13-sector DOS 3.2 master and the WOZ 2.1 flux disk, all Apple software and kept for local testing only); copy-protected disks, weak bits, 3.5-inch disks and disks with tracks that differ on each read were not seen. No WOZ reader other than KEGS's C source is on this Mac, so the bit streams are compared with built files and with the specification, not with another decoder.
Variants
- Apple II sector image (.DSK, .DO, .PO) – the sectors with no header, in DOS or ProDOS order
- 2IMG disk image – a 64-byte header in front of the sectors
- NIB nibble image – the nibbles of each track as the drive reads them
- WOZ disk image – the bit stream of every track, in chunks
Links
Software
- Applesauce – the disk reader and tools that made the WOZ format (Windows, macOS, Linux)
- Apple II JS – Apple II emulator that runs in the browser (any browser)
Reference
- WOZ 2.0 reference – Applesauce's description of the format