CLEAR ALL
TILEMAP 1 NEW 80,50
SPRITE 1 BIND TILEMAP 1 SHOW FIT
TARGET TILEMAP 1
DOUBLE BUFFER
x=0:xd=1
y=0:yd=1
DO
    GOSUB update
    x=x+xd:IF x<0 OR x>79 THEN xd=-xd
    y=y+yd:IF y<0 OR y>49 THEN yd=-yd
    SWAP BUFFERS CLS
    PAUSE
LOOP WHILE INKEY$=""
END
update:
PUT HLINE 0,79,y,TCHAR("b")
PUT VLINE x,0,49,TCHAR("c")
PUT TILE 0,0,TCHAR("a")
PUT TILES 5,30,"Hello world!"
PUT RECT FILL 5,5,25,25,TCHAR("d")
RETURN
