Here is how i do it, this may be a bad method as i dont really put alot of time into the proper way of doing things.
while (groundlayer == 1)
{
if (newtile >= 301) { newtile = 1; xspace = 6; yspace = 3; newtile2 = 0; groundlayer = 0; }
if (newtile2 >= 20) { xspace = 6; yspace = yspace + 32; newtile2 = 0;}
if (data[newtile] > 0)
{
dbSetSpriteFrame ( 90, data[newtile] );
dbPasteSprite (90, xspace, yspace) ;
}
newtile++; xspace = xspace + 32; newtile2++;
}
That will draw a 300 tile map 15 x 20 32 pixels per tile using only 1 sprite.
data[1] will contain the first tile etc. I have mine reading out of a text file.
You need a groundlayer = 1; at the very end of your loop. I did not show the code of reading the file or getting it into the correct format. but this is the general idea. you basically just need to set the sprite frame to the tile you want then paste it.