================================================================================
XEX2CAS 2.0
This program converts Atari DOS 2 binary files to standard (FSK) tape records
================================================================================

Dear users,

It would appear that the data recorders are not dead enough in 2014..., so
we shall let them live.

Being encouraged by reading one of the threads at Forum Atarum (atarionline.pl),
I have decided to rewrite XEX2CAS in order to fix major defects and add
some new features.

The defects I've fixed
----------------------
- Inadvertent prolongation of the converted binary files by up to 127 bytes
- Somehow poor processing of the command line arguments

Notable new features
--------------------
- More binary loaders
- Binary file checking (corrupt and non-binary files are detected)
- Ability to elongate IRGs after records that hold INIT segments
- Conversion of plain files

Processing of the binary files
------------------------------
The structure of the input binary files is checked.
If the input file is not a binary file or its structure is corrupt or
problematic, a warning message is displayed. The conversion continues, because
despite bad structure, many binary files can be successfully loaded and
executed.

Command line arguments
----------------------
The command line arguments have been changed completely

Usage:
xex2cas [option1] [option2] ... infile.xex [outfile.cas]

Options:
-r          Overwrite output file

-s          Use a shorter leader (12 s) 
            Specify this option to reduce loading time
            
-i<n>       Elongate IRGs after INIT segments to n seconds (0 to 99) 
            Specify this option when you are using a cassette adapter instead of
            a compact cassette.
            
-n'Name'    Set name displayed by the binary loader (modern binary loader only)
            The name can be up to 34 characters long 
            If this option is not specified, the name of the input file is used.
            
-l<n>       Binary loader selection 
            n=0 Use modern XL/XE only binary loader (default)
            n=1 Use ! loader updated for XL/XE computers
            n=2 Use original ! loader
            n=3 Use very small binary loader from L.K. Avalon
 
-b          Do not prepend any binary loader

-f          Faster transfer speed (720 bd) 
            Specify this option to reduce loading time
            
-g          Generate longer (350 ms) inter-record-gaps (IRGs) 
            
-e          Generate empty FUJI tape image chunk
            
-p          Convert the input file as a plain file 
            No binary loader will be prepended and the input file will not be
            checked. The -n, -i, and -l options are ignored. 
            
-pe         Same as -p but with usage of the "Data in EOF record trick"                         

-h,-help,-? Display usage instructions

Usage notes:
- If you do not specify output file, then infile.cas is implied.
- There is no support for wildcarding.

Generating WAVE files
---------------------
To generate WAVE files from tape images, use the following software:

A8CAS
Software for reading/writing Atari 8-bit cassettes
http://a8cas.sourceforge.net/ 

Alternatively, you can also use TURGEN SYSTEM (http://turgen.sf.net/), or
MagoTrans (download from the "Utils" section of http://atarionline.pl). 

Binary loaders
--------------
This program allows you to select a binary loader:

Modern binary loader. This is the STDBLOAD 2 loader skeleton from TURGEN SYSTEM.
The loader has been written from scratch and placed in the Public Domain. The
loader can display a program name up to 34 characters long.

Exclamation mark (!) loader. This is a very popular loader created by
Nudmehi Software for their Boot Cassette Maker. It was written for
pre-XL/XE machines. With XEX2CAS 2.0, you can use its original version or a
version updated for XL/XE machines.

L.K. Avalon binary loader. This loader is very small (2 blocks). It is known
to be used for certain L.K. Avalon games released on tapes.

Converting plain files
----------------------
You can use this program to convert plain files. Specify the -p or -pe option.

Data in EOF (0xFE) record trick
-------------------------------
Under normal circumstances, the EOF record is only an End-of-file marker
that holds no data (in fact, all zeros). However, the data bytes of the
EOF record are still placed to the cassette buffer at address 1024 (0x0400).
Any data in the EOF record will appear in the cassette buffer.

Copying
-------
I have placed this work in the Public Domain, thereby relinquishing
all copyrights. Everyone is free to use, modify, republish, sell or give away
this work without prior consent from anybody.

Michael Kalouš (BAKTRA Software)
zylon@post.cz

================================================================================
Text from original version of XEX2CAS
(as a tribute to the author of the original version)
================================================================================

Why did I build this?

The other day, when I was surfing the net, I found the new version (3.1) of
Atari800Win Plus.  This emulator can read cas files.  But the problem is that
writing to this file is not implemented yet.  In the help file there is a note
what a cas file is and of course a link to the wav2cas page. When I saw the
wav2cas program I did not believe that it would work.  So I got my old Atari
and I connected my XC12 and tried it.
First, I wrote a simple program in Basic :) and ... It Works !!!

So, next I decided to convert some old application on my very old cassette to
cas file.  A few errors, but I sampled my program three times, and I compared
the hex file, next I corrected it.  (I wrote my own simple application to
change a hex file to cas).  It Works too !!!

I decided to test cas2wav.  I thought, on the net are more old games for Atari,
so why can't I use it to test on my real Atari?  Now this is the problem.
All games or almost all games are in DOS format, and additionally the emulator
can't write them to cas files.  Another problem is that for all DOS files we
must add some cassette boot loader (you know !-file).
Hmm...  I found that amongst my old cassettes some game had it.  I sampled
this and changed it to cas.  On the emulator I converted it to a clear file. 

At the end of my crazy work I wrote a program in C++ which converts xex files
to cas and adds a boot loader.

How it works?

Let us assume I have a file "seawolf2.xex". :)

I write:
xex2cas seawolf2.xex seawolf2.cas

And now in my directory I have seawolf as a cas file. Next of course use
cas2wav and write the file to tape. 

Finally, Start + Option and I have my new (old) game on my Atari.

I know that is crazy but I love Atari :)

I think my program is a nice supplement to the cassette utilities. 

For all questions my e-mail is always ready,

Regards, Gienek.
plug@poczta.fm