Save 1 byte/2 cycles for fast 6502 LZSA2 depacker

This commit is contained in:
Emmanuel Marty 2020-11-07 08:41:31 +01:00 committed by GitHub
parent 7ea6b63db8
commit d85fc4e034
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,10 +114,9 @@ NO_LITERALS
BNE GOT_OFFSET_LO ; go store low byte of match offset and prepare match
OFFSET_9_BIT ; 01Z: 9 bit offset
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)