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.

Graphics > TONC background tutorial what is pitch?

#150881 - yaazz - Thu Feb 14, 2008 3:18 am

Hello, I am trying to decipher the TONC background tutorial but have run into a snag: Halfway down while trying to explain what SBB you are currently in, a variable, pitch is pulled seemingly out of thin air. Can someone explain what this variable is?

#150890 - Cearn - Thu Feb 14, 2008 12:37 pm

In a graphics context, pitch is the number of bytes per scanline or row. It's related to width, which is the number of elements in a row, but there's a difference in bitdepth per element and perhaps padding too.

In this case is should have actually said width (more precisely mapWidth, in units of tiles) here; I'll fix this later.

#150893 - yaazz - Thu Feb 14, 2008 1:58 pm

Oh I didnt realize you were the guy who wrote tonc! Nice job on the tutorial, I've learned a lot about the ARM processor from these lessons

Thats what I thought pitch must be so in this case it should be 160?
or since i'm using 256 colors should it be 320?

#150896 - tepples - Thu Feb 14, 2008 2:26 pm

I don't know of any 256-color mode on the GBA with a 320-byte row pitch. Mode 4 has a 240-byte row pitch, and modes 0, 1, and 2 are tiled with a 16- to 128-byte row pitch.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.