Re: A86: a tilemap routine


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

Re: A86: a tilemap routine




if the tiles are a fixed size:
	ld a,(ix+0)
	ld l,a
	ld h,0
	add hl,hl ;*2
	add hl,hl ;*4
	add hl,hl ;*8 bytes for each 8x8 tile
	ld de,block0 ;add tile table offset
	add hl,de ;hl->tile

it would probly be faster if you didn't multiply each time you display a
tile.
keep track of tile position by screen address instead:
	ld de,$fc00	;where to put 1st tile
	ld b,8		;8 rows
row_loop:
	ld c,b
	ld b,16	;16 columns
col_loop:
	push de	;need de & bc preserved
	;; get & decode tile like above
	;; copy tile from (hl) to (de)
	pop de
	inc de
	inc ix
	djnz col_loop
	ld hl,16*7	;16 bytes per line, 7 lines left in 8x8 tiles
	add hl,de
	ex de,hl
	;; update ix for source maps wider than the screen
	ld b,c
	djnz row_loop

it might be faster to do this sideways (loop over the columns, draw a row
at a time) because you're already going that way when you copy each tile,
but updating ix in this case might slow it down too much for that to
matter

-josh

On Fri, 17 Mar 2000 22:14:58 -0500 "J.S." <rengets@erols.com> writes:
> can anybody tell me how to make this tilemap drawing routine any 
> better?  I'm a novice assembly programmer so it might (perhaps 
> "will" is a better word) be sloppy.  I just want to see different 
> ways of accomplishing what I did.

________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.