Can anyone help me with this? A glitch appeared when running a TI-Basic program on an 84+CSE, and it had always run successfully before. In a For( loop the index variable kept resetting to 0, although no code referenced that variable: it was just a count of how many times the loop should run. Lots of other things took place in the loop, however, so I ended up adding loads of instructions to display the value of the variable at various points so I could track down when it went wrong. The conclusion made no sense, but prompted me to write these test programs:
Code:
This one prints 1, then repeatedly 0 until I hit ON: the loop can never end.
Next I tried,
Code:
which displays digits 1-5 down the right of the Home Screen, as it should. So ClrDraw by itself did not set R to 0.
Then
Code:
which is apparently the same as the previous one, except for alternately visiting the [blank] Graph Screen and the Home Screen, but now displays an endless sequence of 0s on the Home Screen, until I Break.
Next I try
Code:
where the loop "works", showing that ClrDraw is required for this fault to occur.
Then finally,
Code:
which is the same as the first program here, but with a different name for the variable. This displays the digits 1 - 5 successively on the Graph Screen.
So in the main program I was originally debugging, I altered the index variable from R to S, and it now works properly. But none of this makes sense to me: what is going on?
Footnote: None of these test programs is running from Archive, and I have no evidence to associate this with any Doors CSE issues.
Code:
For(R,1,5
ClrDraw
Text(10,10,R
End
This one prints 1, then repeatedly 0 until I hit ON: the loop can never end.
Next I tried,
Code:
For(R,1,5
ClrDraw
Disp R
End
which displays digits 1-5 down the right of the Home Screen, as it should. So ClrDraw by itself did not set R to 0.
Then
Code:
For(R,1,5
ClrDraw:DispGraph
Disp R
End
which is apparently the same as the previous one, except for alternately visiting the [blank] Graph Screen and the Home Screen, but now displays an endless sequence of 0s on the Home Screen, until I Break.
Next I try
Code:
For(R,1,5
DispGraph
Disp R
End
where the loop "works", showing that ClrDraw is required for this fault to occur.
Then finally,
Code:
For(S,1,5
ClrDraw
Text(10,10,S
End
which is the same as the first program here, but with a different name for the variable. This displays the digits 1 - 5 successively on the Graph Screen.
So in the main program I was originally debugging, I altered the index variable from R to S, and it now works properly. But none of this makes sense to me: what is going on?
Footnote: None of these test programs is running from Archive, and I have no evidence to associate this with any Doors CSE issues.