Read description for more information:
This is a new glitch technique documented by Stump, originally for speedrunning Pokémon Yellow. For such a run, please see Dabomstew's video (https://www.youtube.com/watch?v=mcsKo4K7BNE)
In this glitch technique, the game executes arbitrary code (ACE) based on the data of your Pokémon 5, such as its HP EV and its Attack EV. This is partly why the video is long. In the second part I beat the Pokémon you need to encounter for a certain EV set up.
I have adapted this glitch for outside of speedrunning to run to your items pack and not your Pokédex flags. You can use this glitch without linking up to another Game Boy (for Cable Club escape glitch, etc.) to set up ACE even if you cannot encounter Missingno. for item underflow due to there being no long-range Trainers left. But it is rather tedious at the moment.
I think that the 'most reliable' version of the glitch involves a level 100 Pokémon (Gengar) that you underflowed from level 1 because it will have a constant total experience that is 'safe' for the glitch.
But to do that you need Trainer-Fly. Training a level 44 Graveler from Victory Road works though, unless you have bad ACE items.
Off-screen glitch:
When Pikachu is off-screen (from one of 3 places where it can normally happen including Pewter Pokémon Center's due to Jigglypuff, Bill's House, or the Pokémon Fan Club due to Clefairy, or from a glitch item) for each step you take you corrupt data from D438+ with values that represent your steps from 01 (south) up to 04 (right). You can corrupt a maximum of 255 bytes (up to D536).
By using the Pikachu off-screen glitch in the Vermilion City Pokémon Fan Club, you can do ACE. You can put Pikachu off screen after it goes to see Clefairy. If it is your first visit, then this will happen all the time(?). If you have received the Bike Voucher before, then you may have to enter and leave the Fan Club several times to get the event to happen.
Glitch text box executing arbitrary code from D221:
This glitch technique involves the corruption of D4B6 (coordinates of sign 4) to 01, 01 and D4AF (number of signs) to 04. Sign 4 is text box 11 apparently (will try to check this), and this text box gets its data from D221 in WRAM; the catch rate of Pokémon 5.
You need to have no 'bad' values from D221 that will break your ACE. The Pokémon is said to need four moves (due to the 00?), but I haven't confirmed if it can work with three moves.
In a text box, the byte 08 tells the game to execute the data following it as ASM. We can spell out a 08 followed by a jump instruction to your items using the HP EV and Attack EVs of a Pokémon.
My set up to redirect the code to item 1 (that could likely be improved):
08 c2 (2242) HP stat experience and 1d d3 (7635) Attack experience.
To get these specific EVs, your Pokémon needs to have encountered the following Pokémon (and no more!):
71 Krabby, 1 Farfetch'd, 1 Dugtrio, and 1 Magnemite
(Thanks FMK for working out what Pokémon to battle)
If you are underflowing a Pokémon from 1 to 100, it needs to gain less than 54 experience points. So to pull this off you can encounter 5 Magnemite (as their HP and Attack base stats are a multiple of 5), defeating them only after having 5 Pokémon participate in the battle to get 1/5th of their stat experiences each time.
Once you have the correct EVs, put your Pokémon in the 5th position of the party, prepare your items from item 1, get the Clefairy event in the Vermilion Fan Club, then do the following steps:
1) Go to the bottom-left walkable tile (putting Pikachu off the screen), then walk up to the top and down to the bottom of the left-most column 11 times, but for the 11th time step one tile short on the final way back down.
2) Step right, step left, then walk up to the top and down to the bottom of the left-most column 10 times.
3) Step right, then go the top-left tile you can walk to, face right and press A.
Codes (all from item 1):
Get an item counter of 255 (allows you to do 20+ items related glitches, get more complicated item set ups if you have items like multiple X Special x1 spare)
--
Protein x1
Repel x1
X Accuracy x28
Lemonade x1
Poké Ball x61
Antidote x61
Water Stone x37
X Accuracy x97
TM01 x1
Note: This code may be unstable. I tried to redirect the text box data to D363 (x position current block; should be 0 for top-left corner) after it does its get 255 items job but it ended up at D261 (must have been sleepy). May work on making a better code.
Encounter a Pokémon:
--
Iron x37
X Accuracy x88
Lemonade x(species you want, 21=Mew)
Water Stone x4
Protein x4
TM01 x1
If you are using level 44 Graveler, make note that since you can't really predict its total exp. you may not be able to get your result dictated by items. However, saving before the last few Krabby to get different levels or keeping Rare Candies, saving before talking to the text box and using one if it didn't work last time may fix this.