aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-25 17:37:18 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-25 17:37:18 -0500
commit3da4662976b697f203498b79e46e85ae8df01981 (patch)
treecdccc7bccfa6efddcc8e6a250dc471a57d09ad98
parent9dc7267a351b79ac5b855e812520362f28922341 (diff)
downloadtaipan-3da4662976b697f203498b79e46e85ae8df01981.tar.gz
dictionary now full, 7678 bytes free
-rw-r--r--messages.pl11
-rw-r--r--textdecomp.s14
2 files changed, 21 insertions, 4 deletions
diff --git a/messages.pl b/messages.pl
index d225d17..fe94a35 100644
--- a/messages.pl
+++ b/messages.pl
@@ -8,7 +8,13 @@
open my $t, "<textdecomp.s" or die $!;
while(<$t>) {
next unless /^dict(\d\d):.*;\s*"([^"]*)"/;
- my $value = 'Z' . chr($1 + 96);
+ my $id = $1;
+ if($id < 27) {
+ $id = chr($id + 96);
+ } else {
+ $id = chr($id - 27 + 65);
+ }
+ my $value = 'Z' . $id;
my $key = quotemeta $2;
$dictionary{$key} = $value;
}
@@ -37,12 +43,13 @@ while(<DATA>) {
$total_in += (1 + length);
my $dict_used = 0;
- for my $dk (keys %dictionary) {
+ for my $dk (sort { length $b <=> length $a } keys %dictionary) {
if(s/$dk/$dictionary{$dk}/g) {
$dict_used = 1;
}
}
+ #warn "'$_'\n" if $label eq 'do_you_want';
open my $out, ">msg.out" or die $!;
print $out $_;
close $out;
diff --git a/textdecomp.s b/textdecomp.s
index da0206a..617ba2f 100644
--- a/textdecomp.s
+++ b/textdecomp.s
@@ -47,7 +47,11 @@ dict23: .byte $b8, $12, $50, $04, $e0, $00 ; "Taipan", 3 (but really many more!)
dict24: .byte $d4, $f3, $8c, $67, $50 ; " only ", 3
dict25: .byte $d4, $25, $47, $1c, $54, $93, $00 ; " buggers", 3
dict26: .byte $5c, $95, $08, $d4, $00 ; "with ", 4
-;dict27: .byte $78, $fd, $40 ; "Do ", 4
+dict27: .byte $d4, $64, $8f, $37, $50, $00 ; " from ", 3
+dict28: .byte $d5, $70, $4e, $50, $00 ; " want"
+dict29: .byte $5c, $f4, $94, $20, $93, $85, $4d, $30, $00 ; "worthiness"
+dict30: .byte $d4, $d5, $43, $20, $00 ; " much"
+dict31: .byte $10, $91, $86, $15, $21, $4e, $0c, $50, $00 ; "difference"
dict_offsets:
.byte dict00 - dict00
@@ -77,7 +81,11 @@ dict_offsets:
.byte dict24 - dict00
.byte dict25 - dict00
.byte dict26 - dict00
- ;.byte dict27 - dict00
+ .byte dict27 - dict00
+ .byte dict28 - dict00
+ .byte dict29 - dict00
+ .byte dict30 - dict00
+ .byte dict31 - dict00
; rough estimate of how many bytes are saved by the dictionary
; stuff: the dictionary + extra decoder stuff costs 221 bytes (vs.
@@ -85,6 +93,8 @@ dict_offsets:
; each dictionary entry saves (length - 2) * (occurrences - 1) bytes.
; with only dict00 - dict23, we'll save around 173 bytes.
; actually it works out to 179 bytes, but the estimate was close.
+; we've reached the point of diminishing returns: dict00 - dict31 only
+; saves 200 bytes.
dictsize = * - dict00
.out .sprintf("dictionary plus dict_offsets is %d bytes", dictsize)