1: Things which MUST be changed - Mcl etc.
2: Things which CAN be changed if you want
Lbls -> Fors, =>'s to If's etc
1: THINGS WHICH MUST BE CHANGED
Array variables don't exist on newer models so Lists or Matrices need to be used instead.
The following points need to be taken into account when rewriting a program.
To make array 'A' longer than 26 entries
i.e. beyond A[0]..A[25] , beyond A~Z,
you use the 'defm' command e.g. Defm 30
would allow A[0]..A[29] to be used in programs.
On new models you just set-up the List or the
Matrix to be the size you want beforehand.
See the autodimension page
for info on setting the size of Lists and matrices.
See Language Summary page for more info on lists.
The statement: 1-(2+3=45=>"HELLO" on old models would do nothing, as it would be evaluated as: 1 - (2+3)=45=>"HELLO" 1 - 5 = 45 =>"HELLO" -4 = 45 => "HELLO" ie do nothing. The important point is that the implied ) is inserted before the = sign. On a 9850, it is evaluated as: 1 - (2 + (3=45)) => "HELLO" 1 - (2 + 0) => "HELLO" 1 - 2 => "HELLO" -1 => "HELLO"This time "HELLO" is printed because -1 evaluates as 'TRUE' like all non-zero expressions. The reason for this is that expressions with relative operators
("=","<=","=>","<>")
give
logical values 'TRUE','FALSE' or 'NONZERO', 'ZERO'
on 9850s, whereas they are syntactic break points on the older models.
If A=10 Then "HELLO"_ IfEndBut as it stands there is no advantage with this example because the original method is shorter. The advantage only comes if there are several consequences e.g:
If A=10 Then "HELLO"_ A+1->B "HELLO AGAIN" 2+sin(A+B)->C IfEndwhich is quicker than:
A=10=>"HELLO"_ A=10=>A+1->B A=10=>"HELLO AGAIN"_ A=10=>2+sin(A+B)-CHow many consequences should there be before If...IfEnd becomes shorter than a string of =>'s? No hard rules. It depends on how long the condition is that is being tested. With (A=10) then you can do about 3 of them before you are better off with an If statement.
e.g. A<7=>A>1=>B<7=>B>1=>Goto 1on 9850 models would be:
A<7 And A>1 And B<7 And B>1 => Goto 1.
If A<7 And A>1 And B<7 And B>1 Then Goto 1 IfEnd
5->A:Lbl 1 "HIYA"_ Dsz A:Goto 1In this example where the counter is going down then the alternative below is about the same length.
For 5->A To 1 Step -1 "HIYA"_ NextExample 2:
1->M Lbl 0 sin(M)_ Isz M M<=10=>Goto 0When the counter is going up like this and you have to test a condition to stop the loop then it is shorter to do a For Loop as below:
For 1->M To 10 sin(M)_ Next Isz MYou may wonder what that last Isz M is doing at the end of the For Loop. Well although the original only calculates sin(M) ten times, it quits the loop because it test the condition and finds M=11 so M leaves the loop with value 11. So to make the alternative exactly the same effect then the Isz M is needed. Of course if you were just using the M as a counter variable and don't care what its value is afterwards then you don't need the Isz M.