Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
EnderWiggin


Advanced Newbie


Joined: 10 Dec 2003
Posts: 98

Posted: 15 Jan 2004 10:56:31 am    Post subject:

I was working on a prgm and i noticed that i couldn't use an equation in a goto. Is there a way to get around it?
This is an example of what i mean;

6->A
Repeat B=105
GetKey -> B
Text(1,A,"-"
If B=24 and A(not=s)6
Then
A-6->A
Text(1,A+6," "
End
If B=34 and A(not=s)48
Then
A+6->A
Text(1,A-6," "
End
End
Goto A/6
Lbl 1

Lbl 2

....


That's my program that doesn't work, if any one can tell me if it is possible to do some thing like this, it would be great! Smile
Back to top
Toksyuryel
Crimson Dragon Software


Elite


Joined: 14 Jun 2003
Posts: 880

Posted: 15 Jan 2004 11:15:21 am    Post subject:

1. You can't do that in BASIC.
2. Learn ASM.
Back to top
Jeremiah Walgren
General Operations Director


Know-It-All


Joined: 24 May 2003
Posts: 1937

Posted: 15 Jan 2004 12:11:32 pm    Post subject:

I believe it's the "/" in your label that's causing the problem.
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 15 Jan 2004 12:22:04 pm    Post subject:

Jeremiah Walgren wrote:
I believe it's the "/" in your label that's causing the problem.

He want's to use the equation to decide where to 'goto', the / is part of the equation.

This is a work around:
A/6
If Ans =1:Goto 1
If Ans=2:Goto 2
If Ans=3:Goto 3
If Ans=4:Goto 4
If Ans=5:Goto 5
If Ans=6:Goto 6
Back to top
Jeremiah Walgren
General Operations Director


Know-It-All


Joined: 24 May 2003
Posts: 1937

Posted: 15 Jan 2004 12:31:23 pm    Post subject:

Ahh, I see. Yeah, If - Then statements should work just fine.

Last edited by Guest on 15 Jan 2004 12:31:55 pm; edited 1 time in total
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 15 Jan 2004 12:38:14 pm    Post subject:

Actually, just if statements, if you use goto in a loop or open if..then..else..end statement, it will cause memory problems.
Back to top
Jeremiah Walgren
General Operations Director


Know-It-All


Joined: 24 May 2003
Posts: 1937

Posted: 15 Jan 2004 02:34:28 pm    Post subject:

I was just referring to them in general...
Back to top
EnderWiggin


Advanced Newbie


Joined: 10 Dec 2003
Posts: 98

Posted: 15 Jan 2004 05:11:54 pm    Post subject:

Smile Smile Smile
Thanks a lot!

If you were wondering, I was trying to make the program shorter by using an equation instead of If-Then statements, but I'l just use Arcane Wizard's method with "If Ans Goto 1..."

Thanks a lot guys

(I tried learning Asm but couldn't work it and gave up. I'll give it another try some day though)
Back to top
EnderWiggin


Advanced Newbie


Joined: 10 Dec 2003
Posts: 98

Posted: 15 Jan 2004 05:18:45 pm    Post subject:

Lets see....
hmmmmmmm will my picture work?
I hope so
Back to top
Jedd
1980 Pong World Champion


Elite


Joined: 18 Nov 2003
Posts: 823

Posted: 15 Jan 2004 05:54:50 pm    Post subject:

I've had the same problem with pictures. You can't use a variable or an equation to recall or store a pic. It's too bad because some games would run a lot faster.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 15 Jan 2004 06:52:16 pm    Post subject:

On the TI-89, you can use variables to recall pics, and I think (but am not sure) also Gotos. That is one of the reasons I am writing my rpg on the 89.
Back to top
Jedd
1980 Pong World Champion


Elite


Joined: 18 Nov 2003
Posts: 823

Posted: 15 Jan 2004 08:16:24 pm    Post subject:

Wow that would be so nice. Is the 89 a lot faster than the 83+? Is it faster than the SE? My friend with an 89 was asking me that today. I fooled around with it and its sooo confusing to me. 83 all the way.
Back to top
Jeremiah Walgren
General Operations Director


Know-It-All


Joined: 24 May 2003
Posts: 1937

Posted: 15 Jan 2004 09:02:32 pm    Post subject:

Yes, the 89 is faster than the 83+. (Even the SE if memory serves...) If you can figure out how to use the 89 then it's an awesome calculator to use.
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 16 Jan 2004 03:50:02 am    Post subject:

Yeah, that is the problem.

Also, do not jump to a label from within a then statement, or from within any loop.

Jumps are okay, but do not use Goto to leave a loop. That is how unstable basic programs are made.

I don't have time to explain it all but:

lbl A
while 1
Goto A
End

run that, and the program will eventually display an error letting you know it ate all the system resources and crashed.

Just select Quit, and your calc will be perfectly fine.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 16 Jan 2004 04:02:09 pm    Post subject:

What does the error say? ERR:MEMORY?
Back to top
Jeremiah Walgren
General Operations Director


Know-It-All


Joined: 24 May 2003
Posts: 1937

Posted: 16 Jan 2004 06:12:46 pm    Post subject:

Laughing Yup.

I'm not sure on this, but I'll try to explain why. When the calculator encounters the "While" it looks for an "End" to complete the statement. Since there is a "Goto" inside the statement that takes program execution to the beginning of the loop it never finds the "End" it needs. Therefore, it basically keeps track, I guess you'd say, of how many Ends it needs to encounter. Eventually, it runs out of memory.

Like I said, I'm not sure if that's why so someone correct me if I'm wrong. (I could be totally off...)


Last edited by Guest on 16 Jan 2004 06:16:03 pm; edited 1 time in total
Back to top
X1011
10100111001


Active Member


Joined: 14 Nov 2003
Posts: 657

Posted: 16 Jan 2004 11:50:54 pm    Post subject:

Jeremiah Walgren wrote:
Yes, the 89 is faster than the 83+.  (Even the SE if memory serves...)

Actually, I think the SE has 15 MHz and the 89 has 12 MHz.
Back to top
Jeremiah Walgren
General Operations Director


Know-It-All


Joined: 24 May 2003
Posts: 1937

Posted: 17 Jan 2004 12:24:26 am    Post subject:

Point taken. However, compare the processor types as well.
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 17 Jan 2004 02:59:18 am    Post subject:

Actually, you can even do this:

1->A
Goto B
Lbl A
Getkey
If Ans=32
0->A
End

Disp "ENDED AT 1
Stop

Lbl B
While A
Disp "HELLO
Goto A
End

Disp "ENDED AT 2

Here is how it works:

If A is 1, the While statement is an endless loop, but if A gets changed to 0, the loop stops evaluating as true; therefor the program ends!

So, we make A = 1, so the while statement is true, then we go to the endless loop.

It displays hello, then jumps out of the while loopand executes some more code. If clear is pressed, A is set to 0 ending the endless loop and the program.

Now, End is reached.

Well, the basic parser sees the end, and it thinks it belongs to the While loop, so it goes back there if A is 1 !

The same program could be written like this:

1->A
While A
getkey
If Ans=32
0->A
End


I do not know if it will end at 1 or 2, so run the program to find out!


You probalbly won't see much basic like that because it envolves the programmer haveing some idea of what goes on behind the seans.

Heck, we left a loop but continued because as far as the calc is concerned, you are in a loop until the End is met.

I just proved that the calc tracks loops until the end token is hit!


Last edited by Guest on 17 Jan 2004 03:04:19 am; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 

Advertisement