Hello everyone,

New to the forum seen and looking for some assistance.

So I recently found my old TI-83 Plus (currently running 1.14) and decided to give programming a try again (was into it way back in high-school). Unfortunately I have not retained a lot of the knowledge i once had. I wrote a simple program to store and display up to 10 sets of numbers and allow the user to cycle through them and add or clear. However with my limited know how I'm sure there is a much better and more efficient way of getting the same results. Also every now and then I get a memory error. If anyone could review the code and give some insight i would appreciate it.

I don't see a way to add attachment so i will have to past it all in sorry.

Also i need a program clean up command or something at the end to clear everything but the lists

Thank you in advance for any feedback.

PROGRAM: IJK


Code:
ClrHome
ClrDraw
Text(20,30,"WELCOME!"
"                     "→Str1
"         "→Str2
SetUpEditor ∟ARCS
If not(dim(∟ARCS
120→dim(∟ARCS
SetUpEditor ∟TRAC
If not(dim(∟TRAC
2→dim(∟TRAC
Pause
ClrDraw
Goto D
End


Lbl D
If ∟TRAC(1)=0
Then
∟TRAC(1)+1→∟TRAC(1)
Else
ClrDraw
RecallPic 1
Goto MP
End


Lbl MM
Text(0,81,Str1
Text(2,6,Str1
Text(2,37,Str1
Text(11,10,Str1
Text(11,64,Str1
Text(20,10,Str1
Text(20,64,Str1
Text(29,10,Str1
Text(29,64,Str1
Text(38,10,Str1
Text(38,64,Str1
Text(47,6,Str1
Text(47,60,Str1
Goto MP
End


Lbl MP
Text(0,81,∟TRAC(1)
Text(2,6,∟ARCS(∟TRAC(1)12-11
Text(2,37,∟ARCS(∟TRAC(1)12-10
Text(11,10,∟ARCS(∟TRAC(1)12-9
Text(11,64,∟ARCS(∟TRAC(1)12-8
Text(20,10,∟ARCS(∟TRAC(1)12-7
Text(20,64,∟ARCS(∟TRAC(1)12-6
Text(29,10,∟ARCS(∟TRAC(1)12-5
Text(29,64,∟ARCS(∟TRAC(1)12-4
Text(38,10,∟ARCS(∟TRAC(1)12-3
Text(38,64,∟ARCS(∟TRAC(1)12-2
Text(47,6,∟ARCS(∟TRAC(1)12-1
Text(47,60,∟ARCS(∟TRAC(1)12-0
Goto AA
End


Lbl AA
getKey→K
If K=11 and ∟TRAC(1)>1
Then
∟TRAC(1)-1→∟TRAC(1)
Goto MM
Else

If K=12
Then
Goto CL
Else

If K=13
Then
Goto M
Else

If K=14
Then
Goto N
Else

If K=15 and ∟TRAC(1)<10
Then
∟TRAC(1)+1→∟TRAC(1)
Goto MM
Else

Goto AA
End


Lbl CL
0→∟ARCS(∟TRAC(1)12-11
0→∟ARCS(∟TRAC(1)12-10
0→∟ARCS(∟TRAC(1)12-9
0→∟ARCS(∟TRAC(1)12-8
0→∟ARCS(∟TRAC(1)12-7
0→∟ARCS(∟TRAC(1)12-6
0→∟ARCS(∟TRAC(1)12-5
0→∟ARCS(∟TRAC(1)12-4
0→∟ARCS(∟TRAC(1)12-3
0→∟ARCS(∟TRAC(1)12-2
0→∟ARCS(∟TRAC(1)12-1
0→∟ARCS(∟TRAC(1)12-0
Goto MM
End


Lbl M
ClrHome
Menu("MENU","BACK",MP,"GOTO",S,"INFO",I,"QUIT",Q
End

Lbl S
Disp "ENTER 1-10"
Input "NO.",S
If S≥1 and S≤10
Then
S→∟TRAC(1)
Goto MM
Else
Goto S
End


Lbl I
ClrHome
ClrDraw
RecallPic 2
Pause
Goto M
End


Lbl N
ClrHome
If ∟ARCS(∟TRAC(1)12-11<0 or ∟ARCS(∟TRAC(1)12-11>0
Then
Goto NM
Else
Goto NY
End


Lbl NM
Menu("OVERWRIGHT","NO",NN,"YES",NY
End


Lbl NO
Goto MP
End


Lbl NY
ClrHome
Menu("OD OR ID","OD",OD,"ID",ID
End


Lbl OD
1→∟TRACK(2)
Goto NI
End


Lbl ID
0→∟TRAC(2)
Goto NI
End


Lbl NI
Disp "ARC RADIUS"
Input "R: ",R
Disp "TOOL RADIUS"
Input "TR: ",O
ClrHome
Disp "ARC CENTER"
Input "XC: ",U
Input "YC: ",V
Disp "ARC STARTING ANGLE"
Input "A1: ",A
Disp "ARC ENDING ANGLE"
Input "A2: ",B
ClrHome
Output(5,3,"CALCULATING"
If ∟TRAC(2)=0
Then
R-(O*2)→Q
Else
If ∟TRAC(2)=1
Then
R+(O*2)→Q
Goto CA
End


Lbl CA
R→∟ARCS(∟TRAC(1)12-11
O→∟ARCS(∟TRAC(1)12-10
U→∟ARCS(∟TRAC(1)12-9
V→∟ARCS(∟TRAC(1)12-8
A→∟ARCS(∟TRAC(1)12-7
B→∟ARCS(∟TRAC(1)12-6
U+(Q*cos(A°))→W
W→∟ARCS(∟TRAC(1)12-5
V+(Q*sin(A°))→X
X→∟ARCS(∟TRAC(1)12-4
U+(Q*cos(B°))→Y
Y→∟ARCS(∟TRAC(1)12-3
V+(Q*sin(B°))→Z
Z→∟ARCS(∟TRAC(1)12-2
U-W→∟ARCS(∟TRAC(1)12-1
V-X→∟ARCS(∟TRAC(1)12-0
4→T
prgmZDELAY
ClrHome
Goto MM
End


Lbl Q
ClrHome
ClrDraw
Text(22,27,"COME AGAIN!"
2→T
prgmZDELAY
ClrHome
ClrDraw
Stop
Exhale180 wrote:
Hello everyone,

New to the forum seen and looking for some assistance.

[...]


What do you mean clean up everything besides the Lists?

Also, use the SetUpEditor command without any arguments to reset the set up editor.
I know you can use DelVar to clear up variables and strings but i didn't want to make a line for each one.
I'm sure i can use a for loop or something to get them all i just don't know how to do it. As for the SetUpEditor command i will try that. However my main problem is that after a small period of time the program alarms out with a memory error wile its sitting in Lbl AA waiting to be told what to do. And it only seems to happen after data has been input and is being shown.


Edit: The memory error happens after about 20-30 sec when in Lbl AA regardless if any data has been entered. I'm assuming its because it is continuously looping searching for a K Value. I'm not sure how to pause the program within that Lbl and only have the getkey buttons do anything. If enter is pressed it will move on in the program and I don't want that.

Code:
DelVar ADelVarB


See http://tibasicdev.wikidot.com/delvar for more on the DelVar command, but basically, you don't need a new line for each DelVar, exceptions are in the link.

also, to check for key = 11 ([y=]), do this:


Code:
Repeat K=11
getKey->K
End
If LTRAC...
//do stuff


I skipped the key = 11 part because you *have to* press y= or the loop will keep running, this should fix the mem leak.
SM84CE wrote:

Code:
DelVar ADelVarB


See http://tibasicdev.wikidot.com/delvar for more on the DelVar command, but basically, you don't need a new line for each DelVar, exceptions are in the link.

also, to check for key = 11 ([y=]), do this:


Code:
Repeat K=11
getKey->K
End
If LTRAC...
//do stuff


I skipped the key = 11 part because you *have to* press y= or the loop will keep running, this should fix the mem leak.




Like this?

Code:

Lbl AA
0→K
Repeat K=11
getKey→K
If K=11 and ∟TRAC(1)>1
Then
∟TRAC)1)-1→∟TRAC(1)
Goto MM
Else

Repeat K=12
getKey→12
If K-12
Then
Goto CL
Else

Repeat K=13
getKey→13
If K=13
Then
Goto M
Else

Repeat K=14
getKey→K
If K=14
Then
Goto N
Else

Repeat K=15
getKey→K
If K=15 and ∟TRAC(1)<10
Then ∟TRAC(1)+1→∟TRAC(1)
Goto MM
Else

Goto AA
End





edit- Well that didn't work... :( still got a memory error and had to press the buttons like 6 times before they would work...
Your memory error is caused because you are using Lbl/Goto. It is recommended that you restructure your code to avoid using them.

Basically, whenever you are in a block that requires a matching End statement, the OS designates a bit of memory to look for the end statement. If you never reach the end statement because of a jump, that memory is gone. Done enough times, the OS will run out of available memory.
_iPhoenix_ wrote:
Your memory error is caused because you are using Lbl/Goto. It is recommended that you restructure your code to avoid using them.

Basically, whenever you are in a block that requires a matching End statement, the OS designates a bit of memory to look for the end statement. If you never reach the end statement because of a jump, that memory is gone. Done enough times, the OS will run out of available memory.




How else would i code it then.... and how do i get to the other Lbl's on key press?
You can use If/Then/Else/End to skip code conditionally, ex.


Code:

If K=11
Then
<do something>
Else
If K=12
Then
<do something else>
Else
<...>
End
End
_iPhoenix_ wrote:
You can use If/Then/Else/End to skip code conditionally, ex.


Code:

If K=11
Then
<do something>
Else
If K=12
Then
<do something else>
Else
<...>
End
End



Ok I could maybe do that ( did you check my original code?)
How would i get back to the top of the code?
Or not run throuh all the menus and stuff
Exhale180 wrote:
_iPhoenix_ wrote:
You can use If/Then/Else/End to skip code conditionally, ex.


Code:

If K=11
Then
<do something>
Else
If K=12
Then
<do something else>
Else
<...>
End
End



Ok I could maybe do that ( did you check my original code?)
How would i get back to the top of the code?


You could wrap it all in a Repeat or while loop.

For example, if you want the program to end when the user presses clear (key code=45), structure your code like this:


Code:

//<initialization stuff>
Repeat K=45
0
Repeat Ans
getKey
End
Ans->K
//<do stuff based on keypresses here, see above>
End
//<code to be called when program is supposed to end>
_iPhoenix_ wrote:
Exhale180 wrote:
_iPhoenix_ wrote:
You can use If/Then/Else/End to skip code conditionally, ex.


Code:

If K=11
Then
<do something>
Else
If K=12
Then
<do something else>
Else
<...>
End
End



Ok I could maybe do that ( did you check my original code?)
How would i get back to the top of the code?


You could wrap it all in a Repeat or while loop.

For example, if you want the program to end when the user presses clear (key code=45), structure your code like this:


Code:

//<initialization stuff>
Repeat K=45
0
Repeat Ans
getKey
End
Ans->K
//<do stuff based on keypresses here, see above>
End
//<code to be called when program is supposed to end>



the point of this program is to be able to add up to 10 Lists of data ∟ARCS 1-10 each having 12 values to display and to be able to page through them at will. and also be able to clear the data for what ever page you are on and enter in new data to be calculated... im not seeing how i can do that via loop. and i don't want a keypress to quit program that's why i have a menu with a quit option. I'm so confused...
I made a program back in high school that kept all my pay stub info and that worked just fine i just for the life of me cant remember how i did it.
Thank you everyone for all the input and advice. I'm doing a complete rewrite and everything is going smoothly albeit slowly. Completely different than the cnc programming I've been doing the past 15 years. A few head scratches but I'm learning!

Thanks again!
  
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
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement