Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Native crunch/decrunch code.
2024-04-20 05:56
Flavioweb

Registered: Nov 2011
Posts: 447
Native crunch/decrunch code.

Do you know if the source code of a native crunch/decrunch routine for C64 exists somewhere?
Not a complete utility with interface etc...
just the compression/decompression code.
 
... 13 posts hidden. Click here to view all posts....
 
2024-04-20 10:40
Flavioweb

Registered: Nov 2011
Posts: 447
Quoting Krill
Why would you want to crunch natively?

And if you really must, why do you need the source code?

Just pick apart any of the crunchers from the olden days.

I have a program running, from $3000 to $FFFF that modifies itself.
I would like the user to be able to save a stand alone version.

I managed to get the working sources of Fast Cruncher 5.09 but as soon as I change a small thing I create a lot of problems.

I would like to avoid unnecessary waste of time by using existing code... if it exists somewhere.
that's all.
2024-04-20 11:23
tlr

Registered: Sep 2003
Posts: 1727
Quote: No.
Preferably it should use little ram but I have some headroom to adapt.


Then I’d go for a simple RLE.
2024-04-20 11:33
Krill

Registered: Apr 2002
Posts: 2855
Quoting tlr
Then I’d go for a simple RLE.
Indeed. Native LZ-style crunching would take hours like it did in the olden days.
RLE is not nearly as crunchy, but fast and might fit the bill, too.
2024-04-20 11:48
Flavioweb

Registered: Nov 2011
Posts: 447
Thank you!
If you can provide me with something I hope to be able to use it properly.
2024-04-20 12:14
Krill

Registered: Apr 2002
Posts: 2855
Quoting Flavioweb
If you can provide me with something I hope to be able to use it properly.
https://codebase64.org/doku.php?id=base:rle_pack_unpack perhaps.
2024-04-20 16:45
Raistlin

Registered: Mar 2007
Posts: 575
Quote: Quoting Flavioweb
If you can provide me with something I hope to be able to use it properly.
https://codebase64.org/doku.php?id=base:rle_pack_unpack perhaps.


I’m not the person for this, but, that code on Codebase64 looks a bit long for just RLE pack/depack doesn’t it..? It seems like something that could be coded with a really tight loop…
2024-04-20 17:00
tlr

Registered: Sep 2003
Posts: 1727
Quoting Raistlin
I’m not the person for this, but, that code on Codebase64 looks a bit long for just RLE pack/depack doesn’t it..? It seems like something that could be coded with a really tight loop…

Also it's missing the requested executable binary generation. I have some RLE code here, but that is for streamed input from disk which may not be optimal for this usecase.
2024-04-20 17:34
chatGPZ

Registered: Dec 2001
Posts: 11149
mmmh i remember some simple packer from the past... it loaded to $03xx-$0800 and was super easy to include in own programs (which many people did, i also used it for some "intromaker" stuff iirc). No idea how it was called though, maybe someone remembers... :)
2024-04-21 10:08
Martin Piper

Registered: Nov 2007
Posts: 646
For simple RLE, it should be relatively simple to write two position independent routines. One to compress a block of memory to an address, and the other one to decompress data to an address.

The decompression especially could then be copied to anywhere and just pointed at the data to decompress.
2024-04-21 11:46
Flavioweb

Registered: Nov 2011
Posts: 447
I have collected some ideas in the last few days and I think I have reached a good compromise (at least on a theoretical level).
The "pure" RLE compression didn't convince me very much because, in practice, it doubled the space required for the code to be compressed, but it works well for the data part.
In my specific case I know the location of both the code and the data so I can create an ad hoc compression routine that compresses the data and leaves the code unchanged.
To overcome the problems of lack of RAM, I can save the compression result directly on disk while it is being processed, preceded by the decompression code so as not to worry about creating the entire file in ram before saving it.
It should work. I hope.
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
wbochar
radius75
psenough
Sentinel/Excess/TREX
Guests online: 70
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.6)
6 No Bounds  (9.6)
7 Comaland 100%  (9.6)
8 Aliens in Wonderland  (9.6)
9 Uncensored  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Happy Birthday Dr.J  (9.7)
2 Layers  (9.6)
3 It's More Fun to Com..  (9.6)
4 Cubic Dream  (9.6)
5 Party Elk 2  (9.6)
6 Copper Booze  (9.6)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Rainbow Connection  (9.5)
9 Dawnfall V1.1  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 SHAPE  (9.3)
Top Graphicians
1 Mirage  (9.8)
2 Archmage  (9.7)
3 Talent  (9.6)
4 Facet  (9.6)
5 Hend  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.119 sec.