Turbo tape 64 plug-in for WAV-PRG
Written by Fabrizio Gennari, 1999

This plug-in allows support for Turbo Tape 64 files in WAV-PRG (which was the
only file format supported before version 2.0).

This plug-in, just like the original Turbo Tape 64, performs checksums: at the
end of the conversion, if the computed checksum and the one stored in the tape
do not match, the message "Checksum error!" appears. This is the same as "?LOAD
ERROR" on a real C64. This could mean that the tape is bad, or simply that the
volume is too high or too low. So, you should retry adjusting the volume. You
could try "regenerating the signal": if your C64 can load the game without
errors, just save it again, and sample the new recording. It will have higher
chances of being recognized.

File format info

A Turbo Tape 64 file is split in two parts: a header part and a data part. Each
part is introduced by a lead-in sequence, whose use is to get the byte
synchronization. The bit coding is: short impulse (9-10 samples at 44100 Hz) is
a 0, long impulse (14-15 samples at 44100 Hz) is an 1. The byte endianness is
most significant bit first.

Synchronization byte: $02 (repeated several times)
Initial sequence:     $09,$08,...,$01

The header part starts with a byte $01 or $02 (probably, they mean relocatable
and non-relocatable file respectively), then 192 bytes follow, which are stored
in memory from location 828 ($033C) to 1019 ($03FB).

828-829  Start address (low byte, high byte)
830-831  End address (low byte, high byte)
832      Unused
833-848  File name (filled with spaces until it is 16 characters long)
849-1019 These are usually spaces ($20), and are generally unused.

The data part starts with a $00 byte, then actual data bytes come. After the
last data byte, the checksum byte occurs: this is the XOR of all the data bytes.
If the XOR of the loaded data bytes differs from this, the ?LOAD  ERROR message
appears.