Entries
The directory starts at offset 64 and is as long as the header's maximum entries says, 32 bytes for each. An entry with type 0 is free and is skipped by readers. The layout is that of the VICE manual (chapter 17.2) and Peter Schepers' T64.TXT (revision 1.5), and was also compared with the masswerk PET emulator's reader.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 1 | Entry type | 0 free entry; 1 normal tape file; 2 tape file with header (the header is saved just before the file data; added in version 1.1); 3 memory snapshot, version 0.9, uncompressed (C64S specific); 4 tape block (added in version 2.0); 5 digitised stream (added in version 2.0). That is the VICE manual's list; Schepers' T64.TXT lists only 0, 1 and 3 and calls 2 to 255 reserved. VICE's manual says it supports only type 1, and the explorer opens only type 1 as a file: the data of the other types is shown as bytes, because no description of it was found. A snapshot (type above 1 with file type 0 and start and end address 0) is what C64S calls an "FRZ" session snapshot; its inside is not described by either source. Types above 5 are not in the manual. |
| 1 | 1 | File type | the file type a 1541 disk would store: the low three bits are 0 DEL, 1 SEQ, 2 PRG, 3 USR, 4 REL; bit 7 is set for a closed file, bit 6 for a locked one. $82 is a closed PRG. Many files carry $01 or another value, so a reader should not trust it. |
| 2 | 2 | Start address | where the file loads. A PRG file stores this in front of its bytes; the container keeps it here instead. |
| 4 | 2 | End address | one past the last byte, so the length is end minus start. Often wrong. |
| 6 | 2 | Unused | not used |
| 8 | 4 | Offset | where the file's bytes start in the container, a 32-bit number counted from the start of the file |
| 12 | 4 | Unused | not used by normal files (the C64S memory snapshots keep the RAM dump's offset here, as it is described) |
| 16 | 16 | Name | PETSCII, padded with spaces ($20). The explorer also trims $A0 and zero bytes. |
The end address
Many T64 files were written by tools that did not fill in the end address, or filled it in wrongly, so the length it gives can be longer or shorter than the file's real bytes. VICE's T64 reader (src/tape/t64.c) and the masswerk
emulator correct it: they sort the entries by offset and, for every file but the last, take the room up to the next entry's offset as the length when it differs from the declared one (VICE logs "invalid file size ... fixing" and sets the end address to start plus the room; for the last file the end address is only lowered when it would run past the end of the container). One cause is named in the sources: an early program called conv64 wrote the end address $C3C6 into every file whatever its length (VICE manual 17.2; Schepers' T64.TXT: "regardless of file size"); the explorer flags an entry whose end address is $C3C6 and opens it at the room the container gives. No other value is named in any source found.
The explorer does the same comparison, but reports the case instead of hiding it:
| Case | How it is found | What opens |
|---|---|---|
| exact | declared length = room up to the next file or the end of the container | the declared length |
| more room than declared | declared length < room | the declared length (padding, or an end address that is too small: the option “All the space” takes the whole room) |
| end too far | declared length > room | the room (the file is cut short, or its end address is wrong) |
| end below start | end address < start address | the room |
| empty | end address = start address | the room |
| offset outside | offset before the end of the directory, or at or after the end of the file | nothing |
The check cannot tell a real end address that is too small from padding after the file: in both cases there is more room than declared. It also cannot find a wrong end address that is too large when the file is followed by another file of the right size, because the room then ends at that next file: the declared length is cut off there. Nothing is assumed about particular wrong values.
Not described
Known, not yet covered
- Viewer: the data of entry types 2, 4 and 5 (tape file with header, tape block, digitised stream) and the inside of a type-3 memory snapshot (C64S "FRZ"): no description was found, so they open as bytes with their length taken from the room in the container. See Directory.
Unknown
- Reference: how common each case of the end address is, and whether other tools besides conv64 wrote a fixed wrong value. No real file was available, so the table above was exercised on built files only.