From 4d68a8b59817a70922c9818ef208a57838961129 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 21 Feb 2016 22:11:22 -0500 Subject: more text compression, 7054 bytes free --- textcomp.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'textcomp.c') diff --git a/textcomp.c b/textcomp.c index 1ff769f..bb0b4c0 100644 --- a/textcomp.c +++ b/textcomp.c @@ -4,7 +4,28 @@ Example: "Taipan" (7 bytes, including null terminator) encodes as 0xb8 0x12 0x50 0x04 0xe0 0x00 (6 bytes). - Longer strings approach 75% compression ratio. + Longer strings approach 75% compression ratio. Sadly, the result + has to be padded to an 8-bit byte boundary, or else we'd get 75% + for every string. + + Input length | Encoded length | Ratio + (incl. null) | | + 2 | 2 | 100%, don't bother + 3 | 3 | 100%, don't bother + 4 | 3 | 75% + 5 | 4 | 80% + 6 | 5 | 83% + 7 | 6 | 86% + 8 | 6 | 75% + 9 | 7 | 78% + 10 | 8 | 80% + 11 | 9 | 82% + 12 | 9 | 75% + 13 | 10 | 77% + 14 | 11 | 79% + 15 | 12 | 80% + 16 | 12 | 75% + ...etc etc No encoded string can be over 256 bytes long, as the decompressor can't currently handle it. @@ -38,6 +59,8 @@ print an encoded message. The decoding step slows down printing a bit, but it's not really noticeable. cputc() is used for printing, so it respects the reverse video setting (set by rvs_on() and rvs_off()). + The task of replacing cputs("some string") with print_msg(M_some_string) + is done manually. When a newline is printed, the decoder always prints a carriage return first. Any \r sequences listed in messages.pl are discarded -- cgit v1.2.3