Posted By
Chicken on 2013-01-05 21:02:47
| Re: Speed up Routine for Placing A Bitmap
You should give us more details what you intend to do exactly. Maybe a different approach would do the trick for you.
Why do you want to use bitmap mode? And is there a background graphic that needs to be restored when the "player" bitmap moves? Or is the background just black (or any other color)?
What are the 9 positions? Do they form a pattern like this?
1 2 3 4 5 6 7 8 9 Do the positions have to have pixel coordinates like 4? If they align perfectly to chars (eg 0,0 or 8,8), it could speed things up quite a bit. In fact, dedicated "copy bitmap to pos x" subroutines would be really easy and fast then. Even if the positions do not align to chars, it's still easy if the positions are always the same.
If it's always the very same "player" bitmap and the positions do not overlap, you can also draw the "player" bitmap in all 9 positions and just "hide" the ones you don't need by manipulating the color ram "underneath" (ie black on black). That's just a couple of bytes instead of moving bitmaps around. The bitmap placing routine in your post is a universal one but usually - when coding games - you don't need routines that can handle everything. Also, it helps to design the game "data" (graphics etc) in a way that makes the handling easy (eg aligning stuff to chars).
Anyway, give us more details
|