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 was compared with the masswerk PET emulator's reader on this machine.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 1 | Entry type | 0 free; 1 normal tape file; 2 file with header (the header is saved just before the data); 3 memory snapshot; 4 tape block; 5 digitised stream. The masswerk reader names 0 to 5 this way and opens only type 1; the meaning of 2 to 5 is as that reader and the descriptions of the format give it and was not checked against a file. Types above 5 are not documented here. |
| 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. The masswerk emulator corrects it: it sorts the entries by offset and, if the room up to the next entry's offset (or the end of the container) is smaller than the declared length, it uses the room. 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 structures of entry types 2 to 5. They open as bytes.
Unknown
- Reference: how common each case of the end address is. No real file was available, so the table above was exercised on built files only.