all repos — mgba @ e6148ddb139eaac826c73c19ff29d9f8b2255d0f

mGBA Game Boy Advance Emulator

Add p/t to CLI debugger
Jeffrey Pfau jeffrey@endrift.com
Sat, 30 Aug 2014 04:00:17 -0700
commit

e6148ddb139eaac826c73c19ff29d9f8b2255d0f

parent

383c630891dacdb006248c14d858d951c41bdd0f

1 files changed, 15 insertions(+), 0 deletions(-)

jump to
M src/debugger/cli-debugger.csrc/debugger/cli-debugger.c

@@ -34,6 +34,7 @@ static void _disassembleArm(struct CLIDebugger*, struct DebugVector*);

static void _disassembleThumb(struct CLIDebugger*, struct DebugVector*); static void _next(struct CLIDebugger*, struct DebugVector*); static void _print(struct CLIDebugger*, struct DebugVector*); +static void _printBin(struct CLIDebugger*, struct DebugVector*); static void _printHex(struct CLIDebugger*, struct DebugVector*); static void _printStatus(struct CLIDebugger*, struct DebugVector*); static void _quit(struct CLIDebugger*, struct DebugVector*);

@@ -69,8 +70,10 @@ { "info", _printStatus },

{ "n", _next }, { "next", _next }, { "p", _print }, + { "p/t", _printBin }, { "p/x", _printHex }, { "print", _print }, + { "print/t", _printBin }, { "print/x", _printHex }, { "q", _quit }, { "quit", _quit },

@@ -176,6 +179,18 @@ static void _print(struct CLIDebugger* debugger, struct DebugVector* dv) {

UNUSED(debugger); for ( ; dv; dv = dv->next) { printf(" %u", dv->intValue); + } + printf("\n"); +} + +static void _printBin(struct CLIDebugger* debugger, struct DebugVector* dv) { + UNUSED(debugger); + for ( ; dv; dv = dv->next) { + printf(" 0b"); + int i = 32; + while (i--) { + printf("%u", (dv->intValue >> i) & 1); + } } printf("\n"); }