Lempel-Ziv-Storer-Szymanski Compression (LZSS) Format

NOTE

This section applies to applications that use EABI only.

8-bit index Initialization data compressed using LZSS

The data following the 8-bit index is compressed using LZSS compression. The run-time support library has the routine __TI_decompress_lzss() to decompress the data compressed using LZSS. The first argument to this function is the address pointing to the byte after the 8-bit index. The second argument is the run address from the C auto initialization record.

The decompression algorithm for LZSS is as follows:

  1. Read 16 bits, which are the encoding flags (F) marking the start of the next LZSS encoded packet.
  2. For each bit (B) in F, starting from the least significant to the most significant bit, do the following:
    1. If (B & 0x1), read the next 16 bits and write it to the output buffer. Then advance to the next bit (B) in F and repeat this step.
    2. Else read the next 16-bits into temp (T), length (L) = (T & 0xf) + 2, and offset (O) = (T >> 4).
      1. If L == 17, read the next 16-bits (L'); then L += L'.
      2. If O == LZSS end of data (LZSS_EOD), we've reached the end of the data, and the algorithm is finished.
      3. At position (P) = output buffer - Offset (O) - 1, read L bytes from position P and write them to the output buffer.
      4. Go to step 2a.