EasyManua.ls Logo

Commodore Plus 4 - Page 403

Commodore Plus 4
464 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...
The
Joystick
Ports
391
numeric
value
depending
on
the
state
of
the
joystick.
The
following
table
lists
the
possible
values
returned:
Value
0
1
2
3
4
5
6
7
8
Joystick
State
neutral
up
up
and
right
right
down
and
right
down
down
and
left
left
up
and
left
In
addition,
when
the
fire
button
is
pressed,
128
is
added
to
the
values
listed
in
the
table.
Example:
This
program
plots
and
unplots
a
circle
on
the
high-resolution
graphic
screen.
Whenever
the
joystick
in
port
1
is
pushed
away
from
neutral,
the
circle
is
moved
in
a
corresponding
direction.
Whenever
the
fire
button
of
the
joystick
in
port
1
is
pressed,
a
circle
is
plotted
and
remains
in
place.
To
exit,
press
the
space
bar.
10
P0RI=lT08:READDX(I),DY(I):NEXT
20
GRAPHIC1,1
30
CIRCLE1,160,100,10,10
40
SSHAPEC$,150,90,170,110
50
GSHAPEC$,150,90,4
60
X=150:Y=90
70
GSHAPBC$,X,Y,4
80
GSHAPEC$,X,Y,4
90
GETA$:IFA$="
"THEN150
100
J=JOY(1):IFJ=0THEN70
110
IF(JAND128)=0THEN130
120
GSHAPEC$,X,Y,4
130
J=JAND15:X=X+DX(J):Y=Y+DY(J)
140
GOTO70
150
CHAR1,1,23,"HIT
KEY"
160
GETKEYA$:GRAPHIC0:END
170
DATA0,-1,1,-1,1,0
180
DATA1,1,0,1,-1,1,-1,0
190
DATA-1,-1
Line-by-Line
Explanation
10
Read
in
the
amount
to
change
x-
and
^-coordinates
based
on
JOY
value.