CLEAR ALL
d$="Use the arrow keys to shift the tilemap, ESC to quit."
GOSUB showHeader
TILEMAP 1 NEW 40,25
SPRITE 1 BIND TILEMAP 1 SHOW FIT
TARGET TILEMAP 1
FOR y=0 TO 24
    FOR x=0 TO 39
        INK RND.COLOR
        HIGHLIGHT RND.COLOR
        PUT TILE x,y,RANGE(0,255)
    NEXT x
NEXT y
DO
    LOCATE 2,TEXT.ROWS-1
    INK RGB(255,255,255):HIGHLIGHT RGB(0,0,0)
    PRINT " " USING$("####", TILEMAP.SCX(1)) ", " USING$("####", TILEMAP.SCY(1)) " "
    IF KEY.DOWN(27) THEN EXIT DO
    IF KEY.DOWN(14) THEN SHIFT TILEMAP LEFT 2
    IF KEY.DOWN(15) THEN SHIFT TILEMAP RIGHT 2
    IF KEY.DOWN(16) THEN SHIFT TILEMAP UP 2
    IF KEY.DOWN(17) THEN SHIFT TILEMAP DOWN 2
    PAUSE
LOOP
END
showHeader:
CLS
INK RGB(255,255,255)
PRINT LINE CENTER d$,,RGB(0,0,255)
RETURN
