Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: pimathbrainiac on February 22, 2013, 12:08:52 pm

Title: Lists and appvars
Post by: pimathbrainiac on February 22, 2013, 12:08:52 pm
How do you store an entire list in AXE as an appvar?

not {L1} but the entire L1
Title: Re: Lists and appvars
Post by: Hayleia on February 22, 2013, 12:22:18 pm
How do you store an entire list in AXE as an appvar?

not {L1} but the entire L1
By the fact you said "list", I fear you haven't unserstood the difference between "pointer" and "variable".
Anyway, here is a working code.

"appvNAME"→Str0

GetCalc(Str0,768)→A
!If
 .the appvar was not created, maybe you don't have enough RAM
 .in this case, maybe the program should exit safely instead of copying random bytes to a random place
End
Copy(L1,A,768)
.you can unarchive the appvar here if you want

Of course, if you don't use the full 768 bytes of L1, you can make a smaller appvar and copy less than 768 bytes.

edit For a complete tutorial on how to use appvars (among other things), see this tutorial and give +1s to FinaleTI :)
Title: Re: Lists and appvars
Post by: Matrefeytontias on February 22, 2013, 12:24:58 pm
The steps are as follows :
That's all, if you don't understand something just ask :)
Title: Re: Lists and appvars
Post by: pimathbrainiac on February 22, 2013, 12:58:10 pm
How do you store an entire list in AXE as an appvar?

not {L1} but the entire L1
By the fact you said "list", I fear you haven't unserstood the difference between "pointer" and "variable".
Anyway, here is a working code.

"appvNAME"→Str0

GetCalc(Str0,768)→A
!If
 .the appvar was not created, maybe you don't have enough RAM
 .in this case, maybe the program should exit safely instead of copying random bytes to a random place
End
Copy(L1,A,768)
.you can unarchive the appvar here if you want

Of course, if you don't use the full 768 bytes of L1, you can make a smaller appvar and copy less than 768 bytes.

edit For a complete tutorial on how to use appvars (among other things), see this tutorial and give +1s to FinaleTI :)

I understand pointers, and that a list is a pointer... I guess I should have said that I want to put a pointer in one appvar so I can point to it for save data.

The steps are as follows :
  • Create your appvar using GetCalc(appvarName,size), where in this case size should be 768 since you want to store L1 which is 768 bytes large. The GetCalc function returns a pointer on the appvar, so keep it in a variable.
    Example : you want to create the appvar called LIST which is 768 bytes large and to store his address into P. You'll do something like :GetCalc("appvLIST",768)→P. Don't forget that "appv" must not be typed by hand, but by pressing [2nd] [8].
  • Use Copy(pointer1, pointer2,size) to copy the 'size'th first bytes starting at 'pointer1' into the 'size'th first bytes starting at 'pointer2'.
    In this case, since you want to copy the first 768 bytes from L1 to your appvar P, you'll do Copy(L1,P,768). But if you don't specify any size, Axe will automatically make it 768, so you can also optimize this line by Copy(L1,P).

That's all, if you don't understand something just ask :)

Thanks for that explanation of how it works!