108 Section 8: Programming Basics
File name: hp 12c pt_user's guide_English_HDPMF123E27 Page: 108 of 275
Printed Date: 2005/8/1
Dimension: 14.8 cm x 21 cm
Program Memory
Keystrokes entered into the calculator in Program mode are stored in
program
memory
. Each digit, decimal point, or function key is called an
instruction
and is
stored in one
line
of program memory — usually referred to simply as a
program
line
. Keystroke sequences beginning with the
f
,
g
,
?
,
:
, and
i
prefix
keys are considered to comprise a
complete instruction
and are stored in only one
program line.
When a program is run, each instruction in program memory is executed — that is,
the keystroke in that program line is performed, just as if you were pressing the key
manually — beginning with the current line in program memory and proceeding
sequentially with the higher-numbered program lines.
Whenever the calculator is in Program mode (that is, whenever the
PRGM
status
indicator in the display is lit), the display shows information about the program line
to which the calculator is currently set. At the left of the display is the number of the
program line within program memory. The remaining digits in the display comprise
a code that indicates what instruction has been stored in that program line. No
code is shown for program line 000, since no regular instruction is stored there.
Identifying Instructions in Program Lines
Each key on the hp 12c platinum keyboard — except for the digit keys 0 through
9 — is identified by a two-digit “keycode” that corresponds to the key’s position
on the keyboard. The first digit in the keycode is the number of the key row,
counting from row 1 at the top; the second digit is the number of the key in that
row, counting from 1 for the first key in the row through 9 for the ninth key in the
row and 0 for the tenth key in the row. The keycode for each digit key is simply
the digit on the key. Thus, when you keyed the instruction
b
into program
memory, the calculator displays a line number and a keycode
004, 25
This indicates that the key for the instruction in program line 004 is in the second
row on the keyboard and is the fifth key in that row: the
b
key. When you keyed
the instruction
+
into program memory, the calculator displays a line number and
keycode as
007, 40
This indicates that the key for the instruction in program line 007 is in the fourth
row on the keyboard and is the tenth key in that row: the
+
key. When you
keyed the digit 5 into program memory, the keycode displayed was only the digit
5
.