From 2afcf0cd4f4bb6d41405a0fbbee31d92ddc912dc Mon Sep 17 00:00:00 2001 From: urchlay Date: Sun, 19 Jun 2005 08:37:29 +0000 Subject: [PATCH] DebuggerParser::parseArg now properly formats its string result, depending on the current default base. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@530 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/debugger/DebuggerParser.cxx | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index c9bed2ab4..cf7231ba4 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: DebuggerParser.cxx,v 1.15 2005-06-19 08:29:40 urchlay Exp $ +// $Id: DebuggerParser.cxx,v 1.16 2005-06-19 08:37:29 urchlay Exp $ //============================================================================ #include "bspf.hxx" @@ -171,11 +171,27 @@ bool DebuggerParser::parseArgument( return false; } - if(*value < 0x100) - sprintf(rendered, "%02x", *value); - else - sprintf(rendered, "%04x", *value); + switch(defaultBase) { + case kBASE_2: + if(*value < 0x100) + sprintf(rendered, Debugger::to_bin_8(*value)); + else + sprintf(rendered, Debugger::to_bin_16(*value)); + break; + case kBASE_10: + sprintf(rendered, "%d", *value); + break; + + case kBASE_16: + default: + if(*value < 0x100) + sprintf(rendered, Debugger::to_hex_8(*value)); + else + sprintf(rendered, Debugger::to_hex_16(*value)); + break; + + } return true; }