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

          S M A S H                     by Dr Carlo Delhez
          ^^^^^^^^^
         version 0.10                   January 1995

  Read the section 'Legal Terms' in this file for details about usage!

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

   NOTE:  This is the very first public release of Smash.
          Please inform me about your experiences with this program!

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


Introduction:
^^^^^^^^^^^^^
'Smash' is a self-extracting job-compressor for Qdos-compatible systems.
It compresses executable files in the the same way that ZIP and similar 
archivers do, but the de-compression code is put in front of the 
compressed data. In this way, the compressed file itself becomes a new
(and much smaller) executable: a 'Smashed job'. If you EXEC a Smashed
job, the Smashed file will be 'UnSmashed' in memory and the original
program will be started (as a new job). Smashed jobs have exactly the
same functionality as the original job, but occupy much less diskspace
(40% reduction on average, and for some specific files over 80% reduction
turns out to be possible), hence also need less time to load.


Why use Smash?
^^^^^^^^^^^^^^

(1) 40% reduction means that you can store almost twice as many programs 
    in the same diskspace and you still have *direct* access to them.
    That is: you don't need to unZIP the file before you can run it, the
    compressed file can be executed directly!

(2) On sufficiently fast systems (Gold Card, Super Gold Card, QXL), the
    time needed to expand the data in memory can be smaller than the time
    needed to load the larger amount of data from disk directly. This is
    especially true if you are executing programs from notoriously slow
    devices such as floppy disk, microdrive or network.


Usage: (TK2 and Pointer Interface assumed)
^^^^^^
          EX Smash;'devx_infile devy_outfile'

compresses 'devx_infile', creating 'devy_outfile' as output.

Note # 'devx_infile' must be an executable: these files generally have
       extensions like _exe, _obj, _bin, _task, _job, etc., and need
       to be started by EX, EW or similar.

     # 'devy_outfile' will also be an executable, and can therefore be
       started by EX, EW, or similar commands.

     # some files that need to be LRESPR'ed (extension _bin, _ext, _rext)
       also have the exe-flag set (note the 'E' in the Qpac Files menu).
       Even though these files can be Smashed, the compressed version
       obviously canNOT be EX'ed (nor LRESPR'ed).

     # Smash will always create 'devy_outfile', even if it's larger
       than 'devx_infile': this may happen with very small input files
       (smaller than 1k or so) or with files that were already Smashed.

Once the compression is complete,

          EX 'devx_infile'    and     EX 'devy_outfile'

start the same job, except that 'devy_outfile' should be much smaller!

Parameters can be passed to 'devy_outfile' in the usual way (as you would
pass them to 'devx_infile'), e.g.

          EX 'devy_outfile',#1,ram1_log;'-vxlt:dump' & ext$

will work as expected. (Mind you, this is just a silly example!)

It is also possible to use EW 'devy_outfile' instead of EX, but in that 
case the UnSmash-code and data must remain in memory (whereas it would
remove itself once it has unpacked the data, had you used EX). The only
problem here could be that the amount of RAM memory occupied by UnSmash
remains passively 'in use' all the time. However, you may remove the
UnSmash-job (e.g. using the Rjob option of Qpac2) at any time. This
releases the 'parent-job' (e.g. SuperBasic), but the 'son' keeps on
running; then, the EW has effectively become an EX.


Advantages of Smash:
^^^^^^^^^^^^^^^^^^^^
    + Much less disk storage space required to store programs;
    + Faster startup from slow devices (net, microdrive, floppy);
    + Faster data transfer when copying and/or moving programs;
    + Ability to change an EW into an EX while the job is running,
      releasing the parent job without killing the son!
    + Makes the code less easily accessible for unauthorized patching
      and reverse-engineering.


Disadvantages of Smash:
^^^^^^^^^^^^^^^^^^^^^^^
    - Slight (but often hardly perceptible) delay before the job
      starts running after loading is complete;
    - It's not possible to configure or patch Smashed jobs
      (that is, using the original configure/patch software);
    - Smashed jobs need more memory to start and/or execute, so they 
      might not run in systems with a critical amount of free RAM;
    - Smashed jobs cannot be 'protected' by the special options
      of Qpac (Psion, Guardian, Unlock, Freeze).


Overall Performance:
^^^^^^^^^^^^^^^^^^^^
After some experiments, I observed

 # Approximately 40% reduction of the filesize on average;
 # generally better compression with increasing filesize.

Just try and see.


Please don't ask me for...
^^^^^^^^^^^^^^^^^^^^^^^^^^
 . faster and/or better compression,
 . an option to restore the original file from the Smashed one,
 . wildcard operation (so as to Smash many files at once),
 . or a scrambling option to make the compressed data even less
   easily accessible for 'unauthorized patching'

... because I'm already thinking about and/or working on these things.

Also, I'm thinking of a way to include datafiles, helpfiles and other
stuff that a program may need in the Smashed file. Executing the Smashed
file will let these files be decompressed to a buffer (a special-purpose 
RAM-disk owned by the job) where the program can access these files. This
would be a useful step towards compact, self-contained code that runs
from any device without prior configuration.


"Best Compression Achieved" Top-10:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Here's a list of 10 programs that give excessively large compression.

 Notes: > 'new size' includes the UnSmash self-extracting code.
        > the data is based on Smash v0.08 and UnSmash v0.10; reduction
          may be different with other versions of (Un)Smash.

 #  program name            old size  new size   reduction     type

 1. Diamonds (Merz 1990)      36256      6946     80.8 %       game
 2. MemOmeM (Lenerz 1992)     41368     12320     70.2 %       game
 3. Tetris (Delmas 1989)      41488     13804     66.7 %       game
 4. ZX 2.00 (Lavrov 1992)     43550     15066     65.4 %       utility
 5. QPuzzle (Verbeeck 1988)   32422     11296     65.2 %       game
 6. Arcanoid (Merz 1987)      36566     13746     62.4 %       game
 7. Conqueror v1.09 (DP)      76932     31712     58.8 %       utility
 8. Config_Conq v1.09 (DP)    40348     17058     57.7 %       utility
 9. ANTI 1.0 (Lavrov 1992)    31662     13508     57.3 %       utility
10. BrainSmasher (Merz 1989)  52026     22548     56.7 %       game
                           -------------------------------
                             432618    158004     63.5 %

If you come across any other (existing and commonly available) programs
that will reduce more than 56.7%, please tell me!


Legal Terms:
^^^^^^^^^^^^
Selling or modification of this program is prohibited.
Smash may be distributed for free, but only in the original archive.
No files may be removed from and/or added to the archive.

Smash may be used freely...

(1) by individuals to compress files for their own personal use only;

(2) by freeware- or shareware developers to compress their files; it is
    recommended (but not mandatory) to include a message in the manual or
    in the program itself so as to inform the user that the software
    has been compressed by Smash.

Smash may NOT be used to compress payware or commercial software without
prior written permission of the author.


Final Notes:
^^^^^^^^^^^^
Thanks to Jack Raats for his useful advices about C{68}-programming.

For your remarks, questions, suggestions, hate-mail or anything else,
please contact
                    Carlo Delhez
                    Emmastraat 3
                    4651 BV  Steenbergen
                    Netherlands

That's all folks!
