The data following the 8-bit index is compressed using run length encoded (RLE) format. The MSP430 uses a simple run length encoding that can be decompressed using the following algorithm:
- Read the first byte and assign it as the delimiter (D).
- Read the next byte (B).
- If B != D, copy B to the output buffer and go to step 2.
- Read the next byte (L).
- If L > 0 and L < 4 copy D to the output buffer L times. Go to step 2.
- If L = 4 read the next byte (B'). Copy B' to the output buffer L times. Go to step 2.
- Read the next 16 bits (LL).
- Read the next byte (C).
- If C != 0 copy C to the output buffer L times. Go to step 2.
- End of processing.
The RLE handler function in the TI toolchain is called _ _TI_decompress_rle.