Anonymous user
Pokémon Red and Blue: Difference between revisions
m
→Glitch items: Changed tildes for range to en dashes
m (→Names: Another grammar nitpick) |
m (→Glitch items: Changed tildes for range to en dashes) |
||
Line 35:
* [[Safari Ball (glitch item)|Safari Ball]] (ID 8) exists as an item, even though it is never supposed to appear in the player's inventory. Again, throwing a ball in a Safari Zone battle actually "uses" this item.
* [[Pokédex (glitch item)|Pokédex]] (ID 9) exists as an item, even though it is never supposed to appear in the player's inventory. It is functional, but not actually "used" when the player accesses the Pokédex from the Start menu.
* Items with ID
** Furthermore, the first two of those, [[BoulderBadge (glitch item)|BoulderBadge]] and [[CascadeBadge (glitch item)|CascadeBadge]], are also "used" in a Safari Zone battle when throwing some bait or throwing a rock, respectively. Those glitch items are also functional in normal wild battles.
** The rest of those items are designed to be unusable anywhere, just like some valid items that are supposed to be checked rather than directly used from the menu (e.g. the [[bp:Helix Fossil|Helix Fossil]]), or exist just to be sold (i.e. the [[bp:Nugget|Nugget]]).
Line 42:
* [[Coin]] (ID 59) is an unusable glitch item.
In addition, all items with IDs greater or equal to 196 are considered HMs or TMs, and are handled in a special way. This means that the items with ID
Apart from the above glitch items, other glitch items have IDs outside of the valid range, i.e. either 0 or
=== Names ===
Line 60:
With the exception of TMs and HMs, when an item is used from the menu, the game finds the ''effect pointer'' of said item, and jumps there. Each effect pointer is 2-byte long, and they are stored in a contiguous table<ref>[https://github.com/pret/pokered/blob/fbbade2becdbbbaad787ec4ad957b8b5253498c0/engine/items/item_effects.asm#L18 The table of effect pointers]</ref>. Some valid items, such as all kinds of balls, share the same effect pointer, and the code there will determine exactly which one of them is being used by checking the item ID, which is stored at $CF91.
When finding the address of the effect pointer, the game computes (item ID - 1) * 2 to find out the byte offset first, and makes an assumption that this calculation does not underflow or overflow the byte. This assumption is sound for valid non-TM, non-HM items, but not for glitch items with ID 0 or
As for glitch items with ID
Other glitch items' effect pointers consist of two separate bytes with usually different meanings in assembly. For example, the effect pointer of [[ItemDex/RB:089|4F]] is $FA65, which comes from two assembly instructions <code>jp nz, $658B</code> and <code>ld a, ($D05A)</code>, encoded as the byte sequence "C2 8B '''65 FA''' 5A D0", and the middle two bytes decoded as a 2-byte pointer in little-endian. This address happens to be in the Echo RAM, and "echos" the WRAM address $DA65, leading to another relatively popular ACE exploit.
|