; with slight modifications by Krill/Plush .FEATURE labels_without_colons, leading_dot_in_identifiers decompress = .loadcomp_entry decompsrc = lzsa_srcptr .if MEM_DECOMP_TO_API ; cannot copy remaining uncompressed blob of unknown size .error "***** MEM_DECOMP_TO_API is not supported for LZSA2. Copy compressed data to original location, then use MEM_DECOMP_API to decompress in-place. *****" .endif BITFIRE_ZP_ADDR = DECOMPVARS - 1 .define asr alr lzsa2_get_byte: lda (lzsa_srcptr),y ;Subroutine version for when inc no literal, continue with match cmp #$03 ;Extended length? bne .got_cp_len ;1..2 jsr .get_length ;x is set by .get_length beq .put_cp_len .got_cp_len inx ;Increment # of pages to copy. .put_cp_len stx fetch a lowbyte ;9 bit fetch a bit ;16 -> fetch a highbyte ;rep, skip all .lz_offset lda $ff/$fe rol bne .get_low8 ;BRA .get_5_13_bits sta adc #$0f sta $10 + lzsa_tmp .got_length ;Z-flag is set rts ;lengths. .byte_length jsr lzsa2_get_byte ;So rare, this can be slow! clc ;adc #$0f + 0 adc 10101010 -> first nibble = and #$55, second nibble = asr #$aa? lzsa2_get_nibble lsr