mirror of
https://github.com/emmanuel-marty/lzsa.git
synced 2025-08-08 03:25:26 +00:00
Slight speed and space improvement to nibble processing in 6809 LZSA2 depackers
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
; unlzsa2.s - 6809 decompression routine for raw LZSA2 - 172 bytes
|
; unlzsa2.s - 6809 decompression routine for raw LZSA2 - 169 bytes
|
||||||
; compress with lzsa -f2 -r <original_file> <compressed_file>
|
; compress with lzsa -f2 -r <original_file> <compressed_file>
|
||||||
;
|
;
|
||||||
; in: x = start of compressed data
|
; in: x = start of compressed data
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
; 3. This notice may not be removed or altered from any source distribution.
|
; 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
decompress_lzsa2
|
decompress_lzsa2
|
||||||
lsr <lz2nibct,pcr ; reset nibble available flag
|
clr <lz2nibct,pcr ; reset nibble available flag
|
||||||
|
|
||||||
lz2token ldb ,x+ ; load next token into B: XYZ|LL|MMM
|
lz2token ldb ,x+ ; load next token into B: XYZ|LL|MMM
|
||||||
pshs b ; save it
|
pshs b ; save it
|
||||||
@@ -83,10 +83,9 @@ lz2offs9 deca ; set bits 9-15 of offset, reverse bit 8
|
|||||||
lz2nibct fcb $00 ; nibble ready flag
|
lz2nibct fcb $00 ; nibble ready flag
|
||||||
|
|
||||||
lz2nibl ldb #$aa
|
lz2nibl ldb #$aa
|
||||||
lsr <lz2nibct,pcr ; nibble ready?
|
com <lz2nibct,pcr ; toggle nibble ready flag and check
|
||||||
bcs lz2gotnb
|
bpl lz2gotnb
|
||||||
|
|
||||||
inc <lz2nibct,pcr ; flag nibble as ready for next time
|
|
||||||
ldb ,x+ ; load two nibbles
|
ldb ,x+ ; load two nibbles
|
||||||
stb <lz2nibl+1,pcr ; store nibble for next time (low 4 bits)
|
stb <lz2nibl+1,pcr ; store nibble for next time (low 4 bits)
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
; unlzsa2b.s - 6809 backward decompression routine for raw LZSA2 - 174 bytes
|
; unlzsa2b.s - 6809 backward decompression routine for raw LZSA2 - 171 bytes
|
||||||
; compress with lzsa -f2 -r -b <original_file> <compressed_file>
|
; compress with lzsa -f2 -r -b <original_file> <compressed_file>
|
||||||
;
|
;
|
||||||
; in: x = last byte of compressed data
|
; in: x = last byte of compressed data
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
; 3. This notice may not be removed or altered from any source distribution.
|
; 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
decompress_lzsa2
|
decompress_lzsa2
|
||||||
lsr <lz2nibct,pcr ; reset nibble available flag
|
clr <lz2nibct,pcr ; reset nibble available flag
|
||||||
leax 1,x
|
leax 1,x
|
||||||
leay 1,y
|
leay 1,y
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ lz2token ldb ,-x ; load next token into B: XYZ|LL|MMM
|
|||||||
cmpb #$12 ; LITERALS_RUN_LEN_V2 + 15 ?
|
cmpb #$12 ; LITERALS_RUN_LEN_V2 + 15 ?
|
||||||
bne lz2gotla ; if not, we have the full literals count, go copy
|
bne lz2gotla ; if not, we have the full literals count, go copy
|
||||||
|
|
||||||
addb ,-x ; add extra literals count byte + LITERALS_RUN_LEN + 15
|
addb ,-x ; add extra literals count byte + LITERALS_RUN_LEN + 15
|
||||||
bcc lz2gotla ; if no overflow, we got the complete count, copy
|
bcc lz2gotla ; if no overflow, we got the complete count, copy
|
||||||
|
|
||||||
ldd ,--x ; load 16 bit count in D (low part in B, high in A)
|
ldd ,--x ; load 16 bit count in D (low part in B, high in A)
|
||||||
@@ -77,16 +77,15 @@ lz2nolt ldb ,s ; get token again, don't pop it from the stack
|
|||||||
sex ; set bits 8-15 of offset to $FF
|
sex ; set bits 8-15 of offset to $FF
|
||||||
bra lz2gotof
|
bra lz2gotof
|
||||||
|
|
||||||
lz2offs9 deca ; set bits 9-15 of offset, reverse bit 8
|
lz2offs9 deca ; set bits 9-15 of offset, reverse bit 8
|
||||||
bra lz2lowof
|
bra lz2lowof
|
||||||
|
|
||||||
lz2nibct fcb $00 ; nibble ready flag
|
lz2nibct fcb $00 ; nibble ready flag
|
||||||
|
|
||||||
lz2nibl ldb #$aa
|
lz2nibl ldb #$aa
|
||||||
lsr <lz2nibct,pcr ; nibble ready?
|
com <lz2nibct,pcr ; toggle nibble ready flag and check
|
||||||
bcs lz2gotnb
|
bpl lz2gotnb
|
||||||
|
|
||||||
inc <lz2nibct,pcr ; flag nibble as ready for next time
|
|
||||||
ldb ,-x ; load two nibbles
|
ldb ,-x ; load two nibbles
|
||||||
stb <lz2nibl+1,pcr ; store nibble for next time (low 4 bits)
|
stb <lz2nibl+1,pcr ; store nibble for next time (low 4 bits)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user