You can make your program much smaller by using the drawing commands such as FILLPOLY to color the boxes instead of the two different graphics for each type of box.
Code:
DRAW();
EXPORT TILE()
BEGIN
LOCAL s=16;
LOCAL onoff,key,x=2*s,y=2*s,run=1;
DIMGROB_P(G2,320,240);
DIMGROB_P(G1,s,s);
// create a temporary example; if you want a tile block, then
// you only really need one and then color the rest using
// FILLPOLY
BLIT_P(G1,G0,320-s,0,320,s);
WHILE run DO
DRAW(x,y,onoff);
key:=WAIT(-1);
CASE
if TYPE(key)==6 then run:=0; end;
if key==27 then onoff:=(onoff+1) MOD 2; end;
REPEAT
CASE
if key==2 then y:=y-s; end;
if key==7 then x:=x-s; end;
if key==8 then x:=x+s; end;
if key==12 then y:=y+s; end;
END;
if x<0 then x:=320-s; end;
if x>320-s then x:=0; end;
if y<0 then y:=240-s; end;
if y>240-s then y:=0; end;
DRAW(x,y,onoff);
WAIT(.2);
UNTIL NOT ISKEYDOWN(key); // repeat loop
END; // outer case
END; // while loop
END;
DRAW(x,y,onoff)
BEGIN
LOCAL s=16;
LOCAL red:=#FF0000h, blue:=#FFh;
RECT_P(G2);
BLIT_P(G2,x,y,G1);
FILLPOLY_P(G2,
{ {x,y},{x+s,y},{x+s,y+s},{x,y+s} },
(NOT onoff)*red+onoff*blue,
128);
BLIT_P(G0,G2);
END;