• 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] Return value from ASM to dialog Script

6
Posts
3
Years
  • Hello, I've just begin ROM Hacking for few weeks and now I want to learn ASM/Thumb.
    So I've made simple routine to return a simple number (0x5) to a text of a person just for beginning.
    The problem is that when I talk to the person it just return 0, maybe I dont know yet how to send that value to the script so can someone plz correct my code.

    XSE script:
    Code:
    #org 0x800000
    lock
    faceplayer
    callasm 0x08800101
    buffernumber 0x0 LASTRESULT
    msgbox 0x8800015 MSG_NORMAL '"the number is [buffer1]"
    release
    
    '---------
    ' Strings
    '---------
    #org 0x800015
    = the number is [buffer1]

    thumb:
    Code:
    .align 2
    .thumb
    main:
    	push {r0,lr}
    	ldr r0, param
    	pop {r0,pc}
    .align 2
    param:
    	.word 0x5
     
    48
    Posts
    7
    Years
  • You need to transfer the value of r0 into the variable LASTRESULT.

    Direct Solution:
    Spoiler:


    Just focus on the parts in bold. Those are the parts you need to add. Everything else is alright!
    Here is a ram offset map of FireRed which will be handy for making ASMs, as it contains the memory address of variables and other important things.
    And this ASM tutorial is quite good, you can follow it: https://www.pokecommunity.com/showthread.php?t=343871
     
    Back
    Top