PRG2WAV
By Fabrizio Gennari, 1999, 2000

This programs converts PC emulator files (.PRG, .P00 or .T64) into WAV
files which can be recorded on a tape and loaded on a Commodore 64
using Turbo Tape 64 or another suitable loader. This is done in three
steps.

1. CREATING THE .WAV FILE
This is done by PRG2WAV.

The usage is:

prg2wav -h|-v                                      to show help/version info
prg2wav -l file [file...]                          to list files' contents
prg2wav [-i] [-s] [-o output_file] file [file...]  to actually convert files

If the -l option is not specified, PRG2WAV scans each file given on the
command line and, if it is a .PRG, a .P00 or a .T64 with a single used
entry, converts it to a .WAV file, whose name is chosen with the -o option). If
it is a .T64 with more than one used entry, PRG2WAV interactively asks which
entries should be converted, and converts them. The entries must be given as
a comma-separated list of ranges, where a range can be:
* a number
* lower_bound-upper_bound, where lower_bound and upper_bound can be either
empty or numbers. If lower_bound is empty, it is assumed to be 1. If
upper_bound is empty, it is assumed to be the total number of entries in the
.T64 file.

If the -l option is used, PRG2WAV will list the contents of each file in the
command line. For .PRG, it will display the start and end addresses. For
.P00, it will display the start and end addresses and the C64 name. For
.T64, it will display the number of total and used entries, the tape image
name and, for each entry, the entry number, the name and the start and end
addresses. PRG2WAV will only recognize standard entries in .T64 files
(not memory snapshots).

The -i option is used to generate inverted waveforms. Some soundcards invert
the signal when playing back, i.e. they turn positive impulses into negative
ones and vice versa. If a normal waveform is played back with such a
soundcard, a C64 will not be able to recognize it. If an inverted waveform
is played back with such a soundcard, the soundcard will invert it again,
turning it into a normal waveform, so a C64 will recognize it. If you get no
results without the -i option, try enabling it.

The -s option is used to generate stand-alone files. Without it, a C64 file
in Turbo Tape 64 format will be written. You need Turbo Tape 64 or another
suitable loader to load such files back. With it, a Turbo Tape loader and
the actual Turbo Tape 64 file will be written, so the file can be loaded
on a C64 with a plain LOAD or SHIFT+RUN STOP

2. RECORDING THE .WAV FILE ON A TAPE
You need:
- a sound card
- a tape recorder with a sound input (generally marked with AUX, CD or
  PHONO)
- a suitable cable
- a program which allows you to play .WAV files

Connect the input of your recorder to the output of your sound card (on a
Sound Blaster, there are two outputs, LINE OUT and SPK OUT: the latter is
better because of the louder output). Now you should hear the sounds
emitted by the sound card from the speakers of your tape recorder. Set the
output volume of the sound card as high as possible, disable all the
playback sources but the Wave output (these can be done with Windows' Volume
Control application), keep the output volume of your tape recorder low (the
.WAV files created by WAV-PRG aren't nice to be heard), press RECORD on the
recorder and play the .WAV file.

3. PLAYING THE GAME

3.1 Stand-alone files
If a stand-alone file was created (i.e. the -s option was used), you will just
need to load the game with SHIFT+RUN STOP.
To disable the autostart feature, just load the game with LOAD (not SHIFT+RUN
STOP) and, at the READY. prompt, type
POKE2191,13
RUN

3.2 Normal files
If you have got the program Turbo Tape 64, load it, then load the game with
(left arrow)L. If you don't you can download it at WAV-PRG's homepage.

Some games interfere with Turbo Tape 64 (e.g. the ones from the Blast from
the Past disks): to get around this, load the game, type
POKE 50001,228
POKE 50006,167
SYS50000
then RUN as usual.

If the end address exceeds 40960, a fake ?LOAD  ERROR message appears, but
the game should run fine. If it still doesn't, you have two alternatives:
- load the game, type

  POKE 46,<end-address>/256
  POKE 45,<end-address>-PEEK(46)*256

  then RUN as usual.

- load Turbo Tape, then, before loading the game, turn off the fake message
  by typing

  POKE 50566,234
  POKE 50567,234

If the end address exceeds 50400, the program which is being loaded
overwrites the loader, and the C64 will crash. You will need to use Loader
Generator (downloadable at WAV-PRG's homepage). NOTE: if you use Loader
Generator, you will need to create a loader for each Commodore 64 program.
Thus, it is better to generate one .WAV file for each Commodore 64
program.

4. LICENSE AND (NON)WARRANTY
This program is distributed under the GNU General Public License. See the
file LICENSE.TXT for details.

5. LATEST VERSION
The latest version of the program is available at
http://www.geocities.Com/SiliconValley/Platform/8224/wavprg.html .

6. CONTACTING THE AUTHOR
If you have suggestions, bug reports etc., you can send mail to the author
at: fabrizio.ge@tiscalinet.it

Enjoy!
