HP -16C Owner's Handbook Manual page 76

Table of Contents

Advertisement

74
Section 7: Programming Basics
Example: The body of the concatenation program is listed below.
Assuming that two separate numbers are given in the X- and Y-
registers, program lines 002 to 008 below will concatenate those
two 16-bit words into one 32-bit word. The word initially in the
X-register will become the most significant bits of the result.
Keystrokes
Display
002-
23
2
003-
2
Doubles the word size
0
004-
0
from 16 to 32, providing
005-
42 44
16 extra bits to the left of
the numbersin X and Y.
(9][LSTx]
006-
4336
Brings back word size
(32).
007-
42 b
Computes one-half of
word size (16).
008-
42 E
Shifts number left 16
bits.
009-
4240
ORoperation here
concatenates the
contentsof X and Y.
Ending a Program.
e Theinstruction [9][RTN](return) will end a program, return to
line 000, and halt.* This instruction can be omitted if the
program is the last one in memory, since the end of the
program memory contains an automatic [RTN].
e The instruction
(run/stop) will stop a program without
moving the line position to line 000.
Keystrokes
Display
(9][RTN]
010-
4321
Optionalifthisisthe
last program in memory.
* Except when a subroutine return is pending, as discussed in section 9, page 94.

Advertisement

Table of Contents
loading

Table of Contents