EasyManua.ls Logo

Commodore 128D - Page 330

Commodore 128D
427 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...
LJ
PEN
—Return
X
and
Y
coordinates
of
the
light
pen
in
control
port
1.
PEN(n)
where
n
=
0
PEN
returns
the
X
coordinate
of
VIC
light
pen
position,
n
=
1
PEN
returns
the
Y
coordinate
of
VIC
light
pen
position,
n
=
2
PEN
returns
the
X
coordinate
of
the
80
column
display,
n
=
3
PEN
returns
the
Y
coordinate
of
the
80
column
display,
n
=
4
PEN
returns
the
(80-column)
light
pen
trigger
value.
Note
that,
like
sprite
coordinates,
the
VIC
PEN
value
is
not
scaled
and
uses
real
coordinates,
not
graphic
bit
map
coordinates.
The
X
position
is
given
as
an
even
number,
ranging
from
approximately
60
to
320,
while
the
Y
position
can
be
any
number
from
50
to
250.
These
are
the
visible
screen
coordinate
ranges,
where
all
other
val
ues
are
not
visible
on
the
screen.
A
value
of
zero
for
either
position
means
the
light
pen
is
off
screen
and
has
not
triggered
an
interrupt
since
the
last
read.
Note
that
COLLISION
need
not
be
active
to
use
PEN.
A
white
background
is
usually
required
to
stimulate
the
light
pen.
PEN
values
vary
from
CRT
to
CRT,
and
one
light
pen
to
another..
NOTE:
The
VIC
(40
columns)
provides
only
9
bits
of
resolution,
so
the
accuracy
is
limited
to
two
pixels.
Unlike
the
40
column
(VIC)
screen,
the
80
column
(8563)
coordinates
are
character
row
and
column
positions
and
not
pixel
coordinates
like
the
VIC
screen.
Both
the
40 and
80
column
screen
coordinate
values
are
approximate
and
vary,
due
to
the
nature
of
light
pens.
The
80-column
values
are
not
valid
until
PEN(4)
is
true
(non-zero).
EXAMPLES:
10
PRINT
PEN(0);PEN(1)
Displays
the
X
and
Y
coordinates
of
the
light
pen
(for
the
40
column
screen).
10
DO
UNTIL
PEN(4):LOOP
Ensures
the
values
are
valid
(for
the
80
column
screen).
20X=PEN(2)
30Y
=
PEN(3)
40
REM:REST
OF
PROGRAM
—Return
the
value
of
pi
(3.14159265)
\
i
EXAMPLE:
PRINT
w
This
returns
the
result
3.14159265.
322
BASIC
7.0
ENCYCLOPEDIA-Basic
Functions

Table of Contents

Other manuals for Commodore 128D

Related product manuals