{"id":23136631,"url":"https://github.com/optiroc/shvc-lz","last_synced_at":"2025-08-17T10:32:17.033Z","repository":{"id":230629060,"uuid":"779835218","full_name":"Optiroc/SHVC-LZ","owner":"Optiroc","description":"LZSAv2 decompressor for the 65816 CPU","archived":false,"fork":false,"pushed_at":"2024-04-11T20:31:10.000Z","size":868,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-12T00:52:36.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Optiroc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-30T23:01:24.000Z","updated_at":"2024-04-14T23:28:47.498Z","dependencies_parsed_at":"2024-04-11T21:37:09.329Z","dependency_job_id":null,"html_url":"https://github.com/Optiroc/SHVC-LZ","commit_stats":null,"previous_names":["optiroc/shvc-lzsa2","optiroc/shvc-lz"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Optiroc%2FSHVC-LZ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Optiroc%2FSHVC-LZ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Optiroc%2FSHVC-LZ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Optiroc%2FSHVC-LZ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Optiroc","download_url":"https://codeload.github.com/Optiroc/SHVC-LZ/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230114902,"owners_count":18175445,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-17T12:21:41.647Z","updated_at":"2024-12-17T12:21:42.146Z","avatar_url":"https://github.com/Optiroc.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SHVC-LZ\n\nA collection of decoders for various modern Lempel-Ziv compression variants targeting the Super Famicom/Nintendo system. Written for the [ca65 assembler](https://cc65.github.io/doc/ca65.html), but should be easy to port to other assemblers.\n\nCommon characteristics:\n- Designed for speed over code size\n- Designed to run from ROM – no self-modifying code\n- Full 24-bit addresses for source and destination can be freely set at the call site\n- Uses DMA registers for temporary variables allowing for faster access than RAM\n- Uses DMA to copy literal strings\n- The compressed data or the decompression buffer may not cross bank boundaries\n\nStatistics (speeds in KB/s on a Super Nintendo @ 3.58MHz):\n```\nLZ4           Mean    Median       Min       Max\n  Ratio      2.603     2.308     1.741     7.334\n  Speed    209.377   186.633   137.775   403.959\n\nLZSA1         Mean    Median       Min       Max\n  Ratio      2.810     2.433     1.891     8.266\n  Speed    200.319   178.357   135.252   404.598\n\nLZSA2         Mean    Median       Min       Max\n  Ratio      3.040     2.651     2.117     8.551\n  Speed    144.596   121.368    96.250   349.974\n\nZX0           Mean    Median       Min       Max\n  Ratio      3.217     2.718     2.176     9.799\n  Speed    100.045    83.592    61.838   270.151\n```\n[Full statistics](Statistics.md)\n\n## LZ4\n\n[LZ4](https://lz4.org) aims to achieve extremely fast decompression speeds, with a block format that trades size for simplicity.\n\n[Decompressor source](https://github.com/Optiroc/SHVC-LZ/blob/main/src/shvc-lz4.s)\n\n## LZSA1\n\n[LZSAv1](https://github.com/emmanuel-marty/lzsa) achieves better compression than LZ4 while still being almost as efficient to decode on 8-bit CPUs.\n\nAn excellent choice if you want fast decompression.\n\n[Decompressor source](https://github.com/Optiroc/SHVC-LZ/blob/main/src/shvc-lzsa1.s)\n\n## LZSA2\n\n[LZSAv2](https://github.com/emmanuel-marty/lzsa) achieves better compression than LZSAv1 while still being fairly efficient to decode on 8-bit CPUs. Of the decompressors included in this collection it has the largest code size, which is due to the somewhat involved [block format](https://github.com/emmanuel-marty/lzsa/blob/master/BlockFormat_LZSA2.md).\n\nBetween the faster decompression of LZSA1 and the better compression ratio of ZX0, there is little reason to choose this algorithm.\n\n[Decompressor source](https://github.com/Optiroc/SHVC-LZ/blob/main/src/shvc-lzsa2.s)\n\n## ZX0\n\n[ZX0](https://github.com/einar-saukas/ZX0) has the best compression ratio of the algorithms included in this collection, which is achieved by encoding the length/match tokens in an [interlaced](https://github.com/einar-saukas/Zeta-Xi-Code?tab=readme-ov-file#factor-r) [Elias gamma coded](https://en.wikipedia.org/wiki/Elias_gamma_coding) bit stream. The bit twiddling involved accounts for the slower speed compared to the pure byte or nibble aligned accesses needed by the other decompressors.\n\nThat said it is still quite fast, and should be the clear choice if good compression ratio is the priority. It also has the smallest code size of the included decompressors.\n\n[Decompressor source](https://github.com/Optiroc/SHVC-LZ/blob/main/src/shvc-zx0.s)\n\n## Future work\n- Improve test data set\n- Add optional bank crossing ability \n\n## Dependencies\n- [lz4ultra](https://github.com/emmanuel-marty/lz4ultra) compressor by Emmanuel Marty\n- [lzsa](https://github.com/emmanuel-marty/lzsa) compressor by Emmanuel Marty\n- [salvador](https://github.com/emmanuel-marty/salvador) compressor by Emmanuel Marty\n- ca65 and ld65 from the [cc65](https://github.com/cc65/cc65) development package\n- [Mesen](https://github.com/SourMesen/Mesen2) by Sour (for running tests and benchmarks)\n\nAll dependencies except Mesen are included in this repository.\n\n##\nSHVC-LZ is developed by David Lindecrantz and distributed under the terms of the [MIT license](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptiroc%2Fshvc-lz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foptiroc%2Fshvc-lz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptiroc%2Fshvc-lz/lists"}