Use ACME syntax

This commit is contained in:
Emmanuel Marty 2019-07-26 12:31:26 +02:00 committed by GitHub
parent 316dfdcdce
commit ae4cc12aed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 28 deletions

View File

@ -49,10 +49,10 @@ DECODE_TOKEN
AND #$70 ; isolate literals count AND #$70 ; isolate literals count
BEQ NO_LITERALS ; skip if no literals to copy BEQ NO_LITERALS ; skip if no literals to copy
LSR A ; shift literals count into place LSR ; shift literals count into place
LSR A LSR
LSR A LSR
LSR A LSR
CMP #$07 ; LITERALS_RUN_LEN? CMP #$07 ; LITERALS_RUN_LEN?
BCC PREPARE_COPY_LITERALS ; if not, count is directly embedded in token 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 ; literals count = directly these 16 bits
JSR GETLARGESRC ; grab low 8 bits in X, high 8 bits in A JSR GETLARGESRC ; grab low 8 bits in X, high 8 bits in A
TAY ; put high 8 bits in Y TAY ; put high 8 bits in Y
BYTE $A9 ; mask TAX (faster than BCS) !byte $A9 ; mask TAX (faster than BCS)
PREPARE_COPY_LITERALS PREPARE_COPY_LITERALS
TAX TAX
BEQ COPY_LITERALS BEQ COPY_LITERALS
@ -91,7 +91,7 @@ NO_LITERALS
JSR GETSRC ; get 8 bit offset from stream in A JSR GETSRC ; get 8 bit offset from stream in A
TAX ; save for later TAX ; save for later
LDA #$0FF ; high 8 bits LDA #$FF ; high 8 bits
BNE GOT_OFFSET ; go prepare match BNE GOT_OFFSET ; go prepare match
; (*like JMP GOT_OFFSET but shorter) ; (*like JMP GOT_OFFSET but shorter)
@ -110,7 +110,7 @@ COPY_MATCH_LOOP
LDA $AAAA ; get one byte of backreference LDA $AAAA ; get one byte of backreference
JSR PUTDST ; copy to destination JSR PUTDST ; copy to destination
ifdef BACKWARD_DECOMPRESS !ifdef BACKWARD_DECOMPRESS {
; Backward decompression -- put backreference bytes backward ; Backward decompression -- put backreference bytes backward
@ -120,7 +120,7 @@ ifdef BACKWARD_DECOMPRESS
GETMATCH_DONE GETMATCH_DONE
DEC COPY_MATCH_LOOP+1 DEC COPY_MATCH_LOOP+1
else } else {
; Forward decompression -- put backreference bytes forward ; Forward decompression -- put backreference bytes forward
@ -129,7 +129,7 @@ else
INC COPY_MATCH_LOOP+2 INC COPY_MATCH_LOOP+2
GETMATCH_DONE GETMATCH_DONE
endif }
DEX DEX
BNE COPY_MATCH_LOOP BNE COPY_MATCH_LOOP
@ -142,7 +142,7 @@ GET_LONG_OFFSET ; handle 16 bit offset:
GOT_OFFSET GOT_OFFSET
ifdef BACKWARD_DECOMPRESS !ifdef BACKWARD_DECOMPRESS {
; Backward decompression - substract match offset ; Backward decompression - substract match offset
@ -160,7 +160,7 @@ OFFSHI = *+1
STA COPY_MATCH_LOOP+2 ; store high 8 bits of address STA COPY_MATCH_LOOP+2 ; store high 8 bits of address
SEC SEC
else } else {
; Forward decompression - add match offset ; Forward decompression - add match offset
@ -176,7 +176,7 @@ OFFSHI = *+1
ADC PUTDST+2 ADC PUTDST+2
STA COPY_MATCH_LOOP+2 ; store high 8 bits of address STA COPY_MATCH_LOOP+2 ; store high 8 bits of address
endif }
PLA ; retrieve token from stack again PLA ; retrieve token from stack again
AND #$0F ; isolate match len (MMMM) AND #$0F ; isolate match len (MMMM)
@ -200,7 +200,7 @@ endif
DECOMPRESSION_DONE DECOMPRESSION_DONE
RTS RTS
ifdef BACKWARD_DECOMPRESS !ifdef BACKWARD_DECOMPRESS {
; Backward decompression -- get and put bytes backward ; Backward decompression -- get and put bytes backward
@ -235,7 +235,7 @@ GETSRC_DONE
PLA PLA
RTS RTS
else } else {
; Forward decompression -- get and put bytes forward ; Forward decompression -- get and put bytes forward
@ -266,4 +266,4 @@ LZSA_SRC_HI = *+2
GETSRC_DONE GETSRC_DONE
RTS RTS
endif }

View File

@ -53,9 +53,9 @@ DECODE_TOKEN
AND #$18 ; isolate literals count (LL) AND #$18 ; isolate literals count (LL)
BEQ NO_LITERALS ; skip if no literals to copy BEQ NO_LITERALS ; skip if no literals to copy
LSR A ; shift literals count into place LSR ; shift literals count into place
LSR A LSR
LSR A LSR
CMP #$03 ; LITERALS_RUN_LEN_V2? CMP #$03 ; LITERALS_RUN_LEN_V2?
BCC PREPARE_COPY_LITERALS ; if less, count is directly embedded in token BCC PREPARE_COPY_LITERALS ; if less, count is directly embedded in token
@ -102,7 +102,7 @@ NO_LITERALS
; 00Z: 5 bit offset ; 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 JSR GETCOMBINEDBITS ; rotate Z bit into bit 0, read nibble for bits 4-1
ORA #$E0 ; set bits 7-5 to 1 ORA #$E0 ; set bits 7-5 to 1
@ -142,7 +142,7 @@ GOT_OFFSET_LO
STX OFFSHI ; store high byte of match offset STX OFFSHI ; store high byte of match offset
REP_MATCH REP_MATCH
ifdef BACKWARD_DECOMPRESS !ifdef BACKWARD_DECOMPRESS {
; Backward decompression - substract match offset ; Backward decompression - substract match offset
@ -157,7 +157,7 @@ OFFSHI = *+1
STA COPY_MATCH_LOOP+2 ; store high 8 bits of address STA COPY_MATCH_LOOP+2 ; store high 8 bits of address
SEC SEC
else } else {
; Forward decompression - add match offset ; Forward decompression - add match offset
@ -171,7 +171,7 @@ OFFSHI = *+1
ADC PUTDST+2 ADC PUTDST+2
STA COPY_MATCH_LOOP+2 ; store high 8 bits of address STA COPY_MATCH_LOOP+2 ; store high 8 bits of address
endif }
PLA ; retrieve token from stack again PLA ; retrieve token from stack again
AND #$07 ; isolate match len (MMM) AND #$07 ; isolate match len (MMM)
@ -208,7 +208,7 @@ COPY_MATCH_LOOP
LDA $AAAA ; get one byte of backreference LDA $AAAA ; get one byte of backreference
JSR PUTDST ; copy to destination JSR PUTDST ; copy to destination
ifdef BACKWARD_DECOMPRESS !ifdef BACKWARD_DECOMPRESS {
; Backward decompression -- put backreference bytes backward ; Backward decompression -- put backreference bytes backward
@ -218,7 +218,7 @@ ifdef BACKWARD_DECOMPRESS
GETMATCH_DONE GETMATCH_DONE
DEC COPY_MATCH_LOOP+1 DEC COPY_MATCH_LOOP+1
else } else {
; Forward decompression -- put backreference bytes forward ; Forward decompression -- put backreference bytes forward
@ -227,7 +227,7 @@ else
INC COPY_MATCH_LOOP+2 INC COPY_MATCH_LOOP+2
GETMATCH_DONE GETMATCH_DONE
endif }
DEX DEX
BNE COPY_MATCH_LOOP BNE COPY_MATCH_LOOP
@ -266,7 +266,7 @@ HAS_NIBBLES
AND #$0F ; isolate low 4 bits of nibble AND #$0F ; isolate low 4 bits of nibble
RTS RTS
ifdef BACKWARD_DECOMPRESS !ifdef BACKWARD_DECOMPRESS {
; Backward decompression -- get and put bytes backward ; Backward decompression -- get and put bytes backward
@ -301,7 +301,7 @@ GETSRC_DONE
PLA PLA
RTS RTS
else } else {
; Forward decompression -- get and put bytes forward ; Forward decompression -- get and put bytes forward
@ -332,4 +332,5 @@ LZSA_SRC_HI = *+2
GETSRC_DONE GETSRC_DONE
RTS RTS
endif }