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.

DS development > About write a value to main Memory?

#117806 - alex_III - Wed Feb 07, 2007 6:42 pm

i try to write a ds game trainer
the trainer run before ds game
i try to write a value to main Memory
and tested it in DeSmuME it's working
but in NO$GBA and my ds it's not working..weird
i have no idea..this problem bothered me two days
before write a value to main Memory have to do something?


my codes

for example write 0x1 to 0x02110000

#define trainerflag (*(vuint32*)0x02110000)

while(1)
{
:
if ( keys & KEY_RIGHT )
trainerflag=1;
:

}

#117807 - Lick - Wed Feb 07, 2007 6:56 pm

0x2000000 to 0x2400000 is cached. You need to flush the cache at the regions you're writing to. An easier method would be accessing the uncached mirror (another instance of the same memory) at 0x2400000 to 0x2800000. It's basically the same piece of memory, but you don't need to worry about flushing.

You might also want to set the Main RAM access priority to the processor you are currently on. REG_EXEMEMCNT{0x04000204} bit15=0: arm9 priority, 1: arm7 priority. This should be 0 by default, and you can only change this register on the arm9.
_________________
http://licklick.wordpress.com

#117809 - alex_III - Wed Feb 07, 2007 8:16 pm

It's working now!!!
Big thanks to you Lick!!

#117813 - wintermute - Wed Feb 07, 2007 8:39 pm

Lick wrote:

You might also want to set the Main RAM access priority to the processor you are currently on. REG_EXEMEMCNT{0x04000204} bit15=0: arm9 priority, 1: arm7 priority. This should be 0 by default, and you can only change this register on the arm9.


In general you shouldn't touch the ewram bus priority. The default arm7 core is kept out of this region by using the arm7 iwram for code and data so the arm9 is largely unaffected.

Messing with the priority on this bus has been known to cause audio distortion. The default setting is ARM7 priority.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#117819 - Lick - Wed Feb 07, 2007 9:41 pm

Lick stands corrected.
_________________
http://licklick.wordpress.com