Format:Commodore T64 tape archive
| Platforms | Platform:Commodore 64 |
|---|---|
| Magic | "C64 tape image file" / "C64S tape file" / "C64S tape image file" at 0 (prefix match) |
| Extensions | .t64 |
| Endianness | little |
| On this wiki | Facts · Code · Notes · Topics |
T64 is the C64S emulator's container of C64 program files: a 64-byte header with a magic text ("C64S tape image file" and two other spellings accepted by VICE), a count of 32-byte directory records and the file data; it is an archive, not a pulse-level tape image.
Identification
The first 32 bytes hold an ASCII text padded with 0x00. VICE accepts a file when those bytes start with any of three strings: "C64 tape image file", "C64S tape file" or "C64S tape image file" (a prefix compare of memcmp over the length of each string, so bytes after the string are not checked). Unlike Format:Commodore TAP raw tape image it holds no pulse data.
Header (64 bytes)
- +0, 32 bytes: magic text.
- +32, u16 LE: version, usually 0x100 or 0x101. VICE does not check it (a version test is compiled out: "way too many images with broken version number").
- +34, u16 LE: number of directory records ("total available file records"; the source calls it highly unreliable).
- +36, u16 LE: number of records in use (also unreliable; 0 is common while one file exists).
- +40, 24 bytes: tape description in PETSCII padded with 0x20 (not 0xA0).
Directory records (32 bytes each, from offset 64)
- +0: entry type: 0 free, 1 normal file, 2 header, 3 C64S snapshot, 4 block, 5 stream. VICE's file iterator only selects type 1.
- +1: C1541 file type byte (see the file type byte in Format:Commodore D64, D71 and D81 disk images).
- +2, u16 LE: start (load) address; +4, u16 LE: end address.
- +8, u32 LE: offset in the T64 of the file data. Unverified: the data carries no 2-byte load-address prefix (VICE computes the size as end minus start address and reads from this offset).
- +16, 16 bytes: PETSCII file name.
Broken files
VICE repairs rather than rejects: if the header says 0 entries or 0 used, it uses 1; used > entries is rejected. It reads all num_entries records, then sorts them by data offset and replaces an end address that disagrees with the distance to the next record's data (and for the last file, with the container size when the stated size would overrun the file). So end addresses in T64 files cannot be trusted; derive the length from the next offset or the file size.
Sources
VICE vice/src/tape/t64.c and t64.h, commit 22cf0cc8eee4dae54f55ff7a738cf0cb7eaa258f (GPL-2.0-or-later). Unverified: the exact meaning of record bytes +6/+7 and +12..+15 (VICE does not read them), and anything about how the original C64S tool writes the format.
See also Platform:Commodore 64, Format:Commodore PRG file.
Code & repositories
- https://github.com/VICE-Team/svn-mirror @
22cf0cc8eee4dae54f55ff7a738cf0cb7eaa258f· license: GPL-2.0-or-later (declared by the contributor; GitHub's detector did not recognize a license file)
VICE emulator source: src/tape/t64.c, tap.c, src/crt.c, cartridge.h, diskimage/fsimage-probe.c
Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-19; Note: the latest release ships binaries; the wiki links only the source, never the binaries