So I made this text-based stopwatch, and this is my first more or less serious program (it has 187 lines), so I don't know much about programming yet. Everything works, but the problem is that it counts to about one minute and twenty seconds, and then it gives me "error:memory". I'll be very very gratefull if someone please explains me why this happens and/or what I can do to prevent this, thanks!
The code goes llike this:
The preparations, like clearing the home screen and clearing all lists and variables.
ClrHome ClrList L₁ ClrList L₂ Full 0→M 0→S 0→C 0→D 0→E 0→F 0→G 0→H 0→I 0→J 0→K 0→L 1→N 2→O 3→P 4→Q 5→R
Saving the current time to list one.
Lbl 1 getTime→L₁ L₁(3)→A
Closing the program and resetting the variables to zero (as cleanup) when the clear button is pushed.
Lbl 2 getKey→θ If θ=45 Then ClrList L₁ ClrList L₂ 0→M 0→S 0→C 0→D 0→E 0→F 0→G 0→H 0→I 0→J 0→K 0→L 0→θ 0→A 0→B 0→N 0→O 0→P 0→Q 0→R Stop
Saving the time to one of the laps when one of the arrow keys is pushed.
Else If θ=24 or θ=25 or θ=26 or θ=34 Then Goto 11
Pausing the program when enter is pushed.
Else If θ=105 Then Pause End
Here it loops to Lbl 2 and compares the current time to the time that has been saved back at Lbl 1, until one second has passed (or more), then it adds one to the variable that counts the seconds.
getTime→L₂ L₂(3)→B If B=A Then Goto 2 Else If B≠A Then (S+1)→S End
When there are less than 60 seconds, it displays what it has to display and goes to Lbl 1. When there are 60 seconds (or more) it does the same but also sets the seconds to zero and adds one to the minute variable.
If S<60 Then Goto 20 Else If S≥60 Then (M+1)→M 0→S Goto 20 End
This is just needed to save and display the laps.
Lbl 11 If C≠0 or D≠0 Then Goto 12 Else If C=0 and D=0 Then M→C S→D Goto 2 End Lbl 12 If E≠0 or F≠0 Then Goto 13 Else If E=0 and F=0 Then M→E S→F Goto 2 End Lbl 13 If G≠0 or H≠0 Then Goto 14 Else If G=0 and H=0 Then M→G S→H Goto 2 End Lbl 14 If I≠0 or J≠0 Then Goto 15 Else If I=0 and J=0 Then M→I S→J Goto 2 End Lbl 15 If K≠0 or L≠0 Then Goto 16 Else If K=0 and L=0 Then M→K S→L Goto 2 End Lbl 16 (N+1)→N (O+1)→O (P+1)→P (Q+1)→Q (R+1)→R E→C F→D G→E H→F I→G J→H K→I L→J M→K S→L Goto 2
And this is needed to display everything and restart the cycle.
Lbl 20 Output(1,1," TIMER LAPS ) : : ) : ) : ) : ) : Output(4,2,M Output(4,5,S Output(3,11,C Output(3,14,D Output(4,11,E Output(4,14,F Output(5,11,G Output(5,14,H Output(6,11,I Output(6,14,J Output(7,11,K Output(7,14,L Output(3,8,N Output(4,8,O Output(5,8,P Output(6,8,Q Output(7,8,R Goto 1