From 9913dcf4bb77e5ef5a4a9591a915a063f07a8af6 Mon Sep 17 00:00:00 2001 From: "Peter Helcmanovsky (Ped)" Date: Mon, 19 Sep 2022 14:31:00 +0200 Subject: [PATCH] z80_unpacker: comment with possible LUT variant of updating probs value missing 512 byte table generator, which doesn't look trivial to do (especially in terms of code size). Not tested, but looks as decent speed up. --- z80_unpacker/unpack.asm | 43 +++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/z80_unpacker/unpack.asm b/z80_unpacker/unpack.asm index 300579d..e0218e9 100644 --- a/z80_unpacker/unpack.asm +++ b/z80_unpacker/unpack.asm @@ -316,6 +316,21 @@ decode_number: jr c,.fix_bit_pos ; until stop bit is reached (all bits did land to correct position) ret ; return with CF=0 (important for unpack routine) + DISPLAY "upkr.unpack total size: ",/D,$-unpack + + ; reserve space for probs array without emitting any machine code (using only EQU) + + IFDEF UPKR_PROBS_ORIGIN ; if specific address is defined by user, move probs array there +probs: EQU ((UPKR_PROBS_ORIGIN) + 255) & -$100 ; probs array aligned to 256 + ELSE +probs: EQU ($ + 255) & -$100 ; probs array aligned to 256 + ENDIF +.real_c: EQU 1 + 255 + 1 + 2*NUMBER_BITS ; real size of probs array +.c: EQU (.real_c + 1) & -2 ; padding to even size (required by init code) +.e: EQU probs + .c + + DISPLAY "upkr.unpack probs array placed at: ",/A,probs,",\tsize: ",/A,probs.c + /* archived: negligibly faster but +6B longer decode_number variant using HL' and BC' to do `number|=(1<