• 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!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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
    14
    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.
     
    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
     
    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