[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compressing ProDOS File Type Table



Jonathyn Bet'nct wrote:
> I'm writing a program launcher in assembly language, and I want to
> have a table of all 136 defined ProDOS file types (found at
> http://www.geocities.com/jonrelay/software/a2info/abftypes.htm) as
> part of it.
>
> To keep the program small and simple, I want to compress the table
> like BASIC.SYSTEM compresses its keywords (or at least how I _think_
> it does). For example, I can take the types AWP, WPF, PFS, FST, STN,
> TNJ, JAP, PTX, TXT, and TOL (totaling 30 bytes) and compress it into
> AWPFSTNJAPTXTOL (which is only 15 bytes).
>
> Doing this by hand, the shortest string I came up with was 277 bytes
> long. I want one that's 256 bytes or less (so I can fit it in a
> single page of memory).
>
> Here's my question: Is there a program out there that can compress
> strings this way into the shortest string possible so I don't have
> to?
>
There is something else you can do. If you won't care about speed you could take the letters (normally 8 bits), disgard the MSB and compress 8 bytes into 7.

You could also come up with a code describing the 26 letters A - Z and the numbers 0 - 9 and perform a similar compression. Looking at an ASCII table it could handle from 0 - 63 characters (with some left over) very nicely. This should compress down to about 25% of the size. You may want to consider taking the number of possible characters down to 0 - 47 and get a tighter compression but at 0 - 63 you get four characters per byte which should make uncompression easier.

				Later
				Mike



--
+----------------------------------------------------------------------+
|  Digital Civilization magazine: http://www.digitalcivilization.ca    |
|   http://members.shaw.ca/pfaiffer = Mike Pfaiffer (B.A., B.Sc.)      |
| See my web page before you think about spamming me. I charge cash.   |
+----------------------------------------------------------------------+
----- BEGIN GEEK CODE BLOCK -----
Version: 3.12
GCS/G/IT/PA/SS d s+:- a? C++ UL L++ W++ N++ o+ K- w(---) O+@ M++@ V PS+
PE !PGP t+ 5+ X R tv b+ DI+++ D++ G e++* h! r-- !y-- UF++
------ END GEEK CODE BLOCK ------