(Note: The following content is currently copied directly from "The Code Hut", Tony Hedstrom's website)
Activates debug mode! With the debug mode on, you can restore your energy, pass through obstacles, and edit the palette!
Here's how to use the debug mode:
Press "left" on controller 2 to pause/unpause the game.
Press "up" on controller 2 to pass through obstacles. This one is fun to experiment with.
Press "right" on controller 2 to restore your energy and edit the palette. Use controller 1 to change the palette. Press "select" on controller 1 to exit the edit mode and have your energy restored.
You can also use this code to help you easily find which part of the ROM you can hack to change the levels! When you enter the "edit" mode (by pressing "right" on the 2nd controller), you will see several rows of hex numbers. Just write these numbers down (before you make any changes to them), and then use a hex editor to search for that same string of numbers. For example, if you pick "Napalm Man", when you first start the level, and you enter the "edit" mode, this is the first row of numbers on the right side of the screen:
0F 29 19 0B
Now open up the Megaman 5 ROM with your hex editor and click on the "Find" button, and type in 0F29190B. There is only one match (at 00C998), so you know that is the right area of the ROM for editing the palette for the Napalm level.
Source: Tony Hedstrom, Sephiroth3 for finding the ROM address