Casio fx-201 Programming

The machine programmes in a rather inefficient fortranesque style. There are ten memories labelled 0-9 and a special indirection memory. There are two red led annunciators on the display above the words ENT and ANS which serve to indicate if the machine is expecting the input of a number or is displaying the output of an answer. Consequently, the program must contain instructions to accept a number and store it (eg ENT 1) and to output results (eg ANS 2) ENT and ANS must reference a memory.

Program expressions are delimited by a colon ':' and every key press costs 1 step from a limit of 127. Here is all that is allowed:

<memory#> = <expression> : eg 2 = 3 + 4 : (all numbers refer to memory locations)
2 = 2 + K 1 : (K introduces a constant)
expressions can chain and contain any normal calculator operations (except those not available because the buttons are redefined such as pi and1/x).
ST# <n> : lay down a label (eg ST# 4 : )
GOTO <n> : jump to label or subroutine. (eg GOTO 4 : )
interestingly all goto must remember the return address because the machine doesnt know a subroutine until it gets there. there is no stack, only 1 level of subroutine is allowed.
ENT <n1> : <n2> : ... get input numbers into memory. (eg ENT 1 : 2 : 3 : )
ANS <n1> : <n2> : ... display memory results (eg ANS 1 : 2 : 3 : )
MAC clear all memories
IF <n> = <expression> : <l1> : <l2> : <l3> : conditional branch to label or subroutine. you must have three labels l1, l2, l3 indicating the destinations for n < expr, n = expr and n > expr. you can share labels.
these tests really burn memory.
SUB# <n> : subroutine label.
the labels and subroutine labels share the same number space of 0-9. SUB# can be the destination of any jump. you cant nest subroutines. if another SUB# is encountered or step 127 is reached the program returns.

And thats all. Aside from MJ the manual jump which is a special label to which you can jump to manually in comp mode. You also have an indirect memory which stores the number of another memory (0-9) from which to redirect. This is an advanced feature not seen later until the fx-502p.