diff --git a/asm_routines/lz4_decode.s b/asm_routines/lz4_decode.s new file mode 100644 index 00000000..75b314f9 --- /dev/null +++ b/asm_routines/lz4_decode.s @@ -0,0 +1,174 @@ +; LZ4 data decompressor for Apple II +; Based heavily on code by Peter Ferrie (peter.ferrie@gmail.com) + +; For LZ4 reference see +; https://github.com/lz4/lz4/wiki/lz4_Frame_format.md + +src EQU $00 +dst EQU $02 +end EQU $04 +count EQU $06 +delta EQU $08 +A1L EQU $3c +A1H EQU $3d +A2L EQU $3e +A2H EQU $3f +A4L EQU $42 +A4H EQU $43 + +size EQU 794 +orgoff EQU $8000 ; offset of first unpacked byte +paksize EQU size-$b-8 ; minus 4 for checksum at end + ; not sure what other 4 is from? + ; block checksum? though had that disabled? + + ; size of packed data +pakoff EQU $200b ; 11 byte offset to data? + + +lz4_unpack: + lda #pakoff + sta src+1 + lda #>(pakoff+paksize) + sta end+1 + lda #>orgoff ; original unpacked data offset + sta dst+1 + lda #