MAME debug
When it comes to understanding the code, we could just run the ROM files which contain code through a disassembler and try to read it, but it's easier if we can follow the code while it is executing instead of just reading it. That's one thing debuggers can do.
Luckily MAME already has a built-in debugger that can do that. You just need to invoke it with the -debug command line option, so
mame.exe shinobi -debug
At the command line is enough. It will open the game and a debugger window, like this:
In the debug window you can see the register values on the left, a disassemble of the code at the center top panel, and the command window on the bottom right corner. The debugger includes the usual functions like execute the code instruction by instruction, set breakpoints, examine memory locations, and so on.
Though it's hard to analyze the code just by watching it execute on a debugger. Typically there are thousands of instructions executed for each frame, so it's hard to follow at this level. The goal here is to eventually identify at what address are the subroutines of interest (main game loop, movement routines, enemy routines etc.). It is possible to do that with just the MAME debugger, but it would be a lot of work. It would be better to use more sophisticated tools that can analyze the control flow of the code and identify the blocks and sub-routines, if such a tool is available.
Or maybe we can create one such tool, hopefully based on an already-existing disassembler (because writing the disassembler itself would be a lot more work).
Comments
Post a Comment