2017-11-20 15:18:21 +00:00
|
|
|
word screen @ 1024
|
|
|
|
byte joy2 @ $dc00
|
|
|
|
|
|
|
|
word delta
|
|
|
|
|
2018-09-09 13:01:38 +00:00
|
|
|
define read_stick routine
|
2017-11-20 15:18:21 +00:00
|
|
|
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
|
2017-11-20 15:18:21 +00:00
|
|
|
inputs joy2
|
|
|
|
outputs delta
|
|
|
|
trashes a, x, z, n, screen
|
|
|
|
{
|
|
|
|
repeat {
|
|
|
|
call read_stick
|
|
|
|
copy delta, screen
|
|
|
|
ld a, 1
|
|
|
|
} until z
|
|
|
|
}
|