Load the rom up in Geiger's SNES9X
Hit run, etc..
Click 'Show Hex'
On the far right side, make sure 'Trace Once' is checked'
What that does is when you click 'CPU', it'll trace code with all the actions you do. Basically, you do all the actions you don't WANT to do and let those trace first. Basically, do what you need to do in battle. Then when you know you're going to level up, uncheck CPU, go back to home so it knows it's stopped, then set CPU checked again. When you level up, it'll trace the code for it.
That's the basics of that. It'll appear in a 'Log' folder in your SNES9X unless you change the directory.