100 BUTTON_UP = 1
110 BUTTON_DOWN = 2
120 BUTTON_LEFT = 4
130 BUTTON_RIGHT = 8
140 BUTTON_A = 16
150 BUTTON_B = 32
160 BUTTON_START = 1024
170 BUTTON_SELECT = 2048
180 X_MIN = 0
190 X_MAX = 39
200 Y_MIN = 0
210 Y_MAX = 23
220 cpoke 38, 59
230 cls
240 button(-1)
250 start@
260 locate x, y
270 pX = x
280 pY = y
290 print "&";
300 status = button(0)
310 if status = -1 then print "ERROR": goto end@
320 if status & BUTTON_SELECT then goto end@
330 if status & BUTTON_RIGHT then x = x + 1
340 if status & BUTTON_LEFT then x = x - 1
350 if status & BUTTON_DOWN then y = y + 1
360 if status & BUTTON_UP then y = y - 1
370 if x < X_MIN then x = X_MIN
380 if X_MAX < x then x = X_MAX
390 if y < Y_MIN then y = Y_MIN
400 if Y_MAX < y then y = Y_MAX
410 locate pX, pY
420 print " ";
430 goto start@
440 end@
450 cpoke