diff options
author | 2020-09-25 23:01:33 -0400 | |
---|---|---|
committer | 2020-09-25 23:01:33 -0400 | |
commit | 98f6fde10432ef298ebf6ff3f86b707e4639560a (patch) | |
tree | f2d13b042bc7637a6be622e3371270be86d9754e /src/emu/debug/debugcmd.cpp | |
parent | 78612bd01fca8ce254819cfbe2a4732cc4ebecb6 (diff) |
Add abs, bit, s8, s16, s32 functions to debugger
Diffstat (limited to 'src/emu/debug/debugcmd.cpp')
-rw-r--r-- | src/emu/debug/debugcmd.cpp | 76 |
1 files changed, 67 insertions, 9 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index c6dda192e59..a620d5555d3 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -122,6 +122,11 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu symtable.add("min", 2, 2, std::bind(&debugger_commands::execute_min, this, _1, _2)); symtable.add("max", 2, 2, std::bind(&debugger_commands::execute_max, this, _1, _2)); symtable.add("if", 3, 3, std::bind(&debugger_commands::execute_if, this, _1, _2)); + symtable.add("abs", 1, 1, std::bind(&debugger_commands::execute_abs, this, _1, _2)); + symtable.add("bit", 2, 3, std::bind(&debugger_commands::execute_bit, this, _1, _2)); + symtable.add("s8", 1, 1, std::bind(&debugger_commands::execute_s8, this, _1, _2)); + symtable.add("s16", 1, 1, std::bind(&debugger_commands::execute_s16, this, _1, _2)); + symtable.add("s32", 1, 1, std::bind(&debugger_commands::execute_s32, this, _1, _2)); symtable.add("cpunum", std::bind(&debugger_commands::get_cpunum, this)); /* add all single-entry save state globals */ @@ -322,9 +327,9 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu m_cheat.cpu[0] = m_cheat.cpu[1] = 0; } -/*------------------------------------------------- - execute_min - return the minimum of two values --------------------------------------------------*/ +//------------------------------------------------- +// execute_min - return the minimum of two values +//------------------------------------------------- u64 debugger_commands::execute_min(int params, const u64 *param) { @@ -332,9 +337,9 @@ u64 debugger_commands::execute_min(int params, const u64 *param) } -/*------------------------------------------------- - execute_max - return the maximum of two values --------------------------------------------------*/ +//------------------------------------------------- +// execute_max - return the maximum of two values +//------------------------------------------------- u64 debugger_commands::execute_max(int params, const u64 *param) { @@ -342,9 +347,9 @@ u64 debugger_commands::execute_max(int params, const u64 *param) } -/*------------------------------------------------- - execute_if - if (a) return b; else return c; --------------------------------------------------*/ +//------------------------------------------------- +// execute_if - if (a) return b; else return c; +//------------------------------------------------- u64 debugger_commands::execute_if(int params, const u64 *param) { @@ -353,6 +358,59 @@ u64 debugger_commands::execute_if(int params, const u64 *param) //------------------------------------------------- +// execute_abs - return the absolute value +//------------------------------------------------- + +u64 debugger_commands::execute_abs(int params, const u64 *param) +{ + return std::abs(s64(param[0])); +} + + +//------------------------------------------------- +// execute_bit - extract bit field from value +//------------------------------------------------- + +u64 debugger_commands::execute_bit(int params, const u64 *param) +{ + if (params == 2) + return BIT(param[0], param[1]); + else + return BIT(param[0], param[1], param[2]); +} + + +//------------------------------------------------- +// execute_s8 - sign-extend from 8 bits +//------------------------------------------------- + +u64 debugger_commands::execute_s8(int params, const u64 *param) +{ + return s8(param[0]); +} + + +//------------------------------------------------- +// execute_s16 - sign-extend from 16 bits +//------------------------------------------------- + +u64 debugger_commands::execute_s16(int params, const u64 *param) +{ + return s16(param[0]); +} + + +//------------------------------------------------- +// execute_s32 - sign-extend from 32 bits +//------------------------------------------------- + +u64 debugger_commands::execute_s32(int params, const u64 *param) +{ + return s32(param[0]); +} + + +//------------------------------------------------- // get_cpunum - getter callback for the // 'cpunum' symbol //------------------------------------------------- |