Author Topic: Isn't the 'input' function rather useless?  (Read 2444 times)

0 Members and 1 Guest are viewing this topic.

Offline PickleMan

  • LV0 Newcomer (Next: 5)
  • Posts: 3
  • Rating: +0/-0
    • View Profile
Isn't the 'input' function rather useless?
« on: April 14, 2012, 07:51:49 am »
I don't know much about Axe Parser and TI-83/84s, but when I did something like:

Code: [Select]
input->A
for(I,0,length(A)-1)
    {A+I}->B
    Disp B->DEC,i
end

and looked at the bytes it printed out, 1 byte tokens were encoded as 1 byte, and 2 byte tokens were encoded as 2 bytes, rather than both being 2.
If this *is indeed* the case, how are you supposed to know where one token ends and another starts if each token is a variable length?

Also, a semi-related question, given a pointer returned from input, how can I draw that string to the buffer?

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Isn't the 'input' function rather useless?
« Reply #1 on: April 14, 2012, 04:07:47 pm »
I'm just wondering but what kind of value can input take?
Sig wipe!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Isn't the 'input' function rather useless?
« Reply #2 on: April 14, 2012, 05:10:09 pm »
In the current state of Axe, I agree, the input comamnd is a little lacking in terms of supporting commands. It returns a string of tokens, but there are no Axe commands to handle strings of tokens...


However, you can always make your own. :) Here's a routine I whipped up to return 1 if a token pointed to is a 2-byte token, or 0 if it's a 1-byte token.

Code: [Select]
.INPUT=pointer to token
Lbl Is2B
Return inData({},[BB5C5D5E606162637EAAEF00])+255/256

You could then call this routine from another routine, like this routine I wrote to print a length-prefixed string of tokens (that's what the input command returns) to the screen/buffer:

Code: [Select]
.INPUT=pointer to first token
Lbl Print
→r₁+{-2}ʳ→r₂
Lbl PL
Return!If -r₁
Text Select(r₁,+Is2B()+1→r₁)►Tok
r₂:Goto PL
« Last Edit: April 14, 2012, 05:11:27 pm by Runer112 »

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: Isn't the 'input' function rather useless?
« Reply #3 on: April 14, 2012, 06:12:01 pm »
 *.*

That's so usefull, why Axe haven't this feature ?

Here a screen of runer'code.


EDIT : how to know when tokens exceed screen to jump to the next line ?
« Last Edit: April 14, 2012, 06:13:54 pm by kindermoumoute »
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%