EasyManua.ls Logo

HP HP-32S - Page 80

HP HP-32S
312 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
Loading...
Press
IR/SI
(run/stop)
or
a
to
resume
the
program.
The
value
you
keyed
in
then
writes
over
the
contents
of
the
X-register
and
is
stored
in
the
given
variable.
If
you
have
not
changed
the
displayed
value,
then
that
value
is
retained
in the
X-register.
The
area-of-a-circle
program
with an
INPUT
instruction looks like
this:
R01
LBL
R
fl02
INPUT
R
R03
x*
R04
tf
R05
x
R06
RTN
Using INPUT in a Program.
1.
Decide
which
data
values
you
will
need,
and
assign
them
names.
(In
the
area-of-a-circle
example,
the onlyinput
needed
is the
ra
dius, which we can
assign
to
R.)
2. In the beginningof the
program,
insert an
INPUT
instruction for
each
variable
whose
value
you
will
need.
Later
in
the
program,
when
you
write
the
part
of
the
calculation
that
needs
a
given
value,
insert
a I
RCL
I
variable
instruction
to
bring
that
value
back
into
the
stack.*
For
Example:
See
theTime
Value
of
Money*
program
on
page
222
in
part
4.
The
first
thing
that
routine
T
does
is
collect
all
the
necessary
input
for
the
variables
N,
I,
B,
P,
and
F
(lines
T02
through
T06).
Since
the
INPUT
instruction
also
leaves
the
value
you
just
entered
in
the
X-register,
you
don't
have
to
recall
the
variable
ata
later
time—you
could
INPUT
it
and
use
it
when
you
need
it.
You
might
be
able
to
save
some
memory
space
this
way.
However,
ina
long
pro
gram
it is
simpler
to justinput all your
data
up
front,
andthen
recall
individual
variables
as
you need them.
Remember
also
matthe
user
of
the
program
can
do
calculations
while
the
program
is
stopped,
waiting
for
input.
This
can
alter
the
contents
of the
stack,
which
might
affect
the
next
calculation
to be doneby the
program.
Thusthe
program
should
not
assume
that the
X-, Y-, and Z-registers'contents will be the same before and after the INPUT instruction. If
you
collect
allthe
data
in the
beginning
andthen
recall
them whenneeded
for
calculation,
then this
prevents
the
stack's
contents
from
being
altered
just
before
a
calculation.
78
5:
Simple
Programming

Table of Contents

Related product manuals