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 > DMA problem

#17951 - Darmstadium - Wed Mar 17, 2004 10:30 pm

Whenever I try to use DMA to copy my sprite data into OAM data, it doesn't do what I want it to. I say something like this:
Code:

REG_DM3SAD = (u32)redmarker_Bitmap;
REG_DM3DAD = (u32)OAMData[512];
REG_DM3CNT = 256 | DMA_ENABLE | DMA_TIMEING_IMMEDIATE | DMA_32;

When I try to use DMA to copy anything else but sprites to OAM it works great, but this doesn't work at all.

Thanks in advance for your help

#17956 - poslundc - Wed Mar 17, 2004 10:59 pm

Try:

(u32)(OAMData + 512)

or

(u32) &(OAMData[512])

Dan.

#17957 - sajiimori - Wed Mar 17, 2004 11:00 pm

REG_DMA3DAD is meant to hold an address, but OAMData[512] is not an address -- it's the 512th element of OAMData. Try &OAMData[512] (address of 512th element) or OAMData+512 (512 elements past the start of OAMData -- same thing).

#17959 - poslundc - Wed Mar 17, 2004 11:01 pm

That seems fair, saji... you beat me in the other thread, I beat you in this one. :D

Dan.

#17979 - Darmstadium - Thu Mar 18, 2004 1:18 am

Tons of thanks to you guys!