1) Encounter a MissingNo. (e.g. with old man glitch, Trainer escape glitch, CoolTrainer♀ glitch) to add 128 to the sixth item quantity (if less than 127).
For Pokémon Yellow:
Unstable MissingNo. will not freeze the game if encountered for the first time after a wiped save file with Up+Select+B and if no other glitch Pokémon sprite was viewed. More reliably, the double Trainer escape glitch with Level 80 Starmie can be used (video) to encounter a Fossil/Ghost MissingNo., which will not freeze the game. Alternatively though more difficult, the player may perform the Ditto glitch sub-glitch of the Trainer escape glitch by having Ditto Transform into a Pokémon with 182, 183, 184 Special.
2) Either encounter MissingNo. again or catch it with the sixth item quantity as x127 to get the x255 stack. Note this will not work when catching the MissingNo. if the item used to catch it was the sixth and a Poké Ball x127, therefore items like X Special are more desirable (also in this case, because X Special can be used for Celadon looping map glitch)