68 lines
1.1 KiB
Text
68 lines
1.1 KiB
Text
BYTE lastStick=[255]
|
|
BYTE lastTrig=[255]
|
|
|
|
PROC DrawCross(BYTE s)
|
|
BYTE size=[5]
|
|
CARD x
|
|
BYTE y
|
|
|
|
IF s>=9 AND s<=11 THEN
|
|
x=size
|
|
ELSEIF s>=5 AND s<=7 THEN
|
|
x=159-size
|
|
ELSE
|
|
x=79
|
|
FI
|
|
|
|
IF s=6 OR s=10 OR s=14 THEN
|
|
y=size
|
|
ELSEIF s=5 OR s=9 OR s=13 THEN
|
|
y=79-size
|
|
ELSE
|
|
y=39
|
|
FI
|
|
|
|
Plot(x-size,y)
|
|
DrawTo(x+size,y)
|
|
Plot(x,y-size)
|
|
DrawTo(x,y+size)
|
|
RETURN
|
|
|
|
PROC UpdateStatus(BYTE currStick,currTrig)
|
|
IF currStick#lastStick THEN
|
|
Color=0 DrawCross(lastStick)
|
|
Color=1 DrawCross(currStick)
|
|
lastStick=currStick
|
|
FI
|
|
|
|
IF currTrig#lastTrig THEN
|
|
Print("Button pressed: ")
|
|
IF currTrig THEN
|
|
PrintE("no ")
|
|
ELSE
|
|
PrintE("yes")
|
|
FI
|
|
Put(28) ;move cursor up
|
|
lastTrig=currTrig
|
|
FI
|
|
RETURN
|
|
|
|
PROC Main()
|
|
BYTE CH=$02FC,COLOR1=$02C5,COLOR2=$02C6,
|
|
CRSINH=$02F0 ;Controls visibility of cursor
|
|
BYTE currStick,currTrig
|
|
|
|
Graphics(7)
|
|
Color=1
|
|
COLOR1=$0C
|
|
COLOR2=$02
|
|
CRSINH=1 ;hide cursor
|
|
|
|
DO
|
|
currStick=Stick(0)
|
|
currTrig=STrig(0)
|
|
UpdateStatus(currStick,currTrig)
|
|
UNTIL CH#$FF
|
|
OD
|
|
CH=$FF
|
|
RETURN
|