Stud
Posts: 6
Joined: Mon Feb 27, 2017 6:17 pm

Debuging game code using Mame

Hello there,

I'm working on a Neo-geo game and I have some asm code that I would like to debug during the gameplay. I didn't find any guide on how to do that.
I've seen the memory windows and the possibility to run step by step, but I can't see how I can navigate in the code and find the functions I'm looking for (which makes the beakpoint feature useless).

I'm sure I missed something and I would really appreciate that someone takes some time to explain this to me or redirect me to another post / article about that.

mhoes
Posts: 134
Joined: Wed Oct 26, 2016 12:26 pm

Re: Debuging game code using Mame

Up until recently, there used to be a (blog) site 'letshackarcadegames.com' that had a lot of helpful articles on using the mame debugger. Unfortuantely however, it looks like the domain registration has expired.

Fortunately, it looks like the Internet WaybackMachine Archive has archived at least some of it. (If the archived material proves useful, please consider making a donation to the Internet Archive).

https://web.archive.org/web/20161106154 ... com/?p=338

Stud
Posts: 6
Joined: Mon Feb 27, 2017 6:17 pm

Re: Debuging game code using Mame

Thank you for the link, some console commands explained inside are interesting.

Working with the Mame debugger currently feels like reversing a software. Is there a way to use debugging symbols ? I'm not familiar with all of this actually works to be honest.

mhoes
Posts: 134
Joined: Wed Oct 26, 2016 12:26 pm

Re: Debuging game code using Mame

I'm truly sorry, but as I have no knowledge of the Mame internal debugger whatsoever, I cannot help you any further than pointing you to the various (blog) articles published on the (archived) site I linked to in my previous post.

Having said that, I can only assume that the debugger feels 'like reversing a software', is because I fully assume that to be exactly the main and perhaps even only purpose of the debugger: People read/dump the assembler/binary game code of a specific machine to rom files, without there being any access to source code whatsoever, so the only option left is to reverse engineer the (binary/assembly) game (optionally assisted by documentation or previous efforts on how the specific hardware it runs on works.)

tcdev
Posts: 1
Joined: Thu Nov 06, 2014 9:40 pm

Re: Debuging game code using Mame

MAME has no concept of 'source code' or 'symbols' or any insight into the hundreds of different object file formats output by hundreds of different toolchains for hundreds of different platforms. Nor does it have any mechanism to load anything other than raw binary files into the emulated platform. So in short, no, you're stuck with debugging binaries and raw addresses.

Basically you need to inspect the assembler output (listing) of each build and note the addresses of the functions you're interested in. Then use these addresses to set watchpoints, breakpoints etc. So breakpoints are far from 'useless'.

What you're asking is way out of scope and completely unrealistic to expect of MAME.

On the flip side, I too have done some Neo Geo development and I have also used the MAME debugger in the process.

Arbee
Posts: 27
Joined: Fri Nov 14, 2014 4:27 pm
Contact: Website

Re: Debuging game code using Mame

There are no debugging symbols in arcade games - the best you'll find is sometimes they accidentally left assert()s and debug printf()s enabled, but those are both rare. You are reverse-engineering the game from the assembly on up. This is how MAMEDev figures out how the hardware works, most of the time.

Return to “MAME Discussion”