[A83] Tilemap Routine
[Prev][Next][Index][Thread]
[A83] Tilemap Routine
A couple months ago I was give a nice little 8*8 tilemap routine. And since
I can't figure out how it works I was wondering if someone could explain to
me by explaining the lines of source code. I want to know how it draws the
tiles to the screen and how each line of code is contributing to drawing the
map. i know thats alot to ask but it would be very helpful. Heres the
routine:
hl->tilemap
de->tiles
keypress is put in a
drawTileMap:
ld b,0
ld c,a
add hl,bc
push hl
pop ix
ld hl,8E29h
ld bc,8*256+12
drawTileMapLoop:
push bc
ld b,c
drawLineLoop:
push bc
push hl
ld h,0
ld l,(ix)
inc ix
add hl,hl
add hl,hl
add hl,hl
add hl,de
ex de,hl
ex (sp),hl
ld b,8
drawTileLoop:
ld a,(de)
ld (hl),a
inc de
ld a,b
ld b,0
add hl,bc
ld b,a
djnz drawTileLoop
ld de,-(8*12)+1
add hl,de
pop de
pop bc
djnz drawLineLoop
ld c,7*12
add hl,bc
ld c,12-12
add ix,bc
pop bc
djnz drawTileMapLoop
ret
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.