Author Topic: Axe Q&A  (Read 587025 times)

0 Members and 1 Guest are viewing this topic.

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #540 on: July 24, 2011, 08:17:02 am »
Darl gave me before a routine to display a text on the screen but that wasn't really what I was looking for so using Axeguess example, I've been trying to get input from user as follow:
1. "Input Number" is displayed on the screen
2. Number is input until user presses Enter
3. Number input is displayed on the screen

This is what I've come up with so far, I use 3→{length(A)+A} to add a byte at the end of an existing number in the memory like using lists in BASIC. 3→LX(1+dim(LX, if it works

Code: [Select]
.INPUTNO
"Input Number"→Str0
ClrHome
Disp Str0

sub(I)
Disp A,i
If getKey(15)
ClrHome
End

Lbl I
0→A
getKeyüK
Repeat getKey(9)
If K=36:7→{length(A)+A}
If K=35:4→{length(A)+A}
If K=34:1→{length(A)+A}
If K=28:8→{length(A)+A}
If K=27:5→{length(A)+A}
If K=26:2→{length(A)+A}
If K=20:9→{length(A)+A}
If K=19:6→{length(A)+A}
If K=18:3→{length(A)+A}
End
Goto I

I got an ERR: MISSING END during the compiling. Any help?

Edit: AXEGUESS in Axe 1.0.1 is exactly the same as the code in Axe 0.5.3 so I don't think it's outdated.
« Last Edit: July 24, 2011, 08:19:36 am by selectcoaxial »

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #541 on: July 24, 2011, 08:20:27 am »
Unfortunately, you can't do If statements without an end like in Basic. You must put an End after each one.

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #542 on: July 24, 2011, 08:33:15 am »
if I have an infinite loop in my application, is there a quit button like ON in Basic? and not having to take out the batteries?

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Axe Q&A
« Reply #543 on: July 24, 2011, 08:39:16 am »
if I have an infinite loop in my application, is there a quit button like ON in Basic? and not having to take out the batteries?
No, there is no quit button (unless you program one yourself).

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #544 on: July 24, 2011, 08:40:53 am »
No, but doing Repeat Getkey(15) will loop until you press clear. I hope all these answers are helping you :)

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Axe Q&A
« Reply #545 on: July 24, 2011, 11:53:47 am »
Don't trust me 100% I have been known to make mistakes.

can you explain "{length(A)+A}" to me plz?  I am quite confused.
can't you just replace all instances of "{length(A)+A}"  to just be "A"
If you use {} you are pointing to a memory location. so basically you are just storing K to memory location 0.
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #546 on: July 24, 2011, 02:43:51 pm »
Squidgetx made that routine, so idk really :P
But iirc what length() does is it goes through data until it reaches a zero, then returns that number.  If this is looped and used properly one could skip a definable number of [00]s, which the programmer could put in to separate strings and such.

Something to remember: Axe and basic are completely different.  The only thing they share are the editor and the tokens.  So a good part of the stuff that works in basic won't work in Axe, and vice-versa.


So waht you're trying to do with this is just have one number be put in, or a string of numbers?  Because the code above will only store one number to the variable. (actually I don't see the point of using length() in this, what are you trying to do with it?)
« Last Edit: July 24, 2011, 02:44:10 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #547 on: July 24, 2011, 09:48:41 pm »
I'm just trying to input a 3 byte number. And you're right. It turns out using length is unnecessary. :)
N is a 3 byte number, and I have to to limit user input to those 3 bytes. A increases at every getKey interval

Code: [Select]
.INPUT
Zeros(6)→N
0→A
"Input number:"→Str0
Disp Str0,i
sub(I)
If K=15
ClrHome
Return
End
If K=9
Disp N>Dec,i
End

Lbl I
getKeyüK
If K=36:7→{N+A}End
If K=36:7→{N+A}End
If K=35:4→{N+A}End
If K=34:1→{N+A}End
If K=28:8→{N+A}End
If K=27:5→{N+A}End
If K=26:2→{N+A}End
If K=20:9→{N+A}End
If K=19:6→{N+A}End
If K=18:3→{N+A}End
A++
ReturnIf K=15
ReturnIf length(N)=3
ReturnIf K=9
Disp N>Dec,i
Goto I

The code above doesn't work and it just display 40802 continuously for some reasons.

What is the difference between using Repeat getKey(15):End vs Lbl:Goto? Don't they do the same thing? Is there any benefits in using one and not the other? Also, is there any benefits if I learn TI-ASM then Axe language?

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #548 on: July 24, 2011, 10:33:56 pm »
Goto A would jump to Lbl A.  Repeat getKey(15):End waits until the user presses clear.

As for the code, A is always increased, not just when a key is pressed.  What might work is checking if the byte is non-zero, after the byte is stored.
Also I would change lines like this If K=36:7→{N+A}End to If K=36:7→{N+A}:End.  There's more optimized ways to handle it, but the way you have it works enough.
Btw numbers in axe/asm can only be up to two bytes.  trying to make a three-byte number won't work.

Axe is a lot less complicated than asm, but has some of the same concepts (pointers, data, etc)
Vy'o'us pleorsdti thl'e gjaemue

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #549 on: July 25, 2011, 07:59:02 am »
Another quick question. Is there a way to get the current level of contrast in Axe ? We can set it with Shade(X) but how to get it ?
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: Axe Q&A
« Reply #550 on: July 25, 2011, 08:01:02 am »
Shade().

To restore the OS's original contrast before you quit, use Shade(Shade()).  I've specifically optimized this nesting.
___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: Axe Q&A
« Reply #551 on: July 25, 2011, 08:02:17 am »
Ok, thanks !
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 FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: Axe Q&A
« Reply #552 on: July 25, 2011, 09:16:00 am »
Goto A would jump to Lbl A.  Repeat getKey(15):End waits until the user presses clear.

As for the code, A is always increased, not just when a key is pressed.  What might work is checking if the byte is non-zero, after the byte is stored.
Also I would change lines like this If K=36:7?{N+A}End to If K=36:7?{N+A}:End.  There's more optimized ways to handle it, but the way you have it works enough.
Btw numbers in axe/asm can only be up to two bytes.  trying to make a three-byte number won't work.

Axe is a lot less complicated than asm, but has some of the same concepts (pointers, data, etc)
Actually, Runer wrote a library that lets you add, subtract and display 3 byte numbers.


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #553 on: July 27, 2011, 07:49:57 am »
I'm a bit confused about the number system. If a 1-byte number can have a range from 0 to 255, then why is it when I type 55 into notepad then look at it in a hex editor (HxD), I got 35 35? Isn't it supposed to be hold in one byte and not two bytes?
« Last Edit: July 27, 2011, 07:53:39 am by selectcoaxial »

Ashbad

  • Guest
Re: Axe Q&A
« Reply #554 on: July 27, 2011, 08:22:50 am »
"55" is a string when looked at in a text format.  Once it is compiled, it will correspond to the actual 55, but each character is one byte in text format.  The ASCII equivalent of 5 on TI-8x calcs is 35.
« Last Edit: July 27, 2011, 08:23:37 am by Ashbad »