Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Added support for inplace crunching
Minor speed bump
  • Loading branch information
tonysavon authored Mar 8, 2022
1 parent 5d0a082 commit 04e8afd
Show file tree
Hide file tree
Showing 3 changed files with 200 additions and 197 deletions.
Binary file modified bin/tscrunch.exe
Binary file not shown.
48 changes: 35 additions & 13 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
TSCrunch V1.0
TSCrunch V1.1

by Antonio Savona

February 2022
March 2022


About
Expand All @@ -23,19 +23,24 @@ tscrunch [option] infile outfile

Crunching examples:

tscrunch -x $0820 game.prg crunched.prg
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
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 option.
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.
Please refer to the inline help (tscrunch -h) for a detailed description of the different crunching options.
Note that with the exception of self executables and inplace, all the files generated by TSCrunch are headless binaries, that is they don't come with a 2 byte loader offset.

Decrunching files from code
===========================

For memory decrunching, please #include decrunch.asm and include the crunched binaries in your software, then use the macro TS_DECRUNCH, as explained by the following code fragment
For memory decrunching, please #include decrunch.asm and include the crunched binaries in your code, then use the macro TS_DECRUNCH, as explained by the following code fragment

.pc = $1000 "test"
//decrunches data to $4000
Expand All @@ -49,6 +54,23 @@ For memory decrunching, please #include decrunch.asm and include the crunched bi
.import binary "data.bin"


For inplace decrunching, please #define INPLACE before including the decruncher code, as explained by the following code fragment

#define INPLACE

.pc = $1000 "test"
//decrunches data inplace
:TS_DECRUNCH(compressed_data)
jmp *

.align $100
#include "decrunch.asm"

.pc = LoadAddress //as provided by the cruncher
compressed_data:
.import c64 "data.bin"


Performance
===========

Expand All @@ -58,8 +80,8 @@ The following benchmark compares TSCrunch performance with those of a fast byte-

Chopper Command - Raw encoding - game prg

Tscrunch 1.0 TinyCrunch 1.2 B2
Size 46913 46913 46913
Tscrunch 1.0 TinyCrunch 1.2 B2
Size 46913 46913 46913
Crunched size 13321 15419 11181
% of original 28.40% 32.87% 23.83%
Decrunch cycles 799826 1133039 1694585
Expand All @@ -68,8 +90,8 @@ Cycles per byte 17.0491335 24.15191951 36.12186388

Frostbite - Raw encoding - game prg

Tscrunch 1.0 TinyCrunch 1.2 B2
Size 61185 61185 61185
Tscrunch 1.0 TinyCrunch 1.2 B2
Size 61185 61185 61185
Crunched size 21329 22931 17759
% of original 34.86% 37.48% 29.03%
Decrunch cycles 1176826 1507239 2475450
Expand All @@ -80,5 +102,5 @@ Cycles per byte 19.2338972 24.63412601 40.4584457
Future development
==================

-Block-loading management for integration in disk loaders
-Add in-place decrunching
-Block-loading management for integration in disk loaders.
-Speed up crunching, possibly rewriting the code C.
Loading

0 comments on commit 04e8afd

Please sign in to comment.