MAME Debugger General Commands


help


Syntax: help <topic>

Get help on a particular topic.

do


Syntax: do <expression>

The do command simply evaluates the given <expression>. This is typically used to set or modify variables.

Examples:

  • do pc = 0 – Sets the register pc to 0.

The word do is optional, thus

  • pc=0 – will also set the pc register to 0.

symlist


Syntax: symlist [<cpunum>]

Lists registered symbols. If <cpunum> is not specified, then symbols in the global symbol table are displayed; otherwise, the symbols for <cpunum>'s specific CPU are displayed. Symbols are listed alphabetically. Read-only symbols are flagged with an asterisk.

Examples:

  • symlist – Displays the global symbol table.
  • symlist 2 – Displays the symbols specific to CPU #2.

softreset


Syntax: softreset

Executes a soft reset.

Examples:

  • softreset – Executes a soft reset.

hardreset


Syntax: hardreset

Executes a hard reset.

Examples:

  • hardreset – Executes a hard reset.

print


Syntax: print <item>[,…]

The print command prints the results of one or more expressions to the debugger console as hexadecimal values.

Examples:

  • print pc – Prints the value of pc to the console as a hex number.
  • print a,b,a+b – Prints a, b, and the value of a+b to the console as hex numbers.

printf


Syntax: printf <format>[,<item>[,…]]

The printf command performs a C-style printf to the debugger console. Only a very limited set of formatting options are available:

  • %[0][<n>]d – prints <item> as a decimal value with optional digit count and zero-fill
  • %[0][<n>]x – prints <item> as a hexadecimal value with optional digit count and zero-fill

All remaining formatting options are ignored. Use %% together to output a % character. Multiple lines can be printed by embedding a \n in the text.

Examples:

  • printf “PC=%04X”,pc – Prints PC=<pcval> where <pcval> is displayed in hexadecimal with 4 digits with zero-fill.
  • printf “A=%d, B=%d\nC=%d”,a,b,a+b – Prints A=<aval>, B=<bval> on one line, and C=<a+bval> on a second line.

logerror


Syntax: logerror <format>[,<item>[,…]]

The logerror command performs a C-style printf to the error log. Only a very limited set of formatting options are available:

  • %[0][<n>]d – logs <item> as a decimal value with optional digit count and zero-fill
  • %[0][<n>]x – logs <item> as a hexadecimal value with optional digit count and zero-fill

All remaining formatting options are ignored. Use two % together to output a % character. Multiple lines can be printed by embedding a \n in the text.

Examples:

  • logerror “PC=%04X”,pc – Logs PC=<pcval> where <pcval> is displayed in hexadecimal with 4 digits with zero-fill.
  • logerror “A=%d, B=%d\nC=%d”,a,b,a+b – Logs A=<aval>, B=<bval> on one line, and C=<a+bval> on a second line.

tracelog


Syntax: tracelog <format>[,<item>[,…]]

The tracelog command performs a C-style printf and routes the output to the currently open trace file (see the trace command for details). If no file is currently open, tracelog does nothing. Only a very limited set of formatting options are available. See the printf help for details.

Examples:

  • tracelog “PC=%04X”,pc – Outputs PC=<pcval> where <pcval> is displayed in hexadecimal with 4 digits with zero-fill.
  • tracelog “A=%d, B=%d\nC=%d”,a,b,a+b – Outputs A=<aval>, B=<bval> on one line, and C=<a+bval> on a second line.

snap


Syntax: snap [[<filename>], <scrnum>]

The snap command takes a snapshot of the current video display and saves it to the configured snapshot directory. If <filename> is specified explicitly, a single screenshot for <scrnum> is saved under the requested filename. If <filename> is omitted, all screens are saved using the same default rules as the “save snapshot” key in MAME proper.

Examples:

  • snap – Takes a snapshot of the current video screen and saves to the next non-conflicting filename in the configured snapshot directory.
  • snap shinobi – Takes a snapshot of the current video screen and saves it as shinobi.png in the configured snapshot directory.

source


Syntax: source <filename>

The source command reads in a set of debugger commands from a file and executes them one by one, similar to a batch file.

Examples:

  • source break_and_trace.cmd – Reads in debugger commands from break_and_trace.cmd and executes them.

quit


Syntax: quit

The quit command exits MESS immediately.