Author Topic: modified Shrinkler without parity context  (Read 773 times)

0 Members and 1 Guest are viewing this topic.

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 850
  • Country: fr
    • urban exploration
  • Liked: 1154
  • Likes Given: 689
modified Shrinkler without parity context
« on: 16:28, 14 May 20 »
Hi
I modified Shrinkler v4.6 to avoid using parity context because Z80 is not a 68000
You may expect approx 0.5% gain on the total
New executables for Linux64 / Win32 / Win64
New decrunch routine a little smaller 202 bytes
Enjoy  ;)

use RASM, the best assembler ever made :p

I will survive

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.870
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 849
  • Likes Given: 2103
Re: modified Shrinkler without parity context
« Reply #1 on: 17:34, 14 May 20 »
@roudoudou : Thank you very much! Awesome!!  :) :) :)
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)

Offline teopl

  • CPC664
  • ***
  • Posts: 111
  • Country: cs
  • Liked: 45
  • Likes Given: 95
Re: modified Shrinkler without parity context
« Reply #2 on: 21:00, 14 May 20 »
Thanks, I always wanted to try this compressor.

I am interested in greater compression and decompression speed is not relevant (as long as it's not in seconds).

I see there are several options for the compressor - does someone have some optimal settings for compression of some standard amstrad game assets (1-2K of graphics, song, texts, levels...)?

Or maybe default one is ok?

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 850
  • Country: fr
    • urban exploration
  • Liked: 1154
  • Likes Given: 689
Re: modified Shrinkler without parity context
« Reply #3 on: 00:36, 15 May 20 »
I see there are several options for the compressor - does someone have some optimal settings for compression of some standard amstrad game assets (1-2K of graphics, song, texts, levels...)?
use " -d -9 " for raw data and maximum compression, everything else is useless for us. Option  " -p " to avoid shittext with windows


use RASM, the best assembler ever made :p

I will survive

Offline teopl

  • CPC664
  • ***
  • Posts: 111
  • Country: cs
  • Liked: 45
  • Likes Given: 95
Re: modified Shrinkler without parity context
« Reply #4 on: 20:49, 15 May 20 »
I have trouble converting this z80 decompressor to SDCC compatible asm.

I used Arkos2 Disark tool and compiled it but the cpc crashed when decompressing and now I am not sure if the source is not coverted ok or I am making another error.

Does someone have a SDCC compatible asm?

Ideally I would like to call it like this: (please correct me if I am doing it wrong...)

Code: [Select]
void decompress(u8* source, u8* target) __z88dk_callee __naked {

    __asm

        pop af

        pop ix
        pop de

        push af

        call SHRINKLER_DECRUNCH

        ret

    __endasm;
}


Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.120
  • Country: fr
  • Liked: 1054
  • Likes Given: 153
Re: modified Shrinkler without parity context
« Reply #5 on: 22:09, 15 May 20 »
Mmmh, it is normal that you don't POP the register that you PUSHed???
I don't know what the three first POP are doing here, maybe something related to how to retrieve parameter from C?

Anyway, a PUSH af / CALL / RET will crash for sure. At least, a POP AF must be done before the RET.
Targhan/Arkos

Arkos Tracker 2 - alpha 9 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Offline teopl

  • CPC664
  • ***
  • Posts: 111
  • Country: cs
  • Liked: 45
  • Likes Given: 95
Re: modified Shrinkler without parity context
« Reply #6 on: 22:34, 15 May 20 »
If I understand correctly, the ret address must be last on stack when you leave __z88dk_callee function, the other similar functions work fine this way.

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.120
  • Country: fr
  • Liked: 1054
  • Likes Given: 153
Re: modified Shrinkler without parity context
« Reply #7 on: 23:07, 15 May 20 »
I don't know how Z88DK works. But when I see non-symmetrical PUSH/POP, I hear a huge WARNING alarm in my head.
Targhan/Arkos

Arkos Tracker 2 - alpha 9 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Offline m_dr_m

  • CPC664
  • ***
  • Posts: 75
  • Country: se
  • http://orgams.wikidot.com/
    • OrgaMS!
  • Liked: 60
  • Likes Given: 34
Re: modified Shrinkler without parity context
« Reply #8 on: 11:00, 16 May 20 »
I guess the first pop af is the ret address, so it's properly pushed back once the registers have been picked.

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 600
  • Country: fr
  • Liked: 484
  • Likes Given: 1041
Re: modified Shrinkler without parity context
« Reply #9 on: 14:57, 16 May 20 »
I am not sure to understand this part of code.
It reserved at next aligned position from end of code 0x100 + 0x400 + 0x200 (+ 0x100 ?) = 0x700 (or 0x800) Bytes ?

Code: [Select]
probs=($+256)&#FF00
;+#200: for odd context
probs_ref = probs+#400 ; one word
probs_length = probs_ref ; starts at +1
probs_offset = probs_length + #200 ; could be + #40 by changing test

That means Shrinkler needs a array of 0x800 Bytes to work ?

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 850
  • Country: fr
    • urban exploration
  • Liked: 1154
  • Likes Given: 689
Re: modified Shrinkler without parity context
« Reply #10 on: 17:00, 16 May 20 »
yep!
should probably work with #600 buffer as there is no more odd context changing probs_ref=probs+#200 (and LD H,6*...   / LD B,6 at init)
« Last Edit: 17:02, 16 May 20 by roudoudou »
use RASM, the best assembler ever made :p

I will survive

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 600
  • Country: fr
  • Liked: 484
  • Likes Given: 1041
Re: modified Shrinkler without parity context
« Reply #11 on: 21:21, 16 May 20 »
A question, is a lot of modifications to remove the mandatory aligned address for probs ? :D

SDCC ASZ80 doesn't like :
Code: [Select]
probs=($+256)&#FF00



Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 850
  • Country: fr
    • urban exploration
  • Liked: 1154
  • Likes Given: 689
Re: modified Shrinkler without parity context
« Reply #12 on: 23:56, 16 May 20 »
You may solve the issue aligning the routine then

probs=getnumber+#100
use RASM, the best assembler ever made :p

I will survive

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 600
  • Country: fr
  • Liked: 484
  • Likes Given: 1041
Re: modified Shrinkler without parity context
« Reply #13 on: 10:52, 17 May 20 »
Hi,
here a Shrinkler version for CPCTelera with an example.

Code: [Select]
void shrinklerDecrunch(const u8* source, u8* destination, u8* buffer)
- source : compressed data aligned
- destination : destination data
- buffer : free memory of 0x600-Bytes aligned

The alignment is only for speed optimisation ? With SDCC it's hard to have something aligned.

Offline teopl

  • CPC664
  • ***
  • Posts: 111
  • Country: cs
  • Liked: 45
  • Likes Given: 95
Re: modified Shrinkler without parity context
« Reply #14 on: 13:16, 17 May 20 »
@Arnaud  thanks, this worked but that 2K buffer is a little too much for me now, maybe if I organize things differently.

But the compression did free additional ~700 bytes compared to exomizer2.

And the speed is really problematic meaning it is measured in seconds :) Anyway, great to have it working and maybe use it smart some day.

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.870
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 849
  • Likes Given: 2103
Re: modified Shrinkler without parity context
« Reply #15 on: 16:03, 17 May 20 »
And the speed is really problematic meaning it is measured in seconds :) Anyway, great to have it working and maybe use it smart some day.


Could you please give an rough estimate how much seconds for a KB ?
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 600
  • Country: fr
  • Liked: 484
  • Likes Given: 1041
Re: modified Shrinkler without parity context
« Reply #16 on: 16:26, 17 May 20 »

Could you please give an rough estimate how much seconds for a KB ?

It decompress 7.5KB (17KB screen) in 34s -> 4.5 KB/s
« Last Edit: 18:39, 17 May 20 by Arnaud »

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.870
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 849
  • Likes Given: 2103
Re: modified Shrinkler without parity context
« Reply #17 on: 21:18, 17 May 20 »
Thanks a lot Arnaud, this was actually what did interest me. The time to decompress a ROM. Well 34 seconds - that's ... long.
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)