EasyManuals Logo

HP HP-16C User Manual

HP HP-16C
140 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #53 background imageLoading...
Page #53 background image
Section
4:
Arithmetic
and
Bit
Manipulation
Functions
51
Testing
for
the
presence
of
a
given
bit
([f](B?])
is
a
conditional
test
useful
in
programming:
a
decision
for
program
execution
can
be
based
on
the
bit
pattern
of
a
number.
(The
X-
and
Y-registers
must
contain
the
proper
parameters,
as
noted
above.)
Section
9
describes
conditional
branching.
Masking
The
(mask
left)
and (mask
right)
functions
create
left-
or
right-justified
strings
of
1
bits.
The
magnitude
of
the
number
in
the
X-register
is
used
to
determine
how
many
1’s
will
comprise
the
mask.
Upon
execution,
the
mask
pattern
is
placed
in
the
X-register
(the
stack
does
not
move).
You
can
create
a
mask
as
large
as
the
word
size.
To
place
a
mask
in
the
middle
of
the
field
of
a
number,
use
a
shift
function
in
conjunction
with
[MASKL
or
[MASKR].
Example:
The ASCII
representation
of
a
two-digit
number
occupies
16
bits—eight
bits
per
digit.
Given
an
ASCII
“65”
(0011
01100011
0101),
extract
the
high-order
digit
(6),
thereby
converting
half
of
this
ASCII
code
to
binary
coded
decimal.
0011
0110
0011
0101
ASCII“65”
(“3”,“6”,
“3”,
“5”).
0000
1111
0000 0000
Mask.
0000
0110
0000
0000
The
extracted,
high-order
digit
(“6”).
You
can
save
keystrokes
in this
example
by
shifting
the
digits
into
position
before
masking.
Keystrokes
Display
([STATUS]:
2-16-0000)
3635
3635
h
8
3536
h
Rotates
word
eight
bits
to
the
right
to
right-
justify
the
desired
hex
digit
(6).
4 F
h
Right-justifies
a
mask
of
four
1
bits
(1111)
in
the
16-bit
word.
6
h
Extracts
the
rightmost
four
bits
(6).

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP HP-16C and is the answer not in the manual?

HP HP-16C Specifications

General IconGeneral
BrandHP
ModelHP-16C
CategoryDesktop
LanguageEnglish

Related product manuals