WAV-PRG 2.3 By Fabrizio Gennari, 1998, 2001

This programs runs on Windows 95/98/NT. It does two things:
- converts Commodore 64 tape files to PC in emulator-readable format (.PRG, .P00 
or .T64), so they can be played with PC emulators. Tapes can be converted from 
WAV or TAP samples, or directly from the sound card. In order to recognize 
different file formats, WAV-PRG uses a plug-in architecture: each plug-in 
recognizes a different file format.Plug-ins for Turbo Tape 64, kernel loader 
(the "slow" loader built-in in C64 ROM) and Zzap! Megatapes are included, but 
plug-ins for many other formats can be written. In order to be used by WAV-PRG, 
the plug-ins must be copied in the plugins sub-directory.
- converts programs from .PRG, .P00 and .T64 files to WAV files, which can be 
recorded on a tape and loaded on a Commodore 64 as Turbo Tape 64 files.

Let's see how to do this.

1. CONVERTING FROM C64 TO PC
This is done in three steps.

1.1 SAMPLING THE TAPE
This step is not necessary if you want to convert the tape directly from the
soundcard, or if you already have a WAV or TAP file: in this case you can jump
directly to Chapter 1.2.

1.1.1 Sampling to a WAV file
For this you need:
- a sound card
- a tape player
- a cable connecting the output of your tape player (e.g., the headphone jack
socket) to the input of your sound card (on a SoundBlaster, this is a jack
socket marked as LINE IN)
- a sampling program (e.g. WaveStudio, bundled with
any SoundBlaster, or Goldwave)

First of all, connect the tape player to the sound card. You should hear the
sounds emitted by the player from the speakers of your sound card. Set the
volume of your player to a reasonably high level (half the maximum should be
fine). Set the mixing options of your sound card so the recording level of the
external output is the highest, and the other recording sources are disabled
(this is done using Windows' Volume Control application). Set the volume of your
computer speakers low, so you will not be made deaf by the grating sound coming
from the tape. Now, run the sampling program amd set the recording options as it
follows: Sampling frequency: 44100 Hz Sample size: 8 bits Format: PCM
uncompressed, mono WAV-PRG will not recognize files in a different format than
this. Now, sample the file and save it in WAV format. Some sound programs (e.g.
Goldwave or CoolEdit) show the waveforms in WAV files: if you can see a nice
sinusoidal waveform of reasonable amplitude, everything should work.

1.1.2 Sampling to a TAP file
This is more difficult. One way is to convert to WAV first, using the above
procedure, then converting the WAV to VOC and using
64VOCTAP (http://cia.c64.org/tools/64util05.zip) to create a TAP. Or convert to
WAV, then to TAP with Tape64 (http://members.tripod.com/Andreas_Matthies/c64/).
Another way is to connect the datassette to your PC's parallel port and use mtap
(http://arnold.c64.org/~minstrel).

1.2 CONVERTING THE TAPE
This is what WAV-PRG does. Run WAV-PRG and select the
page "From C64 to PC". Now:
- if you sampled the tape into a WAV file, look for your file and click on its
name. If it is a WAV file, but the format is not as mentioned before (44100 Hz,
8 bits, PCM mono), the message "The format of this wave file differs from the
required one" should appear. If the file is recognized, the message "This is a
convertable file" will appear.
- if you sampled the tape into a TAP file, or you downloaded a TAP file, look
for it and click on its name. The message "This is a raw tape image file" should
appear.
- if you want to sample from the soundcard, check the "Soundcard" radio button.
Connect the tape player and set the volume and the mixer as explained in Chapter
1.1.1

Then, choose the format you want to convert to (.PRG, .P00 or .T64). If you
choose .T64, you must type the .T64 file name and, optionally, the T64 internal
name in the respective boxes. Choose the plug-in according to the original file
format. If your sound card inverts waveforms, tick the "Inverted waveform" box.
Now, press OK. Some plug-ins could ask for the start and/or the end addresses.
The conversion process will start, and information messages will appear in a
box. The WAV file will be scanned, and for each C64 file found in it, a .PRG or
.P00 file or an entry in the T64 will be created. If the chosen format is .PRG,
its name will be the same as on the C64 (if it is not unique, a postfix will be
appended) with the .PRG extension added. If it is .P00, the C64 name will be
shrunk to 8 characters using the PC64 rules, and an extension ranging from .P00
to .P99 will be appended.

What if nothing is recognized? A number of causes can be behind this:
- your sound card inverts waveforms. If this is true, toggle the "Inverted waveform"
box and try again.
- the file cannot be loaded with the chosen plug-in because the formats are
different. Try using a different plug-in
- the cassette has been played at a too high or too low volume: try
sampling the file again, adjusting the volume of your player, and retry.

At the end of the conversion, the message "The file <WAV filename> unexpectedly
ended while converting" could appear: either the final part of the tape was not
sampled, or the recording quality was low. In the first case, try sampling for a
longer time, in the second case, try adjusting the volume of your player, or
"regenerating the signal". This is easier than it sounds: load the game on an
actual C64 and save it on a tape with the datassette (it is better to use a
turbo saver like Turbo Tape 64, which you can download at WAV-PRG's home page).
The freshly-saved ("regenerated") tape will have many more chances to be
correctly loaded by WAV-PRG.

1.3 PLAYING THE GAME
You need a C64 emulator for this. All the most popular emulators should 
recognize all or some of the formats supported by WAV-PRG (CCS64 and VICE do, 
PC64 does .P00, C64S does .T64).

2. CONVERTING FROM PC TO C64
This too is done in three steps.

2.1 CREATING THE .WAV FILE
This is done by WAV-PRG. Just select the page "From PC to C64" and choose if you 
want to generate an inverted waveform (if your C64 does not load the game if the 
box is unchecked, try again with the box checked). The combo box allows you to 
choose a loader. "Loader+Turbo Tape 64" means that a fast loader will be used, 
which can be loaded just by typing LOAD after switching on your C64. "Turbo Tape 
64 only" uses a fast loader, but needs a program such as Turbo Tape 64 in order 
to be loaded. "Kernel loader" does not use fast loaders at all: you can load the 
program by simply typing LOAD. However, the loader is VERY SLOW, so use it only 
for short programs, or for VIC20 programs. Now look for the file you want to 
convert and click on its name. If it is a valid .PRG or .P00 file, you will see 
the message "This is a convertable file" followed by the start and end addresses 
(the former is 2049 in 99% cases, the latter should never exceed 65536) and, in 
the case of .P00, the C64 filename. To convert these files, click on OK. If it 
is a valid .T64 file, WAV-PRG will show the number of total and used entries in 
that file. Click on OK, and the T64 dialog box appears: for each entry, the 
start and end addresses and the offset inside the T64 file are shown. Click on 
an entry and press OK. Now another dialog box is shown. Type the filename you 
want to appear when loading the game on the C64 (next to FOUND). Now, you can 
choose if you want to create a WAV file (whose name is filename.WAV, where 
filename is the name you type in the edit box. If a file with the name 
filename.WAV already exists, a window allows you to choose whether to overwrite
it or keep it) or play the sound immediately.

2.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 .
The latter is not needed if you are playing the sound with WAV-PRG. Connect the 
input of your recorder to the output of your sound card (on a SoundBlaster, 
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 sound sources but the Wave output, 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 sound.

2.3 PLAYING THE GAME

2.3.1 Stand-alone files
If "Loader+Turbo Tape 64" was selected, a stand-alone file has been created.
To load these files, you will just need to load the game with LOAD or 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

2.3.2 Files that need Turbo Tape 64
If "Turbo Tape 64 only" was selected, you will need to use Turbo Tape 64
(it can be downloaded at WAV-PRG's homepage). Load it, then load the game with
(left arrow)L.

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 that this does not happen with stand-
alone files.

2.3.3 Kernel loader programs
If the program was created with "Kernel Loader" selected, just load it
with LOAD or SHIFT+RUN STOP.

3. ADVICE
If you convert directly from/to the soundcard, it is better not to move the
WAV-PRG window. Doing so can lead to errors in conversion. Moving windows is
not a problem when loading from/saving to WAV or TAP file.

4. NOTE FOR VIC20 USERS
Most VIC20 programs do not use fast loaders, just the slow loader built in kernel
ROM, which is exactly the same as C64's. To convert from VIC20 to PC, use the
"Kernel loader" plug-in. To convert from PC to VIC20, choose "Kernel loader".

5. DISCLAIMER
This program comes with NO WARRANTY whatsoever. The programmer
cannot be held responsible for any damages caused by the use of this program.
Use it at your own risk.

6. DISTRIBUTION
This program is freeware. You can use it without paying any fee,
and redistribute it as you like. Just do not charge anything for it, and do not
modify it without asking the author first.

7. HISTORY

1.0 (29th July, 1998)

First release.

1.1 (14th January, 1999)

Additions:
- Added support for .P00 and .T64 files when converting to C64.
- Added support for .P00 when converting to PC.

Refinements:
- When a new window is shown, other windows are disabled.
- Some minor graphical enhancements have been made.

Bug fixes:
- Sometimes, the message "An error occurred while opening this file"
was not shown.
- A bug which caused .WAV files to be read sometimes incorrectly
(the Turbo Tape header could not be found even if it was present) has been
fixed.

2.0 (6th November, 1999)

Additions:
- Plug-in architecture, which allows to converts many file formats
- Added support for .T64 files when converting to PC
- Ability to invert waveforms when converting to C64

Refinements:
- The program can (should) be fully useable with keys only now.
- Some WAV files not conforming to the RIFF-WAVE standard (e.g. the ones created
by Windows' Sound Recorder) are now recognized as valid

2.1 (5th December, 1999)

Additions
- Conversions C64->PC can be done from TAP files as well as WAV files
- When converting from PC to C64, a stand-alone file can be created, which does
not need Turbo Tape 64.

Bugfixes
- A bug which forbid T64s to be converted to WAV (a box "Range check
error" appeared) has been fixed.

2.11 (20th November, 2000)

Additions
- The number of converted games is displayed after a C64-PC conversion

Bugfixes
- A bug which forbid TAP version 1 files from being converted has been fixed.

2.2 (27th December, 2000)

Additions
- Ability to convert from/to the soundcard directly

Bugfixes
- Sometimes, when switching pages, the OK key stayed enabled when it shouldn't
have been.

2.21 (18th February, 2001)

Bugfixes
- When a plug-in returns an end address lower than the start address, the
program does not hang anymore
- If some files are skipped when converting tp PC, they are not counted as
converted
- If a corrupted T64 file is converted, the program does not hang anymore,
instead a warning message is printed

2.3 (28th April, 2001)

Additions
- Ability to convert from PC to "kernel loader" (slow built-in loader)

Bugfixes
- When creating T64 files, the file type for eache ntry is now 82 (PRG) and
not 01 (SEQ). Star Commander was sensitive to this.

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

9. KNOWN BUGS
None.

10. UNKNOWN BUGS
Loads :)

11. CREDITS
Written by Fabrizio Gennari. This program uses algorithms developed
by Janne Veli Kujala and Wolfgang Lorenz.

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

Enjoy!