Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: yunhua98 on October 18, 2010, 05:48:38 pm

Title: Need moar variables...
Post by: yunhua98 on October 18, 2010, 05:48:38 pm
Is there a way to access moar variables in Axe?  Like the Finance variables for BASIC, or something like lists?  or can the Axe lists do this?  if so, I need to figure out how to do it.  ;)

TIA 8)
Title: Re: Need moar variables...
Post by: Builderboy on October 18, 2010, 05:50:01 pm
if you need more variables, there are several option open to you.  In portal, i use memory locations for many variables.  Like {L1+13}r is the same speed and takes the same amount of memory as the variable A. 
Title: Re: Need moar variables...
Post by: ztrumpet on October 18, 2010, 05:50:47 pm
{address}r is the same as a regular variable.

Ex:
{L1}r
{L1+8}r
{L4}r
{oA}r (This is the same as just doing A)

Good luck. :)

Edit: Ninja'd O0
Title: Re: Need moar variables...
Post by: yunhua98 on October 18, 2010, 05:51:11 pm
could you elaborate on that a bit?  How would you know which ones are usable?

EDIT:  I was replying to Builderboy
Title: Re: Need moar variables...
Post by: nemo on October 18, 2010, 05:51:52 pm
you can use any portion in the free RAM areas L1-L6 as your own variables.
Title: Re: Need moar variables...
Post by: yunhua98 on October 18, 2010, 05:54:51 pm
you can use any portion in the free RAM areas L1-L6 as your own variables.

I see, so if I did 5->{L1}, and then wanted moar variables, I would do 42->{L1+1}  but if I wanted to store a two byte number, would I do 256->{L1+2}r?
Title: Re: Need moar variables...
Post by: nemo on October 18, 2010, 05:57:11 pm
yes. be careful about it though. if you do 256->{L1+2}r, make sure you don't try to make a variable at {L1+3}, because this is already being used by the two byte variable at L1+2
Title: Re: Need moar variables...
Post by: yunhua98 on October 18, 2010, 05:58:14 pm
which RAM area would be best and most stable to use?
Title: Re: Need moar variables...
Post by: ztrumpet on October 18, 2010, 05:59:15 pm
L1.  Read up on it in the commands list if you want more info. :)
Title: Re: Need moar variables...
Post by: Michael.3545 on October 18, 2010, 05:59:24 pm
And don't write beyond the limits of L1.  That is called an overflow error and strange and terrible things will happen to your calculator as a result.
Title: Re: Need moar variables...
Post by: nemo on October 18, 2010, 06:00:42 pm
yeah... just don't use more than 700 bytes worth of variables and you'll be fine (like you even need 350 variables)
Title: Re: Need moar variables...
Post by: Runer112 on October 18, 2010, 06:00:43 pm
L1. In that area of safe RAM (the 54 bytes before where L1 points) is where the built-in 27 variables reside, too.

EDIT: Mega ninja'd.
Title: Re: Need moar variables...
Post by: DJ Omnimaga on October 18, 2010, 06:00:51 pm
Note that in some cases, using L2 might cause incompatibility with MirageOs for the people that still uses it. It conflicts with Mirage's interrupts.

I personally use L1 most of the time.
Title: Re: Need moar variables...
Post by: yunhua98 on October 18, 2010, 06:01:10 pm
ok, thanks guys!  as for the commands list, well, lets just say I find it a bit hard to understand at times.  :P

EDIT:  600 posts!/me anticipates becoming evil.  >:D
Title: Re: Need moar variables...
Post by: DJ Omnimaga on October 18, 2010, 06:02:56 pm
Btw with L4, it talks about corruptions with the Archive/Unarchive. Does it means the Axe archive/unarchive commands or the entire TI-OS after exiting your program?
Title: Re: Need moar variables...
Post by: ztrumpet on October 18, 2010, 06:03:43 pm
It means that if you unarchive/archive in Axe during the running of your program, the data in L4 will no longer be there. :)
Title: Re: Need moar variables...
Post by: Deep Toaster on October 18, 2010, 07:08:37 pm
Oh, and yunhua98, use 2-byte storage for most uses. It's one byte less than one-byte vars (weird, I know, but that's just how it works).
Title: Re: Need moar variables...
Post by: DJ Omnimaga on October 18, 2010, 08:44:04 pm
It means that if you unarchive/archive in Axe during the running of your program, the data in L4 will no longer be there. :)
Ah ok, good to know. I was worried that weird crap could happen during archving/unarchving
Title: Re: Need moar variables...
Post by: squidgetx on October 21, 2010, 03:53:43 pm
Oh, and yunhua98, use 2-byte storage for most uses. It's one byte less than one-byte vars (weird, I know, but that's just how it works).
...wait really? I never knew that :x
Title: Re: Need moar variables...
Post by: Builderboy on October 21, 2010, 04:30:06 pm
Oh, and yunhua98, use 2-byte storage for most uses. It's one byte less than one-byte vars (weird, I know, but that's just how it works).

Waitwhat?  Two byte storage is one byte *less* than one byte? ???
Title: Re: Need moar variables...
Post by: Deep Toaster on October 21, 2010, 04:52:40 pm
Yeah, it's weird, but I think I know why.
Code: (Axe) [Select]
1→{GDB0}r


is one byte less than

Code: (Axe) [Select]
1→{GDB0}


because in Axe, numbers are treated as two-byte numbers for all operations (because it's all stored in HL, which is a two-byte register). So when Axe sees that 1, it loads 0001h to HL. Then when you store it to a one-byte space, it has to first load L (the single-byte portion of HL) to A (which is like HL for one-byte numbers), then stores it from A. On the other hand, if you're storing to a two-byte space, it just stores HL straight there.

EDIT: Of course, if Axe 2.0 (or whatever that was called) uses one-byte operations, it won't be this way :)
Title: Re: Need moar variables...
Post by: Builderboy on October 21, 2010, 06:45:29 pm
Ooooooh gotcha i didn't know you meant memory in code, i thought you meant 2 bytes numbers used 1 less byte for storage than 1 byte numbers ;D
Title: Re: Need moar variables...
Post by: Deep Toaster on October 21, 2010, 07:39:59 pm
No, TI's code isn't that bad XD
Title: Re: Need moar variables...
Post by: AngelFish on October 21, 2010, 07:45:59 pm
At least not the RAM addressing part of their code...