Drawing a complete tilemap is done by two nested for-loops.
In case of a tilemap that does not get bigger then the screen:
screenX: calculated X location of sprite
screenY: calculated Y location of sprite
spriteLocation: calculated tile position in memory
map: your tilemap position
This is a _very_ basic idea of how a simple tilemap drawer could be written:
Code: Select all
for (Y=0 to mapheight-1)
for (X=0 to mapwidth-1)
current_tile_value = value_at(map + mapwidth*Y + X)
spriteLocation = current_tilemap_location + 8*current_tile_value
screenX = 8*X
screenY = 8*Y
drawSprite(screenX, screenY, spriteLocation)
next X
next Y
I'm not going into details here, after reading "ASM in 28 days" you're definatly able to write the ASM code yourself.
Good luck!