Done it all. It took a while to get the logic behind the steps you need to perform, but thanks to a guide and a friend who has some knowledge on opcodes, the pieces came together.
Wrote down a little thingy for myself, which I eventually can use for the other five games:
Mega Man 1
- Health Offset: 0x00006A
- Weapon Offsets:0x00006B
0x00006C
0x00006D
0x00006E
0x00006F
0x000070
0x000071
- Breakpoint trigger for Health refill: 05:912E
- Free space: 0X008FC3-0x008FFF
- How to make a jump command:
Trigger the breakpoint, which opens the debugger. Switch to ROM File.
Change the byte at the offset preceeding the triggered command (in this case, 912C, preceeding 912E) from 85 to 4C
(4C being the 'jump' command).
Then, change the arguments (the offset it will jump to) from A26A to the first byte of the free space
(in this case, 8FD0). Be aware that the bytes are written backwards in the hex editor. So first you write D0, next byte 8F.
Replace the byte following the argument (13) with EA.
- Add new commands in free space:
Switch to NES Memory. Head to the free space (8FD0). Switch back to ROM File. First, add an LDA command (A9).
The next byte, what the LDA will refer to, should be 1C (the maximum amount of health/weapon energy).
Add an STA (85) to the next byte. Then, add the byte referring to the offset of health (6A).
Repeat these two steps until you've covered every offset for weapon energy. The result should look like this:
85 6A 85 6B 85 6C 85 6D 85 6E 85 6F 85 70
85 71 00 00 00 00 00 00 00 00 00 00 00 00
Then, add a jump to the next free byte. Make the jump refer to the beginning of the offset after the triggered command
(in this case, 9130, following 912E). First you write 30, next byte 91.
September 14, 2019, 09:41:21 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Now, I looked a little bit into doing this for MM7 and the X games, and it seems like a ten times bigger job.
September 14, 2019, 02:11:55 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Well, seems this won't do much for all the other NES games. Mega Man 2 has its health value at a pretty late offset, a problem which I thought could be circumvented by using an alternate STA, but the game resets whenever you enter a stage.
Mega Man 3 works, except it gives you every weapon from the start of the game. Didn't plan on doing that. Mega Man 4 freezes except for the stage I was in when triggering the breakpoint, Bright Man.
September 14, 2019, 02:32:24 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Okay, so, Mega Man 2 just needed a few more EAs to fix it all. Apparently I mistook sprite data for 'free space' in MM3.
September 14, 2019, 03:41:45 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Any questions about this whole thing so far?
What's the reason I had to look for free space only between 008000 and 00FFFF?