Author Topic: A Few Questions  (Read 8495 times)

0 Members and 1 Guest are viewing this topic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
A Few Questions
« on: September 02, 2010, 01:19:16 pm »
lets say im using axe to move a string from Str1A to an appvar. How do i find out how many bytes the string is? This is a typical text string, not limited to hex or numbers, but can range from 0 to Z.

And, any issues with separating things with commas in that string? If yes, how should I separate them?


And, has Quigbo resolved the interrupt issue yet? The one where the Lbl was inconsistent with Goto?

 if you use asm to create a custom interrupt routine and keep that routine enabled when you exit to the TI-OS, should it continue to operate?
« Last Edit: September 02, 2010, 01:31:48 pm by ACagliano »

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: A Few Questions
« Reply #1 on: September 02, 2010, 01:47:24 pm »
lets say im using axe to move a string from Str1A to an appvar. How do i find out how many bytes the string is? This is a typical text string, not limited to hex or numbers, but can range from 0 to Z.

Well, strings like Str1A aren't really variables. They're just data inside the executable, just like all the other commands, except that it's not executed as a sequence of commands. Basically, you could put random command junk in the middle of the program and call it a string.

In ASM, strings like that "end" when the TI-OS or whatever you're using to read the string hits the value 0. When you put a string by itself in Axe like

Code: (Axe) [Select]
:"Hello"

all the parser does is add the sequence of hex digits [48656C6C6F] somewhere in the executable. But when you "store" it to a name, like

Code: (Axe) [Select]
:"Hello"→Str1A

Axe adds [48656C6C6F00] instead (with the extra zero byte). This is because commands like Disp display each hex value as a character until it hits the zero. So if you want to know how long a string is in Axe, you just have to count each digit in the string until you hit a zero.

And, any issues with separating things with commas in that string? If yes, how should I separate them?

Sorry, don't understand there.

And, has Quigbo resolved the interrupt issue yet? The one where the Lbl was inconsistent with Goto?

No idea. I haven't exactly been keeping my version of Axe up to date, unfortunately :P

if you use asm to create a custom interrupt routine and keep that routine enabled when you exit to the TI-OS, should it continue to operate?

Okay, that gets complicated. First of all, many things in the TI-OS need TI's default interrupt. To give you a picture of how screwed your calc would be if you didn't restore it, these include flashing the cursor and waiting for a keypress.

EDIT: I think there's a way to have the TI-OS go through your custom interrupt, then go through its own interrupt routine, so there aren't any problems. To do that, you add a Goto 58 at the end.
« Last Edit: September 02, 2010, 01:51:03 pm by Deep Thought »




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: A Few Questions
« Reply #2 on: September 02, 2010, 01:51:18 pm »
Keep in mind that lowercase letters are 2 byte tokens, though, and that each will take two spots in memory rather than one.

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: A Few Questions
« Reply #3 on: September 02, 2010, 01:52:41 pm »
Keep in mind that lowercase letters are 2 byte tokens, though, and that each will take two spots in memory rather than one.

But for strings, I think they're converted to their characters by Axe before they're added to the executable.




Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: A Few Questions
« Reply #4 on: September 02, 2010, 01:53:03 pm »
Am I correct in assuming that I could simply use Axe's length( command to get the size of the string?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: A Few Questions
« Reply #5 on: September 02, 2010, 01:54:53 pm »
Keep in mind that lowercase letters are 2 byte tokens, though, and that each will take two spots in memory rather than one.

But for strings, I think they're converted to their characters by Axe before they're added to the executable.
I am confused what you mean, could you explain in more details ???
« Last Edit: September 02, 2010, 01:55:12 pm by DJ Omnimaga »

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: A Few Questions
« Reply #6 on: September 02, 2010, 01:55:18 pm »
Am I correct in assuming that I could simply use Axe's length( command to get the size of the string?

Yeah, I guess that would work. I'm still using Axe 0.2.6, so I haven't gotten there yet :D

Keep in mind that lowercase letters are 2 byte tokens, though, and that each will take two spots in memory rather than one.

But for strings, I think they're converted to their characters by Axe before they're added to the executable.
I am confused what you mean, could you explain in more details ???

Well, lowercase letters and 2-byte tokens are made up of characters, all of which are one byte. So in BASIC, the string "Hello" would be [48BBB4BBBCBBBCBBBF], since lowercase letters are two-byte tokens starting with BB. But in Axe, when you're storing a string like "Hello", you're storing the characters of each token, not the token itself. So in Axe, it'd be [48656C6C6F].

On a side note, I think a newer version of Axe allows you to add an actual token with the T command, but that's separate from these strings.

Here's a list of the TI-OS characters.

EDIT: 444th post! :D
« Last Edit: September 02, 2010, 02:04:15 pm by Deep Thought »




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: A Few Questions
« Reply #7 on: September 02, 2010, 02:05:46 pm »
Aah ok I see. I thought they would also be stored in two memory addresses. I swear there were 2 byte tokens in Axe too, though.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: A Few Questions
« Reply #8 on: September 02, 2010, 02:14:33 pm »
It's partially working. But not entirely. But its working to the point where i know the concept is right, just the technicals are wrong. Its displaying part of the string correctly, when I go to recall, then starts getting garbage, then crashes.

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: A Few Questions
« Reply #9 on: September 02, 2010, 02:15:46 pm »
Whoa, can you give us the code (if it's not a contest entry)?




Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: A Few Questions
« Reply #10 on: September 02, 2010, 02:27:34 pm »
Code: [Select]
"appvBDefs"->Str2A
GetCalc(Str2A)->D
!If D
"AHA,AAHAA,BEEF,BEAT,CRASH,FAIL,HAHA,OFFBY1,PRANK,VIRUS,WINXX,XXX"->Str9Z
length(Str9Z)->V
GetCalc(Str2A,V)->D
conj(Str9Z,D,V)
End

Produces an 80 byte appvar, BDefs. Perfect.
Now, to recall

Code: [Select]
If D
length(D)->V
"0"->Str9Y
conj(D,Str9Y,V)
Disp Str9Y

Displays this: "AHA,AAHAA,BEEF,BEAT,CRASH,FAIL,HAHA,OFFBY1,P...garbage starts here...then

OOPS! Ram Cleared.

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: A Few Questions
« Reply #11 on: September 02, 2010, 02:32:33 pm »
Okay, I see your problem(s).

First of all, you can't just move 80 bytes into Str9Y. Str9Y isn't a string; it's just a label at the end of the program. If you copy stuff over to it, you're not expanding the size of the program. You're just overwriting the data after the program, which could be bad.

Secondly, "0" is not the same as [00]. The character '0' actually has value [30], which is a problem, as the Disp command you're using wouldn't stop there. Instead, it would keep going after the "0" until it hits an actual [00].




Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: A Few Questions
« Reply #12 on: September 02, 2010, 02:34:41 pm »
So, can I just read from the appvar's pointer directly?

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: A Few Questions
« Reply #13 on: September 02, 2010, 02:35:28 pm »
Yeah, of course, if it's in RAM. If not, you have to change to the flash page, and I don't know how to do that in Axe.

EDIT: But most importantly, change that "0" to a [00].
« Last Edit: September 02, 2010, 02:35:56 pm by Deep Thought »




Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: A Few Questions
« Reply #14 on: September 02, 2010, 02:36:54 pm »
im not changing to flash anything with Axe. I'll work in RaM. Last time i inadvertently wrote to flash i almost f***ed over my certificate and actually did wipe an OS sector. Wasn't fun. lol. Thanks for the help.