FAQ  •  Register  •  Login

aplib decompressor for ZX Basic.

<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Sun Aug 05, 2012 10:21 pm

Re: aplib decompressor for ZX Basic.

britlion wrote:Boride gets better and better. Going to add in aplib support too? :)

Thanks. Yes, I will...
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

na_th_an

Posts: 73

Joined: Fri May 07, 2010 7:34 am

Post Mon Aug 06, 2012 6:59 am

Re: aplib decompressor for ZX Basic.

britlion wrote:
na_th_an wrote:1. Download the compressor -> http://www.mojontwins.com/warehouse/apack.exe


I don't think this link is working, Na_th_an?


Sorry, it looks like our server is blocking exe files. Aw.

I zipped it, this should work: http://www.mojontwins.com/warehouse/apack.zip

Editting first post in progress :)
<<

na_th_an

Posts: 73

Joined: Fri May 07, 2010 7:34 am

Post Mon Aug 06, 2012 7:02 am

Re: aplib decompressor for ZX Basic.

slenkar wrote:thanks for the explanation,

how is @mapdata first defined? is it an array,a memory address?


"mapdata" is a label, look at the code. It marks a "spot" in memory. Just afterwards, you have an "asm - end asm" block which includes a defs "command" which is just defining 2400 zeroes.

So @mapdata is the address of such space with 2400 zeroes where compressed maps will decompress in my example. Think of it like an unsigned byte array:

  Code:
Dim mapdata (2399) as uByte


I think that would be exactly the same thing.
<<

boriel

Site Admin

Posts: 1461

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Mon Aug 06, 2012 7:20 am

Re: aplib decompressor for ZX Basic.

na_th_an wrote:
slenkar wrote:thanks for the explanation,

how is @mapdata first defined? is it an array,a memory address?


"mapdata" is a label, look at the code. It marks a "spot" in memory. Just afterwards, you have an "asm - end asm" block which includes a defs "command" which is just defining 2400 zeroes.

So @mapdata is the address of such space with 2400 zeroes where compressed maps will decompress in my example. Think of it like an unsigned byte array:

  Code:
Dim mapdata (2399) as uByte


I think that would be exactly the same thing.

Arrays uses an extra binary data header. To obtain the address of the first element, use @mapdata(0) instead ;-)
<<

na_th_an

Posts: 73

Joined: Fri May 07, 2010 7:34 am

Post Mon Aug 06, 2012 9:29 am

Re: aplib decompressor for ZX Basic.

Nice to know :)
<<

slenkar

Posts: 282

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Mon Aug 06, 2012 7:11 pm

Re: aplib decompressor for ZX Basic.

na_th_an wrote:
slenkar wrote:thanks for the explanation,

how is @mapdata first defined? is it an array,a memory address?


"mapdata" is a label, look at the code. It marks a "spot" in memory. Just afterwards, you have an "asm - end asm" block which includes a defs "command" which is just defining 2400 zeroes.

So @mapdata is the address of such space with 2400 zeroes where compressed maps will decompress in my example. Think of it like an unsigned byte array:

  Code:
Dim mapdata (2399) as uByte


I think that would be exactly the same thing.



this will be useful for an R-Type or double dragon game with lots of scrolling background graphics
<<

britlion

Posts: 762

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Mon Aug 06, 2012 9:43 pm

Re: aplib decompressor for ZX Basic.

I did some tests. Aplib is slightly better at compression than MegaLZ. On average. Not always - text seems to be a weakness, with MegaLZ winning for one of my text tests.

The difference is very thin, however. How big is the decompressor in bytes, is the next question. Compared to MegaLZ. If it's the same size or smaller, Aplib is probably always the right choice. If it's bigger...you've got a dilemma :)
<<

boriel

Site Admin

Posts: 1461

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Mon Aug 06, 2012 10:20 pm

Re: aplib decompressor for ZX Basic.

britlion wrote:I did some tests. Aplib is slightly better at compression than MegaLZ. On average. Not always - text seems to be a weakness, with MegaLZ winning for one of my text tests.

The difference is very thin, however. How big is the decompressor in bytes, is the next question. Compared to MegaLZ. If it's the same size or smaller, Aplib is probably always the right choice. If it's bigger...you've got a dilemma :)

From the compiler point of view, I will include both of them. The user must then try packing the binary data with both compressors and choose the smallest result, IMHO.
<<

britlion

Posts: 762

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Tue Aug 07, 2012 9:05 am

Re: aplib decompressor for ZX Basic.

boriel wrote:
britlion wrote:I did some tests. Aplib is slightly better at compression than MegaLZ. On average. Not always - text seems to be a weakness, with MegaLZ winning for one of my text tests.

The difference is very thin, however. How big is the decompressor in bytes, is the next question. Compared to MegaLZ. If it's the same size or smaller, Aplib is probably always the right choice. If it's bigger...you've got a dilemma :)

From the compiler point of view, I will include both of them. The user must then try packing the binary data with both compressors and choose the smallest result, IMHO.


Surely if one decompressor is larger, you have to take that into account?

10 bytes smaller for data, and 100 bytes larger for decompressor isn't a win :)
<<

boriel

Site Admin

Posts: 1461

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Tue Aug 07, 2012 9:13 am

Re: aplib decompressor for ZX Basic.

britlion wrote:
boriel wrote:
britlion wrote:I did some tests. Aplib is slightly better at compression than MegaLZ. On average. Not always - text seems to be a weakness, with MegaLZ winning for one of my text tests.

The difference is very thin, however. How big is the decompressor in bytes, is the next question. Compared to MegaLZ. If it's the same size or smaller, Aplib is probably always the right choice. If it's bigger...you've got a dilemma :)

From the compiler point of view, I will include both of them. The user must then try packing the binary data with both compressors and choose the smallest result, IMHO.


Surely if one decompressor is larger, you have to take that into account?

10 bytes smaller for data, and 100 bytes larger for decompressor isn't a win :)

That's right. The programmer must keep this trade-off in mind. But I think we must left this decision on the programmer's side, and include both libraries.
<<

britlion

Posts: 762

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Thu Aug 09, 2012 12:25 pm

Re: aplib decompressor for ZX Basic.

boriel wrote:That's right. The programmer must keep this trade-off in mind. But I think we must left this decision on the programmer's side, and include both libraries.


I completely agree - I was just asking if anyone had the relative sizes of the decompressor code handy...
<<

na_th_an

Posts: 73

Joined: Fri May 07, 2010 7:34 am

Post Wed Aug 15, 2012 9:38 pm

Re: aplib decompressor for ZX Basic.

Just take the decompressing assembly, put it in an .asm file, and assemble it with pasmo :

The decompressor looks complicated. It's probably big. But it's not very slow and has always floated my boat. In combination with RAM paging it makes wonders (Maritrini is about 215K of uncompressed map data and graphics fit in less than 96K).

By the way, off-topic... I believe the graphic library we developed for Maritrini could be easily adapted to work in a ZXBasic program.
<<

britlion

Posts: 762

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Wed Aug 15, 2012 9:49 pm

Re: aplib decompressor for ZX Basic.

na_th_an wrote:Just take the decompressing assembly, put it in an .asm file, and assemble it with pasmo :


I know :-) Being completely lazy :)
<<

britlion

Posts: 762

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Fri Mar 31, 2017 8:54 pm

Re: aplib decompressor for ZX Basic.

na_th_an wrote:J

By the way, off-topic... I believe the graphic library we developed for Maritrini could be easily adapted to work in a ZXBasic program.


You know, we never heard back from na_th_an about this one. :(

We need more graphics engine type things. An easily accessible sprite library would be pretty epic.
Previous

Return to How-To & Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO