Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: XiiDraco on December 18, 2012, 03:19:34 am

Title: Help with variable limit
Post by: XiiDraco on December 18, 2012, 03:19:34 am
I have hit a variable limit and was wondering if there was anything to get around that. I know in Ti-BASIC you can just create a list and store things to that, but I do not know how to to such things while using axe parser.
Can I get some help please? Thanks.
Title: Re: Help with variable limit
Post by: DJ Omnimaga on December 18, 2012, 03:31:54 am
There are variable limits in Axe? O.O Did you get any error stating so? I was sure that Axe could let you use as many vars as your RAM do
Title: Re: Help with variable limit
Post by: XiiDraco on December 18, 2012, 03:35:13 am
I am refering to A-Z and ø. Now what do I use...
Title: Re: Help with variable limit
Post by: squidgetx on December 18, 2012, 10:59:26 am
You can use any free ram space, or if you're using a program you can even make your own spaces!

A-Z and theta are just locations in memory that have predefined names. L1 (768 bytes), L2 (531 bytes, but actually bigger), L4 (256 bytes), and L5 (128 bytes) are pointers to other areas of memory that are usually free to use.
Title: Re: Help with variable limit
Post by: Hayleia on December 18, 2012, 12:36:55 pm
What squidgetx said. Look at the Commands.html, find a RAM area that none of your lines of code will corrupt (for example, don't use L5 if you use ClrHomes in your code), then create new variables like this:
  L5→°Var1
  L5+2→°Var2
  L5+4→°TheGame

Now, Var1, Var2 and TheGame are legit variables, like A, B and so on, you can do 1→Var1, etc.
(note that TheGame has a name length above 5 so it will only work on 1.2.0 and higher).
Title: Re: Help with variable limit
Post by: XiiDraco on December 20, 2012, 06:44:46 pm
Im afraid i don't fully understand...
Title: Re: Help with variable limit
Post by: Hayleia on December 21, 2012, 03:57:14 pm
Im afraid i don't fully understand...
??? What didn't you understand ?
Title: Re: Help with variable limit
Post by: Eiyeron on December 21, 2012, 04:00:48 pm
/me lost, darn you, Evil Absol!
Title: Re: Help with variable limit
Post by: Derf321 on December 21, 2012, 09:26:46 pm
If you only need 6 more variables, you can press VARS, go right to Y-VARS, Polar..., and then you can use R1 through R6 just like you would any other variable.
If you need more, this tutorial is what I used to understand how to use Arrays to store variables (it's pretty much like a list). It's best explained by this link, but it'll be confusing at first (was for me at first): http://ourl.ca/9288
Also, if you want to run it in MirageOS or any other OS, make sure to only use L1, not L2 or others or it will not work.
Title: Re: Help with variable limit
Post by: adrusi on May 22, 2013, 07:07:17 pm
This is interesting. I didn't realize that you could have variables other than the prenamed ones. I've never run out of the variables, but it would be nice to have meaningful names.

However I can't get it to work. I have this code:

Code: [Select]
PROGRAM:ΘTEST
.TEST
L₅→°FOO
L₅+1→°BAR
5→FOO
6→BAR
Disp FOO+BAR▸Dec

Which should display 11, but instead it displays 1547 (YMMV)

Am I missing something? Are you sure this is valid (it compiles, but maybe it means something else, though I can't think of what)?
Title: Re: Help with variable limit
Post by: Runer112 on May 22, 2013, 07:52:03 pm
Variables in Axe are two bytes large, and you only allocated FOO and BAR to be one byte apart. The second byte of FOO overlaps the first byte of BAR. :P

Two solutions:
Title: Re: Help with variable limit
Post by: adrusi on May 22, 2013, 07:59:31 pm
Ah yes, forgot that addresses point to bytes and not words, been toying with the dcpu16 architecture recently
Title: Re: Help with variable limit
Post by: adrusi on May 22, 2013, 08:39:31 pm
How does this compile? It looks like you are defining labels at runtime, even though labels are usually resolved to constants at compile time.