__.___ _.___.___ _.____.___ \ < >___< / __/\__\. \| | .__|_ |_/\_ / \/ /T \ : > | \ / /\ \ \| | | |__ < /T | > \| < | / /__\ \| \| | | /_.___| /__._/| /| | / /__.___\ /______|AnG>__.___\__/_|.__\___/ .:the:smaller:the:better:. Copyright (c) 1998 by ÄúJibzúÄ All Rights Reserved ...aBOUT....................... ...aP_pack..................... ...aP_depack_asm............... ...aP_depack_asm_fast.......... ...aPPRECIATION................ ...aLWAYS THE NEWEST VERSION... ...aND HOW TO REACH ME......... aBOUT: ÄÄÄÄÄÄ aPLib is a compression library based on the compression algorithm used in aPACK (my executable compressor). I made this because some people needed an easy way to compress data-files. The compression speed is the same as aPACK (not too fast .. but that should not really matter), and compression takes up about 1 MB of memory! Decompression on the other hand does not need any extra memory (in situ), and is VERY fast. The depackers assume that they are given some valid packed code -- if not they will propably crash the program. This is to ensure that the depackers are as small and easy to understand as possible. If you need any added functionality (CRC-checking, encryption, depacked size stored with packed data, etc.), just add it yourself. The DJGPP library works with DJGPP (wow!). The VC library works with (at least) VC and Watcom. The Watcom library works with (at least) Watcom, DOS32 and TASM32/TLINK32 -- and should work with other compilers/linkers that can use the OMF format. The ASM directory contains the following files: DEPACK.ASM ............ Small decompressor in 32bit assembler code for TASM and WASM assemblers. DEPACKF.ASM ........... Fast decompressor in 32bit assembler code for TASM and WASM assemblers. READ.ME ............... Some info about compiling and using the above. The DOS32 directory contains: APTEST.ASM ............ A little assembler code, that packs and depacks a message to show how aPLib works with DOS32. APTEST.EXE ............ Compiled executable of the above. MAKEIT.BAT ............ Batch file to compile and link the above. The DJGPP directory contains: APLIB.H ............... Include file, that contains the declaration of aP_pack (the function that packs data), aP_depack_asm and aP_depack_asm_fast (depackers). APLIB.A ............... The library that contains aP_pack (and all the code needed to pack), aP_depack_asm and aP_depack_asm_fast functions. The DLL directory contains: APLIB.DLL ............. DLL containing aP_pack (and all the code needed to pack), aP_depack_asm and aP_depack_asm_fast functions. APLIB.H ............... Include file, that contains the declaration of aP_pack (the function that packs data), aP_depack_asm and aP_depack_asm_fast (depackers). This include file is ONLY for the DLL version of aPLib. APTEST.ASM ............ A little assembler code, that packs and depacks a message to show how the aPLib DLL works. APTEST.EXE ............ Compiled executable of the above (Win32 PE). APTEST.DEF ............ Definition file for the above. MAKEIT.BAT ............ Batch file to compile and link the above. READ.ME ............... Some info about using the above. The EXAMPLE directory contains: APPACK.CPP ............ Watcom example code that packs a file, depacks it again, and checks for errors. APPACK.EXE ............ Compiled executable of the above. CURSOR.H .............. Header file with functions to turn the cursor on and off. MAKEFILE .............. Watcom makefile for the above. MAKEIT.BAT ............ Batch file to compile and link the above. The NASM directory contains: DEPACK.ASM ............ Small decompressor in 32bit assembler code for the NASM assembler. DEPACKF.ASM ........... Fast decompressor in 32bit assembler code for the NASM assembler. READ.ME ............... Some info about compiling and using the above. The TLINK32 directory contains: APTEST.ASM ............ A little assembler code, that packs and depacks a message to show how aPLib works with TLINK32. APTEST.DEF ............ Definition file for the above. APTEST.EXE ............ Compiled executable of the above (Win32 PE). MAKEIT.BAT ............ Batch file to compile and link the above. The VPASCAL directory contains: APLIB.DEF ............. Interface Definition for APLIB.DLL (OS/2). APLIBU.PAS ............ A Pascal unit, to interface with the Watcom aPLib library. APLIBUD.PAS ........... Dynamic version of APLIBU.PAS. MAKE_EXE.CMD .......... Batch file to make demo executables. TESTAPDE.PAS .......... An example program, using aPLib with the above interface unit to decompress a file. TESTAPPA.PAS .......... An example program, using aPLib with the above interface unit to compress a file. The VC directory contains: APLIB.H ............... Include file, that contains the declaration of aP_pack (the function that packs data), aP_depack_asm and aP_depack_asm_fast (depackers). APLIB.LIB ............. The library that contains aP_pack (and all the code needed to pack), aP_depack_asm and aP_depack_asm_fast functions. The WATCOM directory contains: APLIB.H ............... Include file, that contains the declaration of aP_pack (the function that packs data), aP_depack_asm and aP_depack_asm_fast (depackers). APLIB.LIB ............. The library that contains aP_pack (and all the code needed to pack), aP_depack_asm and aP_depack_asm_fast functions. So basically you include APLIB.H and link with the library to be able to pack and depack. If you only need to depack, or if you modify the depack code, you can compile and link with one of the assembler versions of the depackers. Getting data into an input buffer and allocating the output buffer is your responsibility. You also need to supply a 1mb work buffer for aP_pack. If some error occurs, aP_pack will return 0 -- otherwise it returns the compressed size. If you do not have a callback for aP_pack, use NULL instead. The EXAMPLE directory contains a simple packer that uses aPLib to compress a given file, and then decompresses it to check that it works. So far aPLib is GREET-WARE for non-profitable use (if nobody charges money for programs that use it) which means that if you use it, then please credit me (well, ain't that cheap!). If you (or anybody else) plans to sell a program that uses aPLib then contact me (look at the end of this file). You may not distribute aPLib without the rest of the files. And you may not edit any of the files (except the header files) or sell aPLib for money (except for charging for the media). #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 aP_pack: ÄÄÄÄÄÄÄÄ unsigned int aP_pack(unsigned char *source, unsigned char *destination, unsigned int length, unsigned char *workmem, int (*callback) (unsigned int, unsigned int)); source - is the data you want to compress. destination - is where the data should be compressed to (It would be a good idea to allocate ((length * 9) / 8) + 16 bytes to be sure that even an uncompressible file can be "compressed" without a page-fault. length - is the number of bytes you want to compress. workmem - a pointer to (at least) 1mb of memory. This is used during compression for tables and temporary storage needs. callback - is a pointer to a function that takes two arguments - the first is the number of input bytes that has been compressed, and the second is how many output bytes they have been compressed to. This function is called every 32nd time the main compression loop is run. If you don't have a callback, use NULL instead. If the function returns 1 then aP_pack will continue packing -- if it returns 0, aP_pack will stop and return 0. returns the packed length (or 0 on any error). aP_depack_asm: ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ unsigned int aP_depack_asm(unsigned char *source, unsigned char *destination); source - is the compressed data that you want to decompress. destination - is where your want the compressed data decompressed to. returns the depacked length. aP_depack_asm_fast: ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ unsigned int aP_depack_asm_fast(unsigned char *source, unsigned char *destination); source - is the compressed data that you want to decompress. destination - is where your want the compressed data decompressed to. returns the depacked length. aPPRECIATION: ÄÄÄÄÄÄÄÄÄÄÄÄÄ .. goes out to the following people: * x-otic for being a great beta-tester (thx mate ;) * d'b for our continous discussions of compression techniques :) * The people who made the Epsilon Compression Page * Pasi 'Albert' Ojala for his info on PuCrunch * 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! * Veit Kannegieser for his work on the VPascal code. * Netscape for making the best internet browser (and releasing the source) * All other people who make good software freely available for non- commercial use! aLWAYS THE NEWEST VERSION: ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ You can find it at: http://apack.home.ml.org/ Or the SAC archive: ftp://ftp.elf.stuba.sk/pub/pc/pack/ aND HOW TO REACH ME: ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Well, if you have any questions, suggestions or bug-reports about aPLib (or you just like chatting), this email-address should work: jibz@hotmail.com If you think that aPLib is a good library 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, and in REGISTER.FRM. If you want to register aPLib in order to use it commercially fill out the registration form in REGISTER.FRM and mail it to me (if you want a company or site license email me). When you register you will receive a registered version of the libraries. Joergen Ibsen Post Danmark Poste Restante Veri Centret Posthus DK - 8240 Risskov Denmark.