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

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

 line 0,0 to x-20,y-20
 line 640,0 to x+20,y-20
 line 0,512 to x-20,y+20
 line 640,512 to x+20,y+20
 rectangle x-20,y-20 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)
