EasyManua.ls Logo

Casio CFX-9800G - Page 171

Casio CFX-9800G
206 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...
HM
About
Conditional
Jumps
a
.
With
a
conditionat
jmp
you'set
up
certain
criteria
and
control
whether
0
or
not
the
jump
is
actually
performed:
a
at
the
follwing
format.
‘
If
true
Relational
”
Right
side.
.>
.
Statement
a
{2
}
snr
;
Left
side
operator
if
not
true
As
shown
above,
if
the
condition
defined
by
the
relational
operator
is
true,
the
statement
following
“=>”
is
executed,
and
fen
thé
next
statement
is
executed.
Ifthe
condition
;
is
false,
the
statement
following-'>"-is
skipped--
-
The
following
are
the
sonaltiong
that
you
can
define
using
the
relational
operators.
L=
True
when
L
and
R
are
equal;
false
when
L
arid
R
are
not
equal
L&R
True
when
L’and
R
are
not
equal;
false
when
L
and
R
are
equal
L>R
True
when
Lis
greater
than
R;
false
when
L
is
less
than
or
equal
to
R
L<R
True
when
Lis
fess
than
R;
false
when
L
is
greater
than
or
equal
to
R
L2=R
True
when
L
is
greater
than
or
equal
to
R;
false
when
L
is
less
than
R
L<R
True
when
L
is
less
than
or
equal
to
R;
false
when
L
is
greater
than
R
©
To
use
a
conditional
jump
oy
Pi
[Example
1]
To
write
a
program
that
calculates.
the
square
root
of
any
input
value
that
is
greater
than
or
equal
to
zero.
If
a
vatue
that
is,less
than
zero
-is.
input,
the
program.
ignores
it-and
prompts
further.
input.
Program
:
_
Lbl,
LA
A,
=,
0,
2...
A,
4,
Goto,
1
16
bytes
.
Vm
4
\
i
This
program
starts
‘out
by
prompting
input
for
A.
The
next
statement
tests
the
input
by
saying:
"if
the
vatue
of
A
is
greater
than
or
equal
to
0,
then
calculate
the
square
root
of
A".
This
is
followed
by
a
display
result
command.-After
the
result
is
displayed,
pressing
fe)
continues
with.
the
Goto-1
unconditional
jump
to
label
1
(Lbl
1).atthe
beginning.of
the
program.
For
values
that.are
less
than
0,
the
square
root
calculation.
statement
is
skipped
and
execution
jumps
directly
to
the
Goto
1
statement.
Example
2]
To
write
a
program
that
accumulates
input'values,
but
displays
the
total
of
the
values
any
time
zero
is
entered.
Program
a,
>,.B,:,
5
‘
cay
Lol,
1,:,27,
>,A,:,A,
=,
8,
>,
Goto,
2,
:,
A,
+,
B,-,
B,
:,
Goto,
1,
:,
Lbl,
2,.:,B
:
ee
‘
31
bytes
With
this
program;
0
is
assigned
to
value
memory'B
to
clear
it.
The
next
statement
prompts
for
input
of
a
value
to
value
memory
A.
The
next
statement
is
a
conditional
jump
that
says:
“if
the
value
input
for
A
equals
0,
then
go
to
label
2”.
The
statement
following
label
2
.
{LbI2)
ends
program
execution
with
a
display
of
the
value
memory
B
contents.
For
other
values,
the
next
statement
adds
value
memories
A
and
B,
and
then
stores
the
result
in
value
memory
B
again.
After
this,
program
execution
returns
to
the
statement
following
tabel
1
(Lb!
1),
where
the
next
input
for
A
is
prompted.
—306—
About
Count
Jumps
_
There
are
two
count
j
jumps:
one
that
increments
a
value
memory
(Isz)
and
one
that
decre-
ments
a
value
memory.
(Dsz).
Look
at
the
following
format.
Memory
contents
0
Ad
Isz_
|
Memory
name:
Statement
{
‘
Statement
|
4
Memory
contents
+0
Memory
contents
=0
d
Dsz
Memory
name:
Statement.
:
}
_
Statement’
|
meee?
f
Memory
contents
=0
As
shown
above,
if
the
increment
or
decrement
operation’
does
‘not
cause’
the
content
of
the
value
memory
to
become
0,
the
statement
following
the
value
memory
namé
is
executed.
If
the
content
of
the
value
memory
becomes
0,
the
next
statement
is
skipped.
To
use
a
count
jump
Example
1]
To
write
a
program
that
accepts
input
of
10
values,
and
then
calcu-
lates
the
average
of
the
values.
Program
1,0,
>,
A,
1,0
Lbl,
1,:,
2,
>,
B.
Dsz,
A;
:,
Goto,
1,
32
bytes
This
program
starts
out
by
assigning
a
value
of
10
to
A.
This
is
because
value
memory
Awill
be
used
as.a
control
variable.
The
next
statemént
clears
C
to
zero.
After
defining
the
location
of
label
1
(Lb!
1),
the
program
then
prompts
for
input.
of.a
value
for
B.
The
next
statement
adds
the
value
of
B
to
value
memory
C,
and
then
stores
the
result
in
C.
The
next
three
statements.
say::‘‘decrement
the
value
in
A,
and
if
it
is
still
greater
‘than
0,
jump
back
to
label
1;
otherwise
divide
the:contents
of
C
by
10”.
Example
2;
To
write
a
program
that
calculates
at
1-second
intervals
the
altitude
of
a
ball
thrown
into
the
air
at
an
initia!
velocity
of
eee’
and
an
angle
of
S°.
The
formula
is
expressed
as:
heave
ssinSt_
5
of,
with
g=9.8.
The
effects
of
air
resistance
should
be
disregarded:
Program
Deg,
:,0.7,F:%7V1%7,8,:
Lbl,
1,
:,
Isz,
T,
:,
V,
x,
sin,
S,
x,
T,
-,
9,
+,
8,
x,
T,
x2,
+,
2,
4,
Goto,
1
38
bytes
4340087-13
be
k
.
i
fe