Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Generation I Glitch Discussion

Missingno.=Cubone: the reason - Page 1

Missingno.=Cubone: the reason

Posted by: Spoink
Date: 2014-06-21 18:36:36
Okay, this all has to do with the rhydon glitch, you know, that annoying glitch that turns Pokés with invalid Pokédex numbers into rhydon… Well, this actually happens because the flag for captures (the one you get after, in this case missingno. resulting in the flag of cubone cubone) is modulo 152…, so if a pokemon has a number of, lets say, 234, then 234 mod 152 is 82, or  Magneton. For missingno, it is a special case. Since (in Gen I) there is no pokemon of ID 0, it doesn't rollover, so 256 modulo 152 equals 104… The number of Cubone. The reason the  cubone conversion happens is (maybe, I'm no technician XD) that the flags after 152 don't show up correctly, so the game tries to minimize the glitches by %ing

Sorry for the piss poor grammar, and sorry for the lack of explanation, i just got very tired of conspiracies…

Re: Missingno.=Cubone: the reason

Posted by: Torchickens
Date: 2014-06-22 05:22:18
This is a cool observation.

The actual reason why owning Cubone corresponds to seeing Missingno. is because the encounter flags directly follow the capture flags: (see here)

The 19 valid seen/own bytes each allow for 152 (19*8 because each bit means you've registered a Pokémon) entries.

So, if you encounter #152 then #152 actually gets registered (the game adds +2^7 of D309). In Pokémon Red/Blue it's Farfetch'd, in Pokémon Yellow it's Scyther.

But the game doesn't stop there. If you register the non-existing (from all the glitch Pokémon I know) #153 as owned it will set the first bit (+2^0) of D30A, which is the first encounter (rather than capture) address, meaning that capturing #153 means that you've seen Bulbasaur, and the game just works through each bit of all the Pokédex seen addresses.

The Pokédex bits come in Pokédex order, and from what you found, we have a convenient way of finding out what invalid Pokédex number has what own flag, through (n)mod152. This is not what the game actually does, but it works.

#000 (used for 'M/Missingno.) is actually managed as #256, so the game will work through 255-151 invalid capture flags before getting to it, which is 104 so far. But 152 doesn't count as a own flag that's actually a seen flag, so let's call it 103. This means that the number for what follows is 104, which is Cubone's Pokédex number.

The same thing happens with invalid encounter flags.

D31C is the last seen byte. It can hold 8 bits; 145-152.

D31D can hold 8 bits too (153-160) but this byte isn't a valid Pokédex byte, it's used for your total number of items. In Japanese Yellow, there is a glitch Pokémon hex:ED that doesn't freeze the game and has a Pokédex number of 159.

This means that encountering it on the opponent's side changes your total number of items. 153 is bit 1 (2^0), so 159 would be bit 7 (2^6), and this means encountering hex:ED adds +2^6 (or 64) to your total number of items, but if bit 7 was set then it probably wouldn't. (if you had 64 or 192 items)

Finding why Missingno. adds 128 to the sixth item is a matter of extrapolation:

D31C: Dex 152 (would have its own accessible Pokédex; Farfetch'd in English Red/Blue or Scyther in English Yellow)
D31D: Dex 153-160 total items
D31E: Dex 161-168 item 1 identifier
D31F: Dex 169-176 item 1 quantity
D320: Dex 177-184 item 2 identifier
D321: Dex 185-192 item 2 quantity
D322: Dex 193-200 item 3 identifier
D323: Dex 201-208 item 3 quantity
D324: Dex 209-216 item 4 identifier
D325: Dex 217-224 item 4 quantity
D326: Dex 225-232 item 5 identifier
D327: Dex 233-240 item 5 quantity
D328: Dex 241-248 item 6 identifier
D329: Dex 249-000 item 6 quantity

D329 is shared with the quantity of item 6. In this group, 000 is listed last. This means it is for the last bit or bit 8 (+2^7), and 2^7 in decimal happens to be 128. When you have 128 or more items in the sixth position, the item won't be duplicated again because bit 8 is set.