Comparing an LZ4 Decompressor on Four Legacy CPUs
3 days ago
- #Assembly Programming
- #Retro Computing
- #LZ4 Compression
- The author recounts their experience implementing LZ4 compression decompression algorithms for various 8- and 16-bit platforms, starting from SNES projects and expanding to CPUs like Z80, 8080, 8086, and 6502.
- The article details the LZ4 algorithm's workings, emphasizing its block format of alternating literal strings and backreferences, with specific modifications for the platforms.
- Implementation comparisons are drawn between Z80, 8080, 8086, and 6502, highlighting each CPU's strengths, such as Z80's LDIR instruction and 8086's string operations, while noting the 6502's different approach using memory arrays.
- API designs for each CPU are tailored to their architectures, with Z80/8080 using HL and DE pointers, 8086 using far pointers with segment registers, and 6502 relying on zero-page scratch space.
- The author reflects on the challenges and insights gained from cross-platform implementation, noting how Z80 habits influenced other CPUs and the unique constraints of the 6502.