1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-12-11 05:49:24 +00:00
SixtyPical/eg/c64/joystick.60p

50 lines
940 B
Plaintext
Raw Normal View History

word screen @ 1024
byte joy2 @ $dc00
word delta
2018-09-09 13:01:38 +00:00
define read_stick routine
inputs joy2
outputs delta
trashes a, x, z, n
{
ld x, joy2
ld a, x
and a, 1 // up
if z {
copy $ffd8, delta // -40
} else {
ld a, x
and a, 2 // down
if z {
copy word 40, delta
} else {
ld a, x
and a, 4 // left
if z {
copy $ffff, delta // -1
} else {
ld a, x
and a, 8 // right
if z {
copy word 1, delta
} else {
copy word 0, delta
}
}
}
}
}
2018-09-09 13:01:38 +00:00
define main routine
inputs joy2
outputs delta
trashes a, x, z, n, screen
{
repeat {
call read_stick
copy delta, screen
ld a, 1
} until z
}