Chapter
10
I
BASIC Keywords
PEN
Function
PEN(
num
ber)
Returns the light pen’s coordinates.
Number
is
a
number in the range
0
to
9 that tells BASIC what
to
return. Values
0-5
return
x,y
coordinates corresponding
to
the
current screen mode. Values 6-9 return the character row
or
col-
umn position.
0
1
2
3
4
5
6
7
8
9
Returns
a
-1
if pen button has been pressed since last
poll. Returns
a
0
if not.
Returns the
x
coordinate (horizontal) where the pen
was last activated.
Returns the
y
coordinate (vertical) where the pen was
last activated.
Returns a
-1
if the pen button is being pressed. Re-
turns
a
0
if it is up.
Returns the last known valid
x
coordinate
(horizontal).
Returns the last known valid
y
coordinate (vertical).
Returns the character row position where the pen was
last activated.
Returns the character column position where the pen
was last activated.
Returns the last known character
row
position.
Returns the last known character column position.
You must execute
a
PEN
ON
statement before executing the
PEN
function. If
you
do not, an “Illegal function call” error
occurs.
Example
A
=
PENC1)
returns the
x
coordinate
of
the pen.
259