BGB emulator used, see BGB website.
Mega Man 2 is used to find "Infinite" type of code.
Mega Man 2 is used (again) to find "Start With" type of code.
Spider-Man (Color) is used to hack Game Genie code into Rom.
Hex Editor is used to hack Game Genie code into Spider-Man (Color) Rom.
1. Create "Infinite" type of code
Step 1. Use a existing Game Shark code (or use the one you find on your own). Im going to use Mega Man 2 as an example, using Infinite Lives game shark code.
Step 2. Open up BGB emu, load up Mega Man 2, enter this Game Shark in cheat list.
Step 3. Test it out, it actually work, so copy the raw address that was automatic converted by BGB (in the circle).
Step 4. Open up Debugger, click "Access Breakpoint" (not Breakpoint) under Debug.
Step 5. Write down the raw address that you copied from previously, don't worry about value, it is used for "start with" type of code. Make sure "write" is check and "read" is not checked. Click Add.
Step 6. Don't forget to "disable" gameshark code (get the "E" off, "E" means Enabled). Just to make you do that or you might find that next 2 steps won't work.
Step 7. Return to the game, get Mega Man to lose a live.
Step 8. After Mega Man lose a live, Debugger will pop up.
Step 9. Here, you just need to write down the one that is circled in the picture, don't worry about next 2 hex, it's just a given address to make change to RAM "lives value"
Step 10. Put address into Cheat list in "address" and "value" is entered as "FA". Why did I entered it "FA"? The instruction "EA" is meant to SAVE value to given address, and "FA" is meant to LOAD value from given address. (So you can picture that it will go in loop using old lives value). Don't forget to enable this cheat, make it turn into "GPE", "P" means Patched and "E" means Enabled.
If you see a hex is "EA" best replacement is "FA". If you see "77", best replacement is "7E". If you see "34" or "35", best replacement, i think, is "1C". If you see anything before the address that has "dec, a", try replace those first before replacing highlighted address).
This might be a good webpage to take a look at GB opcodes to see which is good replacement or to see what those opcodes does.
Step 11. Test the code, yep it worked. Write down your code and submit to your favorite game genie website if they do not have any.
2. Create "Start With" type of code
Step 1. Start up your game like normally (Im going to use Mega Man 2, again). As you see he has 2 lives as a origin.
Step 2. Using Game Shark infinite lives raw address in Debugger Breakpoint again like previously done in "Infinite" type code method, but this time different. I wrote down "02" as a value, this is Mega Man's starting lives. (some games use 1 more value, such as if your game lives is 2, and search 3 instead). Make sure that you disable Game Shark code if you haven't.
Step 3. Hit "Reset" button, if you haven't assisted extra button, or don't know how to reset, hit the "*" in numpad. After pushing reset button, Debugger will popup. Wait!, does these number in the picture looks familar? That must be it!
Step 4. Enter the address in cheat list, why did I entered it "0C1D"? because OC1C is not lives value, you can see that it's a "3C" in hex, that isn't lives value, the next one is lives value, so +1 to offset. New value as "09", (dont try to enter numbers that you think is bigger than it's limit, this game supposely to limited at 9 lives.) Make sure that you enable Game Genie code, and disable Game Shark code if you haven't.
Step 5. Hit "Reset" button again and test it out. It actually worked. Write down your code and submit to your favorite game genie website if they do not have any.
3. Hacking Game Genie code into a ROM
Step 1. Using existing Game Genie codes or the ones you find on your own. (IT MUST BE GAME GENIE because ROM itself is PURELY ROM, no RAM). Im going to use Spider-Man (Color) codes, "Start with and continue with 99 lives" looks nice to hack into rom.
Step 2. Converting from Game Genie to raw ROM address is *VERY* simple, click here to see how. Or use Dlong's utility - GBGG - Using it, on the left type in Game Genie code (with dash in middle), click "convert" button will convert to raw address on the right. So we have 017D=64 and 4B78=64.
Step 3. Extract file from zip (you cannot hex edit from .zip) if you haven't. Make backup of Rom if you already have extracted and rename if needed.
Step 4. Load up the rom in Hex Editor, this should what it look like in picture above.
Step 5. Use the "GO TO" feature in Hex Editor, type in 0000(your raw address here), (example, first line of Spider-Man "Start with and continue with 99 lives" is 0000017D"). Hit "OK".
Step 6. Hex Editor will point to certain HEX, if you went "wait a min, that offset doesn't match what I have entered". Notice that from left to right, 16 of them, from 0 to F. We have where cursor pointing at "D" (000017D) Ahhhh. Go ahead type in the change from "03" to "64" in there (this game used extra 1 value, 63 meant to be 99, but it will show up 98 in game, so 64 then).
Step 7. Doing this again (if you enter many game genie codes), and save change!
Step 8. Open up this altered ROM in BGB, it will alert you that CheckSum is wrong and load up the game anyway. (You can fix checksum from Debugger under "File"). Test it, it actually worked. 99 Lives without having to enter Game Genie or Game Shark codes!