open window 640,512
curbuf=0
x=320:y=256

repeat
 setdrawbuf curbuf
 curbuf=1-curbuf
 setdispbuf curbuf
 clear window

 fill rectangle x,y to x+20,y+20

 joypad=peek("port1")
 if and(joypad,32)>0 then x=x+1 fi
 if and(joypad,128)>0 then x=x-1 fi
 if and(joypad,16)>0 then y=y-1 fi
 if and(joypad,64)>0 then y=y+1 fi
until (joypad=16384)


