Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Xeda112358 on August 05, 2015, 10:10:09 am

Title: CatElem - Catalog Reader
Post by: Xeda112358 on August 05, 2015, 10:10:09 am
There was a request on Cemetech that I took interest in, and this is my work so far. You basically pass a number into the program, and it returns the nth catalog element. So 1:Asm(prgmCATELEM would return "abs(" as an example. If you pass 0 into it, it returns how many catalog elements there are.

Before you can use prgmCATELEM for it's intended purpose, you must run it once, and it will set itself up for your specific OS.
Suggestion: If you are going to use prgmCATELEM in a program that you want to release into the wild, provide a fresh prgmCATELEM, not the version on your calculator. Further, you should run it once at the start of your program to install, just in case the user of your program didn't run the installation step.

There are definitely issues with how prgmCESETUP searches for the catalog table. It assumes that the catalog will not have its first 4 bytes split on two pages and it assumes that catalog starts with "abs(" and then " and ". It also assumes that the catalog end is on the same page and ends with "?".
Title: Re: CatElem - Catalog Reader
Post by: Sorunome on August 05, 2015, 02:33:42 pm
so basically the token is returned as a string?
Title: Re: CatElem - Catalog Reader
Post by: Xeda112358 on August 06, 2015, 08:17:41 am
Yup ^~^ It might be useful if you need to give the user a list of tokens, I dunno. It was still a pain to program XD
Title: Re: CatElem - Catalog Reader
Post by: Sorunome on August 06, 2015, 08:18:55 am
Sounds nice! Couldn't you combind that with eval or something to create a way to dynamically call functions in a rather easy way? *.*
Title: Re: CatElem - Catalog Reader
Post by: Xeda112358 on August 06, 2015, 08:25:26 am
Probably, but isn't that basically what "Input " does? Also, I want to make a note that the program does appear to work on other models and OSes, but it does not return the correct number of catalog elements. I have an idea for how to fix that :P
Title: Re: CatElem - Catalog Reader
Post by: Sorunome on August 06, 2015, 08:26:15 am
Oh, right, I forgot about "Input " :P
Title: Re: CatElem - Catalog Reader
Post by: Xeda112358 on August 06, 2015, 10:51:09 am
I updated the first post. Now it is just one program that sets up itself. It correctly obtains the start of the catalog table as well as the size (tested on multiple OSes from 1.03 to 2.55MP).

After setup is complete, it shrinks down from 322 bytes  to 149 bytes, having only the essential code.