From 48f9cae8fd1c1574a311d793d1ba34130887a12f Mon Sep 17 00:00:00 2001 From: SimonM Date: Wed, 6 Jul 2016 21:01:19 +0100 Subject: [PATCH] Added unpack function to exomiser --- lib/exomiser.h.6502 | 2 ++ lib/exomiser.s.6502 | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lib/exomiser.h.6502 b/lib/exomiser.h.6502 index 5b73c76..ec03ec3 100644 --- a/lib/exomiser.h.6502 +++ b/lib/exomiser.h.6502 @@ -8,6 +8,8 @@ \\ Plus ZP vars \\ Exomiser decruncher routine installs empty NMI handler at &0d00 +\\ Compress data using: +\\ exomizer.exe raw -c -m 1024 -o \ ****************************************************************** \ * Space reserved for runtime buffers not preinitialised diff --git a/lib/exomiser.s.6502 b/lib/exomiser.s.6502 index 2517f1e..2c5e3a3 100644 --- a/lib/exomiser.s.6502 +++ b/lib/exomiser.s.6502 @@ -5,6 +5,26 @@ .exo_start +; ------------------------------------------------------------------- +; Unpack a compressed data stream previously initialized by exo_init_decruncher +; to the memory address specified in X,Y +.exo_unpack +{ + STX write_chr+1 + STY write_chr+2 + + .next_chr + JSR exo_get_decrunched_byte + BCS all_done + .write_chr STA &ffff ; **SELF-MODIFIED** + INC write_chr+1 + BNE next_chr + INC write_chr+2 + BNE next_chr + .all_done + RTS +} + ; ------------------------------------------------------------------- ; Fetch byte from an exomiser compressed data stream ; for this exo_get_crunched_byte routine to work the crunched data has to be @@ -37,6 +57,7 @@ EXO_crunch_byte_hi = exo_get_crunched_byte + 10 ; zero page locations and the decrunch tables ; no constraints on register content, however the ; decimal flag has to be #0 (it almost always is, otherwise do a cld) +; X/Y contains address of EXO crunched data stream ; ------------------------------------------------------------------- .exo_init_decruncher ; pass in address of (crunched data-1) in X,Y {