Knowledge Dynamics LZW COMPRESSOR

From ModdingWiki
Jump to navigation Jump to search
Knowledge Dynamics LZW COMPRESSOR
Format typeCompression algorithm
I/O unit size1-bit

Knowledge Dynamics LZW COMPRESSOR is a semi-known tool used to compress executable files by some early DOS games.

The program ("COMPRESSOR v1.01") was is some-what wide use around 1989-1991. Knowledge Dynamics Corp. were responsible for INSTALL.EXE redist package that was used by many games, so it is possible that it was part of the same suite.

The algorithm is very similar to LZEXE, however is different enough to be incompatible with any version of UNLZEXE tool.

Games compressed with this COMPRESSOR

File Format

offset     length    purpose
0          0x200     DOS exe header, with wrong block count
0x200      0x3       jump instruction to 0x29C
0x203                unpacker data -- copyright notice, or garbage
0x24D      0x10      unpacker data -- filename
0x25D                unpacker data -- error message, or garbage
0x29C	   0x3EE     unpacker code
0x68a                < garbage, will be used for variables in unpacker code >
0x699	   0x25      packed header
0x6C0                special buffer, unknown purpose (old reloc. table?)
"offset"             packed exe

offset to packed header = main_header.blocks * 512 + main_header.extra_bytes
offset to packed exe = offset_to_packed_header + packed_header.headpars * 16
length of packed exe = filesize - offset_to_packed_exe
length of unpacked exe = packed_header.blocks * 512 + packed_header.extra_bytes
  • Filename is null-terminated and is padded with 0x24.
  • In some games, copyright notice and error message are obfuscated/replaced with garbage.
  • Copyright states: "Copyright(C) 1989 Knowledge Dynamics Corp.All rights reserved worldwide."
  • Error message is: "Unable to find $..$"


It is hard to tell how many versions of COMPRESSOR existed and how much they differed. One possible approach is verifying that jump instruction ("e9 99 00") is at position 0x200.

As strings tend to be unreadable (see above), they could not be used reliably.

Decompression algorithm

  • copies "packed header" into 0x68a
  • copies "unpacker code" [0x200-0x680] to far location
  • jumps to far location to execute that code
  • opens file "filename"
  • seeks to "offset to packed exe"
  • unpacks into cs:0000

The compression is identical to the one used in CC_Format#Compression -- it is LZW_compression with dictionary reset.

The unpacked exe is written to offset 0 in memory (offset 0x20 in file).


Devised by openkb project with best regards to modding community.

Tools uncompexe, open-source / public domain decompressor for this format