Commandline utilities for C64 crossdevelopment
----------------------------------------------

Utilities written by Lasse rni (loorni@student.oulu.fi)

CovertBitOps C64 page: http://covertbitops.cjb.net


PRG2BIN.EXE
-----------

Usage: PRG2BIN infile outfile [bytes to strip, default 2]

This program removes a certain amount of bytes from the beginning of the
input file and saves it as the output file. With the default setting
of 2 bytes, it converts PRG files into raw binary files.


PRG2D64.EXE
-----------
Usage: PRG2D64 diskimage c64filename dosfilename [interleave]

This program reads the PC filesystem file indicated by dos filename, and
writes it to the D64 diskimage given, with the desired c64 filename. Use
the underscore _ to represent blanks in the c64 filename.

Interleave can be given as a parameter. By default it's 10.


D642PRG.EXE
-----------
Usage: D642PRG diskimage c64filename dosfilename

This program does the opposite, it extracts the c64 file from the diskimage
and writes it to a PC filesystem file indicated by dos filename. Like above,
Use the underscore _ to represent blanks in the c64 filename.


D64REN.EXE
----------
Usage: D64REN diskimage oldname newname

This program renames one file on a D64 diskimage. Use the underscore _
represent blanks in the filenames.


MAKEDISK.EXE
------------
Usage: MAKEDISK diskimage commandfile [diskname] [interleave]

This program creates a D64 diskimage from scratch, reading dos filename
c64 filename pairs from the commandfile and writing those files on the image.
A disk name and the sector interleave (10 is the default) can be optionally
given. Fiddling with the interleave is nice when trying to find the optimal
loading speed (minimal sector read waiting time) for an IRQ-loader. Use the
underscore _ to represent blanks in the c64 filenames.

Example of a commandfile: (from the BOFH game)
bofh.pak BOFH_V1.0
instr.pak BOFH_MANUAL
hiscore.bin BOFH_HISCORE

So, bofh.pak is written on the image as BOFH V1.0, instr.pak as BOFH MANUAL
and so on.


C64PACK.EXE
-----------
Usage: C64PACK infile outfile [switches]
Switches:
       -r Raw input and output file (no start address)

Packs a C64 file using my quite ineffective string-pack algorithm. (the only
good side is that the depacker is short). The input and output file can even
be same, because input file is first totally stored in memory.

If the -r switch is given, the input file is assumed to be a raw binary file
without the 2-byte starting address (like in PRG files) and the output file
will be raw binary also. Otherwise, the output file contains the same start
address as the input file.


C64UNP.EXE
----------
Usage: C64UNP infile outfile

This program reverses the compression done by above program. NOTE: this
program can only handle files with startaddress! 


PACKPRG.EXE
-----------
Usage: PACKPRG infile outfile execution address in hexadecimal

This program packs an executable PRG file with the above mentioned
algorithm and adds a depacker, making the file startable with a RUN
command. The depacker will start the executable with a JMP to the
execution address, with the value $37 in memory location $01 (enable
Basic ROM, Kernal ROM and I/O area)

This program needs the file DEPACK.S (depacker source code in DASM
source code format) in the current directory and DASM.EXE in the
path, because it invokes DASM to assemble the depacker and link it
with the packed executable data.


BENTON64.EXE
------------
Usage: BENTON64 infile outfile [switches]
Switches:
       -hXX Clip picture height to XX
       -wXX Clip picture width to XX
       -bXX Set background ($D021) color to XX
	    By default it's the most used color.
       -sXX Set picture start address in hex (default a000)
       -r   Raw save (no .PRG start address included)
       -o   Optimal save (do not align bitmap & screen data to page boundary)
       -c   Save color data before bitmap

This is Benton Invertor 64 (heh...don't ask where the name comes
from :)), my C64 multicolor picture conversion program.

The input file has to be in Deluxe Paint IFF/LBM format. Switches
determine what portion of the picture will be converted, and to
what format.

By default a 320x200 picture would be saved like:

2 bytes startaddress
8192 bytes of bitmap data
1024 bytes of screen memory data
1024 bytes of color memory data
As you see, the bitmap/screen/color data lengths are rounded to the next
page (256 bytes) boundary.

By using the /o switch it would be:
2 bytes startaddress
8000 bytes of bitmap data
1000 bytes of screen memory data
1000 bytes of color memory data
(no wasted bytes)

Note that the background color isn't saved with the picture! This is a
downside.


PIC2CHR.EXE
------------
Usage: PIC2CHR infile outfile [switches]
Switches:
       -fXX First char to use. Default 0
       -bXX Set background ($D021) color to XX. Default 0.
       -mXX Set multicolor 1 to XX.
       -nXX Set multicolor 2 to XX.
       -xXX Set Xsize to XX. (default 40)
       -yXX Set Ysize to XX. (default 25)
       -d   Don't search for duplicates
       -c   Don't save colormap
       -s   Don't save screendata
       -t   Don't save chars
       -1   Singlecolor

Converts a LBM picture into character (not bitmap) data + screen data. The
output file is always in raw binary format (no startaddress) and it's as
follows:

xsize*ysize chars of screen memory data
xsize*ysize chars of color memory data, if not disabled
as many chars of chardata as needed

To rebuild MW1 cutscene pictures, replace CUTSCENE.EXE calls with calls to
this program and add parameter /f64 (start from char 64)


PIC2SPR.EXE
-----------
Usage: PIC2SPR infile outfile [switches]
Switches:
       -hXX Clip picture height to XX sprites
       -wXX Clip picture width to XX sprites
       -bXX Set background color to XX. Default 0.
       -mXX Set sprite multicolor 1 to XX.
       -nXX Set sprite multicolor 2 to XX.
       -sXX Set data start address in hex (default a000)
       -r   Raw save (no .PRG start address included)
       -1   Singlecolor

This is the customized graphics conversion program for MW2, that uses sprites
in its cutscene graphics. Basically, an IFF/LBM picture will be converted into
sprites, the sprites going left-right and top-bottom in the like this: (example
has 4 sprites horizontally)

  1 2 3 4
  5 6 7 8

The sprites are saved in the .SPR format, which means raw sprite data with
the 64th byte in each sprite defining the sprite color.


SPRRIP.EXE
----------
Usage: SPRRIP ramdumpfile banknumber outfile [spritecolor]

This program takes a 64KB dump file containing the C64 RAM, such as C64.RAM
used by old versions of CCS64, and rips all 256 sprites from a certain
videobank. The bank numbers are the same that are written to the low 2 bits
of $dd00 (3 = $0000-$3fff, 2 = $4000-$7fff etc.). Destination file is simply
the sprite file name (in the same .SPR file format as used by SPREDIT.EXE)
and the optional spritecolor parameter is what to put in the 64th byte of
each sprite.

This is a program I rarely use :)


SYMBOLS.EXE
-----------
Usage: SYMBOLS dasm-symboldumpfile outputfile [listfile]

Builds an "include"-file or "extern-file" out of DASM symbol dump output, to
be used in compiling a multi-part program, or using game engine symbols in a
CovertScript program. If listfile is present, only the symbols listed in it
will be included, otherwise all.


FILEJOIN.EXE
------------
Usage: FILEJOIN src1+src2+src3 .. dest

I wrote this because "COPY src1+src2 .. dest /B" didn't work reliably for
me. Simply, joins many binary files into the destination file.


CS.EXE
------
Usage: CS infile [switches]
Switches:
        -c       Don't automatically import constants from extern file
        -d       Enable debugging output (ugly-looking :))
        -e<name> Externfile name
        -h       Build chunk-datafile with header
        -l<name> Listfile name
        -o<name> Output to one file, instead of page files (infile.000,
                 infile.001 etc.)
        -p<val>  Page size in hex. Default 0400.
        -v<val>,<val> Variable area start & length in hex. Default 0334,100.

Compiles CovertScript programs into bytecode for execution by the VM contained
in the old MW4 engine. Can also be used to create raw datafiles and chunk-
datafiles.


CPACK.EXE, CDEPACK.EXE
----------------------
Usage: CPACK infile outfile
       CDEPACK infile outfile

Replacement of C64PACK & C64UNP with slightly better compression algorithm.
Used to compress datafiles for old version of MW4 engine


PACK.EXE, PCHUNK.EXE, PMAP.EXE
------------------------------
Usage: PACK infile outfile

These are used in MW4 to make exomizer-packed datafiles that can be loaded to 
any address of memory. Requires fairly new version of Exomizer (invokes it)

PCHUNK and PMAP are specific to the "Covertengine chunk-datafile" system that
was only in use in the old MW4 engine. They are likely not useful..




