From 4b046625e63056431c9b43a314af9fb2cde5e572 Mon Sep 17 00:00:00 2001 From: John Brandwood Date: Mon, 22 Nov 2021 17:02:37 -0500 Subject: [PATCH] Fix reorganized 6502 decompress_faster. Approx 3-4% faster, LZSA2 adds 1 byte. --- asm/6502/decompress_faster_v1.asm | 221 +++++++++++++++--------------- asm/6502/decompress_faster_v2.asm | 103 +++++++------- 2 files changed, 159 insertions(+), 165 deletions(-) diff --git a/asm/6502/decompress_faster_v1.asm b/asm/6502/decompress_faster_v1.asm index 2e29c5d..a130571 100644 --- a/asm/6502/decompress_faster_v1.asm +++ b/asm/6502/decompress_faster_v1.asm @@ -7,7 +7,7 @@ ; ; This code is written for the ACME assembler. ; -; The code is 167 bytes for the small version, and 192 bytes for the normal. +; The code is 165 bytes for the small version, and 191 bytes for the normal. ; ; Copyright John Brandwood 2021. ; @@ -37,15 +37,16 @@ LZSA_SMALL_SIZE = 0 ; *************************************************************************** ; *************************************************************************** ; -; Data usage is last 8 bytes of zero-page. +; Data usage is last 7 bytes of zero-page. ; -lzsa_length = $F8 ; 1 byte. lzsa_cmdbuf = $F9 ; 1 byte. lzsa_winptr = $FA ; 1 word. lzsa_srcptr = $FC ; 1 word. lzsa_dstptr = $FE ; 1 word. +lzsa_offset = lzsa_winptr + LZSA_SRC_LO = $FC LZSA_SRC_HI = $FD LZSA_DST_LO = $FE @@ -60,7 +61,6 @@ LZSA_DST_HI = $FF ; ; Args: lzsa_srcptr = ptr to compessed data ; Args: lzsa_dstptr = ptr to output buffer -; Uses: lots! ; DECOMPRESS_LZSA1_FAST: @@ -95,19 +95,14 @@ lzsa1_unpack: ldy #0 ; Initialize source index. lsr lsr cmp #$07 ; Extended length? - bcc .inc_cp_len + bcc .cp_got_len - jsr .get_length ; CS from CMP, X=0. + jsr .get_length ; X=0, CS from CMP, returns CC. + stx .cp_npages + 1 ; Hi-byte of length. - ora #0 ; Check the lo-byte of length - beq .put_cp_len ; without effecting CC. +.cp_got_len: tax ; Lo-byte of length. -.inc_cp_len: inx ; Increment # of pages to copy. - -.put_cp_len: stx