___.__ _.____.___ __/\__ __/\__ \ | ____ __/\__\. \ / \/ ___\| \| < | / | < < T < | /_.___| /__._/ /__.__\_ __.__\ l_.___\ /__.___\ /______| l___.__\ \/ /_______\AnG .:the:smaller:the:better:. Copyright (c) 1997-2000 by Joergen Ibsen / Jibz, All Rights Reserved ...ABOUT......................... ...LICENSE....................... ...LIMITATIONS................... ...ARGUMENTS..................... ...A GUIDE TO aPACK.............. ...ALGORITHM..................... ...COMPATIBILITY................. ...GREETINGS AND THANKS.......... ...GETTING THE LATEST VERSION.... ...HOW TO REACH ME............... --- ABOUT ------------------------------------------------------------------- Humm .. well .. nothing much to say yet .. the whole idea behind this packer is to make executable files (especially small ones) as small as possible (hence the slogan).. Exe-packers like LZEXE are ok for small files .. but the depacker takes up 330 bytes... WWPACK is great for medium and large files because its compression is great ;) .. but _at_least_ 380 bytes for a depacker is way too much for 4k intros and BBS-intros (IMHO ;).. The depacker in aPACK is between 133 and 340 bytes long (depending on the input file). I have put a lot of work into making it as small as possible. Compression ratio is mostly better than UPX and WWPACK (though UPX wins on very large files) Check out the following chart (if you find an error, or you think I have left out a good packer, or you don't want your packer here - tell me): EXE-file Orig. COMPACK UCEXE WWPACK PKSMART UPX aPACK ------------------------------------------------------------------------- trifill 1,969 1,505 1,664 1,528 1,440 1,969 1,136 ask 2,707 2,026 2,304 2,167 2,070 1,906 1,777 fakecd 8,944 5,290 5,568 5,312 5,180 5,006 4,800 rm 15,296 9,978 10,224 9,811 9,605 9,534 8,927 gifblast 52,395 24,778 24,461 23,950 23,567 22,707 22,753 go32 78,826 47,082 46,925 45,377 45,035 43,951 41,454 dcf 84,726 47,738 47,149 46,151 45,755 43,951 43,653 dvpeg 119,842 66,954 66,029 64,284 63,669 62,054 61,985 ncmain 213,669 111,674 109,621 106,543 105,780 100,918 99,229 gws 341,444 133,994 129,125 125,405 124,025 113,477 117,055 total 919,818 451,019 443,070 430,528 426,126 405,473 402,769 COM-file Orig. COMPACK UCEXE WWPACK PKSMART UPX aPACK ------------------------------------------------------------------------- headrush 5,682 3,864 4,164 4,057 3,875 3,494 3,476 thedream 7,119 4,094 4,404 4,243 4,056 3,780 3,712 2m 14,688 9,612 9,716 9,456 9,180 8,952 8,930 list 41,169 27,184 27,457 26,591 26,317 25,104 25,150 total 68,658 44,754 45,508 45,741 43,428 41,330 41,268 Versions used: COMPACK v5.1 UCEXE v2.4 WWPACK v3.04a (v3.05b5 for ncmain and gws because the ratio was better) PKSMART v1.0b UPX v1.01 (--best option for all files) aPACK v0.99b (the best combination of -1, -2, -3 and -t) --- LICENSE ----------------------------------------------------------------- So far aPACK is GREET-WARE for non-profitable use (if nobody charges money for programs that are packed with it) which means that if you use it, then you must greet me in your files or docs (well, ain't that cheap!). If you (or anybody else) plans to sell a program packed with aPACK then contact me (look at the end of this file). You may not distribute aPACK without the rest of the files (aPACK.DOC, REGISTER.TXT and WHATS.NEW). And you may not edit any of the files or sell aPACK for money (except for charging for the media). Feel free to upload aPACK to any BBS or site, or including it on a CD.. #ifndef _COMMON_SENCE *** This software is provided "as is". In no event shall I, the author, *** be liable for any kind of loss or damage arising out of the use, *** abuse or the inability to use this software. USE IT ENTIRELY AT *** YOUR OWN RISK! *** This software comes without any kind of warranty, either expressed *** or implied, including, but not limited to the implied warranties of *** merchantability or fitness for any particular purpose. *** If you don't agree with these terms or if your juristdiction does *** not allow the exclusion of warranty and liability as stated above *** you are NOT allowed to use this software at all. #else Bla bla bla .. the usual stuff - you know it anyway: If anything goes even remotely wrong - blame _yourself_, NOT me! #endif --- LIMITATIONS ------------------------------------------------------------- I do NOT zero any registers in the depacker .. if you need any registers to be zero, then zero them in your code (the packed file will be smaller that way ;). --- ARGUMENTS --------------------------------------------------------------- These are the switches and arguments for aPACK: Syntax: aPACK [options] [output file] General options: EXE-specific: -i Invert literals -s Don't save DS and ES -f Fast packing -h Don't use any relocations -x XT compatible depacker -t Allow tiny exe depacker -m NO code mover -v Be verbose COM-specific: -1 Use alternative encoding 1 -p Leave segment of PSP in DS and ES -2 Use alternative encoding 2 -3 Use alternative encoding 3 The switches can be given anywhere in the argument-list, in any case and in any order you like. Input- and output file should be pretty self- explanatory. The switches work like this: -i : Invert literals - this inverts all literals that are transmitted. This makes it somewhat more difficult to read text-strings using an hex-editor or some other viewer (unless of course you invert them back :) .. This is NOT meant to be any kind of protection - it merely makes the exe-file look more uninviting ;) It costs you 3 bytes. -f : Fast packing - disables some time-consuming parts of the packer, but makes the compression ratio worse (I added this again ONLY because I have added some stuff to the packer that realy slows it down, and I might just remove it again :). -x : Will produce a XT-compatible depacker. Will cost you 0 - 3 bytes. -m : Do NOT move packed data and depack to original location - this removes the code to move the packed data, and depack to the original location. This is less compatible (since the code is not depacked back to right after the PSP) and requires more memory - but it will save you 32 - 42 bytes (except for small com files!), so try it out! -v : Be verbose -- output more info while packing. -1 : Use alternative encoding 1 - this makes the packer use a slightly different encoding. The depacker will be a little larger, but in a lot of cases the ratio will also be better. -2 : Use alternative encoding 2 - like '-1', but a different encoding. -3 : Use alternative encoding 3 - like '-1', but a different encoding. -s : Don't save DS and ES - if you do not need anything from the PSP in your program, then use this switch. It makes the depacker 4 bytes smaller. -h : Don't use any relocations - normaly aPACK uses a single relocation for the EXE-depacker. This switch makes a depacker that does not use any relocations. It costs a few bytes. -t : Allow tiny exe depacker - this allows the packer to use a depacker that requires a minimum of 64k to work, but is a lot smaller. This switch works on most files below 30k. -p : Leave segment of PSP in DS and ES - this will give you easy access to the PSP from COM-files, and it is compatible with EXE-files converted to COM-files with exe2bin. --- A GUIDE TO aPACK -------------------------------------------------------- This is a short guide on how to get the most out of aPACK. Fast packing (-f switch) should never be used (I just put it in because most packers seem to have one ;). It is always a good idea to try the default encoding and all of the alternative encodings to get the best possible ratio. Normaly code is added to move the data forward and depack it back to the load address. If your program does not require too much memory it may be a good idea to try the '-m' switch. This just depacks the data to right after the packed data and hence requires more memory. It is also less compatible since some programs use the fact that the PSP is right in front of the program. The most common problems with the '-m' switch are addressing the PSP through CS and using a 'ret' to exit from a COM file. If your file is below 30k it might be better to use the '-t' switch than the '-m' switch, as it will result in a much smaller code-mover. COM-files: If you do not exit with a 'ret', and you do not access the PSP, you should try the '-m' switch (but only on files bigger than 30k). If you use '-m' and still want easy access to the PSP, try the '-p' switch. EXE-files: If your program does not require too much memory, you should try the '-m' switch. Most EXE files do not require the PSP to be right in front of the code. If you do not use the PSP, you could further use the '-s' switch. If your file is below 30k, and it is no problem that the resulting executable will need 64k to depack, you should use the '-t' switch. --- ALGORITHM --------------------------------------------------------------- aPACK uses my own version of the LZ algorithm with 56k - 60k lookback and lazy-matching. Tag-bits are inserted in the data to distinguish literal bytes from code-pairs. Code-pairs are encoded using my own version of Gamma-encoding. --- COMPATIBILITY ----------------------------------------------------------- aPACK should run on a 386+ with at least 4mb ram. Files packed with aPACK should run on a 286+. With the -x switch the files should be able to depack on a 8086. --- GREETINGS AND THANKS ---------------------------------------------------- .. go out to the following people: * Dmitry Bortoq (d'b) for our great discussions of compression techniques :) * "Jurik" for discussing the mysteries of Gamma-encoding with me * TAD for all the great ideas and the good discussions * The people who made the Epsilon Compression Page * Pasi 'Albert' Ojala for his info on PuCrunch * Piotr Warezak and Rafal Wierzbicki, for making a truly great exe-packer * RIT Research Labs for making Dos Navigator .. it's the BEST! * LiuTaoTao for making TR .. one of the best debuggers around! * Eugene Suslikov (SEN) for making HIEW .. it ROCKS! * Charles Scheffold and Thomas Pytel for making PMODE/W * Michael Tippach (Wuschel) for making WDOSX * Netscape for making the best internet browser (and releasing the source) * All other people who make good software freely available for non- commercial use! A special thanks to the beta-testers: * x-otic (thx mate ;) * Oleg Prokhorov (great optimizations and bug repports!) * Lawrence E. Boothby * METALBRAIN (beleive in miracles, my friend ;) * eL PuSHeR * Elli --- GETTING THE LATEST VERSION ---------------------------------------------- You can find it at: http://apack.cjb.net/ http://members.xoom.com/jibz/apack/news.htm Or the SAC archive: ftp://ftp.elf.stuba.sk/pub/pc/pack/ --- HOW TO REACH ME --------------------------------------------------------- Well, if you have any questions, suggestions or bug-reports about aPACK (or you just like chatting), this email-address should work: jibz@hotmail.com If you think that aPACK is a good utility and you like using it - feel free to send a money donation to me (will make me work harder ;-). Address at the end of this document. If you want to register aPACK in order to use it commercially, the file REGISTER.TXT contains information on how to register on-line (if you want to use some other way of registering email me). When you register you will receive a registration key file valid for all future versions of aPACK (if any). Joergen Ibsen Post Danmark Poste Restante Veri Centret Posthus DK - 8240 Risskov Denmark.