11 March 2016 - Forum Rules

Main Menu

How do I view and edit the code of a Game Boy game?

Started by lemmyk2008, August 21, 2022, 03:55:08 PM

Previous topic - Next topic


Hello users,
I have been working on a ROM hack of Mega Man 2 on the Game Boy, and have came across an issue of the game. The door to the boss keeps scrolling forward past the door, while in every other Mega Man game, it's supposed to stop scrolling at the door. I believe the way to fix this is to go into the code an change a certain value. However, I cannot figure out how to view and edit the code of the game to fix it. Does anyone here know how to do this?


As above this is probably where a debugger comes in. I don't know what we are suggesting for the original GB/GBC these days.
bgb is what I usually grab but I might be missing out on something newer and shinier (maybe some tool assisted speedrun types made one, usually where we find such things if baseline emulators are not up to snuff).
If you need some info on the gb/gbc hardware then pandocs is the main one (and included with various emulators)

I don't know what your background is as far as assembly coding, much less for the Z80 a like of the GB/GBC, and debugging. Stopping something from scrolling should be easy enough -- there are usually two scenarios for something like this.
1) Your hack is not large enough and the game scrolls on to what is the normal value/value from the base game. You could correct this with what is to follow but more likely you add in another screen or whatever to make it up to value.
1a) Bosses in megaman are often their own little thing, accordingly there might be a flag to say this is boss time and you forgot to trip that when editing something.

2) This is something you want to edit code for. There will be some limit or handling of scrolling somewhere in the game (as well as general gameplay design it speaks to graphics so find something that the graphics deal with, maybe a sprite with the OAM or maybe background with BG and set your breakpoints to trigger on those) and you want to find that, sort the relevant IF ELSE type arrangement such that when the boss is there the scrolling stops, and there you go.


Thanks for the help, and in case you were wondering, the scrolling issue is in the original game was well, and I also need to figure out how to edit levels.