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

[Other] How many flags in a byte?

  • 222
    Posts
    7
    Years
    • Seen Nov 18, 2023
    Using a routine that needs a certain amount of flags. How many flags are in a single byte of RAM? I thought it was 8 but a simple test setting flags doesn't show that. Here is the routine that needs it, for context.

    Using save block hack with repointed flags, if that matters.

    Thanks!
     
    Last edited:
    a flag is a word type. A word has 0000-ffff 65535. A flag can only accept one or zero. In one byte, 00-ff means one flag in two bytes
     
    Last edited:
    There are indeed eight flags in a byte. Each flag sets a different bit in the byte. So if you set the eighth flag in the byte, the byte will then add 0x80 to whatever value was there before. For example, if you have flags 0x900 - 0x907 in a single byte, setting flags 0x900, 0x902, 0x903, and 0x907 will set the byte to 0x1 + 0x2 + 0x4 + 0x80 = 0x87. Does that make sense?

    a flag is a word type. A word has 0000-ffff 65535. A flag can only accept one or zero. In one byte, 00-ff means one flag in two bytes
    You're referring to a var, not a flag. Flags are bit set, meaning their values can only be 0 or 1.
     
    Back
    Top