The first 32 bytes are the generic file header for the compressed file.
0x00000000 56 00 00 00 00 00 00 00 42 43 4F 53 5F 4E 46 46 |V.......BCOS_NFF| 0x00000010 B3 62 18 6C 00 00 00 C0 00 00 00 00 00 00 00 00 |.b.l............|
The next 16 bytes are the extended file header, consisting of the size of the original/uncompressed file (0x0000000000000048 bytes), followed by the checksum/CRC for the original/uncompressed file (0xA333213F), followed by the original/uncompressed file's type (0x00100000, plain text).
0x00000020 48 00 00 00 00 00 00 00 3F 21 33 A3 00 00 10 00 |H.......?!3.....|
The compressed data begins immediately after the extended header.
This first 3 byte entry tells decompression software to copy 8 bytes from offset 0x000000017 in the decompressed file to offset 0x00000018 in the decompressed file. The first byte is decoded as "matched run, one extra byte for size, negative offset, one byte for offset, size = 1". The second byte is the extra byte for the size, which contains bits 2 to 10 of the size of the run. This makes the size of the run "1 + (0x01 << 2) + 3" (or 8 bytes long), where the "1" is from the first byte, "+ (0x01 << 2)" is from the extra size byte, and the final "+ 3" is implied. The last byte is the offset (0x00) which is a negative offset and is therefore relative to the current position in decompressed file. The current position in the decompressed file would be 0x00000018, so the actual offset of the matched run would be "0x00000018 - 0x00 - 1" or 0x00000017.
0x00000030 b1 01 00 |... |
The next 2 byte entry tells decompression software to copy 4 bytes from offset 0x000000008 in the decompressed file to the current offset in the decompressed file. The first byte is decoded as "matched run, no extra size bytes, literal offset, one byte for offset, size = 1". The actual size of the run is "1 + 3" (or 4 bytes long) because there are no extra size bytes, where the "1" is from the first byte and the "+ 3" is implied. The second byte is the offset (0x08) which is taken literally.
0x00000030 81 08 | .. |
The next 28 byte entry tells decompression software to copy 27 bytes from the current position in the compressed file to the current position in the decompressed file. The first byte is decoded as "unmatched run, no extra bytes for size, size = 0x1A". The actual size of the run is "0x1A + 1" where the "+ 1" is implied.
0x00000030 1A 20 54 65 73 74 0A 0A 48 65 6c | . Test..Hel| 0x00000040 6C 6F 20 57 6F 72 6C 64 21 0a 47 6F 6F 64 62 79 |lo World!.Goodby| 0x00000050 65 |e |
The next 3 byte entry tells decompression software to copy 8 bytes from offset 0x000000030 in the decompressed file to offset 0x0000003F in the decompressed file. The first byte is decoded as "matched run, one extra byte for size, negative offset, one byte for offset, size = 1". The second byte is the extra byte for the size, which contains bits 2 to 10 of the size of the run. This makes the size of the run "1 + (0x01 << 2) + 3" (or 8 bytes long), where the "1" is from the first byte, "+ (0x01 << 2)" is from the extra size byte, and the final "+ 3" is implied. The last byte is the offset (0x0E) which is a negative offset and is therefore relative to the current position in decompressed file. The current position in the decompressed file would be 0x0000003F, so the actual offset of the matched run would be "0x0000003F - 0x0E - 1" or 0x00000030.
0x00000050 B1 01 0E 00 00 | ..... |
The last 2 byte entry tells decompression software to copy 1 byte from the current position in the compressed file to the current position in the decompressed file. The first byte is decoded as "unmatched run, no extra bytes for size, size = 0x00". The actual size of the run is "0x00 + 1" where the "+ 1" is implied.
0x00000050 00 00 | .. |
|
|