summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/unsp/unspdasm_jumps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/unsp/unspdasm_jumps.cpp')
-rw-r--r--src/devices/cpu/unsp/unspdasm_jumps.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/devices/cpu/unsp/unspdasm_jumps.cpp b/src/devices/cpu/unsp/unspdasm_jumps.cpp
new file mode 100644
index 00000000000..09c96692285
--- /dev/null
+++ b/src/devices/cpu/unsp/unspdasm_jumps.cpp
@@ -0,0 +1,41 @@
+// license:GPL-2.0+
+// copyright-holders:Segher Boessenkool, David Haywood
+/*****************************************************************************
+
+ SunPlus ยต'nSP disassembler
+
+ Copyright 2008-2017 Segher Boessenkool <segher@kernel.crashing.org>
+ Licensed under the terms of the GNU GPL, version 2
+ http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+
+*****************************************************************************/
+
+#include "emu.h"
+#include "unspdasm.h"
+
+char const* const unsp_disassembler::jumps[] =
+{
+ "jb", "jae", "jge", "jl", "jne", "je", "jpl", "jmi",
+ "jbe", "ja", "jle", "jg", "jvc", "jvs", "jmp", "<inv>"
+};
+
+offs_t unsp_disassembler::disassemble_jumps(std::ostream &stream, offs_t pc, const uint16_t op)
+{
+ uint32_t len = 1;
+ const uint16_t op0 = (op >> 12) & 15;
+ const uint16_t op1 = (op >> 6) & 7;
+ const uint32_t opimm = op & 0x3f;
+
+ if (op1 == 0)
+ {
+ util::stream_format(stream, "%s %04x", jumps[op0], pc + 1 + opimm);
+ return UNSP_DASM_OK;
+ }
+ else if (op1 == 1)
+ {
+ util::stream_format(stream, "%s %04x", jumps[op0], pc + 1 - opimm);
+ return UNSP_DASM_OK;
+ }
+
+ return UNSP_DASM_OK;
+}