Uploaded November 2014 | Updated September 2026, 3 weeks ago
Short version:
In Pokemon Red, Blue and Yellow, if a Pokemon with a Defense or Special stat of 512 or 513 uses Reflect or Light Screen (respectively), the game will freeze upon the Pokemon being attacked with a physical or a special attack, respectively.
In addition, if a Pokemon with a Defense or a Special stat of at least 514 uses Reflect or Light (respectively) its stat will be treated as if it was much lower during damage calculation.
Long version:
Prior to damage calculation, if either the attacker's Attack/Special stat or the defender's Defense/Special stat is 256 or higher, both stats are temporarily quartered so that the stat values can fit in one byte (0 - 255). This assumes that stats can never be higher than 256*4-1 = 1023. While this is still mostly true because stats cap at 999, it doesn't account for the fact that Reflect or Light Screen temporarily double the stat ignoring that cap, allowing a stat to become up to as high as 999*2 = 1998 during damage calculation.
A stat that is exactly 512 or 513 prior to the use of Reflect or Light Screen will become 1024 or 1026 respectively afterwards. When 1024 or 1026 is quartered (and floored), it becomes 256. 256 in binary is 100000000, so if we ignore the 9th bit (in order to fit the number in one byte) it becomes 00000000 or simply 0. When the game attepts to divide by the Defense/Special during damage calculation, it's going to be attepmting to divide by 0. The game will go into and endless loop trying to divide by 0, so everything but the music will freeze.
A similar thing occurs for stats between 514 and 999. The game won't freeze, as the stat will not become 0, but the stat will be effectively treated as if it was much lower (e.g. 514 and 515 will become 1, 516 and 517 will become 2...).
Short version:
In Pokemon Red, Blue and Yellow, if a Pokemon with a Defense or Special stat of 512 or 513 uses Reflect or Light Screen (respectively), the game will freeze upon the Pokemon being attacked with a physical or a special attack, respectively.
In addition, if a Pokemon with a Defense or a Special stat of at least 514 uses Reflect or Light (respectively) its stat will be treated as if it was much lower during damage calculation.
Long version:
Prior to damage calculation, if either the attacker's Attack/Special stat or the defender's Defense/Special stat is 256 or higher, both stats are temporarily quartered so that the stat values can fit in one byte (0 - 255). This assumes that stats can never be higher than 256*4-1 = 1023. While this is still mostly true because stats cap at 999, it doesn't account for the fact that Reflect or Light Screen temporarily double the stat ignoring that cap, allowing a stat to become up to as high as 999*2 = 1998 during damage calculation.
A stat that is exactly 512 or 513 prior to the use of Reflect or Light Screen will become 1024 or 1026 respectively afterwards. When 1024 or 1026 is quartered (and floored), it becomes 256. 256 in binary is 100000000, so if we ignore the 9th bit (in order to fit the number in one byte) it becomes 00000000 or simply 0. When the game attepts to divide by the Defense/Special during damage calculation, it's going to be attepmting to divide by 0. The game will go into and endless loop trying to divide by 0, so everything but the music will freeze.
A similar thing occurs for stats between 514 and 999. The game won't freeze, as the stat will not become 0, but the stat will be effectively treated as if it was much lower (e.g. 514 and 515 will become 1, 516 and 517 will become 2...).
![Pokemon G/S - Turn Coin Case into a memory editor (arbitrary code execution)
This video is outdated and reproducing it is no longer advised. Watching this video instead is recommended: https://www.youtube.com/watch?v=PsIb3OZaYAs
It is a detailed tutorial of a far more versatile Coin Case arbitrary code execution approach that can be used for multiple purposes, and includes examples and troubleshooting.
Help wont be offered in the comments section of this video, other than to redirect to the video linked above. This is because 90% of your ambitions or troubles with the Coin Case glitch are covered or can be avoided by following the steps explained in that other video. This is, in fact, the reason why Ive made that video.
Old video description below
Coin Case glitch: http://forums.glitchcity.info/index.php/topic,6716.0.html
The code can most likely be optimized but its the best I could come up with. The thing about this is that its too generic and aims to cover all possible addresses, allowing to edit the content of any and all of them. Spelling out the code itself with the box names seemed impossible and I gave up after wandering around for some time. The instructions available allow you to do a lot of stuff with register a, and even pop it into d or h, but it looked impossible to make a program that allows to write in any specified memory address. Perhaps a possible better way to do this would be by combining the PC items and the box names to write the code and doing some jumping around. Or even use actual parts of the code to modify future bytes of the code in order to spell out instructions that are unavailable with the character set.
Anyway, its not that this required lots of extremely obscure items. They are all easily obtainable, its just that youll need to have advanced very far in the adventure, particularly, to get HM06 (Toxic) and Pass. Apart from that, there are some generic items that youll need more than one instance of. Its not too difficult to accomplish this, however. Youd just deposit the item 99 times and when you have deposited all the items, you withdraw said item until you have the amount you need. It means youll have to buy more than necessary though. All in all, what I most like about this is that the code is always the same regardless of the address you want to edit, meaning that once all the items have been deposited in the PC, itll just take about a minute to set it up to hack another memory address.
Speaking of editing the memory addresses, the way this is achieved is by naming Box 9 in different ways. Box 9 because pointing to its names address requires the least amount of items. The names first four characters will determine the address to hack (2 bytes), while the last two will determine the value to be written on it (1 byte). Unfortunately, we need two characters to spell out each byte because not all 255 possible values are associated to a character. This means that additional code is required, and consequently, additional items. Because of this, one way to optimize the whole thing could be to take the three bytes from addresses where we can manipulate all the 255 possible values, such as a Pokemons happiness or EVs, or the players steps counter. The last one probably looks like the easiest, but without a memory viewer to follow it, its another story.
The way Ive done it, the game takes the two characters of the name and adds its hexadecimal values, which allows to cover all possible 255 numbers. Ive made a list that shows how to spell each of them: See http://pastebin.com/4ZDpQXGe. They are not the only possible combinations, but just stick to those.
For the item list, http://pastebin.com/in4MS7zW, or just watch it in the video (last part). To get Berry Juice, give Berry to a Shuckle and walk around for a bit. It will eventually become Berry Juice. Stardust is held by 23% of wild Staryu (Staryu can be found fishing on Cherrygrove city with a Good Rod for example) . Getting 3 Ether may not be easy, but as long as you have one, you can consider cloning. Alternatively, you may deposit only one Ether instead of three, and deposit [Any Item] [Any Amount] between Ether and PokeBall x94.
P.S.: The Quagsire must hold Protein, not HP Up. Pokemon G/S - Turn Coin Case into a memory editor (arbitrary code execution)](https://i.ytimg.com/vi/ffZjCabeNr4/mqdefault.jpg)








![Pokemon Red / Blue - Unused (Glitch) Move Effects
This video is a compilation of unused move effects from 0x99 through 0xC3
Follow the byte at 0xCFD3 in the Memory viewer (RAM) to see which attack effect Im using each time.
Effects that didnt show any effect other than causing normal damage (e.g. 0x9E), crashed the dame (e.g. 0xA8), or were repeated (e.g. 0xB3), where cut from the video. Additional tests were made on move effects like 0x9D or 0xB8 to come up with a more accurate conclusion.
99 Normal damage + Haze effect
9A Normal damage + Bide effect
9B Thrash effect
9C Normal damage + Roar/Whirlwind effect
9D Normal damage + Makes the next move to hit 2-5 times? (notice that, in the video, the second time I was attacking with No Effect [00])
9E-9F No effect?
A0 Normal damage + Puts target to sleep
A1 Normal damage + Poisons target
A2-A6 No effect?
A7 Normal damage + Dug in a hole text + Forced to repeat attack next turn (its the turn when Dig would deal damage)
A8-A9 Crashes the game
AA Wrap effect
AB Normal damage + Dug in a hole text + Forced to repeat attack next turn (its the turn when Dig would deal damage)
AC Normal damage + Makes the next move to hit 2-5 times?
AD Crashes the game
AE Normal damage + Mist effect
AF Normal damage + Rage related text (doesnt lock the Pokemon into using the same move and neither the attack stat seems to increase)
B0 Recoil effect
B1 Normal damage + Causes confusion
B2-B7 Normal damage + Nothing happened! text
B8 Normal damage + Recovers HP = Max HP / 2 ?
B9 Normal damage + Transforms into opponent
BA-BF Normal damage + Lowers glitched stat
C0-C1 Normal damage + Reflect effect
C2 Normal damage + Poisons target
C3 Normal damage + Paralyzes target Pokemon Red / Blue - Unused (Glitch) Move Effects](https://i.ytimg.com/vi/h3-4AZGw4XU/mqdefault.jpg)
