• 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!
  • Cyndy, May, Hero (Conquest), or Wes - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Pokemon species

  • 8
    Posts
    4
    Years
    I want to just make a simple ASM where i put the index of a pokemon in the party into 0x8001 then i get the species of that pokemon written into 0x800D (or LASTRESULT), this is what i have:

    .text
    .align 2
    .thumb
    .thumb_func

    main:
    push {r0-r4, lr} @I'm using 4 registers, I think this should be enough
    ldr r0, .SLOT @Load the index of the pokemon
    ldrh r0, [r0] @change it into half-bite i think
    mov r1, #0x64
    mul r0, r0, r1 @change the index into a number we can handle
    ldr r1, =(0x2024284) @load the pokemon data
    add r0, r0, r1 @take the pokemon data at index in the party list
    .... @need help here
    ldr r4, .VAR @take 0x800D
    str r0, [r3] @write the species to give that number back
    pop {r0-r4,pc}


    .align 2

    .VAR:
    .word 0x20270B6 + (0x800D *2) @change to any 2 byte free space in RAM
    .SLOT:
    .word 0x20270B6 + (0x8001 *2) @slot of Pokemon we want to check

    From what I gathered until now I know that a pokemons Data structure has a Data part at offset 0x32 and that the species of the pokemon is at offset 0x0 of that Data. So in order to get that species I would need to just navigate to that offset. This code is probably not good, I tried my best by looking at other code in the ASM thread but I'm still a beginner. If someone has any idea how I can get the code to work pls respond and thank you in advance.
     
    Thank you for your response. I was making another function but I thought maybe starting with something ez to learn ASM was better. Didn't know there was already a function.
     
    Back
    Top