EasyManua.ls Logo

Casio CFX-9800G - Page 172

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...
With
this
program,
the
first
statements
specify
the
unit
of
angular
measurement
and
clear
T
to
0.
Then
the
initial
velocity
is
prompted
for
V
and
the
angle
is
prompted
for
S.
Lbl
1
identifies
the
beginning
of
the
repeat
calculation.
:
The
value
stored
in
T
is
incremented
by
Isz
T,
and
in
this
program
the
Isz
command
is
used
only
for
incrementation,
without
any
comparison
or
decision
being
performed.
Each
time
T
is
incremented,
the
formula
is
calculated
and
the
altitude
is
displayed.
12-9
Using
Subroutines
Up
to
this
point,
all
of
the
programs
we
have
seen
were
contained
in
a
single
program
area.
You
can
also
jump
between
program
areas,
so
that
the
resulting
execution
is
made
up
of
pieces
in
different
areas.
In
such
a
case,
the
central
program
from
which
other
areas
are
jumped
to
is
called
a
“main
routine”.
The
areas
jumped
to
from
the
main
routine
are
called
“subroutines”.
Note
that
you
can
use
either
another
program
stored
in
the
program
area.or
a
program
Stored
as
a
File
Editor
file
asa
subroutine.
Subroutines
Main
Routine
Level
1
Level
2
Level
3
Level
4
‘To
jump
to
a
subroutine,
use
Prog
(input
using
Ga
FaF)(Prg))
followed
by
a
program
area
name
(0
to
9,
A
to
Z,
r,
or
@)
or
the
name
of
a
File
Editor
file:
Examples
Prog
2
—
Jumps
to
the
program
stored
in
program
area
number
2.
Prog
ABC
—
Jumps
to
the
program
stored
in
a
file
named
“ABC”.
After
the
jump
to
the
program
you
specify,
execution
continues
from
the
beginning
of
the
subroutine.
When
end
of
the
subroutine
is
reached,
execution
returns
to
the
statement
following
the
Prog
command
that
initiated
the
subroutine.
You
can
jump
from
one
subroutine
to
another,
a
procedure
that
is
called
“nesting”.
You
can
nest
up
to
a
maximum
of
10.levels,
and
an
error
will'occur
(Ne
ERROR)
if
you
try
to
nest
an
11th
time.
If
you
try
to
jump
to
a
program
area
that
does
not
contain
a
Program,
an
error
message
(Go
ERROR)
will
appear
on
the
display.
*The
Goto
command
does
not
jump
between program
areas.
A
Goto
command
jumps
to
the
label
(Lbl)
tocated
inside
the
same
program
area.
—308—
Subroutines
Save
Memory
Note
the
following
two
programs.
PO
Fix,
3:2,
>,
A:,2,
x,
V3,
x,
A
2%,
of,
V5.2,
+53,
x,
A,
4,
3
23
bytes
P1
Fix,
3,:,2
>,
Au,
¥,3,
x,
Ax
4,
Vv
,2,+,1,2,x,A,%,3
:
22
bytes
If
we
input
these
two
programs
separately,
they
require
a
total
of
45
bytes.
But
note
that
the
underlined
portions
of
these
two
programs
are
identical.
This
means
that
these
paris
can
be
stored
as
subroutines
and
called
by
both
of
thé
programs.
If
we
use
subroutines,
we
get
the
following
results,
Subroutines
.
PQ
Fix,
3,:,2,
7,
A,:,V,3,
x,
A,
x?
12
bytes
PB
Vv
,2,+,3,xK,A%,3
8
bytes
Main
routines
:
PO
Prog,
9,:,
Ans,
x,
2,
4,
Prog,
8
9
bytes
P1
Prog,
9,
4,
Prog,
8,
:,
Ans,
+,
4
9
bytes
As
you
can
see,
the
number
of
bytes
required
to
store
the
two
programs
and
the
subrou-
tines
is
38,
for
a
saving
of
7
bytes.
When
you
execute
the
program
in
program
area
0,
it
immediately
jumps
to
P9
and
exe-
cutes
the
contents
of
that
program
area.
At
the
end
of
P9,
execution
returns
to
PO
where
the
result
produced
by
the
subroutine
in
P9
is
multiptied
by
2
and
then
displayed.
After
you
press
the
3)
key,
execution
jumps
to
P8,
where
the
remainder
of
the
program
is
ex-
ecuted.
With
the
main
routine
in
program
area
P1,
execution
jumps
immediately
to
program
area
P9.
At
the
end
of
P9
execution
returns
to
P1
where
the
P9
result
is
displayed.
When
you
press
(63),
execution
jumps
again
to
P8.
At
the
end
of
P8,
execution
returns
to
P1,
where
the
result
produced
by
P8
is
divided
by
4
and
displayed.
12-10
Using
Array
Memory
iS
In
addition
to
the
individual
value
memories,
the
unit
gives
you
array
memory
capabili-
ties.
Note
the
following.
.
Value
Memories
Array
Memories
A
A[O]
B[-1]
B
Al]
Bio]
Cc
Al2}
B[t]
Note
*You
cannot
use
r
or
@
value
memory
as
array
memory.
~309—