112 Section 10: The Index Register and Loop Control
Keystrokes Display
l %
2.6458
Indirectly recalls contents of R
.2
.
´ X .2
2.6458
Check: same contents recalled
by directly addressing R
.2
.
Exchanging the X-Register
Keystrokes Display
´ X V
12.3456
Exchanges contents of R
I
and
X-register.
l V
2.6458
Present contents of R
I
.
´ X %
0.0000
Exchanges contents of R
2
(which is zero) with X.
l %
2.6458
´ X 2
2.6458
Check: directly address R
2
.
Storage Register Arithmetic
Keystrokes Display
10 O + V
10.0000
Adds 10 to R
I
.
l V
12.6458
New contents of R
I
(= old + 10).
| $ O ÷ %
3.1416
Divides contents of R
.2
by π.
l %
0.8422
New contents of R
.2
.
´ X .2
0.8422
Check: directly address R
.2
.
Example: Loop Control with e
Remember the program in Section 8 which used a loop to calculate
radioactive decay? (Refer to page 93.) This program used a test condition
(x ≥ y?) to exit the loop when the calculated result passed the given limit
(50). As we’ve seen in this section, there’s another way to control loop
execution: through a stored loop counter that is monitored by the I or
e function.