A code slowed down the game? Interesting.
You can try it yourself. Most such codes are based around items or equips you might get in later game to reduce rates/block all but boss encounters. This tends to mean a flag rather than a item counter so marginally more annoying than the basic cheat but searching before, after, loading old savestates and such makes it easy enough, even better if you can reset the flag by going into a town/moving around in a circle for the number of steps/times/whatever. Such a thing can also be loaded by a game for a cust scene as well but let's not go there right now.
Beyond that you get to look into the game itself and how it calculates random battles. Sometimes it is a step counter (leave a town and into the world/come back from a battle and it will generate a random number or time, when that reaches 0/the value it will trigger a battle. You can figure this out by making a savestate and then seeing it is the same number of steps/time each time.
Others will be random per step, random tile chance or other things. At that point you are more likely to want to go into debugging approaches -- something will change to reflect being in battle, while it might be irrelevant to the calculation it will happen as a result of it so you get to work backwards.
Guide to cheat making
https://web.archive.org/web/20080309104350/http://etk.scener.org/?op=tutorial
How DS cheats are encoded
https://doc.kodewerx.org/hacking_nds.html