Z LZSS Compression Format
Z compresses individual JMP2 members with an LZSS variant.
File format
The dictionary is a 4096-byte ring. Start its write cursor at 1 for each member. Read one flag byte and consume its bits from bit 7 down to bit 0.
- A set bit copies one literal byte to output and the dictionary.
- A clear bit reads a little-endian word w. The source ring position is w >> 4; position zero ends the stream. Otherwise copy (w & 15) + 2 bytes.
- Advance both source and destination positions modulo 4096. Copy references byte by byte, since their source can overlap newly written bytes.
The reference is an absolute dictionary index, not a backward distance. The length range is 2–17. The size in the archive directory is the expected output size, not the input size.
Notes
The original dictionary is persistent and is not cleared between calls. Repository regression checks report no reads from unwritten dictionary positions for shipped archive members. An encoder should only reference bytes already written by that member.
Source code
From re-z, the open-source browser port:
- src/formats/lzss.js – decoder with dictionary-read instrumentation
- docs/re/NOTES.md – reverse-engineering notes and evidence status
Credits
This file format was reverse engineered by VorticonCmdr. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)