Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Commodore TAP raw tape image

From ReverseEngineering.wiki
Format
Platforms Platform:Commodore 64
Magic C64-TAPE-RAW / C16-TAPE-RAW at 0
Extensions .tap
Endianness little
On this wiki Facts · Code · Notes · Topics

TAP is the raw pulse-length tape image of Commodore machines: a 20-byte header ("C64-TAPE-RAW" or "C16-TAPE-RAW", version, machine, video standard, data length) followed by one byte per pulse, where a zero byte is an overflow whose meaning depends on the version.

Header (20 bytes)

From VICE's tap.h: +0, 12 bytes: "C64-TAPE-RAW" (or "C16-TAPE-RAW" for Plus/4 and C16 tapes); +12: version; +13: machine (0 C64, 1 VIC-20, 2 C16, 3 PET, 4 C500, 5 C600); +14: video standard (0 PAL, 1 NTSC, 2 old NTSC, 3 PAL-N); +16: u32 LE length of the data after the header (VICE writes it on close). Byte 15 is not used in the VICE code I read. VICE uses the machine and video bytes to choose the tape clock (for example C64 PAL 985248 Hz, C64 NTSC 1022730 Hz).

Pulses

Each data byte is a pulse length; Unverified: the unit is 8 clock cycles (VICE shifts the 24-bit overflow value right by 3, which suggests this). Byte 0 is special:

  • version 0: a pulse of length 256 (overflow).
  • version 1 and 2: followed by three bytes, a little-endian 24-bit pulse length in clock cycles (VICE shifts it right by 3).
  • version 2 (VICE: used for C16 "halfwave" tapes): every pulse is stored as two values (the two half waves) that VICE adds together.

Recognition

VICE's reader only compares the first 12 bytes with the two magic strings (and warns on a mismatch between tag, machine byte and the running machine); it does not reject unknown versions at open time. Unverified: other emulators may be stricter.

Sources

VICE vice/src/tap.h lines 35-52 and vice/src/tape/tap.c (tap_header_read, tap_get_pulse), commit 22cf0cc8eee4dae54f55ff7a738cf0cb7eaa258f (GPL-2.0-or-later). Compare the ZX Spectrum tape formats in Format:ZX Spectrum TAP and TZX tape images (a different format with the same extension). See also Format:Commodore T64 tape archive, Platform:Commodore 64.

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