Compression. Well, sort of.
[Prev][Next][Index][Thread]
Compression. Well, sort of.
As an excercise in ASM I was thinking of writing an improved Periodic
Table-program. Now you may know, that elements are represented by symbols of
one or two characters, of which the first is a capital and the second (if
any) is not. The first character can thus have 26 different values, the
second 27, so there would be 702 possible combinations. If you do the math,
you will find that theoretically, the name of an element can be stored in as
little as 10 bits (2^9=512, 2^10=1024). This way, you can store the symbols
of all 103 elements in (103*10/8) a little less than 130 bytes, instead of
the normal (2*103) 206 bytes, a gain of about 76 bytes. Whoopy! Not too
useful, but I was wondering if this were possible. Seemed like a nice
challange.
This would involve, I think, the following twice for every element:
* Reading a word (2 bytes) from a variable adress,
* using something like 'SLA' or 'SLR' (see note) to shift the 5 bits to
where you want them,
* then AND-ing this with '0001111100000000b' (I believe this is called
'bitmasking')
* adding a constant value to the left resulting bit
* show the result as a character
Does this make any sense? Any thoughts?
(I can't try anything myself, because I don't have a cable for my TI-83 yet
and without a ROM image the emulators aren't much use, either.)
<note>
* SLA and SRL came from the Usgard Programming Lessons. There is sample code
there to shift 16-bit values. Are they 'Usgard-specific'? What exactly is
this 'Usgard', compared to just assembly? A 'Shell'. Right. What's a
'Shell'?
</note>
Have a Nice Day,
Arnout
arnout.engelen@beer.com
******************************************************************
* To UNSUBSCRIBE, send an email TO: listserv@lists.ppp.ti.com
* with a message (not the subject) that reads SIGNOFF CALC-TI
*
* Archives at http://peach.ease.lsoft.com/archives/calc-ti.html
******************************************************************