Section 8: Programming Basics 95
File name: hp 12c_user's guide_English_HDPMBF12E44 Page: 95 of 209
Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm
Program memory is automatically expanded like this whenever another seven
instructions have been keyed into program memory — that is, when you key an
instruction into program line 16, 23, 30 etc. In each case, the additional program
lines made available are converted, seven lines at a time, from the last available
data storage register (whether or not data has been stored in that register; if it has,
it will be lost). Furthermore, the six new program lines (following the 16th, 23th
etc.) will each contain the instruction
i
00.
To determine at any time how many program lines (including those containing
i
00) are currently in program memory and how many storage registers are
currently available for conversion to program lines or for data storage, press
gN
(memory). The calculator will respond with a display like the following:
Up to 99 instructions can be stored in program memory. Doing so would require
the conversion of 13 data storage registers (because 99 = 8 + [13 × 7]), leaving
7 storage registers — R
0
through R
6
— available for data storage.
If you find yourself creating long programs, you should create your programs so
that they don’t use up program lines unnecessarily, since program memory is
limited to 99 program lines. One way to minimize program length is to replace
numbers consisting of more than just one digit — like the number 25 in lines 02
and 03 of the program keyed in above — by a
:
instruction, and then storing
the number in the designated storage register before running the program. In this
case, this would save one program line, since the
:
instruction requires only
one program line, not two as are required by the number 25. Of course, doing so
uses up data storage registers that you might want to save for other data. As in
many business and financial decisions, there is a trade off involved; here it is
between program lines and data storage registers.
Setting the Calculator to a Particular Program Line
There will be occasions when you’ll want to set the calculator directly to a
particular program line — such as when you’re storing a second program in
program memory or when you’re modifying an existing program. Although you
can set the calculator to any line by using
Ç
as described above, you can do so
more quickly as follows:
z With the calculator in Program mode, pressing gi. followed by two
digit keys sets the calculator to the program line specified by the digit keys,
and then displays that line number and the keycode of the instruction stored
there.