An optimal, byte-aligned, LZ+RLE hybrid encoder, designed to maximize decoding speed on NMOS 6502 and derived CPUs
TSCrunch is an optimal, byte-aligned, LZ+RLE hybrid encoder, designed to maximize decoding speed on NMOS 6502 and derived CPUs, while achieving decent compression ratio (for a bytecruncher, that is). TSCrunch was designed as the default asset cruncher for the upcoming game A Pig Quest, and, as such, it's optimized for in-memory level compression, but as of version 1.0 it can also create Commodore 64 SFX executables for off-line prg crunching.
TSCrunch requires python 3.x with scipy library installed, or a windows x64 machine(A pre-compiled windows x64 command line executable is also provided). The memory decruncher requires Kick Assembler, but it should be quite easy to port it to your assembler of choice.
tscrunch [option] infile outfile
Crunching examples:
tscrunch -x $0820 game.prg crunched.prg
Crunches the file game.prg and generates a self executable crunched.prg, using $0820 as post-decrunch jmp address
tscrunch -p game.prg crunched.bin
Mem-crunches the file game.prg, stripping the 2-byte header and generates a binary file crunched.bin
tscrunch data.bin crunched.bin
Mem-crunches the file data.bin and generates a binary file crunched.bin
Please refer to the inline help (tscrunch -h) for a detailed description of the different crunching options. Please note that with the exception of self executables, all the files generated by TSCrunch are headless binaries, that is they don't come with a 2 byte loader offset.
For memory decrunching, please #include decrunch.asm and include the crunched binaries in your software, then use the macro TS_DECRUNCH, as per the following code fragment
.pc = $1000 "test"
//decrunches data to $4000
:TS_DECRUNCH(compressed_data,$4000)
jmp *
.align $100
#include "decrunch.asm"
compressed_data:
.import binary "data.bin"
TSCrunch is designed for ultra-fast decrunching while keeping a decent compression ratio. Being a byte-cruncher, it falls short of popular bit-crunchers, such as exomizer or B2, when comparing compression efficiency, but it is usually much faster at decoding. Furthermore, you can expect a 20% to 40% speed bump compared to popular byte-crunchers with similar compression efficiency. The following benchmark compares TSCrunch performance with those of a fast byte-cruncher, TinyCrunch, and two fast bit-crunchers, B2 and Dali, on a real-case mem-compression scenario: Chopper Command, from the same author.
Block-loading management for integration in disk loaders. Add in-place decrunching. Improve sfx decruching speed.