Main Menu


Major Glitches

Other Glitch Categories


Useful Tools


Search Wiki


Glitch Pokédex flags
 Page | Discussion | View source | History

From Glitch City Laboratories

Jump to: navigation, search

Glitch Pokédex flags are consequences of the existence of Glitch Pokémon.

Every Pokémon game has flags that mark whether each Pokémon has been seen and/or captured.

Glitch Pokédex flags are Pokédex flags associated with Glitch Pokémon.

Why glitch flags?

In computer programming, and games are no exception to this, everything is numbers. Thus, each Pokémon is assigned a number, called its ID. The game identifies each Pokémon using its ID, and each ID corresponds to a specific Pokémon.

When the game wants to retrieve or edit the Pokédex flags of Pokémon X, it gets the flag with the same ID as the Pokémon (eg, the first flag of the "encountered" list is associated with Pokémon ID 1, etc.)

Since a flag is represented by a bit, and a byte is 8 bits large, the game does more or less the following :

  1. Get byte number (Pokédex ID - 1) / 8 in the corresponding table, rounding down.
  2. Tamper with its ( (Pokédex ID - 1) % 8)th flag (Note : % is the modulo operator).

Why "Pokédex ID-1"? Because in computer programming, IDs start at 0 (for mathematical and convenience reasons). So, instead of going from 1 to 151, internally, IDs go from 0 to 150. For the same reason, the bits of a byte are numbered from 0 (rightmost) to 7 (leftmost).

For example, take Generation I and its 151 (non-glitch) Pokémon. We need to store all the flags in an integer amount of bytes, hence, 19 bytes (152 bits) are used.

Now, imagine we caught a Rattata (Pokédex ID 19). The game starts at address D2F7 (wPokedexOwned), and advances (18 / 8 :) 2 bytes forward. Then it sets bit (18 % 8 :) 2, because we have captured it.

Now, this method works fine for all IDs up to 151. But what would happen with higher IDs? You guessed it, the game will go beyond the end of the Pokédex flags table. (The exception being Pokédex flag 152, which is still in-bounds, and has its own unused bit)

The more complicated case is Pokémon with ID 0 (like Missingno or 'M (R/B)), because upon subtracting 1 (Pokédex ID - 1, remember?), the 0 underflows to 255.


Setting a flag (whether it be "seen" or "caught") modifies one bit in memory. The most famous example is when seeing Missingno, where it sets bit 7 of the quantity of the 6th item in the player's inventory (which is why it is known as "gives 128 if has less than 128").

The other way around is that if a Pokémon is marked as "already caught", its Pokédex entry won't show up. Since some glitch Pokémon's Pokédex entries crash the game, they are required to be "already caught" to be catchable without freezing.