There's no need to save the x and y positions of all the pasted images because when you make a tile map the map can be much bigger than the screen.
The important information is the x and y of the upper left of the map which can be saved with 2 variables. Anytime you want to detect what the character can move through you use the x and y of the map not the screen itself.
In this code snip the only actual screen coordinates are the starting x and y (which are both zero):
set display mode 640,480,32
sync rate 0
sync on
hide mouse
dim Map(500,500)
dim Tex$(12)
load bitmap "zelda.bmp",1
` Get Zelda
x=1:y=18
for t=50 to 54
get image t,x,y,x+21,y+23,1
inc x,22
next t
` Get Map Graphics
x=1:y=1
for t=1 to 20
get image t,x,y,x+16,y+16,1
inc x,17
next t
set current bitmap 0
` Make a random map
x=0:y=0
for t1=0 to 500
for t2=0 to 500
a=rnd(9)+1
b=rnd(60)
if b=60
a=rnd(9)+11
endif
Map(t1,t2)=a
inc x,16
next t1
x=0
inc y,16
next t2
` Main Loop
x=0:y=0
sprite 1,320,232,53
ShowMap(x,y)
sync
do
if upkey()>0
if y-1>0
dec y
sprite 1,320,232,52
ShowMap(x,y)
endif
endif
if downkey()>0
if y+1<501-29
inc y
sprite 1,320,232,53
ShowMap(x,y)
endif
endif
if leftkey()>0
if x-1>0
dec x
sprite 1,320,232,50
ShowMap(x,y)
endif
endif
if rightkey()>0
if x+1<501-39
inc x
sprite 1,320,232,51
ShowMap(x,y)
endif
endif
loop
` Show map
function ShowMap(mx,my)
x=0:y=0
for t1=my to my+29
for t2=mx to mx+39
paste image Map(t2,t1),x,y
inc x,16
next t2
x=0
inc y,16
next t1
text 0,0,"Map X = "+str$(mx)
text 0,20,"Map Y = "+str$(my)
sync
endfunction
