Mercurial > repos > blastem
changeset 1923:23394a890508
Added implementation of printing PC in 68K debugger
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 13 Apr 2020 18:14:22 -0700 |
parents | 4a811fd1fb6f |
children | 81b059e3ded6 |
files | debug.c |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/debug.c Fri Apr 10 23:01:13 2020 +1000 +++ b/debug.c Mon Apr 13 18:14:22 2020 -0700 @@ -105,7 +105,7 @@ return m68k_read_word(address, context) << 16 | m68k_read_word(address + 2, context); } -void debugger_print(m68k_context *context, char format_char, char *param) +void debugger_print(m68k_context *context, char format_char, char *param, uint32_t address) { uint32_t value; char format[8]; @@ -152,7 +152,7 @@ genesis_context *gen = context->system; value = gen->vdp->frame; } else if (param[0] == 'p' && param[1] == 'c') { - value = 0; //TODO PC value here; + value = address; } else if ((param[0] == '0' && param[1] == 'x') || param[0] == '$') { char *after; uint32_t p_addr = strtol(param+(param[0] == '0' ? 2 : 1), &after, 16); @@ -693,7 +693,7 @@ fputs("display command requires a parameter\n", stderr); break; } - debugger_print(context, format_char, param); + debugger_print(context, format_char, param, address); add_display(&displays, &disp_index, format_char, param); } else { param = find_param(input_buf); @@ -724,12 +724,13 @@ } } param = find_param(input_buf); - if (!param) { + if (param) { + debugger_print(context, format_char, param, address); + } else { m68k_disasm(&inst, input_buf); printf("%X: %s\n", address, input_buf); - break; } - debugger_print(context, format_char, param); + break; case 'n': if (inst.op == M68K_RTS) { @@ -1054,7 +1055,7 @@ remove_breakpoint(context, address); } for (disp_def * cur = displays; cur; cur = cur->next) { - debugger_print(context, cur->format_char, cur->param); + debugger_print(context, cur->format_char, cur->param, address); } m68k_disasm(&inst, input_buf); printf("%X: %s\n", address, input_buf);