the program once.
To
clear
the Screen, press
(BREAK) and
re-run
the program.
Let the
Pixels Fall
Where They
May
.
.
.
As a review of the Color Computer Extended
BASIC
language,
this
is
what
happens
in
the
program:
•
Line
10 (PMODE
4,1)
creates
the point size
("resolution")
and specifies a two-color
"high
resolution".
•
Line
20 (PCLS) clears
the Graphics
Screen.
•
Line
30
(SCREEN
1,1)
selects the Graphics Screen
and
the Color Set (black
and
green).
•
Line
40 (GOSUB
80)
tells the
Computer
to
automatically
branch to
the subroutine in line 80.
•
Line
50 (IF S<>3 THEN
40)
decides
that,
if S
(which
represents the
Pen) is
not
touching the X-Pad's surface,
program
control
goes to line 40, Since S
=
3
when the
Pen is
on
the
X-Pad, program control goes
to
the next
program
line.
•
Line
60
(PSET(X,Y,1))
sets
the
X-Y coordinates and
specifies
the points' color.
•
Line
70
(GOTO
40)
sends the Computer
to
line 40 so
you
can set
more
points.
•
Line 80 (X-PEEK(65376):Y
=
PEEK(65377):S
=
PEEK
(65378)
:RETURN)
accesses each
memory location
in
the
X-Pad
where digitized
data
is
available. You'll
have
to
include
these PEEK
statements
in
each
X-Pad
program
you write.
The
Big
Cheese
—
PEEK
After running
the program,
it should
be obvious
to
you
that there aren't
any
new
commands the X-Pad uses.
The only
special
thing the X-Pad
does
is
to
PEEK
into
certain
memory
addresses which
store
information
about
the
current
X-Y coordinates of the
Pen (see line
80).
You'll have
to
PEEK
into
these
memory locations in every
X-Pad program
you write.
Do
you want
to
see
what
we
mean?
If
so,
type
in
this
program:
NEW
(ENTEffi
10 PRINT PEEK<G537S>
5
20
PRINT PEEK(65377)
5
30
PRINT PEEK(65378)
40 A$=INKEY$: IF A$="
50
GOTO
10
THEN
40
Position the
Pen above the Writing Surface of the
X-Pad
and
RUN the
program. The
Screen
will display
a
row
of
three
numbers. For
now,
all
you
want
to
concentrate on is
the first
two
(but don't
totally
ignore the number
on the
right. We'll
ccme back
to
it
later). Move
the Pen
to a
different
position and press
any
key
on
the
Keyboard.
Three
more numbers
should appear.
Repeat
the
operation
as
much as
you
like.
Are
you ready for
some answers?
The
first
column
of
numbers
(i.e., on the
left
side
of the Screen)
contains the
X-coordinate
value
for the current Pen position. Memory
location
65376 contains that information.
The
second column
is the current Y-coordinate
value.
Memory
location
65377 contains
that
information.
(And
the third number
is the current Pen Status
—
but
more
on that later!)
As
you
move
the
Pen
from location
to
location (i.e.,
"location" defined by
an
X-Y
coordinate value),
the X-Y
coordinate
values change.
•
Line 10 of the program continuously returns the
current X-coordinate
of the Pen. This number
will
always
be
between and
255.
(Unless you move
the
Pen
into
a
"margin" where
the counting
wraps-around.)
•
Line 20 continuously
returns the current
Y-coordinate of
the Pen. This number
will
always
be
between
0-191.
(Unless you move the
Pen
into a
"margin"
where the counting
wraps-around.)
(And line 30
returns
the
current
Pen Status.)
6