EasyManua.ls Logo

Radio Shack TRS-80 X-PAD GT-116 - Page 18

Radio Shack TRS-80 X-PAD GT-116
65 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...
for
instance),
the
counting
"wraps-around"
or
starts
over.
•
The
range
for
Y is to
191,
but you
will
get
greater
values
for
Y
because
coordinate
counting
wrap-arounds
at
the
Top
margin.
To see
how
this
coordinate
wrapping
works,
try
this
(Note:
The
coordinates
listed
below
are
approximate.
Your actual
readings
will be
near
these.):
1.
Enter
the
one-line
PEEK
program
and
RUN
it:
10
PRINT
PEEKCS537S)
5 PEEK
(
G5377
>
5
PEEK(G5378)
:G0T0
10
2.
Take
the
Pen
and put
it
down as
far
to the
left
of
the
left
margin as you
can.
Your
Screen
should
display
about
240.
3.
Now
move
it
horizontally
from
this
point
to
the
furthest
point
to
the
right
of
the
right
margin.
As
you
move
from
left
to right,
the
horizontal
X
coordinate
(the
only
one
we're
changing
since
we're
moving
horizontally)
is
about
240;
then
it goes
to 255
(end
of
margin), to
(start of
the
Display
Area), to
255
(end
of
Display
Area), to
0,
and
then
begins
counting
to
about
15.
(Pen)
Status
Conscious
Remember
earlier
we
talked
about
Pen
Status
(i.e.,
the
third
column
of
numbers
on
the
Screen)?
Pen
Status
tells
the
Computer
the
current
location
and
condition
of the
Pen.
There
are
16
different
statuses:
0-15.
Pen
Status 3
("Pen
pressed
down
on
Display
Area")
is
the
normal
operating
condition.
Why do
you
need
to
worry
about
Pen
Status?
Simple.
Programs
that
you
write
for the
X-Pad
will
usually
incorporate
information
about
Pen
Status.
The
Pen
Status
information
provides
additional
capabilities
in the use
of
the X-Pad.
Pen
Proximity
provides
a
means of
disabling
data
when
the
Pen is
out
of
range of
the
Writing Surface.
Pen
Down
tells
the
Computer
when
the
Pen is
touching
the
Writing
Surface.
X and
Y margins
tell
when the
Pen is
beyond
the
7"
x
9"
Display Area
and
defines
left,
top and
right
margin areas
that
can be used
for menu
or
other
purposes.
A lower
margin is
not
defined.
However,
a
lower
margin
can
be
easily created
in your
program.
It
should
be
noted
that a
menu can be
created in
the
Display
Area as
well
as
the
Menu
Area.
For
instance,
in the
sample
programs
we've
shown you so
far,
S
has
been used as a
variable
representing
the
Pen's
Current Status (S
=
PEEK(65378))
and
we've
also
tested
that
current status
with an
IF/THEN
statement
(IF
S
=
3
THEN
40,
for instance). What
this
IF/THEN
statement
is
really
saying is,
"If the
Current Pen
Status
is
Ten
pressed
down on
the
Display
Area',
then
goto
line
40".
In
all
other
instances
(such
as
if the
Pen
were
pressed
down
on the
Menu
Area), the
program
would
continue
execution at
the next line.
Other
examples
include:
100
IF S<>3
THEN
90
This
program line
waits
until
you
press
the
Pen
down
on
the
Display
Area or
on the
bottom
margin.
220
IF
S=15
THEN
RETURN
This
program line
reads
if the
Pen is
pressed
down
in the
upper-left or
upper-right
corner of
the
margins.
There are
several
Pen Statuses
(4-15)
that
tell
you
when
you
are
beyond the
perimeters of
the
7"
x
9"
Display
Area.
Three
of the
Statuses
(5,
9,
and
13)
rarely
occur
and
are
difficult to
reproduce.
However,
since
these
are
possible,
they are
included
in the list.
11