116 Section 10: Program Editing

Example: Assuming you have added a -instruction at the end of program memory as in the preceding example, suppose you now wanted to insert an t instruction before the -instruction so that the program will display the amount of the tax before displaying the net income after tax. Since there is only one instruction (-) following the point at which the new instruction is being added, it is simplest to add the tinstruction by replacement, as follows:

Keystrokes

Display

fs

00-

gi.08

08-

t

09-

-

10-

fs

12,000.00

15000t

3,000.00

t

12,000.00

Sets calculator to Program mode.

25Sets calculator to last program line

to be executed, which contains the binstruction.

31Keys in new instruction.

30Keys in original instruction, which was replaced by new instruction added.

Sets calculator back to Run mode.

Twenty percent tax on $15,000 income.

Net income after tax.

Adding Instructions by Branching

1.Press fsto set the calculator to Program mode.

2.Press gi. followed by two digits that specify the program line immediately preceding the point at which the new instruction(s) are being added — usually, the last program line to be executed before the added instruction(s). This sets the calculator to the proper program line for inserting a iinstruction in the next step. This iinstruction will replace whatever instruction was already stored there, but that instruction will be keyed back into program memory, to be executed just after the new instructions, in step 7.

3.Press gifollowed by two digits that specify the second line after the last line you keyed into program memory. (Branching to the second line rather than to the first is necessary because the first line following the last program in program memory must contain a i00 instruction. The i00 instruction ensures that program execution will branch to line 00 and halt after the program is run.) For example, if the last line you keyed into program memory was line 10, you would press gi12 at this step, preserving the gi00 in line 11.

4.Press gi. followed by two digits that specify the last line you keyed into program memory.

File name: hp 12c_user's guide_English_HDPMBF12E44

Page: 116 of 209

Printered Date: 2005/7/29

Dimension: 14.8 cm x 21 cm