mirror of
https://github.com/emmanuel-marty/lzsa.git
synced 2025-02-05 21:35:30 +00:00
Save 1 byte/2 cycles for small 6502 LZSA2 depacker
This commit is contained in:
parent
b98f8410fe
commit
7ea6b63db8
@ -114,7 +114,6 @@ NO_LITERALS
|
||||
BNE GOT_OFFSET_LO ; go store low byte of match offset and prepare match
|
||||
|
||||
OFFSET_9_BIT ; 01Z: 9 bit offset
|
||||
;;ASL ; shift Z (offset bit 8) in place
|
||||
ROL
|
||||
ROL
|
||||
AND #$01
|
||||
@ -134,7 +133,6 @@ REPMATCH_OR_LARGE_OFFSET
|
||||
; (*same as JMP GOT_OFFSET_HI but shorter)
|
||||
|
||||
REPMATCH_OR_16_BIT ; rep-match or 16 bit offset
|
||||
;;ASL ; XYZ=111?
|
||||
BMI REP_MATCH ; reuse previous offset if so (rep-match)
|
||||
|
||||
; 110: handle 16 bit offset
|
||||
@ -259,7 +257,6 @@ GETCOMBINEDBITS
|
||||
|
||||
JSR GETNIBBLE ; get nibble into bits 0-3 (for offset bits 1-4)
|
||||
PLP ; merge Z bit as the carry bit (for offset bit 0)
|
||||
COMBINEDBITZ
|
||||
ROL ; nibble -> bits 1-4; carry(!Z bit) -> bit 0 ; carry cleared
|
||||
DECOMPRESSION_DONE
|
||||
RTS
|
||||
|
@ -109,11 +109,9 @@ NO_LITERALS
|
||||
BNE GOT_OFFSET_LO ; go store low byte of match offset and prepare match
|
||||
|
||||
OFFSET_9_BIT ; 01Z: 9 bit offset
|
||||
;;ASL ; shift Z (offset bit 8) in place
|
||||
ROL
|
||||
ROL
|
||||
AND #$01
|
||||
EOR #$FF ; set offset bits 15-9 to 1
|
||||
ROL ; carry: Z bit; A: xxxxxxx1 (carry known set from BCS OFFSET_9_BIT)
|
||||
ADC #$00 ; if Z bit is set, add 1 to A (bit 0 of A is now 0), otherwise bit 0 is 1
|
||||
ORA #$FE ; set offset bits 15-9 to 1. reversed Z is already in bit 0
|
||||
BNE GOT_OFFSET_HI ; go store high byte, read low byte of match offset and prepare match
|
||||
; (*same as JMP GOT_OFFSET_HI but shorter)
|
||||
|
||||
@ -129,7 +127,6 @@ REPMATCH_OR_LARGE_OFFSET
|
||||
; (*same as JMP GOT_OFFSET_HI but shorter)
|
||||
|
||||
REPMATCH_OR_16_BIT ; rep-match or 16 bit offset
|
||||
;;ASL ; XYZ=111?
|
||||
BMI REP_MATCH ; reuse previous offset if so (rep-match)
|
||||
|
||||
; 110: handle 16 bit offset
|
||||
@ -242,7 +239,6 @@ GETCOMBINEDBITS
|
||||
|
||||
JSR GETNIBBLE ; get nibble into bits 0-3 (for offset bits 1-4)
|
||||
PLP ; merge Z bit as the carry bit (for offset bit 0)
|
||||
COMBINEDBITZ
|
||||
ROL ; nibble -> bits 1-4; carry(!Z bit) -> bit 0 ; carry cleared
|
||||
DECOMPRESSION_DONE
|
||||
RTS
|
||||
|
Loading…
x
Reference in New Issue
Block a user