Getting 1st gen programs working on 2nd gen models

For converting programs for 1st Generation Casio Graphic Calculators to work on 2nd Generation models like 7400, 9850, Algebra FX.

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

  • On Algebra FX 2.0 models the => command cannot be typed. See below.

  • The Range command must be changed to ViewWindow.
  • The Mcl command puts zero into all variables but is not available on newer models.
    Instead, use: 0->A~Z and also 0->r:0->theta if you need r and theta to be zero as well.
  • The Rec( and Pol( commands now store result in form of a list (List Ans) whereas the old models stored the answers in the memories I and J. Now after Pol(X,Y), List Ans[1] displays the radius and List Ans[2] displays the angle. Similarly differentiation, integration and stats function no longer use value memories for storing results. However the Graph function still affects X,Y,T,r and theta.
  • There are a variety of screen sizes on the different models. Programs using graphics commands such as Plot and Line will need to be adjusted accordingly. See the history page for default Range/ViewWindow settings and screen dimensions in pixels for the different models.
  • Thanks to Brian Hetrick for this item:
    The 7400 does not have a matrix datatype built in to the calculator, so there is no way to make it do matrices other than by programming it. You can relatively easily build a matrix out of a List by linearizing the indices: if element (i,j) of a RxC matrix is desired, and RC is at most 255, the linear index (i-1)C+j can be used to index a List element which represents the matrix element. Matrix operations such as addition, multiplication, inversion, and so forth are straightforward programming exercises.
  • You used to be able to specify range parameters the wrong way round. i.e. have Xmin>Xmax or Tmin>Tmax. All that happened was that in rect mode that the mirror image was produced or a parametric graph was drawn in reverse. But on the 9850s it just says syntax error.
  • The old models used array variables to store lists of data. Rather than use the letters A,B,C etc you could use A[0], A[1], A[2] etc.

    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.

    1. Array varibles are indexed starting from zero
      e.g. A[0], H[0] etc
      whereas Lists and Matrices are indexed from '1'.
      e.g. List 1[1] Mat A[1,1]
    2. Array variables used the same memory space as normal variables: e.g. A[0]=A, A[1]=B, A[2]=C, ... A[25]=Z, B[0]=B, B[1]=C, ... B[24]=Z etc.
    The last two points mean that if you want to replace the array A[0], A[1] etc with a List, say List 1, then you would replace A[0] with List 1[1] and A[1] with List 1[2], and also variables such as 'F', 'G', 'Q' or whatever might also have to be replaced if they were being used as part of an array. e.g. 'F' might mean A[5] or it might just mean 'F' depending on whether the array 'A' had up to 5 elements or not.

    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.

  • On old programs you could do something like:
    ?->A[F]
    i.e. input into the Fth element of A. But F=A[5] so upon rewriting you might try:
    ?->Mat A[1,Mat A[1,5]]
    But this gives a syntax error so you have to use an intermediate value like this:
    Mat A[1,5]->Z:?->Mat A[1,Z]

    See Language Summary page for more info on lists.

  • Warning: Although you can store complex numbers in arrays on old models you can't store complex numbers in either lists or matrices, unless you are using the new model: "Algebra FX 2.0".
  • On 9850 models it doesn't tell you how much memory an individual program takes up. But you can copy the program into f-memory and see how much memory the f-memory takes up as long as that one program is the only thing in f-memory.

  • On later models in the 9x50 series it does tell you how much memory is used next to each program name, but it includes 17 extra steps for storing the program name, so will report 17 more than old models for the same program.
  • The stats fucntions are totally different and programs will have to be completely rewritten.
  • Thanks to Tom Lynn for this item:
    One of the memory saving tricks is that trailing brackets are unecessary. However....
    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.
    2: THINGS WHICH YOU CAN CHANGE IF YOU WANT

  • If vs =>
    On old models you could write A=10=>"HELLO" and you can still do this on new models (except Algebra FX 2.0) but you can also do:
    If A=10
    Then "HELLO"_
    IfEnd
    
    But 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
    IfEnd
    
    which is quicker than:
    A=10=>"HELLO"_
    A=10=>A+1->B
    A=10=>"HELLO AGAIN"_
    A=10=>2+sin(A+B)-C
    
    How 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.

  • And vs =>
    On old models you could string a whole load of => statements together to test several conditions at once.
    e.g. A<7=>A>1=>B<7=>B>1=>Goto 1
    on 9850 models would be:
     A<7 And A>1 And B<7 And B>1 => Goto 1.

    The 9850 models can use either version. But the FX 1.0 and Algebra FX 2.0 models don't have the => symbol so you would have to use:
    If A<7 And A>1 And B<7 And B>1
    Then Goto 1
    IfEnd
    

  • Lbls Vs LpWhile
    There are a limited amount of labels that can be used in a single program. Namely, Lbls 0~9 and A~Z. With the new langauge you can avoid using Labels.
    e.g. Lbl 1 ... Dsz A:Goto 1 could be replaced by
    Do ... LpWhile A>0
  • Lbls Vs Fors
    Count junps using Lbls can be replaced with For Loops. There are two situations which I will describe. In the first you don't save much memory by using a For loop whereas in the second situation the For Loop is better.
    Example 1:
    5->A:Lbl 1
    "HIYA"_
    Dsz A:Goto 1
    
    In 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"_
    Next
    
    Example 2:
    1->M
    Lbl 0
    sin(M)_
    Isz M
    M<=10=>Goto 0
    
    When 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 M
    
    You 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.
    (c) Roy F.A.Maclean 28th Feb 1997. Updated with 7400 info 26th October 2005.
    rfamgm at gmail
    http://www.spiderpixel.co.uk/caspro