

                  ######################################

                         AlfCrunch Documentation

                  ######################################

Revised 6/5/88



AlfCrunch is an implementation of the Lempel-Ziv compression algorithm.

Although it produces files that have the same structure as those produced

by the Arc program, the two are not compatible. Arc cannot uncrunch

AlfCrunch files, nor can AlfUnCrunch unarc normal Arc files.



The current version of the LZ/DZ files is 1.2. Versions 1.1 and 1.2 are

compatible, but not with 1.0. If you have 1.0, you should discard it and

use 1.2. The reason for this is that 1.0 used the same header as normal

Arc crunch. Because of possible confusion over this, the header used by

AlfCrunch was changed.  Since 1.0 had very limited distribution, this

situation should not often arise.  For those who wish to be able to detect

the AlfCrunch format, the first two bytes of the file will always be $1A

$0F.



This latest version fixes a couple of problems with 1.1. When specifying

a subdirectory as the input filemask, 1.1 ignored it and always searched

the root directory. This could be avoided by the use of CWD to switch to

the proper directory. When using ArcView, the filenames in a 1.1 file may

contain garbage characters after each filename. Finally, under SpartaDos

2.3 and Dos 2.0, 1.1 crashed when it was trying to return to Dos.



The enhancements to 1.2 include fixing the above problems and adding batch

file capabilities. Batch file processing is only available under SpartaDos

3.2, as there is some quirk with i/o redirection under SpartaDos 2.3 which

causes the batch file to fail.



When running either LZ.COM or DZ.COM, Memlo must be under $2000. This

should not normally be a problem with SpartaDos, unless you have a lot of

handlers installed. With a Dos 2.0 type Dos (ie., 2.5, 2.6, etc.), this

can be fixed by only having one or two drives defined to the Dos. A

cartridge may be present, as it only affects the size of the buffer

available to AlfCrunch. Maximum speed will be achieved without a cartridge

being present.



Thanks to Robert Ames and the Phoenix for their suggestions and aid in

testing AlfCrunch.



                                  Alfred

                           Programmer's Aid BBS

                              (416) 465-4182



                            Running AlfCrunch

                            -----------------



To crunch files, load LZ.COM. The title will be displayed, along with the

version which should be 1.2. You will then be prompted for the output

filename. This may be up to 80 characters long, including subdirectory

names.



If the output file already exists, it is checked to see if it is an

AlfCrunch file. If the first header is correct, then the new files will be

appended to it. If the header is wrong the program will print an error

message and exit to Dos. If the file is shorter than the header length

(29 bytes), then it is simply opened for normal output, which erases it.



Next you will be prompted for the input filemask. This is what will be

used to select the files. This may also be up to 80 characters long,

including any subdirectory names. Wildcards are allowed. If selecting all

files, the mask must end in *.* .



Finally, you have the option of turning the screen off. Selecting this

option will speed up the program by 15-20%. Once selected, you will not

again be prompted for this option. If you do not elect to turn the screen

off, the program will continue to present this prompt until it is selected.



The program will then select files using the mask and compress them,

displaying the filenames as it progresses. When it has finished, it will

prompt you for additional input filemasks. You may either enter another

mask or simply press return to exit back to Dos.



                           LZ and SpartaDos 3.2

                           --------------------



If you are using SpartaDos 3.2, you may invoke LZ.COM and specify the

output file and input filemask on the command line. The format is:



      [Dn:]LZ  Dn:[path>]filename[.ext]  [Dn:[path>]filename[.ext] ]



The square brackets denote optional parameters which may be omitted. The

first filename is the output file. The second is the input filemask.  If

you do not specify the input filemask, the program will prompt you for it.

The program will automatically turn the screen off. When it is finished

it will prompt you for more input filemasks.



To invoke LZ as part of a batch file, the format is almost identical. The

lines in the batch file would be:



      [Dn:]LZ  Dn:[path>]filename[.ext]  [Dn:[path>]filename[.ext] ]

       Dn:[path>]filename[.ext]            <- Additional

       Dn:[path>]filename[.ext]               input masks



The program will read each input filemask, compress the files selected and

continue until all the input masks have been used. You will then be

prompted for more input masks. If this is part of a larger batch file,

leave a single return after the last input mask to force LZ to return

control back to the batch file. Example:



      [Dn:]LZ  Dn:[path>]filename[.ext]  [Dn:[path>]filename[.ext] ]

       Dn:[path>]filename[.ext]

       Dn:[path>]filename[.ext]

                   (single return here)

      [Dn:]LZ  Dn:[path>]filename[.ext]  [Dn:[path>]filename[.ext] ]

       Dn:[path>]filename[.ext]

       Dn:[path>]filename[.ext]

                   (single return here)



At the end of this, you will be left at the Dos prompt. Because of the way

i/o redirection is handled, an alternative form is available:



[Dn:]LZ

 Dn:[path>]filename[.ext]           <- The output file

 Dn:[path>]filename[.ext]           <- The input filemask

 Y                                  <- Turn the screen off

 Dn:[path>]filename[.ext]           <- Additional

 Dn:[path>]filename[.ext]           <- input filemasks

 (single return here)



Notice that the Y was only supplied once. When LZ is run in this manner,

it behaves exactly as if you were pressing the keys yourself. If you turn

the screen off, then you need only enter the Y once. If you said N, then

you would need an N after every input filemask until you said Y. Example:



[Dn:]LZ

 Dn:[path>]filename[.ext]           <- The output file

 Dn:[path>]filename[.ext]           <- The input filemask

 N                                  <- Leave the screen on

 Dn:[path>]filename[.ext]           <- Additional mask

 N                                  <- Leave the screen on

 Dn:[path>]filename[.ext]           <- Additional mask

 Y                                  <- Screen off now

 Dn:[path>]filename[.ext]           <- Additional masks, but no Y

 Dn:[path>]filename[.ext]           <- is necessary

 (single return here)



                            Getting Them Back

                            -----------------



To extract the files from an Alfcrunch file, load DZ.COM The title will be

displayed, along with the version number.



The first prompt is for the name of the file to uncrunch. This filename

may be up to 80 characters long, including subdirectory names. Wildcards

are not allowed.



The next prompt is the output directory. This is the directory where the

files will be placed when extracted from the crunch file.  If the directory

does not exist, an attempt will be made to create the directory. This may

involve creating a number of subdirectories to get to the last one, so

care should exercised with this feature. If errors occur during the

directory build stage, an error message will be displayed, and the program

will return to DOS.



Auto directory creation is only available under SpartaDos. Under any other

Dos, if you specify a subdirectory, you will probably get a single file

with the name of the first pathname.



Assuming all is well, you again have the option of turning the screen off

while files are being extracted.



The program will then extract each file and place it in the output

directory specified. If any errors occur, an error message is printed and

the program returns to Dos. When all files have been extracted, you will

be prompted for another input file. You may enter another filename or

press Return to exit to Dos.



The situation may arise where the crunch file has been corrupted. This may

occur due to errors during download, or failure of the disk on which the

file resides. There are several error messages which are associated with

bit errors.



                       Msg: Not An AlfCrunch File!

                       ---------------------------



If this message is issued before any files were extracted, then either the

first two bytes of the file are corrupt, or else the file was not created

by AlfCrunch. If the message is issued after several files were extracted,

then the file has been damaged somewhere in the last file extracted. You

may also get the message which is described next.



                       Msg: File Checksum In Error

                       ---------------------------



DZ has detected that the checksum calculated for the filename just

extracted does not agree with the checksum in the header block.  Either

the header block has been damaged or more likely, the file itself has been

corrupted. If the file is a text file, it may be partially correct. Object

file types should be discarded, as it must be assumed they are corrupt.



                            Msg: Stack Overrun

                            ------------------



This is an internal DZ error. The file being processed has been corrupted,

and DZ has exhausted all free memory in attempting to extract the data.

The output file produced is incomplete, corrupt, and should be discarded.



                Msg: Extra Bytes At Eof, Don't Add To File

                ------------------------------------------



This means that the file has extra data at the end which is not valid.

This may arise from downloading where the last block is padded. Do not add

new files to it with LZ as you will not be able to get them back when you

run DZ again. You will get the 'Not An AlfCrunch File!' message at that

time.



                           DZ and SpartaDos 3.2

                           --------------------



If you are using SpartaDos 3.2, you may invoke DZ.COM and specify the

input file and output directory on the command line. The format is:



           [Dn:]DZ  Dn:[path>]filename[.ext]  [Dn:[path>][*.*]



The square brackets denote optional parameters which may be omiited if you

wish. The first filename is the file to be processed. The second filename

is the directory in which the output files are to be placed. Remember, if

any of the directories in the output path do not exist, an attempt will be

made to create them. If you omit the *.*, it will be automatically added

by the program.



The program will automatically turn the screen off, and extract the files.

If any errors occur, the appropriate error message will be printed and

control will return to Dos.



When DZ is finished with the current input file, it will again prompt you

for another input file. You may continue uncrunching files, or simply

press return to exit back to Dos.



As part of a batch file, the form for DZ is almost identical to the LZ

form. Accordingly, only brief examples will be shown:



[Dn:]DZ  Dn:[path>]filename[.ext]  [Dn:[path>][*.*]

 Dn:[path>]filename[.ext]          <- Second input file

 Dn:[path>][*.*]                   <- Second output path

 Dn:[path>]filename[.ext]          <- Third input file

 Dn:[path>][*.*]                   <- Third output path

 (single return)                   <- Return to Dos



The second format is:



[Dn:]DZ  Dn:[path>]filename[.ext] <- First input file

 Dn:[path>][*.*]                   <- First output path

 Dn:[path>]filename[.ext]          <- Second input file

 Dn:[path>][*.*]                   <- Second output path

 Dn:[path>]filename[.ext]          <- Third input file

 Dn:[path>][*.*]                   <- Third output path

 (single return)                   <- Return to Dos



The third format is:



[Dn:]DZ

 Dn:[path>]filename[.ext]          <- First input file

 Dn:[path>][*.*]                   <- First output path

 Y                                 <- Screen off

 Dn:[path>]filename[.ext]          <- Second input file

 Dn:[path>][*.*]                   <- Second output path

 Dn:[path>]filename[.ext]          <- Third input file

 Dn:[path>][*.*]                   <- Third output path

 (single return)                   <- Exit to Dos

