• 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.

[Other] Calculate checksum

jota_rdk

Spanish hacker [Javi4315]
98
Posts
13
Years
  • I am working I a ASM routine, but I can't understand how is the 16-bits checksum calculated.
    I hope somebody can help me.
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018

    jota_rdk

    Spanish hacker [Javi4315]
    98
    Posts
    13
    Years
  • https://bulbapedia.bulbagarden.net/wiki/Pokémon_data_structure_in_Generation_III

    This one? Just load halfwords (2 bytes) and add them together, then clear the upper 16 bits of the register. But if you're just doing something simple like reading or setting something in the Pokemon data you should really use the built-in functions.

    I had read about this. I knew I had to add all data substructure values, but I knew the result would be greater than two bytes, so I had the doubt. But it is true, clearing the upper two bytes, both values match (my calculated value and the original value).

    I am making a routine to edit the pokémon data. Really, I have already finished it, but I have always obtained a Bad Egg because I wasn't able to discover how checksum was made.

    Thanks! ;D
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    I had read about this. I knew I had to add all data substructure values, but I knew the result would be greater than two bytes, so I had the doubt. But it is true, clearing the upper two bytes, both values match (my calculated value and the original value).

    I am making a routine to edit the pokémon data. Really, I have already finished it, but I have always obtained a Bad Egg because I wasn't able to discover how checksum was made.

    Thanks! ;D

    No problem. If you tell me your ROM's code, I can tell you the address of a function you can call that sorts all of this out for you. It's the function that the engine uses to edit Pokemon data. To avoid wasted space it's recommended that you use it.
     
    Back
    Top