From: Steve Judd (sjudd_at_ffd2.com)
Date: 2002-07-12 18:00:11
Hola,
I've written a program for compressing small programs. The algorithm was
mentioned in C=Hacking #21, and is very simple: use n bits to represet the
most common bytes, 9 bits for the rest. The program is at
http://www.ffd2.com/fridge/xip/xip.zip
and includes source code (and please read the readme before using it!).
The decompressor is 51 bytes, plus the lookup table of compressed bytes,
plus a 4-byte header. Performance seems pretty decent -- the best so far
is 69 bytes (net) on a 1k program. Tests on unoptimized 1k programs
showed a 20-40 byte gain.
The program generates an autobooting executable, and the autobooting
technique is fairly novel: load to $0326, overwriting the BSOUT vector
(what $FFD2 jumps through). Using this trick, an autobooting program of
any size may be loaded, using just a 4-byte header (the second two bytes
being the STOP vector).
Before implementing this algorithm, I did some preliminary calculations
with three other related algorithms (an ideal (entropy limit) Huffman
tree, the first described in C=Hacking, etc.) and this one performed best.
Anyways, give it a try and see what you think!
cu,
-Steve
Message was sent through the cbm-hackers mailing list
Archive generated by hypermail 2.1.4.