mirror of
https://github.com/emmanuel-marty/lzsa.git
synced 2024-11-22 21:32:07 +00:00
Use ACME syntax
This commit is contained in:
parent
316dfdcdce
commit
ae4cc12aed
@ -49,10 +49,10 @@ DECODE_TOKEN
|
||||
|
||||
AND #$70 ; isolate literals count
|
||||
BEQ NO_LITERALS ; skip if no literals to copy
|
||||
LSR A ; shift literals count into place
|
||||
LSR A
|
||||
LSR A
|
||||
LSR A
|
||||
LSR ; shift literals count into place
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
CMP #$07 ; LITERALS_RUN_LEN?
|
||||
BCC PREPARE_COPY_LITERALS ; if not, count is directly embedded in token
|
||||
|
||||
@ -71,7 +71,7 @@ LARGE_VARLEN_LITERALS ; handle 16 bits literals count
|
||||
; literals count = directly these 16 bits
|
||||
JSR GETLARGESRC ; grab low 8 bits in X, high 8 bits in A
|
||||
TAY ; put high 8 bits in Y
|
||||
BYTE $A9 ; mask TAX (faster than BCS)
|
||||
!byte $A9 ; mask TAX (faster than BCS)
|
||||
PREPARE_COPY_LITERALS
|
||||
TAX
|
||||
BEQ COPY_LITERALS
|
||||
@ -91,7 +91,7 @@ NO_LITERALS
|
||||
|
||||
JSR GETSRC ; get 8 bit offset from stream in A
|
||||
TAX ; save for later
|
||||
LDA #$0FF ; high 8 bits
|
||||
LDA #$FF ; high 8 bits
|
||||
BNE GOT_OFFSET ; go prepare match
|
||||
; (*like JMP GOT_OFFSET but shorter)
|
||||
|
||||
@ -110,7 +110,7 @@ COPY_MATCH_LOOP
|
||||
LDA $AAAA ; get one byte of backreference
|
||||
JSR PUTDST ; copy to destination
|
||||
|
||||
ifdef BACKWARD_DECOMPRESS
|
||||
!ifdef BACKWARD_DECOMPRESS {
|
||||
|
||||
; Backward decompression -- put backreference bytes backward
|
||||
|
||||
@ -120,7 +120,7 @@ ifdef BACKWARD_DECOMPRESS
|
||||
GETMATCH_DONE
|
||||
DEC COPY_MATCH_LOOP+1
|
||||
|
||||
else
|
||||
} else {
|
||||
|
||||
; Forward decompression -- put backreference bytes forward
|
||||
|
||||
@ -129,7 +129,7 @@ else
|
||||
INC COPY_MATCH_LOOP+2
|
||||
GETMATCH_DONE
|
||||
|
||||
endif
|
||||
}
|
||||
|
||||
DEX
|
||||
BNE COPY_MATCH_LOOP
|
||||
@ -142,7 +142,7 @@ GET_LONG_OFFSET ; handle 16 bit offset:
|
||||
|
||||
GOT_OFFSET
|
||||
|
||||
ifdef BACKWARD_DECOMPRESS
|
||||
!ifdef BACKWARD_DECOMPRESS {
|
||||
|
||||
; Backward decompression - substract match offset
|
||||
|
||||
@ -160,7 +160,7 @@ OFFSHI = *+1
|
||||
STA COPY_MATCH_LOOP+2 ; store high 8 bits of address
|
||||
SEC
|
||||
|
||||
else
|
||||
} else {
|
||||
|
||||
; Forward decompression - add match offset
|
||||
|
||||
@ -176,7 +176,7 @@ OFFSHI = *+1
|
||||
ADC PUTDST+2
|
||||
STA COPY_MATCH_LOOP+2 ; store high 8 bits of address
|
||||
|
||||
endif
|
||||
}
|
||||
|
||||
PLA ; retrieve token from stack again
|
||||
AND #$0F ; isolate match len (MMMM)
|
||||
@ -200,7 +200,7 @@ endif
|
||||
DECOMPRESSION_DONE
|
||||
RTS
|
||||
|
||||
ifdef BACKWARD_DECOMPRESS
|
||||
!ifdef BACKWARD_DECOMPRESS {
|
||||
|
||||
; Backward decompression -- get and put bytes backward
|
||||
|
||||
@ -235,7 +235,7 @@ GETSRC_DONE
|
||||
PLA
|
||||
RTS
|
||||
|
||||
else
|
||||
} else {
|
||||
|
||||
; Forward decompression -- get and put bytes forward
|
||||
|
||||
@ -266,4 +266,4 @@ LZSA_SRC_HI = *+2
|
||||
GETSRC_DONE
|
||||
RTS
|
||||
|
||||
endif
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ DECODE_TOKEN
|
||||
|
||||
AND #$18 ; isolate literals count (LL)
|
||||
BEQ NO_LITERALS ; skip if no literals to copy
|
||||
LSR A ; shift literals count into place
|
||||
LSR A
|
||||
LSR A
|
||||
LSR ; shift literals count into place
|
||||
LSR
|
||||
LSR
|
||||
CMP #$03 ; LITERALS_RUN_LEN_V2?
|
||||
BCC PREPARE_COPY_LITERALS ; if less, count is directly embedded in token
|
||||
|
||||
@ -102,7 +102,7 @@ NO_LITERALS
|
||||
|
||||
; 00Z: 5 bit offset
|
||||
|
||||
LDX #$0FF ; set offset bits 15-8 to 1
|
||||
LDX #$FF ; set offset bits 15-8 to 1
|
||||
|
||||
JSR GETCOMBINEDBITS ; rotate Z bit into bit 0, read nibble for bits 4-1
|
||||
ORA #$E0 ; set bits 7-5 to 1
|
||||
@ -142,7 +142,7 @@ GOT_OFFSET_LO
|
||||
STX OFFSHI ; store high byte of match offset
|
||||
|
||||
REP_MATCH
|
||||
ifdef BACKWARD_DECOMPRESS
|
||||
!ifdef BACKWARD_DECOMPRESS {
|
||||
|
||||
; Backward decompression - substract match offset
|
||||
|
||||
@ -157,7 +157,7 @@ OFFSHI = *+1
|
||||
STA COPY_MATCH_LOOP+2 ; store high 8 bits of address
|
||||
SEC
|
||||
|
||||
else
|
||||
} else {
|
||||
|
||||
; Forward decompression - add match offset
|
||||
|
||||
@ -171,7 +171,7 @@ OFFSHI = *+1
|
||||
ADC PUTDST+2
|
||||
STA COPY_MATCH_LOOP+2 ; store high 8 bits of address
|
||||
|
||||
endif
|
||||
}
|
||||
|
||||
PLA ; retrieve token from stack again
|
||||
AND #$07 ; isolate match len (MMM)
|
||||
@ -208,7 +208,7 @@ COPY_MATCH_LOOP
|
||||
LDA $AAAA ; get one byte of backreference
|
||||
JSR PUTDST ; copy to destination
|
||||
|
||||
ifdef BACKWARD_DECOMPRESS
|
||||
!ifdef BACKWARD_DECOMPRESS {
|
||||
|
||||
; Backward decompression -- put backreference bytes backward
|
||||
|
||||
@ -218,7 +218,7 @@ ifdef BACKWARD_DECOMPRESS
|
||||
GETMATCH_DONE
|
||||
DEC COPY_MATCH_LOOP+1
|
||||
|
||||
else
|
||||
} else {
|
||||
|
||||
; Forward decompression -- put backreference bytes forward
|
||||
|
||||
@ -227,7 +227,7 @@ else
|
||||
INC COPY_MATCH_LOOP+2
|
||||
GETMATCH_DONE
|
||||
|
||||
endif
|
||||
}
|
||||
|
||||
DEX
|
||||
BNE COPY_MATCH_LOOP
|
||||
@ -266,7 +266,7 @@ HAS_NIBBLES
|
||||
AND #$0F ; isolate low 4 bits of nibble
|
||||
RTS
|
||||
|
||||
ifdef BACKWARD_DECOMPRESS
|
||||
!ifdef BACKWARD_DECOMPRESS {
|
||||
|
||||
; Backward decompression -- get and put bytes backward
|
||||
|
||||
@ -301,7 +301,7 @@ GETSRC_DONE
|
||||
PLA
|
||||
RTS
|
||||
|
||||
else
|
||||
} else {
|
||||
|
||||
; Forward decompression -- get and put bytes forward
|
||||
|
||||
@ -332,4 +332,5 @@ LZSA_SRC_HI = *+2
|
||||
GETSRC_DONE
|
||||
RTS
|
||||
|
||||
endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user