Olivetti Programma 101 Reference Manual page 33

Table of Contents

Advertisement

The Conditional Jump can not directly differentiate between a negative value and zero. If the A
register has a negative value, the distinction may be made by a two-test procedure:
1. The value of A is tested. If the jump occurs, this value is positive; if the jump does not
occur, the A
(absolute value) instruction is executed.
2. The value of A is again tested. If the jump occurs, the value is negative. If the jump does
not occur the value is zero. If necessary, the program can re-establish the initial algebraic
condition of A.
The following sample program is for a simple calculation, c = a - b, to illustrate conditional
jumps by testing for a +, -, or 0 value in the A register.
Starting point of program; reached by touching the key V. AV
Stop computer to enter value for a.S
Transfer value a to the A register.~
Stop computer to enter value for b.S
Subtract b from a, developing c in the A register.
Exchange c to the M register for retention.
Transfer c to the A register for testing.
If c > 0 jump to AN.
If c < 0 take absolute value of c.
If |c| > 0 jump to B/W.
If |c| = 0 space tape one line.
Return to starting point AV.
Entry to routine for |c| > 0.
Print negative c retained in the M register. Return to starting point AV.
Entry to routine for c > 0.
Print positive c in the A register.
Return to starting point AV.
- 33 -

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents