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 > Can someone explain me about memory locations?

#14701 - KickFlip - Sun Jan 11, 2004 8:15 pm

Like 0x6000000 is the beginning location of screen. And how do I alter them (especcialy the 0x4000000 one)

Thanks!

#14703 - sajiimori - Sun Jan 11, 2004 9:01 pm

GBATEK has a good intro to GBA memory layout.
http://www.work.de/nocash/gbatek.htm#memorymap

To write to a particular memory location in C, recast the address as a pointer to the type of thing you're writing.
Code:

write_something()
{
  int* p = (int*) 0x1234;  // pointer to address 0x1234 (as int)
  *p = 500;  // put the int 500 there

  *((int*) 0x1234) = 500;  // same thing but shorter
}