Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2020-07-10 17:30:51

toxa
Member
Registered: 2020-02-13
Posts: 305

aPLib/apultra decompressor

I translated the aPLib/apultra decompressor for i8080 to GBZ80. I'm just leaving the link here for those who may be interested. 

Link: https://github.com/untoxa/UnaPACK.GBZ80

Offline

 

#2 2020-07-13 16:31:02

tmk
Member
Registered: 2017-05-01
Posts: 63
Website

Re: aPLib/apultra decompressor

Looks like it's faster than PuCrunch providing similar ratios. I've added it to my Game Boy Compression Playground. Thanks~!

Offline

 

#3 2020-08-07 22:03:48

bbbbbr
Member
Registered: 2019-03-04
Posts: 124

Re: aPLib/apultra decompressor

I used this combined with apultra for compressing gbt_player music in Petris today.

It worked well- converted mod file sizes shrunk a lot and the time required to decompress right before starting playback isn't noticeable.

Uncompressed: 9,671 bytes
Compressed: 2,226 bytes


To keep decompression simpler I modified mod2gbt to produce a single large array (in a separate binary file) plus a set of pattern offsets (instead of one array per pattern and a set of pointers to those patterns). Then an entire song can be extracted into a single memory location and the relative pattern offsets are overlayed on it.

For reference in case others find it useful:
https://github.com/bbbbbr/gbt-player/co … 491ee127a6

And from the makefile

Code:

$(MOD2GBT_SINGLEARRAY) $< $(basename $(basename $(notdir $<)))_mod $(subst .b,,$(suffix $(<:%.mod=%))) > /dev/null
$(APULTRA) output.bin output_comp.bin
$(BIN2C) output_comp.bin output_comp.c $(basename $(basename $(notdir $<)))_mod
cat output_comp.c >> output.c

Last edited by bbbbbr (2020-08-07 22:21:43)

Offline

 

#4 2020-08-08 05:20:28

toxa
Member
Registered: 2020-02-13
Posts: 305

Re: aPLib/apultra decompressor

wow! that is nice! but you have to spare a lot of ram for decompressed tune.

Offline

 

#5 2020-08-08 08:13:19

0x7f
Member
Registered: 2019-11-24
Posts: 65

Re: aPLib/apultra decompressor

Hi, I tested the decompressor today but unfortunately it does not work. I used the original version appack.exe to compress the data. When I decompress it with appack.exe the data output is ok. But when I decompress it with your function UNAPACK(const unsigned char * sour, unsigned char * dest) it seems not to work.

Can somebody give a small example how to use it? Thanks!

Uncompressed data:

Code:

0x18,0x1D,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x16,0x00,0x00,0x00,0x16...

Compressed data:

Code:

0x41,0x50,0x33,0x32,0x18,0x00,0x00,0x00,0x43,0x04,0x00,0x00,0x2E,0x8B,0x5D...

Function output:

Code:

0x41,0x33,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x43,0x04,0x00,0x00,0x2E,0x8B...

Last edited by 0x7f (2020-08-08 08:37:27)

Offline

 

#6 2020-08-08 13:48:07

toxa
Member
Registered: 2020-02-13
Posts: 305

Re: aPLib/apultra decompressor

please, drop me a line to untoxa (at) mail (dot) ru, i'll send you an example. please send me your data too.
ps: try this compressor: https://github.com/emmanuel-marty/apult … ses/latest
pps: ah! i know what your problem is! smile original appack.exe produces data with header. you should skip that header:

Code:

UNAPACK(packed_data + 24, buffer);

if you are using the original appack.exe utility.

Last edited by toxa (2020-08-08 14:45:15)

Offline

 

#7 2020-08-08 14:33:12

0x7f
Member
Registered: 2019-11-24
Posts: 65

Re: aPLib/apultra decompressor

Hi toxa, the compressor from the link works like a charm! So many thanks!!!

Offline

 

#8 2020-08-08 18:58:23

bbbbbr
Member
Registered: 2019-03-04
Posts: 124

Re: aPLib/apultra decompressor

toxa wrote:

wow! that is nice! but you have to spare a lot of ram for decompressed tune.

Yeah, it does take some space. smile The largest song is ~3K bytes unpacked, so that's the uncompressed buffer size. My project isn't using much of the CGB's RAM so it's a good trade-off for saving the ROM space.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson