LZ4 decoder (assembler)

All 680x0 related coding posts in this section please.

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

orionfuzion
Atariator
Atariator
Posts: 28
Joined: Fri Nov 11, 2016 1:57 pm
Location: Paris, France
Contact:

Re: LZ4 decoder (assembler)

Postby orionfuzion » Mon Feb 03, 2020 11:12 pm

Cyprian wrote:which UPX do you use?


You probably missed this post: viewtopic.php?f=68&t=26825&start=25#p371256

Orion

User avatar
swapd0
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 111
Joined: Thu Dec 13, 2007 8:56 pm

Re: LZ4 decoder (assembler)

Postby swapd0 » Tue Feb 04, 2020 8:33 am

Cyprian wrote:
swapd0 wrote:I'm using the following command to pack the data files.
upx -q --nrv2b --small --data infile -ooutfile

a0 packed data
a1 destination addresss


which UPX do you use?
I've tried UPX 3.96w on Windows 10 and it shows me:

Code: Select all

>upx -q --nrv2b --small --data test.bin -otest.upx
upx: unrecognized option '--data'
Usage: upx [-123456789dlthVL] [-qvfk] [-o file] file..

I'm using 3.95 on OS-X with the patch by orionfuzion

User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 1862
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: LZ4 decoder (assembler)

Postby Cyprian » Tue Feb 04, 2020 1:01 pm

thx
Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.appspot.com/

User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 1862
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: LZ4 decoder (assembler)

Postby Cyprian » Fri Feb 07, 2020 12:44 am

Anima wrote:Hi Cyprian,

thanks for the numbers.

Here's an optimized version of the decoder. You may do some tests with it as well!? ;)

...

Profile data suggest that it gives an speed improvement of up to 18% compared to the one in the original post. It also still fits in a MC68030 cache. :D

Cheers
Sascha


Hey Sascha,

Ive used your decoder in this Lotus project. Is it ok for you?
viewtopic.php?f=3&t=38060&p=393408#p393408

I've compressed 512KB data file to 185KB with lz4_win64_v1_9_2.
Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.appspot.com/

User avatar
leonard
Moderator
Moderator
Posts: 660
Joined: Thu May 23, 2002 10:48 pm
Contact:

Re: LZ4 decoder (assembler)

Postby leonard » Fri Feb 07, 2020 1:01 pm

Anima wrote:Here are the two parts dealing with little endian values (32 Bit block length and 16 Bit match offset):


Code: Select all

    move.b  (a0)+,-(a2)
    move.b  (a0)+,-(a2)
    move.w  (a2)+,d3


Same speed but you don't need to initialize a2 and a2 buffer anymore with a7.b trick:

Code: Select all

   move.b   (a0)+,d1   ; read 16bits offset, little endian, unaligned
   move.b   (a0)+,-(a7)
   move.w   (a7)+,d3
   move.b   d1,d3


https://github.com/arnaud-carre/lz4-68k/blob/master/lz4_fastest.asm
Leonard/OXYGENE.

orionfuzion
Atariator
Atariator
Posts: 28
Joined: Fri Nov 11, 2016 1:57 pm
Location: Paris, France
Contact:

Re: LZ4 decoder (assembler)

Postby orionfuzion » Fri Feb 07, 2020 1:40 pm

Code: Select all

move.b   (a0)+,d1   ; read 16bits offset, little endian, unaligned
move.b   (a0)+,-(a7)



By curiosity I've checked if this behavior of the stack pointer ("A7 is decremented by two to maintain a word-aligned stack") exists on all 680x0 processors.
680x0 User's Manuals describe this behavior for the 68000-68030 processors, but nothing for the 68060.
Any idea how it behaves on a 68060?

-- Orion

User avatar
shoggoth
Nature
Nature
Posts: 990
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: LZ4 decoder (assembler)

Postby shoggoth » Fri Feb 07, 2020 7:25 pm

orionfuzion wrote:By curiosity I've checked if this behavior of the stack pointer ("A7 is decremented by two to maintain a word-aligned stack") exists on all 680x0 processors.
680x0 User's Manuals describe this behavior for the 68000-68030 processors, but nothing for the 68060.
Any idea how it behaves on a 68060?

-- Orion


Behavior is the same on all "full" 68k-CPUs, 68060 included. It fails on the Coldfire, however (the CF doesn't work-align the stack when pushing/popping bytes).
Ain't no space like PeP-space.

orionfuzion
Atariator
Atariator
Posts: 28
Joined: Fri Nov 11, 2016 1:57 pm
Location: Paris, France
Contact:

Re: LZ4 decoder (assembler)

Postby orionfuzion » Fri Feb 07, 2020 8:37 pm

shoggoth wrote:Behavior is the same on all "full" 68k-CPUs, 68060 included. It fails on the Coldfire, however (the CF doesn't work-align the stack when pushing/popping bytes).

Thx! :cheers:

User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 1862
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: LZ4 decoder (assembler)

Postby Cyprian » Sun Feb 09, 2020 1:46 pm



which assembler do you use?
Devpac and VASM return a lot of errors. My guess is that due "space" before and after that "minus" sign.

VASM:

Code: Select all

error 3005: reloc type 1, size 16, mask 0xffffffff (symbol sl_sm0 + 0x18c) not supported

error 3005: reloc type 1, size 16, mask 0xffffffff (symbol sl_sm1 + 0x1d0) not supported

error 3005: reloc type 1, size 16, mask 0xffffffff (symbol sl_sm2 + 0x216) not supported

error 3005: reloc type 1, size 16, mask 0xffffffff (symbol sl_sm3 + 0x25e) not supported

Devpac:

Code: Select all

Error: relative not allowed at line 1830 in file C:\A_PROG\LZ4_TST\LZ4_FAST.S
 1830 T  00000E14 018C                         dc.w    sl_sm5+4 - lz4jmp               ; C5
Error: relative not allowed at line 1831 in file C:\A_PROG\LZ4_TST\LZ4_FAST.S
 1831 T  00000E16 01DA                         dc.w    sl_sm6+4 - lz4jmp               ; C6
Error: relative not allowed at line 1832 in file C:\A_PROG\LZ4_TST\LZ4_FAST.S
 1832 T  00000E18 022A                         dc.w    sl_sm7+4 - lz4jmp               ; C7
Error: relative not allowed at line 1833 in file C:\A_PROG\LZ4_TST\LZ4_FAST.S
 1833 T  00000E1A 027C                         dc.w    sl_sm8+4 - lz4jmp               ; C8



---EDIT---
works fine after removing that "space". Depacking time is 25% faster than Amina's one, but bigger: 3778 vs 248 bytes
Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.appspot.com/

User avatar
leonard
Moderator
Moderator
Posts: 660
Joined: Thu May 23, 2002 10:48 pm
Contact:

Re: LZ4 decoder (assembler)

Postby leonard » Thu Feb 20, 2020 8:35 pm

I did three versions ( really fast, normal, and really small ). Just pickup the right one for your need :)
https://github.com/arnaud-carre/lz4-68k

Btw I'm using as68 as assembler ( an assembler made by Ziggy Stardust & updated by Ben/Ovr )
Leonard/OXYGENE.


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 4 guests