I don't have the game you're hacking, but you can find a RAM address that is consistent throughout the game, whose value changes depending on what mode, level, or screen you're on. Then just use it as a check to force your ASM modification. Here is a semi-fake example with your ASM hack included:
D002468A BEEF [FAKE ADDRESS]
800ABB32 2400
or using your real code
D00ABB32 3082 (less common value than comparing against 0001)
800ABB32 2400
D002468A BEEF [FAKE ADDRESS]
800B841E 2400
or using your real code
D00B841E 2443 (less common value than comparing against 0001)
800B841E 2400
2400 is a short nop. It can replace those 00000000 nops (shorten your codes too). It should be applicable to the 'No Random Battle For Town' code as well, but I don't know what the ASM looks like to guarantee its effect.
D002468A BEEF [FAKE ADDRESS]
800ABB32 2400
or using your real code
D00ABB32 3082 (less common value than comparing against 0001)
800ABB32 2400
D002468A BEEF [FAKE ADDRESS]
800B841E 2400
or using your real code
D00B841E 2443 (less common value than comparing against 0001)
800B841E 2400
2400 is a short nop. It can replace those 00000000 nops (shorten your codes too). It should be applicable to the 'No Random Battle For Town' code as well, but I don't know what the ASM looks like to guarantee its effect.

Comment