Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: Hayleia on June 06, 2011, 07:23:32 am
-
Is there any way to store text data in Axe and to recall it to display it ? (like bcall(_vputs) or bcall(_puts) in ASM ).
The aim is not only to display text (or I'll do Text(?,?,"?")
The aim is to "choose" the text to display in fonction of a number.
With text data, it would be possible.
;example of text data
.db "lol",0
.db "yes",0
Here, if a=1 it displays "lol" and if a=2 it displays "yes" (if we add the display code). See what I mean ?
-
"Text 1" -> Str1
"Txt2" -> Str2
"T 003" -> Str3
Data(Str1r,Str2r,Str3r) -> Gbd0
ClrHome
rand^3 -> A
Output(0,,{A*2+Gbd0}
Did you mean that?
-
He's right, but I don't recommend the Data( command. You store text that way.
-
He's right, but I don't recommend the Data( command. You store text that way.
Why not? In Aichi's code it's used to store the pointers to the strings in a list.
-
Oops! Then its waaay better with Aichi's method. I thought it stored the data. Excuse me.
-
aeTIos, it stores the pointers to get all pointers in a list and work more efficient with it, it doesn't store the same strings of course. :P
Pointer list are extremly useful in some cases.
-
Argh...
***Goes headbang himself :banghead:
-
He's right, but I don't recommend the Data( command. You store text that way.
Is Data() highly volatile?
-
Check next posts. I thought that Aichi copied everything into GDB1 which is not really efficient.
-
Hey, thanks to all for your (very) fast answers.
But I'm bothering you all again with another question :
How do I do to store lots and lots of words ? Because with your method, I need a pointer for each word but if I have 200 words ???
-
Yeah, I think you have to type in all 200 pointers by yourfelf, but notice that setting a pointer won't affect the size after compiling. Axe Parser replaces the pointer usages with the real data locations in the program plus 9D95h, so you don't have to spare on setting pointers.
-
Okay but I wasn't wondering about the size but the number: does the TI have more than 200 names of pointers ? (offtopic: how do you do to make your avatar color changing :hyper: ?)
-
The Data command needs the r modifier after each entry if you're using pointers since each entry needs to be 2 bytes large. But there is a more memory efficient way to store the text, which is to just have each entry right after each other like this:
:"Text1"[00]->Str1
:"Text2"[00]
:"More Text"[00]
:.etc
And then to get the Nth string, just write a routine that starts at Str1 and scans until it has read N-1 zeros
:Lbl NTH
:Str1->r2
:While r1
: While {r2}
: r2++
: End
: r2++
: r1--
:End
:Return r2
-
Once again, thank you.
So "Text1" is at Str1 and "Text2" is at Str1+2 ?
Another question: even "lolcoopuhstoretoAAAwtfloveomnimaga"[00] takes 2 bytes ?
-
Okay but I wasn't wondering about the size but the number: does the TI have more than 200 names of pointers ? (offtopic: how do you do to make your avatar color changing :hyper: ?)
The TI OS doesn't support that much pointers, but Axe Parser does. You can use Gbd08A as a pointer for example.
The random color is generated through PHP. :)
-
@Hayleia
Not quite, you can't read the pointers like that unless all the strings are the same length. You have to scan the text each time since you don't know how far apart each text entry is from one another. Text1 is at sub(NTH,0), Text2 is at sub(NTH,1), etc...
-
AH I UNDERSTOOD !!!! Sorry for being French and for being a noob at non-Basic. In fact, you store a 0 between each words and you just have to count the zeros to find the text you want !!!
Thank you very very much Quigibo, and thanks to the others too.
Edit:
What ? and how do I do to write at X,Y the text located in sub(NTH,1) ?
-
Text(X,Y,sub(NTH,1)) :)
By the way I edited the NTH routine to make a correction.
-
I told you I was a noob at non-Basic.
I first thought the answer was Text(X,Y,sub(NTH,1)) but I soon thought "no, it is impossible you idiot (me the idiot not you)". That was forgetting how wonderful was Axe. You made a fantastic work man, it's amazing how it makes the transition between Basic and ASM. Thanks for your hard work, and for your answers. If I finish my game (also have to begin it before), I'll give you credits, and I'll give Omnimaga credits too.
-
The TI OS doesn't support that much pointers, but Axe Parser does. You can use Gbd08A as a pointer for example.
The random color is generated through PHP. :)
You're still limited to (I think) around 150 pointers though. It's the max that Axe can keep track of.
And off-topic: Is each color in a separate image or does the script itself tell you what color to add?
-
And off-topic: Is each color in a separate image or does the script itself tell you what color to add?
There are about 12 pre-recolored pictures. PHP randomly picks one of them.
Recoloring directly through PHP would be quite awkward.