Author Topic: New cruncher ZX0  (Read 2891 times)

0 Members and 1 Guest are viewing this topic.

Offline Animalgril987

  • Supporter
  • CPC664
  • *
  • Posts: 146
  • Country: gb
  • Liked: 66
  • Likes Given: 160
Re: New cruncher ZX0
« Reply #25 on: 21:59, 02 March 21 »
. You can probably guess this from the fact that I am hanging around on a CPC forum while I am actually a ZX Spectrum guy
Boo, hiss!! Lol :D

Offline m_dr_m

  • CPC6128
  • ****
  • Posts: 195
  • Country: se
  • http://orgams.wikidot.com/
    • OrgaMS!
  • Liked: 120
  • Likes Given: 132
Re: New cruncher ZX0
« Reply #26 on: 04:51, 03 March 21 »
Wow, great job @introspec , thanks!
If I've understood well (I should say "did't read too fast"), you got your ratio for the graph as total_uncrunched/total_crunched.
That is, you concatenated all the corpus.

Offline teopl

  • CPC664
  • ***
  • Posts: 137
  • Country: cs
  • Liked: 61
  • Likes Given: 116
Re: New cruncher ZX0
« Reply #27 on: 21:28, 05 March 21 »

I just quickly added this new compressor on real project and result is:


compared to exomizer2: ZX0 saved me 318 bytes (not very much but hey :) )


If I use shrinkler I gain 625 bytes but I don't like decompression speed so I will stick with ZX0 for now.

Thanks for sharing this and of course the author!


Sizes:


EXO2:  00009F30
ZX0:   00009DF2 (-318 bytes)
SHR:   00009CBF (-625 bytes)


Offline introspec

  • CPC464
  • **
  • Posts: 27
  • Country: gb
  • Liked: 42
  • Likes Given: 10
Re: New cruncher ZX0
« Reply #28 on: 14:01, 11 March 21 »
If I've understood well (I should say "did't read too fast"), you got your ratio for the graph as total_uncrunched/total_crunched.
That is, you concatenated all the corpus.
I would be careful to use word concatenated. For my total uncompressed data - yes, I used the size of all files added together, which is the same size I would get if I was to concatenate the files. However, if I was to take such a massive concatenated file and compress it - my compressed size would become much smaller compared to the compressed size I am getting by compressing every file independently. Of course, this would not be possible, as many compressors in the test have a hard limit of 64K for the largest possible file, but this is another issues. So, overall, I would not say it is concatenated, I'd say it is just total. Also, the article shows the split for the individual file categories, so you can see the relative performance of compressors on specific types of data.

Offline eto

  • Supporter
  • CPC6128
  • *
  • Posts: 207
  • Country: de
  • Liked: 137
  • Likes Given: 115
Re: New cruncher ZX0
« Reply #29 on: 11:03, 07 May 21 »
I'm struggling to make this work from BASIC. MAybe someone can help me to understand what needs to be done here.

I must admit, I still do not know assembler, so probably this is just a newbie mistake (Assembler book is alreeady here and I started to read...). I thought it should work if I add a few lines to the code, so HL and DE are properly populated. But when I call the code, I only get garbage on screen (and it returns to BASIC) or the computer halts or resets. So clearly I am missing something.

I want to store a compressed image and then decrunch it to screen memory. Decompressor starts at &4000, compressed data is at &9200, target is &c000. In memory, the data looks like I would expect it (compared with a hex editor).


These are the lines I added to the source code from github:


Code: [Select]
org $4000


ld    hl, $9200  ; source address
ld    de, $c000  ; target address
;

I call the decompressor with "call &4000" from BASIC.

Online roudoudou

  • 6128 Plus
  • ******
  • Posts: 1.028
  • Country: fr
    • urban exploration
  • Liked: 1399
  • Likes Given: 832
Re: New cruncher ZX0
« Reply #30 on: 13:25, 07 May 21 »

i guess you need to use the AMSDOS compatible version (without AF' usage) or

Code: [Select]
DI : EX AF,AF' : PUSH AF : ... : POP AF : EX AF,AF' : EI
« Last Edit: 14:43, 07 May 21 by roudoudou »
use RASM, the best assembler ever made :p

I will survive

Offline eto

  • Supporter
  • CPC6128
  • *
  • Posts: 207
  • Country: de
  • Liked: 137
  • Likes Given: 115
Re: New cruncher ZX0
« Reply #31 on: 14:39, 07 May 21 »
i guess you need to use the AMSDOS compatible version (without AF' usage) or
Code: [Select]
DI : PUSH AF : ... : POP AF : EI

Ok, so I can't find a AMSDOS compatible version, but the hint with AF now helped (despite my lack of knowledge). Seems however that I have to preserve AF' and not AF.

this finally works:

Code: [Select]
di
ex af,af'
push af


ld    hl, &9000  ; source address (put "Cobra.scr.zx0" there)
ld    de, &c000  ; target address (screen memory in this case)


call dzx0_turbo


pop af
ex af,af'


ei
ret


thanks!

Online roudoudou

  • 6128 Plus
  • ******
  • Posts: 1.028
  • Country: fr
    • urban exploration
  • Liked: 1399
  • Likes Given: 832
Re: New cruncher ZX0
« Reply #32 on: 14:43, 07 May 21 »
oups, i forgot the EX, i edited my previous post, well done!
use RASM, the best assembler ever made :p

I will survive

Offline eto

  • Supporter
  • CPC6128
  • *
  • Posts: 207
  • Country: de
  • Liked: 137
  • Likes Given: 115
Re: New cruncher ZX0
« Reply #33 on: 16:28, 07 May 21 »
Just in case someone else needs this, here is the code to use the zx0 decruncher in BASIC:



Code: [Select]
10 SYMBOL AFTER 256
20 MEMORY &9000
30 FOR i=&A600 TO &A695: REM can be any other feasible address
40 READ p:POKE i,p
50 NEXT
60 REM source=&9000:LOAD "screen.zx0",source
70 REM target=&C000
80 REM CALL &A600,source,target
90 END
100 DATA &DD,&66,&3,&DD,&6E,&2,&DD,&56,&1,&DD,&5E,&0,&F3,&8,&F5,&CD
110 DATA &16,&A6,&F1,&8,&FB,&C9,&1,&FF,&FF,&ED,&43,&46,&A6,&3,&3E,&80
120 DATA &18,&2D,&C,&87,&C2,&2A,&A6,&7E,&23,&17,&D4,&6D,&A6,&8,&AF,&91
130 DATA &C8,&47,&8,&4E,&23,&CB,&18,&CB,&19,&ED,&43,&46,&A6,&1,&1,&0
140 DATA &D4,&6D,&A6,&3,&E5,&21,&0,&0,&19,&ED,&B0,&E1,&87,&38,&D3,&C
150 DATA &87,&C2,&57,&A6,&7E,&23,&17,&D4,&6D,&A6,&ED,&B0,&87,&38,&C3,&C
160 DATA &87,&C2,&67,&A6,&7E,&23,&17,&D4,&6D,&A6,&C3,&44,&A6,&87,&CB,&11
170 DATA &87,&30,&FA,&C0,&7E,&23,&17,&D8,&87,&CB,&11,&87,&D8,&87,&CB,&11
180 DATA &87,&D8,&87,&CB,&11,&87,&D8,&87,&CB,&11,&CB,&10,&87,&30,&F8,&C0
190 DATA &7E,&23,&17,&30,&F2,&C9