• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[ASM & Hex✓] IWRAM location of the DMA pointers to non-temporary variables?

222
Posts
6
Years
    • Seen Nov 18, 2023
    I have ASM code that needs to access a certain variable in the DMA, namely 0x4011, but as you probably know the actual location of this variable in the RAM changes all the time. I could (probably) get around this by using copyvar to 0x8005 or something before callasm-ing (as XSE script is evidently able to bypass this BS), but as this might not be an option in the future I wanted to know how seasoned ASM coders got around this, and the location of the IWRAM DMA cache (which contains pointers to each variable protected by DMA).

    Thanks for any help in this matter.
     
    Last edited:

    Skeli

    Lord of the Rings
    300
    Posts
    10
    Years
  • I have ASM code that needs to access a certain variable in the DMA, namely 0x4011, but as you probably know the actual location of this variable in the RAM changes all the time. I could (probably) get around this by using copyvar to 0x8005 or something before callasm-ing (as XSE script is evidently able to bypass this BS), but as this might not be an option in the future I wanted to know how seasoned ASM coders got around this, and the location of the IWRAM DMA cache (which contains pointers to each variable protected by DMA).

    Thanks for any help in this matter.

    Loads the value of the var into r0.
    Code:
    ldr r0, .Var
    bl Var_Load
    ...
    
    Var_Load:
    ldr r1, =0x806E569
    bx r1
    
    .align 2
    .Var: .word 0x4011
     
    Last edited:

    Skeli

    Lord of the Rings
    300
    Posts
    10
    Years
  • It calls the function at 0x806E568 which reads the value of the var. if you're asking how the specific function works, then get yourself a copy of Knizz's Fire Red IDB and take a look at the function.
     
    Back
    Top