BY MODESTO ALVAREZ
This is an extremely useful program.
First of all; it can be used to convert numbers in certain base to another base. That process occurs between instructions 2000 and 2160.
The program as a whole does something really great; converts from base 32 into base 256; and back into 32.
Before you exclaim "that's it?" or "so what?" let me explain something: DATA FILES.
Let's say that you want to produce a disk-file (or cassette file) with 4000 long strings (records); each string being the combination of 10 or 12 substrings (fields).
Well! Under those premises each record will occupy a string with 90 or more characters in length (90+ bytes); which means that in spite of using four double density (180K) disk-drives you will be limited to around 8000 records (unless you insert another set of disks).
HERE COMES THE TRICK: If you could reduce each field of 5 characters into one of three character length; you will actually increase your storage capacity about 40%. Right? OK! Next!
ARRAYS OF STRINGS
Atari O.S. does not take the string-arrays, but if you really want to, you can go around this.
The clue is to take a normal array (actually I should say a matrix), dismember the strings into its characters, and deposit each string into each row of the matrix.
For a particular row, each column will contain the ASCII value of one character on that string. Therefore, if you want to work with twenty strings of 5 character length you will require an array of 20x5 (e.g. 20 DIM A(20,5)
HERE COMES THE OTHER TRICK: By reducing a five-character string into a three-character string, and then taking this "condensate" and converting it to decimal base; the obtained decimal value will be small enough so that it can be stored in just one cell of the array. So; you end up putting a five-character string in just one array cell. ISN'T THAT SOMETHING??
This means that if you have enough RAM memory to handle DIM (900;5) - 900 rows of 5 columns you can instead use 5400 rows - DIM(5400) - of just one column. A capacity. increase of 600%.
HOW IS IT DONE? Since the alphabet uses only 26 characters out of a total of 256 that our ASCII keyboard will tolerate, I can equate a 5-letter word into a 32-base number (26 chr. + 6 symbols = 32 or 25 a natural base) which can now be translated into a 256-base quantity requiring only three digits.