summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-04-04 19:31:14 -0700
committerMichael Pavone <pavone@retrodev.com>2017-04-04 19:31:14 -0700
commite27e2f7fd642beb4381ec6171b7b4a8a6da5deb5 (patch)
tree003b3874911dfb238d835f929e1401fcca4a359d
parent80a1591669c0d33075853af54ce8d3b9af615435 (diff)
Allow a .l suffix to a memory print command to allow fetching and printing a longword
-rw-r--r--debug.c15
1 files changed, 12 insertions, 3 deletions
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;