So I'm through Nugget Bridge again, and it's time to catch an Abra. I'm currently 1425 frames ahead of my Charmander test run, and 4155 frames ahead of my initial run. But as far as catching an Abra goes, I've found either I find one right away, or I can't find one at all. For this run, the latter is the case. I tried everything I could think of; waiting to end the last battle, redoing the last battle completely, but nothing seemed to work. Then I began to notice a trend. All of the pokémon I was encountering were either lv12 Pidgeys or lv8 Kakunas. They both have high occurance rates, but together they only make up 30% of the probability space. I figured something was up, so I decided to do some research. Entering the grass at different frame counts, walking until a random battle occured, and then recording the frame at which the pokémon appeared. I repeated this for the two cases mentioned above, both waiting a few frames to end the battle (at the got cash for winning screen), and redoing the battle entirely. The results are as follows, sorted by time of appearance:
winning...88277 winning...88279 different battle
----------------- ----------------- -----------------
88815 - pidgey 12 88837 - pidgey 12 88835 - pidgey 12
88840 - kakuna 8 88839 - kakuna 8 88841 - kakuna 8
88862 - kakuna 8 88846 - kakuna 8 88852 - kakuna 8
88867 - kakuna 8 88865 - kakuna 8 88855 - pidgey 12
88887 - kakuna 8 88866 - kakuna 8 88856 - kakuna 8
88892 - kakuna 8 88866 - kakuna 8 88868 - kakuna 8
88893 - kakuna 8 88870 - kakuna 8 88879 - kakuna 8
88903 - kakuna 8 88927 - weedle 7 88898 - kakuna 8
88916 - weedle 7 88946 - weedle 7 88901 - kakuna 8
88929 - weedle 7 88954 - weedle 7 88916 - kakuna 8
88933 - weedle 7 88976 - weedle 7 88922 - kakuna 8
88934 - weedle 7 89028 - pidgey 13 88940 - weedle 7
88978 - abra 8 89029 - oddish 14 88964 - weedle 7
88986 - abra 8 89036 - oddish 14 89018 - abra 8
88994 - abra 8 89052 - oddish 14 89026 - oddish 14
89030 - abra 10 89062 - abra 10 89040 - oddish 14
89043 - abra 10 89072 - abra 10 89051 - abra 10
89055 - abra 10 89073 - abra 10 89067 - abra 10
89059 - abra 10 89165 - pidgey 12 89071 - abra 10
89082 - oddish 13 89260 - weedle 7 89121 - oddish 12
You'll notice that each pokémon type (species and level) has a specific range that it appears in. There is admittedly a bit of overlap between the ranges, but this is both explainable and expected. There are actually two rolls for random encounters: once when you first enter a tile, and once when you are about to leave (to confirm the second of these, you'll notice that leaving a square in a different direction often produces an encounter where you are still in the old square, but facing the new direction). Taking this into mind, all of these values could be plus or minus 18 frames, which puts things back into their respective ranges. Also notice that changing random factors in the game did not affect these ranges at all. Additionally, they seem to repeat every ~320 frames or so.
I currently have two theories:
Theory 1: The z80 processor has a register known as the r register. Every clock cycle, this register is incremented by one. If not accessed too often, this register can be used as a simple (albeit very bad) RNG. My theory is that the code takes this value, and if it is within a certain range, produces the corresponding pokémon. This would mean that in effect, which pokémon you see at a specific frame count is set in stone.
Theory 2: When the player first enters a zone (i.e. changes from one geographical area to another), the distribution is seeded randomly, and then continues on it's normal 320 frame cycle.
If theory 1 is correct, then I only have two options. Either wait 160 frames for an Abra, or go back and try to save ~120 frames previously, which will indeed prove difficult. If theory 2 is correct, then I can perhaps solve this problem by waiting a certain number of frames before entering the Nugget Bridge area. Although truthfully, I really have no reason to believe this theory, I'm just being hopeful.