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 > GBA memory adresses

#55775 - Wizad - Sun Oct 02, 2005 1:39 am

is there any tutorial explaning clearly how memory adresses work? I have a hard time to understand the concept.

for instance, on this little piece of code;

Code:
#define REG_DMA3SAD *(volatile unsigned int*)0x40000D4
#define REG_DMA3DAD *(volatile unsigned int*)0x40000D8
#define REG_DMA3CNT *(volatile unsigned int*)0x40000DC
#define DMA_ENABLE 0x80000000
#define DMA_TIMING_IMMEDIATE 0x00000000
#define DMA_16 0x00000000
#define DMA_32 0x04000000
#define DMA_32NOW (DMA_ENABLE | DMA_TIMING_IMMEDIATE | DMA_32)
#define DMA_16NOW (DMA_ENABLE | DMA_TIMING_IMMEDIATE | DMA_16)


I don't understand why DMA_TIMING_IMMEDIATE and DMA_16 have the same adresse.

#55777 - APL - Sun Oct 02, 2005 2:25 am

Only the first three of those are memory addresses, the rest of them are constants.
_________________
-Andy L
http://www.depthchasers.com

#55778 - Wizad - Sun Oct 02, 2005 2:50 am

thanks.

but can you help me and tell me what really happens here?

#55779 - tepples - Sun Oct 02, 2005 3:19 am

"Immediate" and "16-bit" are the initial settings of a DMA channel; both represent the appropriate bits set to 0. Specifying "immediate" or "16-bit" is the same as leaving them unspecified. To change them to something else such as 32-bit or hblank-triggered, you need to OR in some non-zero bits.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#55827 - Wizad - Sun Oct 02, 2005 11:24 pm

Do you have any reading suggestions (on the web) helping me to understand this part?

when we OR/AND/XOR, then it means it give a new adresss which the hardware is refering?

#55829 - tepples - Sun Oct 02, 2005 11:35 pm

Work through this example (in Perl, but Perl's bitwise operators are the same as C's and the syntax is similar) and see if you understand more.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#55830 - Wizad - Sun Oct 02, 2005 11:37 pm

thanks you tepples, I'll read it carefully! I'll give you some news.