C64 RAW TAPE (.TAP) FILE FORMAT.

0000 'C64-TAPE-RAW'
000C UBYTE Version
000D UBYTE[3] For future use...
0010 ULONG data length (Intel format LSB,MSB)
0014 UBYTE[] data
...

Version=0:
Each data byte represent the length of a pulse (the time until the c64's hardware triggers again).
The length is (8*data) cycles (PAL C64), i.e. the data byte of 2F represent (47*8/985248) seconds.
The data byte value of 00 represents overflow, any pulselength of more than 255*8 cycles.

Version=1:
As above but data value of 00 is now followed by three bytes, representing a 24 bit value of C64
cyles (NOT times 8). The order is as follow: 00 <bit0-7> <bit8-15> <bit16-24>.