EasyManua.ls Logo

Commodore Plus 4 - Page 404

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...
392
Using
Peripheral
Devices
20
Enter
high-resolution
graphic
mode.
30
Draw
a
circle.
40
Save
the
circle
in
C$.
50
Erase
the
circle.
60
Set
the
initial
coordinate
values.
70
Draw
the
circle.
80
Erase
the
circle.
90
Look
for
the
space
bar.
100
Get
the
current
value
of
JOY.
If
neutral,
go
back
to
line
70.
110
Check
for
fire
button.
If
not,
go
on
to
line
130.
120
Draw
the
circle.
130
Use
the
value
of
JOY
(fire
button
status
removed)
to
change
the
coordinates.
140
Go
back
to
line
70.
150
Write
HIT
KEY
on
the
screen.
160
Wait
for
a
key,
then
return
to
the
text
mode
and
stop.
170-190
Data
for
change
in
x-
and
^-coordinates
based
on
JOY
value.
Using
Joysticks
from
Machine
Language
In
machine
language,
the
joysticks
must
be
read
through
the
keyboard
latch
at
$FF08
on
the
graphics
chip.
Since
the
normal
system
interrupt
service
routine
uses
this
register
for
keyboard
scanning,
interrupts
would
normally
be
turned
off
during
this
process.
For
joystick
port
1,
store
$FA
to
$FF08
and
then
read
$FF08.
For
joystick
port
2,
use
$FD.
Usually,
this
should be
done
at
least
twice
and
the
results
compared
to
avoid
spurious
readings.
Additional
debouncing,
such
as
reading
the
ports
somewhat
infrequently,
may
be
required
to
provide
smooth
joystick
action.
The
results
of
reading
the
keyboard
latch
are
slightly
different
for the
two
ports.
In
particular,
port
1
uses
bit
6
for
the
fire
button
switch,
whereas
port
2
uses
bit
7.
The
relationships
between
bit
and
switch
are
as
follows:
Bit
Switch
0
Up
1
Down