>>12148879
2/2
The encounter logic works like this: earlier in the code, a table containing the random encounter rate of every area is indexed to get the random encounter rate of the current area. Its stored in $00. The current step counter is compared to $00. If your step count is greater than or equal to $00, trigger an encounter. Otherwise, step like normal. The way this manifests in gameplay is that you get into an encounter every n step, where n is the encounter rate of the area. A random encounter rate of $00 is hard coded to be treated as "no encounters in this area" and not "encounter every 256 steps." This rule is enforced by a check before the step counter check occurs. This check is the code we are going to be editing for out Game Genie code.
Every instruction the 6502 can execute has a 1 byte opcode, followed by an arbitrary number of parameter bytes. We are going to replace the opcode for the LDA Zero Page instruction ($A5) at $A233 with the opcode for the LDA Immediate instruction ($A9). This means that instead of loading the accumulator with the value at CPU address $00, it will load the accumulator with the value $00. A value of $00 is treated as no encounters, so for all areas, encounters will be disabled. Plugging the aforementioned values into a Game Genie encoder gives the code OZUZLZSX, which works. While not strictly necessary all the time, its good practice to fill the "compare" entry of the encoder with the original value of the byte you are replacing. Dude to how mappers work, the same address won't always point to the same region of PRG ROM, and the compare value ensures you only replace the byte you want to and not every byte that uses that address.