Post by VDC 8x2 on Jun 5, 2014 4:03:07 GMT
Here is some code from the old board. My decompress assembly routine.
uses lsr to parse the control byte
uses lsr to parse the control byte
source = $fc ;the data stream
target = $fe ;output memory
*=$1300
start ldy #$00 ;index
lda (source),y
jsr incsource
lsr
bcs fill ;1 to 127. 0=256
lsr
bcs copy8 ;1 to 63. 0=256
bne skip ;skip 1 to 63 bytes
rts ;zero so we exit
fill tax ;put a into x counter
lda (source),y ;get value to fill x times
@loop sta (target),y ;put value
jsr inctarget
dex
bne @loop ; not zero so contiue loop
jsr incsource ;get next source
jmp start
copy8 tax ;put a into x counter
@loop ldy #$07
@loop1 lda (source),y
sta (target),y
dey
bpl @loop1
clc ;get ready to add 9
lda target
adc #$09
sta target
lda target+1
adc #$00
sta target+1
dex
bne @loop ;not zero
clc ;clean up and add 9 to source
lda source
adc #$09
sta source
lda source+1
adc #$00
sta source+1
jmp start
skip tax ;#of bytes to skip 1 to 63
@loop lda (source),y
sta (target),y
jsr incsource
jsr inctarget
dex
bne @loop ;loop until zero
jmp start
inctarget inc target
bne @end
inc target+1
@end rts
incsource inc source
bne @end
inc source+1
@end rts