DXB132@psuvm.psu.edu (05/23/91)
In article <7674@ecs.soton.ac.uk> jmss89@ecs.soton.ac.uk (Scott JMS) writes: > Does anyone have any algorithms / assembler to implement file > compression for the Z80 CPU ? > > I could do a port of stuff for 68000, but with 64k memory the hash > tables tend to gobble it all up - therefore I'd prefer something > that didn't need hash tables > First of all I'd like to thank Dan Babcock for posting this for me. Then ... I changed the LZRW1 algoritm to be a bit more efficient and posted it into comp.compression a while ago. If you weren't able to get the source for it (which was in 68000 assembler, Turbo Pascal and in C), you should ask around on netnews ... I'm sorry, but I haven't got the source lying around here anymore. The C-Source should still be available in alt.sources. Normally you should be able to use this algoritm on any system with say 64K or more. Let's make a short map of the memory used : LZRW1KH uses a buffer to store the part of the file that's copressed at that time, and another buffer to store the compressed block. If we make the input buffer 16384 bytes big, the buffer for the compressed data should be 16386 for savety reasons. Then we have a hash-table of 4096 words, i.e. 8192 bytes. That's about all we need ... So, we have : Input buffer : 16384 Output buffer : 16386 Hash table : 8192 The code and variables : 4096 -------- 45058 bytes used. The estimated size for the code and variables was a guess, but I think the program won't take up 4096 bytes at all. As you see, you can use this algoritm, even if you only have 64K of ram (or a bit less if you also have a ROM in your machine). If this still won't fit : make the input and output buffer smallen, i.e. 8192 and 8194 bytes. I've owned a Commodore 64 for a while, a machine with a 6510 processor and 64K RAM. By the time I parted from it a lot of programs were brought out to compress files. I don't know how they did it, but maybe some ex-64er could give you some tips ... Ask around on the net ... Kurt Haenen Univerity of Leuven Belgium. --------------------------------------------------------------------------- How much pressure is needed to reduce the data on a disk to halve its size? ---------------------------------------------------------------------------