112 Section 10: The Index Register and Loop Control

Keystrokes

Display

l%

2.6458

´X.2

2.6458

Exchanging the X-Register

Indirectly recalls contents of R.2.

Check: same contents recalled by directly addressing R.2.

Keystrokes

Display

´XV

12.3456

lV

2.6458

´X%

0.0000

l%

2.6458

´X2

2.6458

Storage Register Arithmetic

Exchanges contents of RI and X- register.

Present contents of RI.

Exchanges contents of R2 (which is zero) with X.

Check: directly address R2.

Keystrokes

Display

10 O+V

10.0000

lV

12.6458

$O÷

3.1416

%

 

l%

0.8422

´X.2

0.8422

Adds 10 to RI.

New contents of RI (= old + 10). Divides contents of R.2 by π.

New contents of R.2. 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.