mGBA Forums
How to use mgba for code/data separation??????????? - Printable Version

+- mGBA Forums (https://forums.mgba.io)
+-- Forum: mGBA (https://forums.mgba.io/forumdisplay.php?fid=1)
+--- Forum: Development (https://forums.mgba.io/forumdisplay.php?fid=11)
+--- Thread: How to use mgba for code/data separation??????????? (/showthread.php?tid=3891)



How to use mgba for code/data separation??????????? - wavedevice - 12-30-2017

What I need is the following: log all the states of the program counter and the rombank number, so that I can use the addresses to differ between what are variables/instructions/tilemaps/graphics, etc.
I was going to use some very crazy hack (ptrace in linux) to do such a thing. But if I use the source code of mgba this could be much easier and less time consuming.
Where in the source code I can find the routines that modify/read the pc(program counter) and rombank number?

There is some documentation about the data structures used in the source code?

Just to clarify, my final objective is to create a tool for code/data separation, for reverse engineering gbc roms. A feature similar to code/data separation that exists in Emulicious emulator, this tool will be enhanced for automated data structures extraction and recompilation.


RE: How to use mgba for code/data separation??????????? - endrift - 12-31-2017

Take a look at the debugger interface. You can use it to trace individual instructions, although I think it might be a bit buggy for GB/C games right now.