EasyManua.ls Logo

HP HP-16C - Page 49

HP HP-16C
140 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Section
4:
Arithmetic
and
Bit
Manipulation
Functions
47
Left-Justify.
To
left-justify
a
bit
pattern
within
its
word
size,
press
(9]
[LJ].
The
stack
will
lift,
placing
the
left-justified
word
in
the
Y-register
and
the
count
(number
of
bit-shifts
necessary
to
left-
justify
the
word)
in
the
X-register.
The
carry
flag
is
not
affected
by
[LJ).
Example:
Left-justify
the
binary
value
1111
in
a
word
size
of
eight.
Keystrokes
Display
([STATUS]:
2-08-0000)
1111
1111
b
(9]
100
b
The
count:
four
bit-shifts
to
left-justify
the
word.
11110000
b
Left-justified
word.
Arithmetic
Shift
Right.
Pressing
(9]
(arithmetic
shift
right)
will
move
the
contents
of
the
word
in
the
X-register
one
bit
to
the
right,
as
does
[SR].
However,
instead
of
placing
a
zero
into
the
new
place
at
the
left
of
the
word,
the
sign
bit
is
regenerated.
(In
Unsigned
mode,
which
has
no
sign
bit,
operates
like
[SR].)
The
carry
bit
is
set
if
a
1
is
shifted
out
of
the
X-register
and
cleared
if
0
1s
shifted
out.
ASR
[
«
>
|
>
D
C
Sign
Bit
Unchanged
Example:
Shifting
a
positive
binary
number
to
the
right
n
places
is
equivalent
to
dividing
it
by
2”.
Since
it
regenerates
the
sign
bit,
an
arithmetic
shift
also
can
be
used
to
divide
an
even
negative
integer
by
2.*
Divide
01111111
(word
size
8)
by
2%,
then
divide
10000000
by
23,
Keystrokes
Display
([STATUS]:
2-08-0000)
(9]
3
Allows
display
of
leading
zeros.
1111111
01111111
b
*For
odd
negative
integers
in
2’s
Complement
mode,
gives
a
result
one
less
than
division
by
2.

Table of Contents

Related product manuals