Omnimaga

Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: tilky on October 17, 2012, 04:47:39 pm

Title: GDB and output problem
Post by: tilky on October 17, 2012, 04:47:39 pm
I have this code
Code: [Select]
Repeat getKey(9)
0~K
If R<14
If getKey(47)
Output(R,0,"A"
R+1~R
1~{GDB3+1}
47~K
End
While getKey(K)=1
End
End
End
In case it wasn't self explanatory, ~ is the Sto>.

Now, what should happen if you repeatedly press math is that you get an output that it "AAAAAAAAAAAAAAA"

But what is really happening is a display like "Annnnnnnnnnnn" with the "n"s italicized.

It works properly if i leave out the line with the GDB write, or if i don't add a number to the pointer.

I am new to Axe, so most i just figured out by trial and error, but i can't firgure this one out :banghead: 
Title: Re: GDB and output problem
Post by: shmibs on October 18, 2012, 10:00:45 am
did you ever declare GDB3 anywhere? STR, PIC, and GDB are used as pointers to positions in your program, so, if you start writing to them you will be overwriting parts of your program. it looks like you're probably overwriting the letter you're trying to output somehow, as character 01 is that italicised n.
Title: Re: GDB and output problem
Post by: aeTIos on October 18, 2012, 10:05:12 am
I don't get it. Why would you need GBD3? You aren't doing anything with it.
Title: Re: GDB and output problem
Post by: shmibs on October 18, 2012, 10:09:48 am
he's just messing around to try to figure out how things work, i think.
Title: Re: GDB and output problem
Post by: aeTIos on October 18, 2012, 10:11:43 am
Hmm, he did never declare GDB3. I think he's overwriting the $32 for A with $01 which is indeed n(I think it's $32)
Title: Re: GDB and output problem
Post by: tilky on October 18, 2012, 02:42:47 pm
that is the problem.  i did declare it, but with Data()~GBD3, which was writing over the program i guess.  I declared it as Data(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) and it works fine.  Thanks so much shmibs!
Title: Re: GDB and output problem
Post by: Hayleia on October 18, 2012, 03:26:48 pm
If you declared it as Data()→GDB3, then the behaviour of your program is normal ;)
Here is your program, untouched:

Data()→GDB3
[??]
.I think you have declared some data inbetween, or
.maybe some code before that loop declared some data
.Else, the output would not be "Annnnn" but "AAnnnnn"

Repeat getKey(9)
0~K
If R<14
If getKey(47)
Output(R,0,"A"
R+1~R
1→{GDB3+1}
47~K
End
While getKey(K)=1
End
End
End

Here is how Axe translates it:

Data()→GDB3
[??]
"A"→Str0
Repeat getKey(9)
0~K
If R<14
If getKey(47)
Output(R,0,Str0)
R+1~R
1→{GDB3+1}
47~K
End
While getKey(K)=1
End
End
End

Which is basically the same as this, since there is nothing in the Data():

[??]→GDB3
"A"→Str0
Repeat getKey(9)
0~K
If R<14
If getKey(47)
Output(R,0,Str0)
R+1~R
1→{GDB3+1}
47~K
End
While getKey(K)=1
End
End
End

And now, Str0=GDB3+1, so when you do 1→{GDB3+1}, it replaces the A by a n, which is why you got the n :)