• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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
    7
    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:
    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:
    Back
    Top