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.

Coding > Mode 1 display problems

#4428 - Unciaa - Mon Mar 31, 2003 1:19 am

I've been using a few tutorials to teach myself how to work with various display modes that GBA supports and have hit a snag when it came to map/tiled modes. Using a slightly modified version [to use correct image and tile files] of this tutorial I tried to create a simple map to scroll about, but upon loading it saw this. Seems my mapping data is getting both squished vertically and isn't looped over correctly [original map], but having checked the values it should work. Any advice on just what I did wrong?
I'll post the code and data files if need be, but given the basic level of it I don't expect it to be much more than a trivial mistake on my part. :p

#4430 - tepples - Mon Mar 31, 2003 1:56 am

Unciaa wrote:
I tried to create a simple map to scroll about, but upon loading it saw this. Seems my mapping data is getting both squished vertically and isn't looped over correctly [original map]

You're starting a new row every 17 u16's rather than every 32 u16's, and you aren't writing every row. Did you export your map data correctly? Look over the binary (with a hex editor) or the exported header file and make sure all rows are there.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#4442 - niltsair - Mon Mar 31, 2003 9:44 am

Another common mistake : You need to write 16bits at a time. Video memory can only be addressed with 16bits or 32bits pointers.

A Tile Pixels takes :
-4bits in 16 color mode
-8bit in 256 color mode.

A Map Entry takes:
-16bits
-A Basic Map has a size of 32x32 tiles.

A Palette Entry takes:
-16Bits.

This means that :
-You have to write the 2 Tiles in one time in 256 colors mode.
-You have to write the 4 Tiles in one time in 16 colors mode.

#4445 - Quirky - Mon Mar 31, 2003 11:05 am

niltsair wrote:
This means that :
-You have to write the 2 Tiles in one time in 256 colors mode.
-You have to write the 4 Tiles in one time in 16 colors mode.


Should that be pixels instead of tiles? you can always write tiles 1 at a time (16 bits per tile, 256 or 16 colour tiles) unless they are for rotation backgrounds, when you have to write 2 at a time (8 bits per tile, needs 256 colour tile gfx)

#4448 - niltsair - Mon Mar 31, 2003 11:58 am

Quote:
Should that be pixels instead of tiles? you can always write tiles 1 at a time (16 bits per tile, 256 or 16 colour tiles) unless they are for rotation backgrounds, when you have to write 2 at a time (8 bits per tile, needs 256 colour tile gfx)


Yes, you're totally. I meant Pixels of a tile.

#4452 - Unciaa - Mon Mar 31, 2003 3:32 pm

tepples wrote:
You're starting a new row every 17 u16's rather than every 32 u16's, and you aren't writing every row. Did you export your map data correctly? Look over the binary (with a hex editor) or the exported header file and make sure all rows are there.


Aaah, found the problem, cheers mate. :)
I exported the map with size 16x16 tiles, but split the actual tile bitmap into 8x8 tiles. Matching the sizes did the trick, just split each tile into 4 pieces. Is there a point to larger tiles [past faster map creation], can they be utilized directly? Or do I always need to reduce them to 8x8 pieces?

#4454 - tepples - Mon Mar 31, 2003 3:53 pm

Unciaa wrote:
Is there a point to larger tiles [past faster map creation], can they be utilized directly?

The NES had 8x8 pixel tiles in hardware (actually, it was more complicated than that), and the Sega Genesis and Super NES had 8x8 pixel tiles in hardware (under an architecture very similar to the GBA), but most games stored their maps with 16x16, 32x16, or 32x32 pixels per tile and expanded them at runtime. Storing a map with larger "metatiles" really helps when you've got only 64 KB to work with, and using larger tiles speeds up sprite/BG collision detection as well.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#4460 - Unciaa - Mon Mar 31, 2003 5:04 pm

Ah, so they are supported. How do you get them to work though? Quarter the amount of tiles read, but read 32 bits at a time instead of 16?

#4463 - tepples - Mon Mar 31, 2003 6:15 pm

Unciaa wrote:
Ah, so they are supported. How do you get them to work though? Quarter the amount of tiles read, but read 32 bits at a time instead of 16?

Each HW map entry still covers 8x8 pixels and 16 bits, but each tile now uses four HW map entries. Try searching this board's archive for metatile OR metatiles to see where this has already been discussed.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#4473 - Unciaa - Tue Apr 01, 2003 12:23 am

tepples wrote:
Unciaa wrote:
Ah, so they are supported. How do you get them to work though? Quarter the amount of tiles read, but read 32 bits at a time instead of 16?

Each HW map entry still covers 8x8 pixels and 16 bits, but each tile now uses four HW map entries. Try searching this board's archive for metatile OR metatiles to see where this has already been discussed.


Cheers. :)