HP -16C Owner's Handbook Manual page 51

Table of Contents

Advertisement

Section 4: Arithmetic and Bit Manipulation Functions
49
Rotation Through the Carry Bit. The
and
(rotate
left through carry and rotate right through carry) functions
respectively load the leftmost or rightmost bit of a word into the
carry bit, and move the carry bit into the other end of the word.
[J=——|
c —
RRC
[
>| ——»D
C
Rotating More Than One Bit at a Time. Given a bit pattern in
the Y-register and n in the X-register, pressing (fJ(RLn],
[f][RRn], (9]
[RLCn], or [9][RRCn] will rotate the pattern |n|bits. The stack drops,
placing the result in the X-register.
The status of the carry flag (flag 4) is the sameas if [RL], [RR], [RLC],
or
were performed | n|times. For instance, executing
with
n = 3 will set the carry flag only if the third bit from the right (bit 2)
is 1.
Example: Develop a keystroke sequence that will serve to rotate
left as one word a 16-bit word divided into two separate 8-bit words
held in two separate registers. For instance, with a word size of
eight bits, rotate the word 00011100 11100111.
Keystrokes
Display
([STATUS]: 2-08-1000)
11100
00011100 b
High order portion of
16-bit word.
00111000 b
Moves most significant
bit into carry bit.
(9](LSTx]
00011100 b
Recovers high-order
portion.
11100111
11100111 b
Low-order portion of
16-bit word.

Advertisement

Table of Contents
loading

Table of Contents