Sharp PC-1500 Instruction Manual page 98

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

Advertisement

All
and
more
about
Sharp PC-1500
at
http://www.PC-1500.info
G.
DEBUGGING
No
matter
hovv
carefu
l
you a rc
,
eventually you
will
creat
e
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
t
he Trace
mode
, th
e
PC· 1500
will
display the line-number
o
f
eac
h
program
line
and \\lill
hal
t
a ft
er
the execution
of
that
line.
This
allov1s
you
to
follow
(or t
race)
the
sequence of
ins.t
ructions as
they
ar
e
actually
pe·rformcd.
Wh
en
the
program
pauses afte
r
the
execution
of a
line
.
y
ou
may
inspect or
~l ter
the
val
ues of
vadables.
The form of
th
e instructio
n
for initiating
the- T
race
mode
is
simply:
TRON.
The
TRON
instruction
may be
issued as
a
command
{in
RUN
mode)
or
it
may
be embedded
..
as
a
statement,
w ithin
a p rogram
.
Used as a command, TRON informs
SHARP
th
at
t racing is
required
during
the
ex·
e
cution
of a
ll
subsequent
programs.
The
programs
to
be
t
raced are
then
started
in
a
n
ormal
manner,
wi th
a
GOTO
or
RUN command
.
If
TRON
is
used as
a
statement,
it
will initiate the Trace mode
only when
t he
line containing
it
is
executed
.
If,
fo
r
some reason,
that line
is
never
reached,
the
Trace
mode
\viii
remain
inactive.
Once
in
itiated, t he Trace
mode
of
operation remains
in
effect
until
canceled
by
a
TROFF
inst
ruction.
The
TRO
FF inst
ruction may also
be
issued
as
ei
ther a command
or a
st
atement.
The Trace
mode
ca
n
also
be
canceled by
the key
sequence:
As
an
example of
...
1sing
the
Trace
mode, enter
the
follo,ning
program
to
com
p
u
te
th
e
length
o
f
the
hypotenuse
of
a
triangle given the
length
of
the
sides:
Program
Listing:
10
IN
PUT
A.
B
2()
A
=
A*A: B
=
B*B
30
H
=
y(A
+
B)
40
PR INT "HYPOTENUSE
=
'"
H
In
RUN
mode,
issue the
T
RON
command, followed by
the
R UN command.
Not
ice
t
hat the
INPUT
command operates
in
the usual
manne
r
by
display ing a question mark
fo
r
each
inpu
t
value
required. As
soon as
you have en tered
t
wo
values, the
line
number
of
th
e INPUT
statement
appears
:
RUN
·
1
1 0
By pressing the
CD
(Up
Arrow)
key
a nd holding
it.
you may
review
the
entire
lin
e
:
RU
N
;-i
I
1
0
IN
PUT
A, B
To
continue
the
p
:rogram,
press
the
IT)
(OO\vn
A rrow) key o
nce.
This
causes
thie
1)e>:.t line
to
be
execu
ted
and
its
l
ine number
to
be
d isplayed.
Again, you may review
the
tine
with
the
(Up
Arro\v)
key.
You
may a lso
ch
eck
the
c
ontents
of
a
ny
variable
by
t
yping its
name
and
pressing
!1!HJl!Jt)
:
96
Do not
sale
this PDF
!!!

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents