Basic hypothesis on error codes
Error codes are almost certainly the remains of now-removed debugging tools.
In this interview, Morimoto states that 300 bytes worth of debug features were removed from the game and replaced with MEW's data:
An interesting side note is that some ROM hackers found the remains of what used to be an assert() function in the ASM for Pokemon FireRed. Completely different game in a completely different generation, I know, but in combination with the above source it hints at a pattern. DavidJCobb 21:54, 4 April 2012 (GMT+6)
If you open a hex editor, and force [hex:00] in the middle of a text entry; this will cause the game to print an error code. The number depends on the entry of the text inside the ROM.
In Pokémon Red and Green, this number is stored in the RAM address at FFB2. Do you think that this could be a debugging remnant? In the example below, I've modified the text string for the signpost in front of the player's house by replacing the first letter with 00. The game printed a '6 ERROR'. This is because the signpost at the player's house is the sixth entry for Pallet Town.
If you modify the next string (the signpost in front of the rival's house), you would get a '7 ERROR'. The '00' character will ignore every character that proceeds it, but it's possible to add text before it. For example, reading [AD][7F] gives you "An (X) ERROR".
For different map locations, there are (x) number of text entries. When you exploit the Trainer-Fly glitch and return to the route that you fled, the game typically attempts to bring up whichever text is stored in the VRAM. Often, this is fine if the last text was the start menu, but if the equivalent text is different, glitches can occur when the game attempts to print it. I don't know how this works though. The text that you receive in this case isn't just a case of matching the text entries with the map numbers. --Torchickens 10:02, 25 June 2012 (GMT+6)