; Huffman Compression/Decompression in 32bit ASSEMBLY 
; Ver 1.00
;
; ANAkTOS (c)1999 
; Europe/Greece 
;------------------------------------------------------

Files in this package:

  ankts_hf.txt	- this file	
  ankts_c.inc	- includes the compression routine:   "anaktos_compress"
  ankts_d.inc	- includes the decompression routine: "anaktos_decompress"

 The two routines 'anaktos_compress'/'anaktos_decompress' are written as 
C callable functions, thus you can call them directly from a C/C++ program.  
Here, i will describe only how you can use it from ASM programs.

Place the following two lines in the code segment of your ASM file:

 include "ankts_c.inc"
 include "ankts_d.inc" 

For compressing a memory block, you need to reserve a 5Kbytes memory block 
used as a working buffer by the engine and a memory block used as the 
destination big enough to hold the compressed data. 
Then push in the stack the following information, and call the function:

  PUSH  'starting offset of the working buffer'
  PUSH  'size of the data to be compressed' 
  PUSH  'starting offset of the data to be compressed'
  PUSH  'starting offset of the destination memory block'
  CALL anaktos_compres

For decomressing a compressed memory block you only need to reserve a
memory block for destination of the decompressed data. The size of 
this block can be determined by the compressed data(see next paragraph).
As before, you have to push the input data into the stack, before 
calling the decompression function:

  PUSH  'starting offset of the compressed data to be decompressed'
  PUSH  'starting offset of the destination memory block'
  CALL anaktos_decompress

The compressed data has the following format:

Offset   Meaning
   0-1   Recognition Mark. The WORD 'CA'
         The decompression routine checks if this WORD exists.
   2-5   DWORD value. The size of uncompressed data.
   6-9   DWORD value. The size of compressed data.
  10-13  DWORD value. Starting offset of the bitstream.
  14-??  The huffman tree.

ANAkTOS
http://welcome.to/SPL