gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Tiles Misalligned

#13621 - beetlefeet - Thu Dec 18, 2003 4:19 pm

Hi, I'm a GBA Newbie.

I'm using gfx2gba to get a map into mode 0 bg 0. I'm using the code from Johnathan Harbour's book at http://www.jharbour.com/ (Thanks! Eagerly awaiting the rest of the chapters) (it's the Scrolling background example at the start of chapter 6).

Anyway I'm sure the code isn't the problem. (unless something to do with the map size).

Basically the map is 512x160 pixels. When I show it the rows are in the wrong order. I get a full 512 length row as 2 shorter rows so i get an interleaved effect. [Images not permitted - Click here to view it]

Now I seem to remember something about the tilemap being divided into sectors but I can't find it again. How can I get gfx2gba to output the map in the right order?

Or if that isn't the problem what else is there to try?

#13624 - tepples - Thu Dec 18, 2003 4:50 pm

There are two ways to store a tile map: paged and linear. GBA text modes use paged maps; rot/scale modes use a linear map. It seems gfx2gba with the settings you give is storing it linearly. It's straightforward to convert a linear map to paged at run time: just copy only the first 32 bytes or the last 32 bytes of a line of map spaces. It's also a bit easier to scroll on a "big" map (>64x64 tiles) if it's stored linearly.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#13625 - beetlefeet - Thu Dec 18, 2003 5:53 pm

Thanks for replying so fast.

I've got it sorted now.

I used a nested loop to copy my whole map into the BG tile memory with the right layout.

Now I can move along finally :)

Thanks again