[A83] Re: Tilemap Routine


[Prev][Next][Index][Thread]

[A83] Re: Tilemap Routine



I don't think anyone is going to comment all that for you. Tilemap routines 
have been explained _many_ times in the past. Search the archives, and you 
should find a general explanation of what a tilemap routine actually does.


> 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 that's 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






Follow-Ups: