Packing binaries

http://jiggawatt.org/badc0de/lzsscube.zip

I wrote a small LZSS decoder in SH2 assembly that lets you run compressed binaries on your Saturn. It basically works like this:

* Build your binary as normal, but with an altered base address (I use 06008000, which works fine as long as the compressed binary is <16kB).

* Compress the binary with an LZSS encoder (included in the zip above).

* Assemble and link the decoder code with the compressed binary incbin'd.

* As you run the resulting binary from 06004000 the decoder will recreate your original binary in RAM and jump to it.

Note that the example uses gouraud shading, which doesn't work properly in yabause. It does work on a real Saturn though, as you can see here (minus all the artifacts that came from photographing a TV screen):

gcube2.jpg
 
I've collected all of the decompression routines I've ported on one page, which can be found here: http://jiggawatt.org/badc0de/decrunch/

These include 3 different (but similar) routines for the SH2; LZSS, aPLib and PackFire. All of them are written in assembly and I've tried to keep them as small as possible, but they still conform to the SH2 ABI so that they're callable from C.
 
Seems quite interesting that you created a loader, might come in useful in the future.

What's the reasoning behind running compressed binaries? Are you filling up a CD?
 
slinga said:
Seems quite interesting that you created a loader, might come in useful in the future.

What's the reasoning behind running compressed binaries? Are you filling up a CD?

It may be useful in the case you want to make a custom ARP firmware larger than 256KB
smile.gif
 
slinga said:
Seems quite interesting that you created a loader, might come in useful in the future.

What's the reasoning behind running compressed binaries? Are you filling up a CD?

I don't run stuff from CD. I upload to RAM using the PAR+. These algorithms also aren't limited to compressing code - you could compress some graphics data and then uncompress it to VRAM at runtime.

And they could be useful if someone wanted to do a 4k intro or something like that.
 
Back
Top