Loop Control Using - HP -11C Owner's Handbook Manual

Hide thumbs Also See for HP-11C:
Table of Contents

Advertisement

132
Section 9: The Index Register
Loop Control Using
Example: Here is a program that illustrates how
works. It
contains a loop that pauses to display the current value in R; and
uses
to control the number of passes through the loop and the
value of a squared number. The program generates a table of
squares of even numbers from 2 through 50.
Program mode.
Program label.
Current counter value
(nnnnn).
Counter test value (xxx).
0
2 } Increment value (yy).
Keystrokes
Display
SE7A
000-
[f)JCLEAR
000-
001-42,21,11
2
002-
2
(-]
003-
48
0
004-
0
5
005-
5
0
006-
0
0
007-
2
008-
(sT0](1]
009-
4425
(f)[LBL]1
010-42,21, 1
[ReL)()
011-
4525
[@)[INT)
012-
4344
013-
42 31
@@
014-
4311
015-
42 31
016-
42 6
[GTO)1
017-
22 1
[9][RTN]
018-
4332
[9]{P/R]
Store loop control value in
R;.
Begin the loop.
Recall the number in R;.
Take the integer portion.
Pause to display the
integer.
Square the number.
Display the square of the
number.
Increment R; by 2 and
check to see that the
counter is not greater than
the final number (50). If
the counter is greater than
the final number, skip the
next line in the program.
Loop back to label 1.
Halts the program.
Run mode.

Advertisement

Table of Contents
loading

Table of Contents