Re-tune LZSS since it now has to handle a longer run of 0s in the hires screen
authorNick Downing <nick@ndcode.org>
Fri, 17 Jun 2022 13:15:50 +0000 (23:15 +1000)
committerNick Downing <nick@ndcode.org>
Fri, 17 Jun 2022 13:17:00 +0000 (23:17 +1000)
loader/lzss_decode.py
loader/lzss_encode.py
loader/lzss_loader.asm

index 32d1793..edadba8 100755 (executable)
@@ -10,8 +10,8 @@ DIST_BITS0 = 7
 LEN_BITS0 = 1
 
 # long (16-bit) pointer
-DIST_BITS1 = 11
-LEN_BITS1 = 5
+DIST_BITS1 = 10
+LEN_BITS1 = 6
 
 MAX_DIST = (1 << DIST_BITS1) # distance codes are 1..MAX_DIST
 MAX_LEN = (1 << LEN_BITS1) + 1 # length codes are 2..MAX_LEN
@@ -107,7 +107,7 @@ while True:
   else:
     #print('a', lzss[-1])
     bin.append(lzss.pop())
-assert len(lzss) == 0xb4
+assert len(lzss) == 0xb3
 bin = bin[::-1]
 
 load_size = len(bin)
index 5e4aeda..ddea002 100755 (executable)
@@ -13,8 +13,8 @@ DIST_BITS0 = 7
 LEN_BITS0 = 1
 
 # long (16-bit) pointer
-DIST_BITS1 = 11
-LEN_BITS1 = 5
+DIST_BITS1 = 10
+LEN_BITS1 = 6
 
 MAX_DIST = (1 << DIST_BITS1) # distance codes are 1..MAX_DIST
 MAX_LEN = (1 << LEN_BITS1) + 1 # length codes are 2..MAX_LEN
@@ -29,7 +29,7 @@ out_bin = sys.argv[4]
 
 with open(lzss_loader_bin, 'rb') as fin:
   lzss_loader = list(fin.read())
-assert len(lzss_loader) == 0xb4
+assert len(lzss_loader) == 0xb3
 
 with open(in_bin, 'rb') as fin:
   data = list(fin.read())
index 2c525e7..f78c5f9 100644 (file)
@@ -112,9 +112,9 @@ short_or_long_pointer:
        bcc     pointer
 
 long_pointer:
-       ; high of long pointer, lllllddd
+       ; high of long pointer, lllllldd
        tax
-       and     #7
+       and     #3
        sta     dist + 1
 
        lda     src
@@ -128,7 +128,6 @@ long_pointer:
        txa
        lsr     a
        lsr     a
-       lsr     a
        tay
 
 pointer: ; dist set up, y = len - 2