104
105
* Hereinafter, commas (,) will be used to separate steps for
the sake of clarity,
Add “Goto 1” to the end of the program, and add “Lbl 1”to
the beginning of program as the branch destination.
If this is simply left the way it is , however, the volume will
not be displayed and execution will move immediately to
the input of one side at the beginning, To prevent this
situation , insert a display command " " in front of the
“Goto 1”.
The complete program with the unconditional jump added
should look like this :
Lbl , 1, : ,?, , A , : ,
√
, 3 ,
x
, A,
x
2 ,
,
√
,2, ÷ , 1, 2,
x
, A ,
x
y
,
3 , ,Goto , 1 25 steps
Now let’s try executing this program.
* Henceforth , the displays will only show calculation result
output.
Since the program is in an endless loop, it will continue
execution, To terminate execution, press
.
Besides the beginning of the program , branch destinations
can be designated at any point within the program.
The programs for this unit are made based upon manual
calculations. Special program commands, however, are
available to allow the selection of the formula, and
repetitive execution of the same formula.
Here, some of these commands will be used to produce
more convenient programs.
Jump commands
Jump commands are used to change the flow of program
execution.
Programs are executed in the order that they are input
(from the lowest step number first ) until the end of the
program is reached. This system is not very convenient
when there are repeat calculations to be performed or
when it is desirable to transfer execution to another
formula. It is in these cases, however, that the jump
commands are very effective. There are three types of
jump commands: a simple unconditional jump to a branch
destination, conditional jumps that decide the branch
destination by whether a certain condition is true or not,
and count jumps that increase or decrease a specific
memory by one and then decide the branch destination
after checking whether the value stored equals zero or not.
Unconditional jump
The unconditional jump is composed of “Goto “ and “Lbl” .
When program execution reaches the statement “ Goto
n
”
(where
n
is a number from 0 through 9),execution then
jumps to “Lbl
n
”(n is the same value as Goto
n
). The
unconditional jump is often used in simple programs to
return execution to the beginning for repetitive calculations,
or to repeat calculations from a point within a program .
Unconditional jumps are also used in combination with
conditional and count jumps,
The previously presented program to find the
surface area and volume of a regular
tetrahedron will be rewritten using “Goto 1”
and “Lbl 1 ” to allow repeat calculations.
The previous program contained:
?, , A , : ,
√
, 3 ,
x
, A,
x
2 ,
,
√
, 2, ÷ , 1, 2,
x
, A ,
x
y
,3 19 steps
Summary of Contents for CA756
Page 24: ...38 Parenthesis calculations...
Page 27: ...41...
Page 34: ...48...
Page 40: ...54...
Page 42: ...56...
Page 45: ...59 Binary octal decimal hexadecimal conversions Negative expressions...
Page 46: ...60 Basic arithmetic operations using binary octal decimal and hexadecimal values...
Page 58: ...82 83 first...
Page 79: ...125 124...
Page 80: ...127 126...
Page 81: ...129 128 Program Calculations...
Page 82: ...131 130 Error Message Table...