Sharp PC-1500A Instruction Manual page 98

Hide thumbs Also See for PC-1500A:
Table of Contents

Advertisement

All
and
more
about Sharp PC-1500
at
http://www.PC-1500.info
G.
DEBUGGING
No
matter
how
careful
you
are, eventually you will create a program
which
does
not
do quite
what you
expect
it
to.
In
order
to isolate
the
problem,
SHARP's designers have
provided
a
special
method of
executing
programs
known
as
the
" Trace"
mode. In
the
Trace
mode,
the
PC·1
500Awill
display
the
li
1
,
c-number
of each
prograrn
lir
'c and
will
halt
after
the
execution
of that
line.
This
allows
you
to
follow (or trace)
the
sequence
of instructions as t hey are actually
performed.
When
the
program pauses
af
ter
the
execution of a
line.
you
may inspect
or
alter
the
values of
variables.
The
form
of
th.e
instruction
for initiating the Trace mode is simply:
TRON.
The
TRON
instruction may
be
issued as
a
command {in
RUN
mode) or
it
may
be
embedded,
as
a
statement,
within
a
program.
Used
as
a
command, TRON
informs SHARP
t
hat tracing
is required
during
the
execution o
f all
subsequent
programs.
The
progr·
a ms to
be
ttaced
arc
then star ted
in
a
normal
manner,
w
ith a
GOTO
or
RUN
command.
If TRON is used as
a
statement,
it
w ill
initiate t
he Trace
mode
only
when
the
line
containing
it
is executed.
If,
f
or
some
reason,
that line is never reC1ched, the
Trace mode
will remain
inactive.
Once initiated, the
Trace
mode of operation remains
in
effect u ntil canceled
by
a TROFF
instruction.
The TROFF
instruction may also
be
issued
as
either
a
commanrt
or
a
!i:rAtP.ment.
The
Trace
mode
can
also be
canceled
by
the
key
sequence:
As
an
example of
using
the Trace mode,
enter the
following program
to compute
the length
of
the
hypotenuse of
a
triangle
given the
length
of
tlhe
sides:
Program Listing:
10
INPUT
A,
B
20
A
=
A
*
A
:
B
=
B*B
30
H
v(A
+
Bl
40
PRINT "HYPOTENUSE
=
...
H
.
In
RUN
mode, issue
the TRON
command,
followed
by the RUN
command.
Notice
that
the
INPUT
command
opel'ates
in
the
usual
manner
by
display
ing
a question
mark
for
each
input
value
required
.
As
soon as
you
have
entered
two
values,
the line
number
of the
INPUT
statement
appears
:
RUN
By pressing
the
CTI
{Up
Arrow)
key and
ho
lding
it,
you
may
review
the
entire
line:
RUN
1 0
I
N
PUT A. B
' - - - - -
--
-
To
continue
the
pr ogram
,
press the
OJ
(Down
Arrow) key
once.
This
causes
the
next
line
to be
executed
and
its I
inc
number
to
be
displayed. Again,
you
may
review the
line
with
the
(Up
Arrow) key.
You
may
also
check
t
he
contents
of any variable
by
typing
its
name
and
pressing
!
ENTER!
:
96
Do not sale this PDF
!!!

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents