Remove _ from internal vars

This commit is contained in:
Lauri Kasanen
2017-06-09 10:37:50 +03:00
parent e85796e028
commit cd460a8160

View File

@@ -10,13 +10,13 @@
.import memcpy_upwards,pushax,popax .import memcpy_upwards,pushax,popax
.export _decompress_lz4 .export _decompress_lz4
_out = regsave out = regsave
_written = regsave + 2 written = regsave + 2
_tmp = tmp1 tmp = tmp1
_token = tmp2 token = tmp2
_offset = ptr3 offset = ptr3
_in = sreg in = sreg
_outlen = ptr4 outlen = ptr4
; --------------------------------------------------------------- ; ---------------------------------------------------------------
; void decompress_lz4 (const u8 *in, u8 * const out, const u16 outlen) ; void decompress_lz4 (const u8 *in, u8 * const out, const u16 outlen)
@@ -26,22 +26,22 @@ _outlen = ptr4
.proc _decompress_lz4: near .proc _decompress_lz4: near
sta _outlen sta outlen
stx _outlen+1 stx outlen+1
jsr popax jsr popax
sta _out sta out
stx _out+1 stx out+1
jsr popax jsr popax
sta _in sta in
stx _in+1 stx in+1
; ;
; written = 0; ; written = 0;
; ;
lda #$00 lda #$00
sta _written sta written
; ;
; while (written < outlen) { ; while (written < outlen) {
; ;
@@ -50,12 +50,12 @@ _outlen = ptr4
; token = *in++; ; token = *in++;
; ;
L0004: ldy #0 L0004: ldy #0
lda (_in),y lda (in),y
sta _token sta token
inc _in inc in
bne L000A bne L000A
inc _in+1 inc in+1
L000A: L000A:
; ;
; offset = token >> 4; ; offset = token >> 4;
@@ -65,47 +65,47 @@ L000A:
lsr a lsr a
lsr a lsr a
lsr a lsr a
sta _offset sta offset
stx _offset+1 stx offset+1
; ;
; token &= 0xf; ; token &= 0xf;
; token += 4; // Minmatch ; token += 4; // Minmatch
; ;
lda _token lda token
and #$0F and #$0F
clc clc
adc #4 adc #4
sta _token sta token
; ;
; if (offset == 15) { ; if (offset == 15) {
; ;
lda _offset lda offset
cmp #$0F cmp #$0F
L0013: bne L001A L0013: bne L001A
; ;
; tmp = *in++; ; tmp = *in++;
; ;
ldy #0 ldy #0
lda (_in),y lda (in),y
sta _tmp sta tmp
inc _in inc in
bne L0017 bne L0017
inc _in+1 inc in+1
L0017: L0017:
; ;
; offset += tmp; ; offset += tmp;
; ;
clc clc
adc _offset adc offset
sta _offset sta offset
lda #$00 lda #$00
adc _offset+1 adc offset+1
sta _offset+1 sta offset+1
; ;
; if (tmp == 255) ; if (tmp == 255)
; ;
lda _tmp lda tmp
cmp #$FF cmp #$FF
; ;
; goto moreliterals; ; goto moreliterals;
@@ -114,24 +114,24 @@ L0017:
; ;
; if (offset) { ; if (offset) {
; ;
L001A: lda _offset L001A: lda offset
ora _offset+1 ora offset+1
beq L001C beq L001C
; ;
; memcpy(&out[written], in, offset); ; memcpy(&out[written], in, offset);
; ;
lda _out lda out
clc clc
adc _written adc written
sta ptr2 sta ptr2
lda _out+1 lda out+1
adc _written+1 adc written+1
tax tax
lda ptr2 lda ptr2
stx ptr2+1 stx ptr2+1
jsr pushax jsr pushax
lda _in lda in
ldx _in+1 ldx in+1
sta ptr1 sta ptr1
stx ptr1+1 stx ptr1+1
ldy #0 ldy #0
@@ -139,30 +139,30 @@ L001A: lda _offset
; ;
; written += offset; ; written += offset;
; ;
lda _offset lda offset
clc clc
adc _written adc written
sta _written sta written
lda _offset+1 lda offset+1
adc _written+1 adc written+1
sta _written+1 sta written+1
; ;
; in += offset; ; in += offset;
; ;
lda _offset lda offset
clc clc
adc _in adc in
sta _in sta in
lda _offset+1 lda offset+1
adc _in+1 adc in+1
sta _in+1 sta in+1
; ;
; if (written >= outlen) ; if (written >= outlen)
; ;
L001C: lda _written L001C: lda written
cmp _outlen cmp outlen
lda _written+1 lda written+1
sbc _outlen+1 sbc outlen+1
; ;
; return; ; return;
; ;
@@ -172,44 +172,44 @@ L001C: lda _written
; memcpy(&offset, in, 2); ; memcpy(&offset, in, 2);
; ;
L0047: ldy #0 L0047: ldy #0
lda (_in),y lda (in),y
sta _offset sta offset
iny iny
lda (_in),y lda (in),y
sta _offset+1 sta offset+1
; ;
; in += 2; ; in += 2;
; ;
lda #$02 lda #$02
clc clc
adc _in adc in
sta _in sta in
bcc L002F bcc L002F
inc _in+1 inc in+1
; ;
; copysrc = out + written - offset; ; copysrc = out + written - offset;
; ;
L002F: lda _out L002F: lda out
clc clc
adc _written adc written
pha pha
lda _out+1 lda out+1
adc _written+1 adc written+1
tax tax
pla pla
sec sec
sbc _offset sbc offset
sta ptr1 sta ptr1
txa txa
sbc _offset+1 sbc offset+1
sta ptr1+1 sta ptr1+1
; ;
; offset = token; ; offset = token;
; ;
lda #$00 lda #$00
sta _offset+1 sta offset+1
lda _token lda token
sta _offset sta offset
; ;
; if (token == 19) { ; if (token == 19) {
; ;
@@ -219,26 +219,26 @@ L0045: bne L003C
; tmp = *in++; ; tmp = *in++;
; ;
ldy #0 ldy #0
lda (_in),y lda (in),y
sta _tmp sta tmp
inc _in inc in
bne L0039 bne L0039
inc _in+1 inc in+1
L0039: L0039:
; ;
; offset += tmp; ; offset += tmp;
; ;
clc clc
adc _offset adc offset
sta _offset sta offset
tya tya
adc _offset+1 adc offset+1
sta _offset+1 sta offset+1
; ;
; if (tmp == 255) ; if (tmp == 255)
; ;
lda _tmp lda tmp
cmp #$FF cmp #$FF
; ;
; goto morematches; ; goto morematches;
@@ -247,12 +247,12 @@ L0039:
; ;
; memcpy(&out[written], copysrc, offset); ; memcpy(&out[written], copysrc, offset);
; ;
L003C: lda _out L003C: lda out
clc clc
adc _written adc written
sta ptr2 sta ptr2
lda _out+1 lda out+1
adc _written+1 adc written+1
tax tax
lda ptr2 lda ptr2
stx ptr2+1 stx ptr2+1
@@ -261,20 +261,20 @@ L003C: lda _out
; ;
; written += offset; ; written += offset;
; ;
lda _offset lda offset
clc clc
adc _written adc written
sta _written sta written
lda _offset+1 lda offset+1
adc _written+1 adc written+1
L0046: sta _written+1 L0046: sta written+1
; ;
; while (written < outlen) { ; while (written < outlen) {
; ;
lda _written lda written
cmp _outlen cmp outlen
lda _written+1 lda written+1
sbc _outlen+1 sbc outlen+1
jcc L0004 jcc L0004
rts rts