Author Topic: Using "input"  (Read 4298 times)

0 Members and 1 Guest are viewing this topic.

Offline bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Using "input"
« on: April 09, 2013, 01:15:50 am »
Hello everyone, this is my first post on the forums and I hope no one yells at me for anything stupid.

I was just wondering if there is a problem with using "input", because whenever I try using it more than twice it clears my ram. I think I saw a post that said it was buggy, but I don't know if that is true in newer versions of axe. Any help would be appreciated :D

Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: Using "input"
« Reply #1 on: April 09, 2013, 01:39:52 am »
You'll probably need my detokenize Axiom to do anything useful with the input command. Off the top of my head, I'm not certain why it would crash, but I can think of a few possible reasons.

It could be that you're parsing the data returned by input incorrectly. It's tokenized, in case you didn't know. Tokens are explained elsewhere, but suffice it say, you can't send the result of input directly to Output or Disp, and it's unwise to pass the result to GetCalc( without validating that the user typed a valid name.

It could also be due to memory allocation issues. input is special in that it allocates a special temporary variable to hold the text the user types in. A temporary variable is just a regular file (like Axe files, programs, Strings, Pics, &c.) that is automatically deleted when your program ends. It's entirely possible to run out of memory by calling input multiple times, so the detokenize Axiom has a CleanAll() command that frees all of the temporary memory input allocates.

If you create, resize, or delete anything after calling input, the pointer to the temporary variable becomes invalid (the OS moves the variable) and you have no way of getting a new, valid pointer. You can do it in assembly, but it would be a bit of a pain. (Of course, in assembly, you'd already know the same of the temporary variable, so getting a new pointer to it would be easy. I wish Runer would add an option in Axe to get the VAT pointer to files; it would have reduced the excessive amount of assembly code embedded in its source.)
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC

Offline bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Re: Using "input"
« Reply #2 on: April 09, 2013, 02:35:29 am »
Thanks for the complete reply, i'm really not used to that. So because of the difficulty using the input command (detokenizing), would it be worth doing some other type of input? I want to do some basic input, for example getting a characters name.

I've written a simple routine using getKey() before, but I was hoping this would be smaller or faster. I'll try out some of your suggestions tomorrow and see if I like it.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Using "input"
« Reply #3 on: April 09, 2013, 08:14:55 am »
You indeed do not really need input for getting input into your program. You can also write your own input routine.
Not that I ever needed to, though.
I'm not a nerd but I pretend:

Offline bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Re: Using "input"
« Reply #4 on: April 09, 2013, 04:11:41 pm »
Ok, I think i'm just going modify my old routine and use that (which is in axe). While i'm at it, is there any good assembly tutorials for starters out there? I want to learn but I don't know where to start.

*Edit* I found http://ourl.ca/10913/207213, which is Hot Dog's Ti-83+ ASM Lessons, can I use the information from that for programming on the ti-84+?
« Last Edit: April 09, 2013, 05:24:25 pm by bobbean »

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Using "input"
« Reply #5 on: April 09, 2013, 06:31:30 pm »
Yep, the 83+ and 84+ series are largely the same, and ASM programs for the 83+ run on the 84+.

Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: Using "input"
« Reply #6 on: April 09, 2013, 10:19:20 pm »
Learn Assembly in 28 Days is good. Also, read all of WikiTI's hardware documentation. And TI has an SDK full of documentation about the OS that's pretty good to be aware of, even if you don't use it much.
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC

Offline bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Re: Using "input"
« Reply #7 on: April 10, 2013, 12:06:34 am »
Wow thanks everyone. It's weird for me to get good responses from people, I guess i'm just used to crappy forums. ;D

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Using "input"
« Reply #8 on: April 10, 2013, 12:14:52 am »
Most of us here are glad to help. :)

Offline bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Re: Using "input"
« Reply #9 on: April 10, 2013, 12:23:51 am »
Perfect, because i'm probably going to need lots of it.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Using "input"
« Reply #10 on: April 11, 2013, 03:40:24 am »
Just a heads up: Asm in 28 days is not for axe. (After all this is in the Axe help section :3 )
I'm not a nerd but I pretend: