Eagle Posted February 8, 2022 Share Posted February 8, 2022 Level compressed ZX0 - 682 bytes Depacking only 6 frames! ? 10 bytes on Zero Page (you can move 4 bytes to ram) ASM tested 100% ? Code by @xxl https://xxl.atari.pl/zx0-decompressor/ @mksmith let me know if it works rem unpack compressed data asm SET_POINTER ZX0_INPUT,Level11CompressedMapData SET_POINTER ZX0_OUTPUT,MAPSCREENRAM jsr dzx0_standard end ZX0_OUTPUT equ a copysrc equ ZX0_Output+2 ZX0_INPUT equ copysrc+2 offsetL equ ZX0_INPUT+2 offsetH equ offsetL+1 LenL equ offsetH+1 LenH equ LenL+1 dzx0_standard lda #$ff sta offsetL sta offsetH ldy #$00 sty lenL sty lenH lda #$80 dzx0s_literals jsr dzx0s_elias pha cop0 jsr get_byte ldy #$00 sta (ZX0_OUTPUT),y inc ZX0_OUTPUT bne skip inc ZX0_OUTPUT+1 skip lda lenL bne Label1 dec lenH Label1 dec lenL bne cop0 lda lenH bne cop0 pla asl @ bcs dzx0s_new_offset jsr dzx0s_elias dzx0s_copy pha lda ZX0_OUTPUT clc adc offsetL sta copysrc lda ZX0_OUTPUT+1 adc offsetH sta copysrc+1 ldy #$00 ldx lenH beq Remainder Page lda (copysrc),y sta (ZX0_OUTPUT),y iny bne Page inc copysrc+1 inc ZX0_OUTPUT+1 dex bne Page Remainder ldx lenL beq copyDone copyByte lda (copysrc),y sta (ZX0_OUTPUT),y iny dex bne copyByte tya clc adc ZX0_OUTPUT sta ZX0_OUTPUT bcc copyDone inc ZX0_OUTPUT+1 copyDone stx lenH stx lenL pla asl @ bcc dzx0s_literals dzx0s_new_offset ldx #$fe stx lenL jsr dzx0s_elias_loop pha php ; stream ldx lenL inx stx offsetH bne Label2 plp ; stream pla rts ; koniec Label2 jsr get_byte plp ; stream sta offsetL ror offsetH ror offsetL ldx #$00 stx lenH inx stx lenL pla bcs Label3 jsr dzx0s_elias_backtrack Label3 inc lenL bne Label4 inc lenH Label4 jmp dzx0s_copy dzx0s_elias inc lenL dzx0s_elias_loop asl @ bne dzx0s_elias_skip jsr get_byte sec ; stream rol @ dzx0s_elias_skip bcc dzx0s_elias_backtrack rts dzx0s_elias_backtrack asl @ rol lenL rol lenH jmp dzx0s_elias_loop GET_BYTE ldy #$00 lda (ZX0_INPUT),y inc ZX0_INPUT bne g_b1 inc ZX0_INPUT+1 g_b1 rts Level11Map.binary.zx0 Quote Link to comment Share on other sites More sharing options...
xxl Posted February 9, 2022 Share Posted February 9, 2022 ZX5 also gives very good results (sometimes surprising), also PackFire (tiny) is worth checking - in general it is worth checking different compressors depending on your data. 2 hours ago, Eagle said: Level compressed ZX0 - 682 bytes ZX5 - 678 ( https://xxl.atari.pl/zx5-decompressor/ ) PackFire - 646 ( https://xxl.atari.pl/packfire-decompressor/ ) 1 1 Quote Link to comment Share on other sites More sharing options...
+mksmith Posted February 9, 2022 Author Share Posted February 9, 2022 Thanks @xxl! Will be great to have a few options for the community to choose from based on the needs of each projects. @Eagle will get to this as soon as I have some time!! 2 Quote Link to comment Share on other sites More sharing options...
+mksmith Posted February 14, 2022 Author Share Posted February 14, 2022 Hi all, Thanks again to @Eagle, find attached the ZX0 compression example! scrollingmap_ZX0.zip 4 Quote Link to comment Share on other sites More sharing options...
+mksmith Posted February 14, 2022 Author Share Posted February 14, 2022 I've done a full cleanup and added a combined file in the first post. Contains LZ4, ZX0 and ZX7 examples. 1 1 Quote Link to comment Share on other sites More sharing options...
Eagle Posted February 14, 2022 Share Posted February 14, 2022 Thanks @mksmith So I can assume that we’re going in the right direction Will adapt 5-6 more soon. 1 1 Quote Link to comment Share on other sites More sharing options...
RevEng Posted April 5, 2022 Share Posted April 5, 2022 Heads up that I've released lz4raw, which is essentially a recreation of @playsoft's hacked lz4 encoder. (which skips LZ4 headers and just produces raw compressed data output) I wanted to have OS binaries for each of the OS platforms supported under 7800basic, so I can distribute it in a future release of 7800basic. 6 Quote Link to comment Share on other sites More sharing options...
+mksmith Posted April 5, 2022 Author Share Posted April 5, 2022 3 hours ago, RevEng said: Heads up that I've released lz4raw, which is essentially a recreation of @playsoft's hacked lz4 encoder. (which skips LZ4 headers and just produces raw compressed data output) I wanted to have OS binaries for each of the OS platforms supported under 7800basic, so I can distribute it in a future release of 7800basic. Awesome thanks Mike ??? 1 Quote Link to comment Share on other sites More sharing options...
+karri Posted April 6, 2022 Share Posted April 6, 2022 Is this the same compression used by Lemmings levels in the old times? At least tge Lynx version of Lemmings used compression. Quote Link to comment Share on other sites More sharing options...
RevEng Posted April 6, 2022 Share Posted April 6, 2022 Nope. LZ4 dates back to 2011, and it looks like Lemmings on the Lynx was from 1993. Quote Link to comment Share on other sites More sharing options...
Ecernosoft Posted June 11, 2022 Share Posted June 11, 2022 So cool! I also have my own routine. Go check it out! 1 Quote Link to comment Share on other sites More sharing options...
Ecernosoft Posted June 12, 2022 Share Posted June 12, 2022 OMG i'm late! Sorry for being a slowpoke. ? 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.