Table of Contents
Compress and Decompress RomWBW ROM
Introduction
RomWBW for Eazy80-512 is a 96KB program interspersed with many strings of 0's and FF's. A simple compression algorithm can reduce the code size to 64K and fit in the 64KB W27C512 flash. This page describes the compression and decompression process.
Theory of Operation
The compression program looks for two or more consecutive bytes of same values while retain the original program that does not have two or more consecutive bytes of same values. When a string of two or more bytes of same values are encountered, the string is replaced with two values followed by a byte count, n-1, where n is the number of identical values. The value of n ranges from 1 (two identical bytes) to 255 (256 identical bytes). If a string contains more than 256 identical bytes, it is encoded in multiple set of <value, value, count>, <value, value, count>, etc, until all values are accounted for.
The decompress program copies the compressed data to destination while looking for two consecutive bytes of same value. If such pair is detected, the program fetches the next byte to decide how many more of the same value need to copy to the destination.
In practice, RomWBW for Eazy80-512 is generated using command file provided in RomWBW software package. The resulting file, RCZ80_ez512_std.rom, is converted to Intel Hex format and loaded into ZRC. A compression program, compress_romwbw, is ran to produced a compressed RomWBW which is downloaded as Intel Hex file. In the TL866 PROM programmer the compressed RomWBW is combined with the decompress program, decomp_romwbw, into one 64K file to program the W27C512 flash.