Excuse me if anything in my English is wrong . My native language is
Spanish.



BASIC PROGRAMMING
-----------------

The more elemental program I can imagine is one that adds two numbers.
It is only composed for one instruction:  +

For create the program you can use any ascii text editor.

Let's us put a name to the program :  ADD.PRG

In DOS for build the program you can write :

COPY CON ADD.PRG
+

Now, for close the ascii file, at the PC keyboard press F6 and the Enter key.

The program is made with only one character !

To execute the program put two numbers, one in X an other in Y using the
[ENTER] calculator key.

Then press the [XEQ] calculator key and write ADD , (press the Enter PC key
for end the string ADD )

The program shows the result in X.





The second super elementary program that I can imagine is for calculate
a rectangle area.

It is composed for only one instruction :    *

Of course, the rectangle base and height must be in X and Y

To create the program you can use

COPY CON AREA.PRG
*

(Close the file with F6 and Enter.)

or you can build the program with  DOS EDIT:

EDIT AREA.PRG
*

(Alt File Exit for close the program)

Load SIM41.EXE . Put two numbers in X and Y,
Press the [XEQ] calculator key and write AREA (For end the name use the Enter
PC keyboard key).
Then you obtain the answer in X ( the calculator display )




Third program: Triangle area
-------------


Remembering that the triangle area is base* height
                                      ------------
                                            2
our program will be :

TRIAREA.PRG

and will has three intructions:

*
2
/


To execute the program, again put two numbers in X and Y (Triangle base and
height),
Press [XEQ] TRIAREA
and you will obtain the result.


Program four:  Circle Area
------------

The program is:

x^2
pi
*

Other possibility is:

enter^
*
pi
*

To execute the program put the radius of the circle in X , press [XEQ]
and write CIRCLE. The area of the circle is returned in X.

Program five:  Mean of three student scores.
------------



In DOS:

COPY CON SCORE.PRG
stop
+
stop
+
3
/

(Close the file with F6 Enter)

Begin the program with the first score in X
The first 'stop'  waits for the second score.
The first '+' adds the first two scores.
The second 'stop' waits for the third score.
The second '+' adds the answer of the first two scores sum with the third
score.
The last two instructions obtain score1+score2+score3
                                 --------------------
                                           3

Load SIM41.EXE.

Put the calculator in FIX 1 for work with only one decimal.

For calculate the mean of 3.8  ,  4.2   and   4.9

Calculator Keyboard                 PC Keyboard               Display
Write  3.8                          3.8                         3.8
[XEQ] SCORE                         [K] SCORE [ENTER]           3.8
4.2   [R/S]                         4.2 [R]                     8.0
4.9   [R/S]                         4.9 [R]                     4.3

The display shows the answer :   4.3






Program six: Mean of three student scores using PROMPT.
------------




The PROMPT instruction stops program execution showing the alpha register
contents.

In the program SCORE2.PRG we put the messages "SCORE 1?" , "SCORE 2?",
"SCORE 3?" into the alpha register and wait the user input for each Score.

At the end of the program we calculate the mean of three scores. We put
the message "MEAN = " into the alpha register and using ARCL X we append
the result at the right of the message. For view the answer we use again
the PROMPT instruction.

This is the program:

fix 1
"SCORE 1?"
prompt
"SCORE 2?"
prompt
+
"SCORE 3?"
prompt
+
3
/
"MEAN = "
arcl x
prompt


Executing the program:

Calculator keyboard.           PC Keyboard              Calculator Display

[XEQ] SCORE2                   [K] SCORE2 [ENTER]       SCORE 1?
4.2 [R/S]                      4.2 [R]                  SCORE 2?
4.9 [R/S]                      4.9 [R]                  SCORE 3?
3.8 [R/S]                      3.8 [R]                  MEAN = 4.3





Program seven: Find the sum of the first n numbers.
-------------


To obtain the sum of the first n numbers  1+2+3+4+ ... + n you must put n in
the X register and execute the program. The program returns the sum in the X
register.

Example:  Obtain the sum of the first 6 numbers. 



Calculator keyboard.           PC Keyboard              Calculator Display

6                              6                        6
[XEQ] SUMN                    [K] SUMN [ENTER]          21



Of course,  1+2+3+4+5+6 = 21


This is the program:   (SUMN.PRG)



sto 00              Save n in Memory 00
0
sto 01              Memory 01 is the partial sum
lbl 00              Begin loop 
rcl 00
rcl 01
+
sto 01              Partial sum in the form  n+ (n-1) + ... 
rcl 00
1
-                   
sto 00              Decrement counter
x#0?                If x is not equal to 0 go to label 00 
gto 00
rdn                 If x equal to 0 then end the program. Roll down the stack
                    for shows the answer in the Y register 






To be continued.


