From e27e2f7fd642beb4381ec6171b7b4a8a6da5deb5 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 4 Apr 2017 19:31:14 -0700 Subject: Allow a .l suffix to a memory print command to allow fetching and printing a longword --- debug.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'debug.c') diff --git a/debug.c b/debug.c index 3a40899..b7bc9ed 100644 --- a/debug.c +++ b/debug.c @@ -145,12 +145,21 @@ void debugger_print(m68k_context *context, char format_char, char *param) genesis_context *gen = context->system; value = gen->vdp->frame; } else if ((param[0] == '0' && param[1] == 'x') || param[0] == '$') { - uint32_t p_addr = strtol(param+(param[0] == '0' ? 2 : 1), NULL, 16); - value = m68k_read_word(p_addr, context); + char *after; + uint32_t p_addr = strtol(param+(param[0] == '0' ? 2 : 1), &after, 16); + if (after[0] == '.' && after[1] == 'l') { + value = m68k_read_long(p_addr, context); + } else { + value = m68k_read_word(p_addr, context); + } } else if(param[0] == '(' && (param[1] == 'a' || param[1] == 'd') && param[2] >= '0' && param[2] <= '7' && param[3] == ')') { uint8_t reg = param[2] - '0'; uint32_t p_addr = param[1] == 'a' ? context->aregs[reg] : context->dregs[reg]; - value = m68k_read_word(p_addr, context); + if (param[4] == '.' && param[5] == 'l') { + value = m68k_read_long(p_addr, context); + } else { + value = m68k_read_word(p_addr, context); + } } else { fprintf(stderr, "Unrecognized parameter to p: %s\n", param); return; -- cgit v1.2.3