EasyManua.ls Logo

Commodore Plus 4 - Page 405

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
393
2
3
4
5
6
7
Left
Right
Unused
Unused
Fire
for
Fire
for
port
port
1
2
(unused
(unused
for
for
2)
1)
When
a
switch
is
engaged,
the
bit
is
cleared
to
0;
otherwise
it
is
set
to
1.
All
of
the
unused
bits
are
always
set
to
1.
As
a
result,
an
$FF
indicates
a
neutral
position
for
the
joystick.
Example:
This
is
a
subroutine
for
reading
joystick
port
1.
On
return,
carry
clear
means
FIRE;
carry
set
is
no
FIRE.
The
X
register
is
set
to
-1
($FF),
0,
or
1
to
indicate
left,
middle,
and
right
positions,
respectively,
in
the
horizontal
direction.
The
Y
register
is
set
to
-1
($FF),
0,
or
1
to
indicate
down,
middle,
and
up
positions,
respectively,
in
the
vertical
direction.
2000
A2
FA
LDX
#$FA
2002
78
SEI
2003 8E
08
FF
STX
$FF08
2006
AD
08
FF
LDA
$FF08
2009
8E
08
FF
STX
$FF08
200C
200F
2011
2012
2014
2016
2017
2019
201A
201B
201D
201E
201F
2021
2022
2023
2025
2026
2027
2028
2029
CD
D0
58
A2
A0
4A
B0
C8
4A
B0
88
4A
B0
CA
4A
B0
E8
4A
4A
4A
60
08
F2
00
00
01
01
01
01
FF
CMP
BNE
CLI
LDX
LDY
LSR
BCS
INY
LSR
BCS
DEY
LSR
BCS
DEX
LSR
BCS
INX
LSR
LSR
LSR
RTS
$FF08
$2003
#$00
#$00
$201A
$201E
$2022
$2026
Latch
value
for
port
1.
Disable
interrupts.
Store
latch
value
in
keyboard
latch
register.
Read
keyboard
latch
register.
Store
latch
value
in
keyboard
latch
register.
Compare
to
previous
reading.
If
not
equal,
do
it
again.
Enable
interrupts.
Initially
set
changes
to
zero.
Look
at
bit
0.
If
set,
switch
is
off.
Up
switch
is
on,
increment
y
change.
Look
at
bit
1.
If
set,
switch
is
off.
Down
switch
is
on,
decrement
y
change.
Look
at
bit
2.
If
set,
switch
is
off.
Left
switch
is
on,
decrement
x
change.
Look at
bit
3.
If
set,
switch
is
off.
Right
switch
is on,
increment
x
change.
Skip
bit
4.
Skip
bit
5.
Carry
reflects
status of fire
switch.
Return.
For
port
2,
the
$FA
in
the
instruction
at
$2000
must
be
changed
to
$FD
and
an
additional
LSR
instruction
placed
at
$2029,
with
the
RTS
at
$202A.