From 3730f98dc438c1d921b31cea4d412ef1aca05e16 Mon Sep 17 00:00:00 2001 From: neauoire Date: Wed, 15 Nov 2023 15:12:21 -0800 Subject: [PATCH] Faster decoder --- cli/lz/ulzdec.tal | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/cli/lz/ulzdec.tal b/cli/lz/ulzdec.tal index 5eb911c..1a200ae 100644 --- a/cli/lz/ulzdec.tal +++ b/cli/lz/ulzdec.tal @@ -41,6 +41,7 @@ BRK @decode_ulz_byte ( byte -- ) DUP #80 AND ?op-dict + @op-lit ( byte -- ) #00 SWP INC2 DUP2 .File/length DEO2 @@ -48,22 +49,17 @@ BRK DUP2 .File/read DEO2 ADD2 .ptr STZ2 JMP2r + @op-dict ( byte ) #7f AND DUP #40 AND ?&dict2 - ( length ) #00 SWP #0004 ADD2 - !do-copy - + #00 SWP !do-copy &dict2 ( byte -- ) - ( hb ) - #3f AND - ( lb ) - #0001 .File/length DEO2 - ;&b .File/read DEO2 [ LIT &b $1 ] #0004 ADD2 - !do-copy + #3f AND getc @do-copy ( length* -- ) - ( offset ) ;&b .File/read DEO2 [ LIT &b $1 ] INC + ( +4 ) #0004 ADD2 + ( +1 ) getc INC #00 SWP #0000 SWP2 SUB2 .ptr LDZ2 ADD2 STH2 #0000 &l @@ -82,5 +78,6 @@ JMP2r @skey ( key buf -- proc ) OVR #21 LTH ?&eval #00 SWP sput #00 JMP2r &eval POP2 #01 JMP2r @scap ( str* -- end* ) LDAk ?&w JMP2r &w INC2 LDAk ?&w JMP2r @sput ( chr str* -- ) scap INC2k #00 ROT ROT STA STA JMP2r +@getc ( -- b ) #0001 .File/length DEO2 ;&b .File/read DEO2 [ LIT &b $1 ] JMP2r @mem