Author Topic: Text Data  (Read 10011 times)

0 Members and 1 Guest are viewing this topic.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Text Data
« 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.
Code: [Select]
  ;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 ?
« Last Edit: September 02, 2011, 08:31:38 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: Text Data
« Reply #1 on: June 06, 2011, 07:54:20 am »
Code: [Select]
"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?

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Text Data
« Reply #2 on: June 06, 2011, 09:09:11 am »
He's right, but I don't recommend the Data( command. You store text that way.
I'm not a nerd but I pretend:

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Text Data
« Reply #3 on: June 06, 2011, 09:40:49 am »
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.




Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Text Data
« Reply #4 on: June 06, 2011, 09:43:53 am »
Oops! Then its waaay better with Aichi's method. I thought it stored the data. Excuse me.
I'm not a nerd but I pretend:

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: Text Data
« Reply #5 on: June 06, 2011, 09:46:32 am »
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.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Text Data
« Reply #6 on: June 06, 2011, 09:49:09 am »
Argh...

***Goes headbang himself :banghead:
« Last Edit: June 06, 2011, 09:49:37 am by aeTIos »
I'm not a nerd but I pretend:

Offline BrownyTCat

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 420
  • Rating: +37/-8
    • View Profile
Re: Text Data
« Reply #7 on: June 06, 2011, 09:50:24 am »
He's right, but I don't recommend the Data( command. You store text that way.
Is Data() highly volatile?

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Text Data
« Reply #8 on: June 06, 2011, 09:51:23 am »
Check next posts. I thought that Aichi copied everything into GDB1 which is not really efficient.
I'm not a nerd but I pretend:

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Text Data
« Reply #9 on: June 06, 2011, 10:39:06 am »
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   ???
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: Text Data
« Reply #10 on: June 06, 2011, 10:49:16 am »
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.
« Last Edit: June 06, 2011, 10:50:03 am by Aichi »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Text Data
« Reply #11 on: June 06, 2011, 10:53:22 am »
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: ?)
« Last Edit: June 06, 2011, 10:54:44 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Text Data
« Reply #12 on: June 06, 2011, 10:54:15 am »
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:

Code: [Select]
:"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

Code: [Select]
:Lbl NTH
:Str1->r2
:While r1
: While {r2}
:  r2++
: End
: r2++
: r1--
:End
:Return r2
« Last Edit: June 06, 2011, 11:09:25 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Text Data
« Reply #13 on: June 06, 2011, 10:57:04 am »
Once again, thank you.
So "Text1" is at Str1 and "Text2" is at Str1+2 ?
Another question: even "lolcoopuhstoretoAAAwtfloveomnimaga"[00] takes 2 bytes ?
« Last Edit: June 06, 2011, 10:59:11 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: Text Data
« Reply #14 on: June 06, 2011, 10:57:41 am »
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. :)