Bregalad wrote:
In this case you save nothing because when you'll want to acess the map, the vertical index would be 15*Highcounter + Low counter so you need some multiplication !
I think you didn't understand my solution, because I don't need multiplications or divisions. Let me explain:
I have a variable called
CameraY which represents the position of the camera within the map. In addition to that I have a variable called
NTCameraY, that represents the position of the camera in the name tables. Every time
CameraY changes,
NTCameraY is changed by the same amount, so they move together, but each over their own space:
CameraY moves over the map, while
NTCameraY moves over the name tables.
NTCameraY wraps around respecting the dimensions of the name tables, but both variables are always in sync.
Whenever I need to render a new row or column of blocks, I use
CameraY to read from the map and
NTCameraY to calculate their target address in VRAM. There are no multiplications or divisions involved at all.
Quote:
Even if multiplications and divisions can be "worked arround", there is really NO POINT to work around them because they are VERY EASY to do.
They might be EASY, but they are SLOW. Whenever I can work around them I do, because it's always FASTER to avoid them, even if the code gets a little more complex (which is not always the case).