====== MAME Debugger General Commands ====== ---- ===== help ===== ---- **Syntax:** ''help '' Get help on a particular topic. ===== do ===== ---- **Syntax:** ''do '' The //do// command simply evaluates the given ''''. 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 []'' Lists registered symbols. If '''' is not specified, then symbols in the global symbol table are displayed; otherwise, the symbols for '''''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 [,…]'' 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 [,[,…]]'' The //printf// command performs a C-style printf to the debugger console. Only a very limited set of formatting options are available: * ''%[0][]d'' – prints '''' as a decimal value with optional digit count and zero-fill * ''%[0][]x'' – prints '''' 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='' where '''' is displayed in hexadecimal with 4 digits with zero-fill. * ''printf "A=%d, B=%d\nC=%d",a,b,a+b'' – Prints ''A=, B='' on one line, and ''C='' on a second line. ===== logerror ===== ---- **Syntax:** ''logerror [,[,…]]'' The //logerror// command performs a C-style printf to the error log. Only a very limited set of formatting options are available: * ''%[0][]d'' – logs '''' as a decimal value with optional digit count and zero-fill * ''%[0][]x'' – logs '''' 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='' where '''' is displayed in hexadecimal with 4 digits with zero-fill. * ''logerror "A=%d, B=%d\nC=%d",a,b,a+b'' – Logs ''A=, B='' on one line, and ''C='' on a second line. ===== tracelog ===== ---- **Syntax:** ''tracelog [,[,…]]'' The //tracelog// command performs a C-style printf and routes the output to the currently open trace file (see the [[debugger:execution#trace|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|printf]] help for details. **Examples:** * ''tracelog "PC=%04X",pc'' – Outputs ''PC='' where '''' is displayed in hexadecimal with 4 digits with zero-fill. * ''tracelog "A=%d, B=%d\nC=%d",a,b,a+b'' – Outputs ''A=, B='' on one line, and ''C='' on a second line. ===== snap ===== ---- **Syntax:** ''snap [[], ]'' The //snap// command takes a snapshot of the current video display and saves it to the configured snapshot directory. If '''' is specified explicitly, a single screenshot for '''' is saved under the requested filename. If '''' 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 '' 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.