APack decompression for Z80!

A General Discussion forum for TI calculators

Moderator: MaxCoderz Staff

Post Reply
User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

APack decompression for Z80!

Post by Dwedit »

I've just ported the APack decompressor to Z80. The size of the decompressor is exactly 250 bytes large (about half the size of pucrunch decompressor), and the compression rates provided by APack are often better than Pucrunch!

For example, the game plus chapters of The Verdante Forest are about 70k in size. Apack gets it down to 41.3k, and Pucrunch gets it down to 40.7k. So pucrunch wins in one case, but...

Other games (like Joltima and Dying Eyes) favor Apack over pucrunch. Dying eyes gets 500 bytes smaller if compressed with Apack instead of Pucrunch, while Joltima gets 250 bytes smaller.

Here's a sample program that merely draws a picture, but it also includes the full decompression code and compression tool.
http://home.comcast.net/~alanweiss3/dwe ... k_demo.zip
You know your hexadecimal output routine is broken when it displays the character 'G'.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Wow, nice work DWedit, this might come in handy :).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Duck
Sir Posts-A-Lot
Posts: 231
Joined: Sat 18 Dec, 2004 3:38 am

Post by Duck »

Have you tested it on uncompressed highly-redundant levelsets yet? I'm wondering if it could be used as a RLE replacement...
Kozak
Maxcoderz Staff
Posts: 791
Joined: Fri 17 Dec, 2004 5:33 pm
Location: On the dark side of the moon.
Contact:

Post by Kozak »

Will you be implementing this in COS or is it for individual programmers? A method which get's TVF down by 30k is 8) .
"They say that sea was created by a man named Maarten Zwartbol, a long time ago...." - Duck, an old Corbin version
User avatar
Madskillz
Calc Wizard
Posts: 745
Joined: Fri 17 Dec, 2004 10:22 pm
Location: Wandering around in the Jungle...
Contact:

Post by Madskillz »

Wow nice Dwedit! I can certainly use this! :D
The Revolution is here...
Kerey
Regular Member
Posts: 136
Joined: Tue 11 Jan, 2005 10:10 pm
Location: No longer in the Midwest... now in Seattle
Contact:

Post by Kerey »

Cool. Can APack be used to decompress arbitrary offsets in the bitstream, (ie: like my on-the-fly Huffman routines) or is it adaptive? I couldn't find any papers on the algorithm and don't feel like reading code at the moment.
User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

Post by Dwedit »

It's LZ based, and it works by storing references to data that has occurred previously in the file.

While decompressing, the entire output file must be intact up to the current decompression pointer.

You can also overlap the input file with the output file, just as long as the output is written before the input, and the output never overwrites the current input file position. I used that on the GBA to run big roms in pocketnes.

Apack uses some crazy hybrid of a bit stream, and byte aligned data. It makes reading bytes faster, since they are always aligned.

From what I see, an uncompressed byte that has not occurred within 15 bytes back is encoded with 9 bits, while an uncompressed byte that has appeared within 15 bytes back is encoded with 7 bits. This is exculding all the LZ compression stuff it also does.
You know your hexadecimal output routine is broken when it displays the character 'G'.
darkstone knight
New Member
Posts: 67
Joined: Sun 09 Nov, 2008 1:56 pm

Re: APack decompression for Z80!

Post by darkstone knight »

sorry for the necropost :excited: , but the site is down... and i cant seem to find the program on ticalc or google

i may use this to compress supaplex levels (RLE compresses by about 62% (21 possible tiles), i need 80...)
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: APack decompression for Z80!

Post by benryves »

User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

Re: APack decompression for Z80!

Post by Dwedit »

Now rehosted on my domain:
http://www.dwedit.org/files/apack_demo.zip

Also attached here too.
Attachments
apack_demo.zip
(28.98 KiB) Downloaded 636 times
You know your hexadecimal output routine is broken when it displays the character 'G'.
Post Reply