Re: A89: Re: Making a faster map routine


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

Re: A89: Re: Making a faster map routine




> How exactly would I do that?  Could I see an example
> for one plane?  Thanks.
>
> > If the sprites are any multiple of 8 in width you
> > shouldn't plot them with a
> > normal sprite function, even if you want to scroll
> > pixel-by-pixel. Plot your
> > sprites (by yourself) into a buffer that's one
> > sprite too wide and one sprite
> > too high, then copy-and-shift that buffer onto the
> > LCD.

Well, say you have 16x16-pixel sized sprites and want to plot them on the entire
LCD (i.e. no status bar)...

FIrst, create a buffer that's 32 bytes by 144 rows big.

Now say you have an (x,y) that's your upper left corner of the map part you want
to plot, in the form of (16*x0 + x1, 16*y0 + y1), where (x0,y0) are the "tile"
coordinates and (x1,y1) are the "in-a-tile" coordinates for sub-tile accuracy :)

Using (x0,y0) to determine the tile that will be (partly) in the upper left
corner of the LCD, plot the desired part of the map into the buffer (putting a
16x16 sprite on a word-aligned place in that buffer is easy, so I won't go into
that here). You will plot one tile row too much on the right and bottom edge of
the buffer.

Now, using (x1,y1), you copy the buffer onto the LCD, starting at row y1 in the
buffer and shifting everything x1 steps to the left as you go. This part is
basically how a sprite plotter works, but if you want speed you should write a
routine that's specialized for this task.


 / Niklas Brunlid
Check out Prosit for the TI-89 / TI-92+ at http://prosit.ticalc.org
Random PQF Quote follows:

When the least they could do to you was everything, then the most
they could do to you suddenly held no terror.
        -- (Terry Pratchett, Small Gods)




References: