home *** CD-ROM | disk | FTP | other *** search
- SHRINK 1.0 Copyright (c) 1988 Thomas G. Hanlin III
-
- Program Compression Utility
- 06/01/88
-
-
-
- Using SHRINK:
-
- This utility compresses .COM files without affecting the way you run them.
- Its compression scheme is simple and will not work on all files, but may
- produce impressive results depending on the particular file. If SHRINK is
- unable to compress the file, it will abort without doing anything.
- Otherwise, it will overwrite the old file with the smaller, compressed
- file. Note that this will save only disk space, not memory. You must
- have at least 64K of memory available to run a compressed program. The
- larger the program is, the better chance SHRINK has to compress it... but
- SHRINK can only handle programs up to 30,000 bytes long.
-
- NOTE that SHRINK is not compatible with every program. In some cases, a
- program compressed with SHRINK will no longer run. Do not use SHRINK on a
- program unless you have a backup copy, just in case! Some files known not
- to compress properly with SHRINK are: BURGER.COM, the Landmark Speed Test,
- PKARC, and PKXARC.
-
- The average compression rate seems to be around 7% for files that SHRINK
- is able to compress, but I've seen compression rates of 46% and higher.
- It depends entirely on the program.
-
- To use SHRINK, just type "SHRINK filename" (without the quotes), where
- "filename" is the name of the .COM file to shrink. SHRINK will only work
- properly on .COM files, so if you do not type a file extension, ".COM" is
- assumed. If SHRINK can compress the file, it will do so in place,
- modifying the file you specified... so be sure to make a backup copy of
- the file before SHRINKing it, in case something goes wrong.
-
-
-
- Distributing SHRINK:
-
- The SHRINK utility is protected by copyright, and may be distributed only
- according to the following limitations:
-
- 1) No price may be charged, other than a disk copying/mailing fee which
- may not exceed $6.00.
-
- 2) The utility and documentation must be included together, in unmodified
- form. This includes the SHRINK.COM and SHRINK.DOC files.
-
- Programs compressed with SHRINK may be distributed without royalties or
- licensing. Please do not distribute a compressed program without the
- author's permission, however, as this may result in a violation of his
- copyright.
-
-
-
- Warning:
-
- I've warned you before, now let me say it again... back up your programs
- before using SHRINK on them! Although SHRINK works fine in most cases, it
- is known to be incompatible with some programs. You will simply have to
- find out for yourself whether your particular programs will work with
- SHRINK. Please notify me of any incompatibilities, and I'll try to keep
- track of them (and find out what is causing the problem)... but I won't
- guarantee that I'll be able to fix it, and I won't be responsible for any
- damages you may accumulate through your carelessness.
-
-
-
- Tech Notes:
-
- The SHRINK utility works by compressing a COM-format executable file,
- using the inefficient but simple Run Length Encoding compression scheme to
- turn the code into an encoded data stream. The flag used for RLE is
- chosen by scanning the file for the least-frequently-used character, for
- maximum efficiency. The encoded program is written back to disk under the
- original file name, with a relocating decoder attached to the start of the
- file.
-
- When the .COM file executes, control passes to the relocating decoder,
- which relocates itself (and the encoded data) higher in memory. It then
- decodes the program into the same place it would have been loaded if it
- were not encoded... resets the registers and flags to their original
- form... and starts the program just as if there had never been any
- encoding.
-
- So why doesn't it work for all .COM files? I really don't know. Any
- suggestions would be appreciated.
-
- Why did I choose RLE compression? I did so for a number of reasons. One,
- it's fast, both for encoding and decoding. The SHRINK utility imposes no
- noticeable loss of speed on executing a program. Two, it's simple, which
- keeps it small. The compression overhead, so far as memory is concerned,
- is equal to the length of the relocating decoder. With RLE compression,
- this decoder is only 82 bytes, which is insignificant. Other coding
- schemes might be more efficient, but would have a far greater amount of
- overhead to overcome. Since no compression method I've seen appears to be
- terribly effective on .COM files anyway, RLE is good enough.
-