summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/cpu')
-rw-r--r--src/emu/cpu/dsp56k/dsp56dsm.c6
-rw-r--r--src/emu/cpu/dsp56k/dsp56k.c48
-rw-r--r--src/emu/cpu/dsp56k/dsp56k.h42
-rw-r--r--src/emu/cpu/dsp56k/dsp56ops.c2
-rw-r--r--src/emu/cpu/dsp56k/inst.c33
-rw-r--r--src/emu/cpu/dsp56k/inst.h1308
-rw-r--r--src/emu/cpu/dsp56k/opcode.c4
-rw-r--r--src/emu/cpu/dsp56k/opcode.h6
-rw-r--r--src/emu/cpu/dsp56k/pmove.c6
-rw-r--r--src/emu/cpu/dsp56k/pmove.h116
-rw-r--r--src/emu/cpu/dsp56k/tables.c669
-rw-r--r--src/emu/cpu/dsp56k/tables.h78
12 files changed, 1363 insertions, 955 deletions
diff --git a/src/emu/cpu/dsp56k/dsp56dsm.c b/src/emu/cpu/dsp56k/dsp56dsm.c
index 4a9aead9d67..8cc109c2dc4 100644
--- a/src/emu/cpu/dsp56k/dsp56dsm.c
+++ b/src/emu/cpu/dsp56k/dsp56dsm.c
@@ -1,8 +1,8 @@
/***************************************************************************
- dsp56dsm.c
- Disassembler for the portable Motorola/Freescale dsp56k emulator.
- Written by Andrew Gardner
+ dsp56dsm.c
+ Disassembler for the portable Motorola/Freescale dsp56k emulator.
+ Written by Andrew Gardner
***************************************************************************/
diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c
index 32ad1453dc4..40b81cc713e 100644
--- a/src/emu/cpu/dsp56k/dsp56k.c
+++ b/src/emu/cpu/dsp56k/dsp56k.c
@@ -21,7 +21,7 @@
- 1-9 For fractional arithmetic, the 31-bit product is added to the 40-bit contents of A or B. No pipeline!
- 1-10 Two types of rounding: convergent rounding and two's complement rounding. See status register bit R.
- 1-10 Logic unit is 16-bits wide and works on MSP portion of accum register
- - 1-10 The AGU can implement three types of arithmetic: linear, modulo, and reverse carry.
+ - 1-10 The AGU can implement three types of arithmetic: linear, modulo, and reverse carry.
- 1-12 "Two external interrupt pins!!!"
- 1-12 Take care of all interrupt priority (IPR) stuff!
- 1-19 Memory WAIT states
@@ -318,7 +318,7 @@ static size_t execute_one_new(dsp56k_core* cpustate)
UINT16 w0 = ROPCODE(ADDRESS(PC));
UINT16 w1 = ROPCODE(ADDRESS(PC) + ADDRESS(1));
-
+
Opcode op(w0, w1);
op.evaluate(cpustate);
PC += op.evalSize(); // Special size function needed to handle jmps, etc.
@@ -381,6 +381,46 @@ ADDRESS_MAP_END
/**************************************************************************
* Generic set_info/get_info
**************************************************************************/
+enum
+{
+ // PCU
+ DSP56K_PC=1,
+ DSP56K_SR,
+ DSP56K_LC,
+ DSP56K_LA,
+ DSP56K_SP,
+ DSP56K_OMR,
+
+ // ALU
+ DSP56K_X, DSP56K_Y,
+ DSP56K_A, DSP56K_B,
+
+ // AGU
+ DSP56K_R0,DSP56K_R1,DSP56K_R2,DSP56K_R3,
+ DSP56K_N0,DSP56K_N1,DSP56K_N2,DSP56K_N3,
+ DSP56K_M0,DSP56K_M1,DSP56K_M2,DSP56K_M3,
+ DSP56K_TEMP,
+ DSP56K_STATUS,
+
+ // CPU STACK
+ DSP56K_ST0,
+ DSP56K_ST1,
+ DSP56K_ST2,
+ DSP56K_ST3,
+ DSP56K_ST4,
+ DSP56K_ST5,
+ DSP56K_ST6,
+ DSP56K_ST7,
+ DSP56K_ST8,
+ DSP56K_ST9,
+ DSP56K_ST10,
+ DSP56K_ST11,
+ DSP56K_ST12,
+ DSP56K_ST13,
+ DSP56K_ST14,
+ DSP56K_ST15
+};
+
static CPU_SET_INFO( dsp56k )
{
dsp56k_core* cpustate = get_safe_token(device);
@@ -464,8 +504,8 @@ CPU_GET_INFO( dsp56k )
case CPUINFO_INT_CLOCK_DIVIDER: info->i = 2; break;
case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 2; break;
case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 4; break;
- case CPUINFO_INT_MIN_CYCLES: info->i = 1; // ? break;
- case CPUINFO_INT_MAX_CYCLES: info->i = 8; // ? break;
+ case CPUINFO_INT_MIN_CYCLES: info->i = 1; // ? break;
+ case CPUINFO_INT_MAX_CYCLES: info->i = 8; // ? break;
case DEVINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16; break;
case DEVINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16; break;
diff --git a/src/emu/cpu/dsp56k/dsp56k.h b/src/emu/cpu/dsp56k/dsp56k.h
index ace6eccabee..7620b170715 100644
--- a/src/emu/cpu/dsp56k/dsp56k.h
+++ b/src/emu/cpu/dsp56k/dsp56k.h
@@ -14,48 +14,6 @@
#include "emu.h"
-/***************************************************************************
- REGISTER ENUMERATION
-***************************************************************************/
-enum
-{
- // PCU
- DSP56K_PC=1,
- DSP56K_SR,
- DSP56K_LC,
- DSP56K_LA,
- DSP56K_SP,
- DSP56K_OMR,
-
- // ALU
- DSP56K_X, DSP56K_Y,
- DSP56K_A, DSP56K_B,
-
- // AGU
- DSP56K_R0,DSP56K_R1,DSP56K_R2,DSP56K_R3,
- DSP56K_N0,DSP56K_N1,DSP56K_N2,DSP56K_N3,
- DSP56K_M0,DSP56K_M1,DSP56K_M2,DSP56K_M3,
- DSP56K_TEMP,
- DSP56K_STATUS,
-
- // CPU STACK
- DSP56K_ST0,
- DSP56K_ST1,
- DSP56K_ST2,
- DSP56K_ST3,
- DSP56K_ST4,
- DSP56K_ST5,
- DSP56K_ST6,
- DSP56K_ST7,
- DSP56K_ST8,
- DSP56K_ST9,
- DSP56K_ST10,
- DSP56K_ST11,
- DSP56K_ST12,
- DSP56K_ST13,
- DSP56K_ST14,
- DSP56K_ST15
-};
// IRQ Lines
// MODA and MODB are also known as IRQA and IRQB
diff --git a/src/emu/cpu/dsp56k/dsp56ops.c b/src/emu/cpu/dsp56k/dsp56ops.c
index f971abc0856..a57966ec3b2 100644
--- a/src/emu/cpu/dsp56k/dsp56ops.c
+++ b/src/emu/cpu/dsp56k/dsp56ops.c
@@ -41,7 +41,7 @@ struct _typed_pointer
};
typedef struct _typed_pointer typed_pointer;
-#define ADDRESS(X) (X<<1)
+//#define ADDRESS(X) (X<<1)
#define BITS(CUR,MASK) (Dsp56kOpMask(CUR,MASK))
/*********************/
diff --git a/src/emu/cpu/dsp56k/inst.c b/src/emu/cpu/dsp56k/inst.c
index b88c8ec04ff..23838d6c73f 100644
--- a/src/emu/cpu/dsp56k/inst.c
+++ b/src/emu/cpu/dsp56k/inst.c
@@ -5,8 +5,8 @@ namespace DSP56K
{
// Factory
-Instruction* Instruction::decodeInstruction(const Opcode* opc,
- const UINT16 word0,
+Instruction* Instruction::decodeInstruction(const Opcode* opc,
+ const UINT16 word0,
const UINT16 word1,
bool shifted)
{
@@ -18,7 +18,7 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
w0 = w1;
w1 = 0x0000;
}
-
+
/**************************************************************************/
/* The very funky case of the XMemoryDataMoveWithShortDisplacement */
/**************************************************************************/
@@ -112,8 +112,8 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
/* No Parallel Data Move : 0100 1010 .... .... : A-131 */
/* Register to Register Data Move : 0100 IIII .... .... : A-133 */
/* Address Register Update : 0011 0zRR .... .... : A-135 */
- /* X Memory Data Move : 1mRR HHHW .... .... : A-137 */
- /* X Memory Data Move : 0101 HHHW .... .... : A-137 */
+ /* X Memory Data Move : 1mRR HHHW .... .... : A-137 */
+ /* X Memory Data Move : 0101 HHHW .... .... : A-137 */
/* Quote: (32 General parallel move instructions) */
/****************************************************************/
else if (((w0 & 0xff00) == 0x4a00) ||
@@ -333,12 +333,12 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
else if (((w0 & 0xfff0) == 0x14b0) && ((w1 & 0x1f00) == 0x1200))
// NEW // else if (((w0 & 0xffe0) == 0x14a0) && ((w1 & 0x1f00) == 0x1200))
{
- return global_alloc(BfInstruction(opc, w0, w1));
+ return global_alloc(BfInstruction_2(opc, w0, w1));
}
/* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */
else if (((w0 & 0xffe0) == 0x1480) && ((w1 & 0x1f00) == 0x1200))
{
- return global_alloc(BfInstruction(opc, w0, w1));
+ return global_alloc(BfInstruction_3(opc, w0, w1));
}
/* BFCLR : 0001 0100 11Pp pppp BBB0 0100 iiii iiii : A-40 */
else if (((w0 & 0xffc0) == 0x14c0) && ((w1 & 0x1f00) == 0x0400))
@@ -349,12 +349,12 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
else if (((w0 & 0xfff0) == 0x14b0) && ((w1 & 0x1f00) == 0x0400))
// NEW // else if (((w0 & 0xffe0) == 0x14a0) && ((w1 & 0x1f00) == 0x0400))
{
- return global_alloc(BfInstruction(opc, w0, w1));
+ return global_alloc(BfInstruction_2(opc, w0, w1));
}
/* BFCLR : 0001 0100 100D DDDD BBB0 0100 iiii iiii : A-40 */
else if (((w0 & 0xffe0) == 0x1480) && ((w1 & 0x1f00) == 0x0400))
{
- return global_alloc(BfInstruction(opc, w0, w1));
+ return global_alloc(BfInstruction_3(opc, w0, w1));
}
/* BFSET : 0001 0100 11Pp pppp BBB1 1000 iiii iiii : A-42 */
else if (((w0 & 0xffc0) == 0x14c0) && ((w1 & 0x1f00) == 0x1800))
@@ -365,12 +365,12 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
else if (((w0 & 0xfff0) == 0x14b0) && ((w1 & 0x1f00) == 0x1800))
// NEW // else if (((w0 & 0xffe0) == 0x14a0) && ((w1 & 0x1f00) == 0x1800))
{
- return global_alloc(BfInstruction(opc, w0, w1));
+ return global_alloc(BfInstruction_2(opc, w0, w1));
}
/* BFSET : 0001 0100 100D DDDD BBB1 1000 iiii iiii : A-42 */
else if (((w0 & 0xffe0) == 0x1480) && ((w1 & 0x1f00) == 0x1800))
{
- return global_alloc(BfInstruction(opc, w0, w1));
+ return global_alloc(BfInstruction_3(opc, w0, w1));
}
/* BFTSTH : 0001 0100 01Pp pppp BBB1 0000 iiii iiii : A-44 */
else if (((w0 & 0xffc0) == 0x1440) && ((w1 & 0x1f00) == 0x1000))
@@ -381,12 +381,12 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
else if (((w0 & 0xfff0) == 0x1430) && ((w1 & 0x1f00) == 0x1000))
// NEW // else if (((w0 & 0xffe0) == 0x1420) && ((w1 & 0x1f00) == 0x1000))
{
- return global_alloc(BfInstruction(opc, w0, w1));
+ return global_alloc(BfInstruction_2(opc, w0, w1));
}
/* BFTSTH : 0001 0100 000D DDDD BBB1 0000 iiii iiii : A-44 */
else if (((w0 & 0xffe0) == 0x1400) && ((w1 & 0x1f00) == 0x1000))
{
- return global_alloc(BfInstruction(opc, w0, w1));
+ return global_alloc(BfInstruction_3(opc, w0, w1));
}
/* BFTSTL : 0001 0100 01Pp pppp BBB0 0000 iiii iiii : A-46 */
else if (((w0 & 0xffc0) == 0x1440) && ((w1 & 0x1f00) == 0x0000))
@@ -397,12 +397,12 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
else if (((w0 & 0xfff0) == 0x1430) && ((w1 & 0x1f00) == 0x0000))
// NEW // else if (((w0 & 0xffe0) == 0x1420) && ((w1 & 0x1f00) == 0x0000))
{
- return global_alloc(BfInstruction(opc, w0, w1));
+ return global_alloc(BfInstruction_2(opc, w0, w1));
}
/* BFTSTL : 0001 0100 000D DDDD BBB0 0000 iiii iiii : A-46 */
else if (((w0 & 0xffe0) == 0x1400) && ((w1 & 0x1f00) == 0x0000))
{
- return global_alloc(BfInstruction(opc, w0, w1));
+ return global_alloc(BfInstruction_3(opc, w0, w1));
}
/* Bcc : 0000 0111 --11 cccc xxxx xxxx xxxx xxxx : A-48 */
else if (((w0 & 0xff30) == 0x0730) && ((w1 & 0x0000) == 0x0000))
@@ -548,6 +548,9 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
/* JMP : 0000 0001 0010 01RR : A-110 */
else if ((w0 & 0xfffc) == 0x0124)
{
+ //JMP2->m_oco = opc;
+ //JMP2->decode(w0, w1);
+ //return JMP2;
return global_alloc(Jmp_2(opc, w0, w1));
}
/* JScc : 0000 0110 --01 cccc xxxx xxxx xxxx xxxx : A-112 */
diff --git a/src/emu/cpu/dsp56k/inst.h b/src/emu/cpu/dsp56k/inst.h
index aee86c4b47e..5d31dd8ef96 100644
--- a/src/emu/cpu/dsp56k/inst.h
+++ b/src/emu/cpu/dsp56k/inst.h
@@ -7,6 +7,7 @@
#include "tables.h"
#include "dsp56k.h"
+#include "dsp56def.h"
#include "dsp56pcu.h"
//
@@ -15,6 +16,8 @@
namespace DSP56K
{
+#define ADDRESS(X) ((X)<<1)
+
class Opcode;
class Instruction
@@ -24,8 +27,8 @@ public:
m_oco(oco),
m_sizeIncrement(0),
m_opcode(""),
- m_source(""),
- m_destination("") { }
+ m_source(iINVALID),
+ m_destination(iINVALID) { }
virtual ~Instruction() {}
virtual bool decode(const UINT16 word0, const UINT16 word1) = 0;
@@ -37,16 +40,15 @@ public:
virtual size_t accumulatorBitsModified() const = 0; // Potentially make this always return ALL (like flags)
virtual size_t flags() const { return 0; }
- static Instruction* decodeInstruction(const Opcode* opc,
- const UINT16 word0,
- const UINT16 word1,
+ static Instruction* decodeInstruction(const Opcode* opc,
+ const UINT16 word0,
+ const UINT16 word1,
bool shifted=false);
const bool valid() const { return m_valid; }
- const std::string& opcode() const { return m_opcode; }
- const std::string& source() const { return m_source; }
- const std::string& destination() const { return m_destination; }
+ const reg_id& source() const { return m_source; }
+ const reg_id& destination() const { return m_destination; }
size_t sizeIncrement() const { return m_sizeIncrement; }
@@ -57,8 +59,8 @@ protected:
// Parameters nearly everyone has
std::string m_opcode;
- std::string m_source;
- std::string m_destination;
+ reg_id m_source;
+ reg_id m_destination;
};
@@ -70,7 +72,7 @@ protected:
class Abs: public Instruction
{
public:
- Abs(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
+ Abs(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
m_valid = decode(word0, word1);
}
@@ -82,7 +84,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -99,14 +101,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_JF_table(BITSn(word0,0x0001), BITSn(word0,0x0008),
+ decode_JF_table(BITSn(word0,0x0001), BITSn(word0,0x0008),
m_source, m_destination);
m_opcode = "adc";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -123,14 +125,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08),
+ decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08),
m_source, m_destination);
m_opcode = "add";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -149,14 +151,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_uuuuF_table(BITSn(word0,0x17), BITSn(word0,0x08),
+ decode_uuuuF_table(BITSn(word0,0x17), BITSn(word0,0x08),
m_opcode, m_source, m_destination);
// TODO: m_opcode = "add";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -176,14 +178,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_JJF_table(BITSn(word0,0x03),BITSn(word0,0x08),
+ decode_JJF_table(BITSn(word0,0x03),BITSn(word0,0x08),
m_source, m_destination);
m_opcode = "and";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -203,7 +205,7 @@ public:
{
m_immediate = BITSn(word0,0x00ff);
decode_EE_table(BITSn(word0,0x0600), m_destination);
-
+
m_opcode = "andi";
// NEW // sprintf(opcode_str, "and(i)");
return true;
@@ -211,13 +213,13 @@ public:
void disassemble(std::string& retString) const
{
char temp[32];
- sprintf(temp, "#$%x,%s", m_immediate, m_destination.c_str());
+ sprintf(temp, "#$%x,%s", m_immediate, regIdAsString(m_destination).c_str());
retString = m_opcode + " " + std::string(temp);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
UINT8 m_immediate;
};
@@ -238,7 +240,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -261,7 +263,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -284,7 +286,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -307,7 +309,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -330,7 +332,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -338,69 +340,163 @@ public:
};
/* BFCHG : 0001 0100 11Pp pppp BBB1 0010 iiii iiii : A-38 */
-/* BFCHG : 0001 0100 101- --RR BBB1 0010 iiii iiii : A-38 */
-/* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */
/* BFCLR : 0001 0100 11Pp pppp BBB0 0100 iiii iiii : A-40 */
-/* BFCLR : 0001 0100 101- --RR BBB0 0100 iiii iiii : A-40 */
-/* BFCLR : 0001 0100 100D DDDD BBB0 0100 iiii iiii : A-40 */
/* BFSET : 0001 0100 11Pp pppp BBB1 1000 iiii iiii : A-42 */
-/* BFSET : 0001 0100 101- --RR BBB1 1000 iiii iiii : A-42 */
-/* BFSET : 0001 0100 100D DDDD BBB1 1000 iiii iiii : A-42 */
/* BFTSTH : 0001 0100 01Pp pppp BBB1 0000 iiii iiii : A-44 */
-/* BFTSTH : 0001 0100 001- --RR BBB1 0000 iiii iiii : A-44 */
-/* BFTSTH : 0001 0100 000D DDDD BBB1 0000 iiii iiii : A-44 */
/* BFTSTL : 0001 0100 01Pp pppp BBB0 0000 iiii iiii : A-46 */
-/* BFTSTL : 0001 0100 001- --RR BBB0 0000 iiii iiii : A-46 */
-/* BFTSTL : 0001 0100 000D DDDD BBB0 0000 iiii iiii : A-46 */
class BfInstruction: public Instruction
{
public:
BfInstruction(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ dString = "";
+ m_iVal = 0x0000;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
/* Decode the common parts */
- UINT16 iVal = 0x0000;
- iVal = BITSn(word1,0x00ff);
-
- int upperMiddleLower = -1;
- upperMiddleLower = decode_BBB_table(BITSn(word1,0xe000));
+ m_iVal = BITSn(word1,0x00ff);
+ bfShift upperMiddleLower = decode_BBB_table(BITSn(word1,0xe000));
switch(upperMiddleLower)
{
- case BBB_UPPER: iVal <<= 8; break;
- case BBB_MIDDLE: iVal <<= 4; break;
- case BBB_LOWER: iVal <<= 0; break;
-
+ case BBB_UPPER: m_iVal <<= 8; break;
+ case BBB_MIDDLE: m_iVal <<= 4; break;
+ case BBB_LOWER: m_iVal <<= 0; break;
+
case BBB_INVALID: return false; break;
}
- switch(BITSn(word0,0x00e0))
+ assemble_D_from_P_table(BITSn(word0,0x0020), BITSn(word0,0x001f), dString);
+
+ if (dString == "!!")
+ return false;
+
+ switch(BITSn(word1,0x1f00))
{
- case 0x6: case 0x7: case 0x2: case 0x3:
- assemble_D_from_P_table(BITSn(word0,0x0020), BITSn(word0,0x001f), m_destination);
- break;
- case 0x5: case 0x1:
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x0003), rNum);
- sprintf(temp, "X:(R%d)", rNum);
- m_destination = temp;
- break;
- case 0x4: case 0x0:
- decode_DDDDD_table(BITSn(word0,0x001f), m_destination);
- break;
+ case 0x12: m_opcode = "bfchg"; break;
+ case 0x04: m_opcode = "bfclr"; break;
+ case 0x18: m_opcode = "bfset"; break;
+ case 0x10: m_opcode = "bftsth"; break;
+ case 0x00: m_opcode = "bftstl"; break;
}
+ return true;
+ }
+ void disassemble(std::string& retString) const
+ {
+ char temp[32];
+ sprintf(temp, "#$%x", m_iVal);
+ // NEW // sprintf(temp, "#$%04x", iVal);
+ std::string source = temp;
- if (m_destination == "!!")
+ retString = m_opcode + " " + source + "," + dString;
+ }
+ void evaluate(dsp56k_core* cpustate) {}
+ size_t size() const { return 2; }
+ size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+private:
+ UINT16 m_iVal;
+ std::string dString;
+};
+
+/* BFCHG : 0001 0100 101- --RR BBB1 0010 iiii iiii : A-38 */
+/* BFCLR : 0001 0100 101- --RR BBB0 0100 iiii iiii : A-40 */
+/* BFSET : 0001 0100 101- --RR BBB1 1000 iiii iiii : A-42 */
+/* BFTSTH : 0001 0100 001- --RR BBB1 0000 iiii iiii : A-44 */
+/* BFTSTL : 0001 0100 001- --RR BBB0 0000 iiii iiii : A-46 */
+class BfInstruction_2: public Instruction
+{
+public:
+ BfInstruction_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
+ {
+ m_r = iINVALID;
+ m_iVal = 0x0000;
+ m_valid = decode(word0, word1);
+ }
+ bool decode(const UINT16 word0, const UINT16 word1)
+ {
+ /* Decode the common parts */
+ m_iVal = BITSn(word1,0x00ff);
+
+ bfShift upperMiddleLower = decode_BBB_table(BITSn(word1,0xe000));
+ switch(upperMiddleLower)
+ {
+ case BBB_UPPER: m_iVal <<= 8; break;
+ case BBB_MIDDLE: m_iVal <<= 4; break;
+ case BBB_LOWER: m_iVal <<= 0; break;
+
+ case BBB_INVALID: return false; break;
+ }
+
+ decode_RR_table(BITSn(word0,0x0003), m_r);
+
+ if (m_r == iINVALID)
return false;
+ switch(BITSn(word1,0x1f00))
+ {
+ case 0x12: m_opcode = "bfchg"; break;
+ case 0x04: m_opcode = "bfclr"; break;
+ case 0x18: m_opcode = "bfset"; break;
+ case 0x10: m_opcode = "bftsth"; break;
+ case 0x00: m_opcode = "bftstl"; break;
+ }
+ return true;
+ }
+ void disassemble(std::string& retString) const
+ {
char temp[32];
- sprintf(temp, "#$%x", iVal);
- // NEW // sprintf(temp, "#$%04x", iVal);
- m_source = temp;
+ sprintf(temp, "#$%x", m_iVal);
+ // NEW // sprintf(temp, "#$%04x", m_iVal);
+ std::string source = temp;
+
+ sprintf(temp, "X:(%s)", regIdAsString(m_r).c_str());
+ std::string destination = temp;
+
+ retString = m_opcode + " " + source + "," + destination;
+ }
+ void evaluate(dsp56k_core* cpustate) {}
+ size_t size() const { return 2; }
+ size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ reg_id m_r;
+ UINT16 m_iVal;
+};
+
+/* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */
+/* BFCLR : 0001 0100 100D DDDD BBB0 0100 iiii iiii : A-40 */
+/* BFSET : 0001 0100 100D DDDD BBB1 1000 iiii iiii : A-42 */
+/* BFTSTH : 0001 0100 000D DDDD BBB1 0000 iiii iiii : A-44 */
+/* BFTSTL : 0001 0100 000D DDDD BBB0 0000 iiii iiii : A-46 */
+class BfInstruction_3: public Instruction
+{
+public:
+ BfInstruction_3(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
+ {
+ m_iVal = 0x0000;
+ m_valid = decode(word0, word1);
+ }
+ bool decode(const UINT16 word0, const UINT16 word1)
+ {
+ /* Decode the common parts */
+ m_iVal = BITSn(word1,0x00ff);
+
+ bfShift upperMiddleLower = decode_BBB_table(BITSn(word1,0xe000));
+ switch(upperMiddleLower)
+ {
+ case BBB_UPPER: m_iVal <<= 8; break;
+ case BBB_MIDDLE: m_iVal <<= 4; break;
+ case BBB_LOWER: m_iVal <<= 0; break;
+
+ case BBB_INVALID: return false; break;
+ }
+
+ decode_DDDDD_table(BITSn(word0,0x001f), m_destination);
+
+ if (m_destination == iINVALID)
+ return false;
switch(BITSn(word1,0x1f00))
{
@@ -414,11 +510,19 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ char temp[32];
+ sprintf(temp, "#$%x", m_iVal);
+ // NEW // sprintf(temp, "#$%04x", m_iVal);
+ std::string source = temp;
+
+ retString = m_opcode + " " + source + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ UINT16 m_iVal;
};
// Bcc : 0000 0111 --11 cccc xxxx xxxx xxxx xxxx : A-48 ////////////////////////
@@ -433,7 +537,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_immediate = (INT16)word1;
-
+
std::string M;
decode_cccc_table(BITSn(word0,0x000f), M);
m_opcode = "b" + M;
@@ -450,7 +554,7 @@ public:
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
INT16 m_immediate;
};
@@ -499,11 +603,7 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x00c0), rNum);
- sprintf(temp, "R%d", rNum);
- m_destination = temp;
+ decode_RR_table(BITSn(word0,0x00c0), m_destination);
std::string M;
decode_cccc_table(BITSn(word0,0x000f), M);
@@ -513,7 +613,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -532,7 +632,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_immediate = (INT16)word1;
-
+
m_opcode = "bra";
return true;
}
@@ -546,7 +646,7 @@ public:
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
INT16 m_immediate;
};
@@ -577,7 +677,7 @@ public:
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
INT8 m_immediate;
};
@@ -592,18 +692,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x0003), rNum);
- sprintf(temp, "R%d", rNum);
- m_destination = temp;
-
+ decode_RR_table(BITSn(word0,0x0003), m_destination);
+
m_opcode = "bra";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -647,7 +743,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_immediate = (INT16)word1;
-
+
std::string M;
decode_cccc_table(BITSn(word0,0x000f), M);
m_opcode = "bs" + M;
@@ -667,7 +763,7 @@ public:
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
size_t flags() { return DASMFLAG_STEP_OVER; }
-
+
private:
INT16 m_immediate;
};
@@ -682,22 +778,18 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x00c0), rNum);
- sprintf(temp, "R%d", rNum);
+ decode_RR_table(BITSn(word0,0x00c0), m_destination);
std::string M;
decode_cccc_table(BITSn(word0,0x000f), M);
- m_destination = temp;
-
+
m_opcode = "bs" + M;
// NEW // sprintf(opcode_str, "bs.%s", M);
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -717,7 +809,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_immediate = (INT16)word1;
-
+
m_opcode = "bsr";
return true;
}
@@ -733,7 +825,7 @@ public:
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
size_t flags() { return DASMFLAG_STEP_OVER; }
-
+
private:
INT16 m_immediate;
};
@@ -748,18 +840,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x0003), rNum);
- sprintf(temp, "R%d", rNum);
- m_destination = temp;
-
+ decode_RR_table(BITSn(word0,0x0003), m_destination);
+
m_opcode = "bsr";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -805,7 +893,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -828,7 +916,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -846,15 +934,15 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
/* Note: This is a JJJF limited in the docs, but other opcodes sneak
- in before cmp, so the same decode function can be used. */
- decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08),
+ in before cmp, so the same decode function can be used. */
+ decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08),
m_source, m_destination);
m_opcode = "cmp";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -872,15 +960,15 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
/* Note: This is a JJJF limited in the docs, but other opcodes sneak
- in before cmp, so the same decode function can be used. */
- decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08),
+ in before cmp, so the same decode function can be used. */
+ decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08),
m_source, m_destination);
m_opcode = "cmpm";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -950,7 +1038,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -973,7 +1061,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -990,14 +1078,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_DDF_table(BITSn(word0,0x0003), BITSn(word0,0x0008),
+ decode_DDF_table(BITSn(word0,0x0003), BITSn(word0,0x0008),
m_source, m_destination);
m_opcode = "div";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -1010,34 +1098,34 @@ class Dmac: public Instruction
public:
Dmac(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQF_special_table(BITSn(word0,0x0003), BITSn(word0,0x0008),
+ decode_QQF_special_table(BITSn(word0,0x0003), BITSn(word0,0x0008),
m_source, m_source2, m_destination);
std::string a;
decode_ss_table(BITSn(word0,0x0024), a);
if (a == "!!") return false;
-
+
m_opcode = "dmac" + a;
// NEW // sprintf(opcode_str, "dmac(%s)", A);
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_source2;
+ reg_id m_source2;
};
// DO : 0000 0000 110- --RR xxxx xxxx xxxx xxxx : A-82 /////////////////////////
@@ -1053,12 +1141,8 @@ public:
{
m_immediate = word1;
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x0003), rNum);
- sprintf(temp, "X:(R%d)", rNum);
- m_source = temp;
-
+ decode_RR_table(BITSn(word0,0x0003), m_source);
+
m_opcode = "do";
return true;
}
@@ -1066,8 +1150,13 @@ public:
{
char temp[32];
sprintf(temp, "*+$%x", 2 + m_immediate);
+ std::string destination = temp;
// NEW // sprintf(temp, "X:(R%d),$%02x", Rnum, pc + 2 + word1);
- retString = m_opcode + " " + m_source + "," + std::string(temp);
+
+ sprintf(temp, "X:(%s)", regIdAsString(m_source).c_str());
+ std::string source = temp;
+
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 2; }
@@ -1091,7 +1180,7 @@ public:
{
m_immediate = BITSn(word0,0x00ff);
m_displacement = word1;
-
+
m_opcode = "do";
return true;
}
@@ -1105,7 +1194,7 @@ public:
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
UINT8 m_immediate;
UINT16 m_displacement;
@@ -1123,10 +1212,10 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_displacement = word1;
-
+
decode_DDDDD_table(BITSn(word0,0x001f), m_source);
- if (m_source == "SSH") return false; // NEW //
- if (m_source == "!!") return false; // NEW //
+ if (m_source == iSSH) return false; // NEW //
+ if (m_source == iINVALID) return false; // NEW //
m_opcode = "do";
return true;
}
@@ -1135,12 +1224,12 @@ public:
char temp[32];
sprintf(temp, "*+$%x", 2 + m_displacement);
// NEW // sprintf(temp, "%s,$%04x", S1, pc + 2 + word1);
- retString = m_opcode + " " + m_source + "," + std::string(temp);
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + std::string(temp);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
UINT16 m_displacement;
};
@@ -1171,7 +1260,7 @@ public:
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
UINT16 m_displacement;
};
@@ -1208,14 +1297,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_JJF_table(BITSn(word0,0x03),BITSn(word0,0x08),
+ decode_JJF_table(BITSn(word0,0x03),BITSn(word0,0x08),
m_source, m_destination);
m_opcode = "eor";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -1238,7 +1327,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -1273,28 +1362,28 @@ class Imac: public Instruction
public:
Imac(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
+ decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
m_source, m_source2, m_destination);
m_opcode = "imac";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_source2;
+ reg_id m_source2;
};
// IMPY : 0001 0101 1000 FQQQ : A-102 //////////////////////////////////////////
@@ -1303,28 +1392,28 @@ class Impy: public Instruction
public:
Impy(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
+ decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
m_source, m_source2, m_destination);
m_opcode = "impy";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
private:
- std::string m_source2;
+ reg_id m_source2;
};
// INC : .... .... 0010 F010 : A-104 ///////////////////////////////////////////
@@ -1343,7 +1432,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -1366,7 +1455,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -1385,7 +1474,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_displacement = word1;
-
+
std::string M;
decode_cccc_table(BITSn(word0,0x000f), M);
m_opcode = "j" + M;
@@ -1417,11 +1506,7 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x00c0), rNum);
- sprintf(temp, "R%d", rNum);
- m_destination = temp;
+ decode_RR_table(BITSn(word0,0x00c0), m_destination);
std::string M;
decode_cccc_table(BITSn(word0,0x000f), M);
@@ -1431,7 +1516,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -1450,7 +1535,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_displacement = word1;
-
+
m_opcode = "jmp";
return true;
}
@@ -1461,8 +1546,16 @@ public:
// NEW // sprintf(temp, "$%04x", word1);
retString = m_opcode + " " + std::string(temp);
}
- void evaluate(dsp56k_core* cpustate) {}
+ void evaluate(dsp56k_core* cpustate)
+ {
+ cpustate->ppc = PC;
+ PC = m_displacement;
+
+ /* S L E U N Z V C */
+ /* - - - - - - - - */
+ }
size_t size() const { return 2; }
+ size_t evalSize() const { return 0; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
private:
@@ -1479,34 +1572,30 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x0003), rNum);
- sprintf(temp, "R%d", rNum);
- m_destination = temp;
-
+ decode_RR_table(BITSn(word0,0x0003), m_destination);
+
m_opcode = "jmp";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate)
{
- // Get value from source
-
- // Set the PC
- PC = 0;
+ cpustate->ppc = PC;
+ PC = regValue16(cpustate, m_destination);
- /* S L E U N Z V C */
- /* - - - - - - - - */
+ /* S L E U N Z V C */
+ /* - - - - - - - - */
}
size_t size() const { return 1; }
size_t evalSize() const { return 0; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
};
+//static Jmp_2* JMP2 = new Jmp_2(NULL, 0x0000, 0x0000);
+
// JScc : 0000 0110 --01 cccc xxxx xxxx xxxx xxxx : A-112 //////////////////////
class Jscc: public Instruction
{
@@ -1519,7 +1608,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_displacement = word1;
-
+
std::string M;
decode_cccc_table(BITSn(word0,0x000f), M);
m_opcode = "js" + M;
@@ -1552,11 +1641,7 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x00c0), rNum);
- sprintf(temp, "R%d", rNum);
- m_destination = temp;
+ decode_RR_table(BITSn(word0,0x00c0), m_destination);
std::string M;
decode_cccc_table(BITSn(word0,0x000f), M);
@@ -1566,7 +1651,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -1586,7 +1671,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_displacement = word1;
-
+
m_opcode = "jsr";
return true;
}
@@ -1618,7 +1703,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_bAddr = BITSn(word0,0x00ff);
-
+
m_opcode = "jsr";
return true;
}
@@ -1633,7 +1718,7 @@ public:
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
size_t flags() { return DASMFLAG_STEP_OVER; }
-
+
private:
UINT8 m_bAddr;
};
@@ -1648,18 +1733,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x0003), rNum);
- sprintf(temp, "R%d", rNum);
- m_destination = temp;
+ decode_RR_table(BITSn(word0,0x0003), m_destination);
m_opcode = "jsr";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -1673,35 +1754,32 @@ class Lea: public Instruction
public:
Lea(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_ea = "";
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
if ((word0 & 0x000c) == 0) return false; // NEW TODO //
- char temp[32];
-
- INT8 tNum;
- decode_TT_table(BITSn(word0,0x0030), tNum);
- sprintf(temp, "R%d", tNum);
- m_destination = temp;
-
- INT8 rNum;
- std::string ea;
- decode_RR_table(BITSn(word0,0x0003), rNum);
- assemble_ea_from_MM_table(BITSn(word0,0x000c), rNum, ea);
- m_source = ea;
+ decode_TT_table(BITSn(word0,0x0030), m_destination);
+ INT8 rNum = BITSn(word0,0x0003);
+ assemble_ea_from_MM_table(BITSn(word0,0x000c), rNum, m_ea);
+
m_opcode = "lea";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ // HACK
+ retString = m_opcode + " " + m_ea + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ std::string m_ea;
};
// LEA : 0000 0001 10NN MMRR : A-116 ///////////////////////////////////////////
@@ -1716,30 +1794,25 @@ public:
{
if ((word0 & 0x000c) == 0) return false; // NEW TODO //
- char temp[32];
-
- INT8 nNum;
- decode_NN_table(BITSn(word0,0x0030), nNum);
- sprintf(temp, "N%d", nNum);
- m_destination = temp;
-
- INT8 rNum;
- decode_RR_table(BITSn(word0,0x0003), rNum);
+ decode_NN_table(BITSn(word0,0x0030), m_destination);
- std::string ea;
- assemble_ea_from_MM_table(BITSn(word0,0x000c), rNum, ea);
- m_source = ea;
+ INT8 rNum = BITSn(word0,0x0003);
+ assemble_ea_from_MM_table(BITSn(word0,0x000c), rNum, m_ea);
m_opcode = "lea";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ // HACK
+ retString = m_opcode + " " + m_ea + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ std::string m_ea;
};
// LSL : .... .... 0011 F011 : A-118 ///////////////////////////////////////////
@@ -1758,7 +1831,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -1781,7 +1854,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -1794,34 +1867,36 @@ class Mac: public Instruction
public:
Mac(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_sign = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQQF_table(BITSn(word0,0x07), BITSn(word0,0x08),
+ decode_QQQF_table(BITSn(word0,0x07), BITSn(word0,0x08),
m_source, m_source2, m_destination);
- std::string sign;
- decode_kSign_table(BITSn(word0,0x40), sign);
- if (sign == "-")
- m_source = sign + m_source; // TODO: Probably silly for Instruction
+ decode_kSign_table(BITSn(word0,0x40), m_sign);
m_opcode = "mac";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ std::string ts = m_sign;
+ if (ts != "-") ts = "";
+ retString = m_opcode + " " +
+ ts +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
private:
- std::string m_source2;
+ reg_id m_source2;
+ std::string m_sign;
};
// MAC : 011m mKKK 1xx0 F1QQ : A-122 ///////////////////////////////////////////
@@ -1830,12 +1905,12 @@ class Mac_2: public Instruction
public:
Mac_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08),
+ decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08),
m_source, m_source2, m_destination);
m_opcode = "mac";
@@ -1843,16 +1918,16 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
private:
- std::string m_source2;
+ reg_id m_source2;
};
// MAC : 0001 0111 RRDD FQQQ : A-122 ///////////////////////////////////////////
@@ -1861,28 +1936,28 @@ class Mac_3: public Instruction
public:
Mac_3(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
+ decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
m_source, m_source2, m_destination);
m_opcode = "mac";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
private:
- std::string m_source2;
+ reg_id m_source2;
};
// MACR : .... .... 1k11 FQQQ : A-124 //////////////////////////////////////////
@@ -1891,34 +1966,36 @@ class Macr: public Instruction
public:
Macr(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_sign = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQQF_table(BITSn(word0,0x07), BITSn(word0,0x08),
+ decode_QQQF_table(BITSn(word0,0x07), BITSn(word0,0x08),
m_source, m_source2, m_destination);
- std::string sign;
- decode_kSign_table(BITSn(word0,0x40), sign);
- if (sign == "-")
- m_source = sign + m_source; // TODO: Probably silly for Instruction
+ decode_kSign_table(BITSn(word0,0x40), m_sign);
m_opcode = "macr";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ std::string ts = m_sign;
+ if (ts != "-") ts = "";
+ retString = m_opcode + " " +
+ ts +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
private:
- std::string m_source2;
+ std::string m_sign;
+ reg_id m_source2;
};
// MACR : 011m mKKK 1--1 F1QQ : A-124 //////////////////////////////////////////
@@ -1927,28 +2004,28 @@ class Macr_2: public Instruction
public:
Macr_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08),
+ decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08),
m_source, m_source2, m_destination);
m_opcode = "macr";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
private:
- std::string m_source2;
+ reg_id m_source2;
};
// MAC(su,uu) : 0001 0101 1110 FsQQ : A-126 ////////////////////////////////////
@@ -1957,13 +2034,13 @@ class Macsuuu: public Instruction
public:
Macsuuu(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
// Special QQF
- decode_QQF_special_table(BITSn(word0,0x0003), BITSn(word0,0x0008),
+ decode_QQF_special_table(BITSn(word0,0x0003), BITSn(word0,0x0008),
m_source, m_source2, m_destination);
std::string a;
@@ -1974,16 +2051,16 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
private:
- std::string m_source2;
+ reg_id m_source2;
};
// MOVE : .... .... 0001 0001 : A-128 //////////////////////////////////////////
@@ -2002,9 +2079,9 @@ public:
// This insures the debugger matches the reference disassembler
// for the undocumented .... .... 0001 1001 Instruction.
if(BITSn(word0, 0x000f) == 0x0001)
- m_destination = "A";
+ m_destination = iA;
else
- m_destination = "B";
+ m_destination = iB;
// Hack to match reference disassembler
UINT8 BITSn = (word0 & 0xff00) >> 8;
@@ -2042,9 +2119,9 @@ public:
// Amounts to a nop with two parallel moves.
// This insures the debugger matches the reference disassembler
if((word0 & 0x0008) == 0x0008)
- m_destination = "B";
+ m_destination = iB;
else
- m_destination = "A";
+ m_destination = iA;
m_opcode = "move";
return true;
@@ -2064,31 +2141,35 @@ class Move_3: public Instruction
public:
Move_3(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_W = 0;
m_b = 0;
+ m_SD = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
m_b = BITSn(word0,0x00ff);
-
- std::string SD;
- decode_HHH_table(BITSn(word1,0x0e00), SD);
- assemble_reg_from_W_table(BITSn(word1,0x0100), 'X', SD, m_b,
- m_source, m_destination);
+ m_W = BITSn(word1,0x0100);
+ decode_HHH_table(BITSn(word1,0x0e00), m_SD);
m_opcode = "move";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ assemble_reg_from_W_table(m_W, 'X', m_SD, m_b, source, destination);
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
INT8 m_b;
+ UINT8 m_W;
+ reg_id m_SD;
};
// MOVE(C) : 0011 1WDD DDD0 MMRR : A-144 ///////////////////////////////////////
@@ -2097,21 +2178,19 @@ class Movec: public Instruction
public:
Movec(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_W = 0;
+ m_ea = "";
+ m_SD = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- std::string ea;
- decode_RR_table(BITSn(word0,0x0003), rNum);
- assemble_ea_from_MM_table(BITSn(word0,0x000c), rNum, ea);
-
- std::string SD;
- decode_DDDDD_table(BITSn(word0,0x03e0), SD);
- assemble_arguments_from_W_table(BITSn(word0,0x0400), 'X', SD, ea,
- m_source, m_destination);
+ INT8 rNum = BITSn(word0,0x0003);
+ assemble_ea_from_MM_table(BITSn(word0,0x000c), rNum, m_ea);
- if (SD == "!!") return false;
+ m_W = BITSn(word0,0x0400);
+ decode_DDDDD_table(BITSn(word0,0x03e0), m_SD);
+ if (m_SD == iINVALID) return false;
m_opcode = "move";
// NEW // sprintf(opcode_str, "move(c)");
@@ -2119,11 +2198,19 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination);
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ INT8 m_W;
+ reg_id m_SD;
+ std::string m_ea;
};
// MOVE(C) : 0011 1WDD DDD1 q0RR : A-144 ///////////////////////////////////////
@@ -2132,21 +2219,19 @@ class Movec_2: public Instruction
public:
Movec_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_W = 0;
+ m_ea = "";
+ m_SD = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- std::string ea;
- decode_RR_table(BITSn(word0,0x0003), rNum);
- assemble_ea_from_q_table(BITSn(word0,0x0008), rNum, ea);
-
- std::string SD;
- decode_DDDDD_table(BITSn(word0,0x03e0), SD);
- assemble_arguments_from_W_table(BITSn(word0,0x0400), 'X', SD, ea,
- m_source, m_destination);
+ INT8 rNum = BITSn(word0,0x0003);
+ assemble_ea_from_q_table(BITSn(word0,0x0008), rNum, m_ea);
- if (SD == "!!") return false;
+ decode_DDDDD_table(BITSn(word0,0x03e0), m_SD);
+ m_W = BITSn(word0,0x0400);
+ if (m_SD == iINVALID) return false;
m_opcode = "move";
// NEW // sprintf(opcode_str, "move(c)");
@@ -2154,11 +2239,19 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination);
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ INT8 m_W;
+ reg_id m_SD;
+ std::string m_ea;
};
// MOVE(C) : 0011 1WDD DDD1 Z11- : A-144 ///////////////////////////////////////
@@ -2167,19 +2260,18 @@ class Movec_3: public Instruction
public:
Movec_3(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_W = 0;
+ m_ea = "";
+ m_SD = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- std::string ea;
- decode_Z_table(BITSn(word0,0x0008), ea);
-
- std::string SD;
- decode_DDDDD_table(BITSn(word0,0x03e0), SD);
- assemble_arguments_from_W_table(BITSn(word0,0x0400), 'X', SD, ea,
- m_source, m_destination);
+ decode_Z_table(BITSn(word0,0x0008), m_ea);
- if (SD == "!!") return false;
+ decode_DDDDD_table(BITSn(word0,0x03e0), m_SD);
+ m_W = BITSn(word0,0x0400);
+ if (m_SD == iINVALID) return false;
m_opcode = "move";
// NEW // sprintf(opcode_str, "move(c)");
@@ -2187,11 +2279,19 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination);
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ INT8 m_W;
+ reg_id m_SD;
+ std::string m_ea;
};
// MOVE(C) : 0011 1WDD DDD1 t10- xxxx xxxx xxxx xxxx : A-144 ///////////////////
@@ -2200,43 +2300,78 @@ class Movec_4: public Instruction
public:
Movec_4(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_args = "";
+ m_t = 0;
+ m_W = 0;
+ m_sd = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- char temp[128];
- std::string SD;
- decode_DDDDD_table(BITSn(word0,0x03e0), SD);
- if (SD == "!!") return false;
+ m_value = word1;
+ m_t = BITSn(word0,0x0008);
+ m_W = BITSn(word0,0x0400);
- std::string ea;
- assemble_ea_from_t_table(BITSn(word0,0x0008), word1, ea);
+ decode_DDDDD_table(BITSn(word0,0x03e0), m_sd);
+ if (m_sd == iINVALID) return false;
// TODO: Figure out what this means, exactly.
if ((word0 & 0x000c) == 0x000c && (word0 & 0x0400) == 0x0000)
return false;
- if (BITSn(word0,0x0400))
- sprintf(temp, "%s,%s", ea.c_str(), SD.c_str());
- else
- sprintf(temp, "%s,%s", SD.c_str(), ea.c_str());
- m_args = temp; // TODO
-
m_opcode = "move";
// NEW // sprintf(opcode_str, "move(c)");
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_args; // TODO
+ std::string ea;
+ assemble_ea_from_t_table(m_t, m_value, ea);
+
+ retString = m_opcode + " ";
+ if (m_W) retString += ea + "," + regIdAsString(m_sd);
+ else retString += regIdAsString(m_sd) + "," + ea;
}
- void evaluate(dsp56k_core* cpustate) {}
+ void evaluate(dsp56k_core* cpustate)
+ {
+ if (m_W)
+ {
+ if (m_t)
+ {
+ setReg16(cpustate, m_value, m_sd);
+ }
+ else
+ {
+ //UINT16 memValue = memory_read_word_16le(cpustate->data, ADDRESS(m_value));
+ //setReg16(cpustate, memValue, m_sd);
+ }
+ }
+ else
+ {
+ if (m_t)
+ {
+ logerror("DSP561xx|Movec_4: This sure seems like it can't happen.");
+ }
+ else
+ {
+ //UINT16 regValue = regValue16(cpustate, m_sd);
+ //memory_write_word_16le(cpustate->data, m_value, regValue);
+ }
+ }
+
+ /* S L E U N Z V C */
+ /* * ? ? ? ? ? ? ? */
+ // All ? bits - If SR is specified as a destination operand, set according to the corresponding
+ // bit of the source operand. If SR is not specified as a destination operand, L is set if data
+ // limiting occurred. All ? bits are not affected otherwise.
+ }
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_args;
+ UINT8 m_t;
+ UINT8 m_W;
+ UINT16 m_value;
+ reg_id m_sd;
};
// MOVE(C) : 0010 10dd dddD DDDD : A-144 ///////////////////////////////////////
@@ -2252,8 +2387,8 @@ public:
decode_DDDDD_table(BITSn(word0,0x03e0), m_source);
decode_DDDDD_table(BITSn(word0,0x001f), m_destination);
- if (m_source == "!!" || m_destination == "!!") return false;
- if (m_source == "SSH" && m_destination == "SSH") return false;
+ if (m_source == iINVALID || m_destination == iINVALID) return false;
+ if (m_source == iSSH && m_destination == iSSH) return false;
m_opcode = "move";
// NEW // sprintf(opcode_str, "move(c)");
@@ -2261,7 +2396,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -2274,17 +2409,16 @@ class Movec_6: public Instruction
public:
Movec_6(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_W = 0;
m_b = 0;
+ m_SD = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
m_b = BITSn(word0,0x00ff);
-
- std::string SD;
- decode_DDDDD_table(BITSn(word1,0x03e0), SD);
- assemble_reg_from_W_table(BITSn(word1,0x0400), 'X', SD, m_b,
- m_source, m_destination);
+ m_W = BITSn(word1,0x0400);
+ decode_DDDDD_table(BITSn(word1,0x03e0), m_SD);
m_opcode = "move";
// NEW // m_opcode = "move(c)";
@@ -2292,14 +2426,19 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ assemble_reg_from_W_table(m_W, 'X', m_SD, m_b, source, destination);
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
INT8 m_b;
+ UINT8 m_W;
+ reg_id m_SD;
};
// MOVE(I) : 0010 00DD BBBB BBBB : A-150 ///////////////////////////////////////
@@ -2328,13 +2467,13 @@ public:
else sprintf(temp, "#<-$%x", 1 - m_immediate - 1);
// NEW // sprintf(temp, "#$%02x,%s", BITSn(word0,0x00ff), D1);
- retString = m_opcode + " " +
- std::string(temp) + "," + m_destination;
+ retString = m_opcode + " " +
+ std::string(temp) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
INT8 m_immediate;
};
@@ -2345,19 +2484,18 @@ class Movem: public Instruction
public:
Movem(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_W = 0;
+ m_ea = "";
+ m_SD = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- decode_RR_table(BITSn(word0,0x00c0), rNum);
+ INT8 rNum = BITSn(word0,0x00c0);
- std::string SD;
- std::string ea;
- decode_HHH_table(BITSn(word0,0x0007), SD);
- assemble_ea_from_MM_table(BITSn(word0,0x0018), rNum, ea);
- assemble_arguments_from_W_table(BITSn(word0,0x0100), 'P', SD, ea,
- m_source, m_destination);
+ decode_HHH_table(BITSn(word0,0x0007), m_SD);
+ assemble_ea_from_MM_table(BITSn(word0,0x0018), rNum, m_ea);
+ m_W = BITSn(word0,0x0100);
m_opcode = "move";
// NEW // sprintf(opcode_str, "move(m)");
@@ -2365,11 +2503,19 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ assemble_arguments_from_W_table(m_W, 'P', m_SD, m_ea, source, destination);
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ INT8 m_W;
+ reg_id m_SD;
+ std::string m_ea;
};
// MOVE(M) : 0000 001W RR11 mmRR : A-152 ///////////////////////////////////////
@@ -2378,23 +2524,15 @@ class Movem_2: public Instruction
public:
Movem_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_W = 0;
+ m_ea = "";
+ m_ea2 = "";
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- std::string ea;
- std::string ea2;
- assemble_eas_from_mm_table(BITSn(word0,0x000c), BITSn(word0,0x00c0), BITSn(word0,0x0003), ea, ea2);
- if (BITSn(word0,0x0100))
- {
- m_source = "X:" + ea;
- m_destination = "P:" + ea2;
- }
- else
- {
- m_source = "P:" + ea;
- m_destination = "X:" + ea2;
- }
+ m_W = BITSn(word0,0x0100);
+ assemble_eas_from_mm_table(BITSn(word0,0x000c), BITSn(word0,0x00c0), BITSn(word0,0x0003), m_ea, m_ea2);
m_opcode = "move";
// NEW // sprintf(opcode_str, "move(m)*");
@@ -2402,11 +2540,28 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ if (m_W)
+ {
+ source = "X:" + m_ea;
+ destination = "P:" + m_ea2;
+ }
+ else
+ {
+ source = "P:" + m_ea;
+ destination = "X:" + m_ea2;
+ }
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ UINT8 m_W;
+ std::string m_ea;
+ std::string m_ea2;
};
// MOVE(M) : 0000 0101 BBBB BBBB 0000 001W --0- -HHH : A-152 ///////////////////
@@ -2415,17 +2570,15 @@ class Movem_3: public Instruction
public:
Movem_3(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_b = 0;
+ m_SD = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 b;
- b = BITSn(word0,0x00ff);
-
- std::string SD;
- decode_HHH_table(BITSn(word1,0x0007), SD);
- assemble_reg_from_W_table(BITSn(word1,0x0100), 'P', SD, b,
- m_source, m_destination);
+ m_b = BITSn(word0,0x00ff);
+ m_W = BITSn(word1,0x0100);
+ decode_HHH_table(BITSn(word1,0x0007), m_SD);
m_opcode = "move";
// NEW // m_opcode = "move(m)";
@@ -2433,11 +2586,19 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ assemble_reg_from_W_table(m_W, 'P', m_SD, m_b, source, destination);
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 2; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ INT8 m_b;
+ UINT8 m_W;
+ reg_id m_SD;
};
// MOVE(P) : 0001 100W HH1p pppp : A-156 ///////////////////////////////////////
@@ -2446,19 +2607,19 @@ class Movep: public Instruction
public:
Movep(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_W = 0;
+ m_ea = "";
+ m_SD = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- std::string SD;
- decode_HH_table(BITSn(word0,0x00c0), SD);
+ decode_HH_table(BITSn(word0,0x00c0), m_SD);
- std::string fullAddy;
- assemble_address_from_IO_short_address(BITSn(word0,0x001f), fullAddy);
- fullAddy = "<<$" + fullAddy;
+ assemble_address_from_IO_short_address(BITSn(word0,0x001f), m_ea);
+ m_ea = "<<$" + m_ea;
- assemble_arguments_from_W_table(BITSn(word0,0x0100), 'X', SD, fullAddy,
- m_source, m_destination);
+ m_W = BITSn(word0,0x0100);
m_opcode = "movep";
// NEW // sprintf(opcode_str, "move(p)");
@@ -2466,11 +2627,19 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination);
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ INT8 m_W;
+ reg_id m_SD;
+ std::string m_ea;
};
// MOVE(P) : 0000 110W RRmp pppp : A-156 ///////////////////////////////////////
@@ -2479,37 +2648,43 @@ class Movep_2: public Instruction
public:
Movep_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_W = 0;
+ m_ea = "";
+ m_SD = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- decode_RR_table(BITSn(word0,0x00c0), rNum);
+ INT8 rNum = BITSn(word0,0x00c0);
- std::string ea;
- assemble_ea_from_m_table(BITSn(word0,0x0020), rNum, ea);
+ assemble_ea_from_m_table(BITSn(word0,0x0020), rNum, m_ea);
std::string fullAddy; /* Convert Short Absolute Address to full 16-bit */
assemble_address_from_IO_short_address(BITSn(word0,0x001f), fullAddy);
- std::string SD;
- SD = "X:<<$" + fullAddy;
+ m_W = BITSn(word0,0x0100);
+ m_SD = "X:<<$" + fullAddy;
// NEW // sprintf(SD, "X:$%s", fullAddy);
- assemble_arguments_from_W_table(BITSn(word0,0x0100), 'X', SD, ea,
- m_source, m_destination);
-
m_opcode = "movep";
// NEW // sprintf(opcode_str, "move(p)*");
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination);
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ INT8 m_W;
+ std::string m_SD;
+ std::string m_ea;
};
// MOVE(S) : 0001 100W HH0a aaaa : A-158 ///////////////////////////////////////
@@ -2518,32 +2693,40 @@ class Moves: public Instruction
public:
Moves(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
+ m_W = 0;
+ m_ea = "";
+ m_SD = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- std::string SD;
- decode_HH_table(BITSn(word0,0x00c0), SD);
+ decode_HH_table(BITSn(word0,0x00c0), m_SD);
char temp[32];
- std::string a;
sprintf(temp, "<$%x", BITSn(word0,0x001f));
- a = temp;
-
- assemble_arguments_from_W_table(BITSn(word0,0x0100), 'X', SD, a,
- m_source, m_destination);
+ m_ea = temp;
+ m_W = BITSn(word0,0x0100);
+
m_opcode = "moves";
// NEW // sprintf(opcode_str, "move(s)");
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ std::string source;
+ std::string destination;
+ assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination);
+ retString = m_opcode + " " + source + "," + destination;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
+
+private:
+ INT8 m_W;
+ reg_id m_SD;
+ std::string m_ea;
};
// MPY : .... .... 1k00 FQQQ : A-160 ///////////////////////////////////////////
@@ -2552,36 +2735,38 @@ class Mpy: public Instruction
public:
Mpy(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_sign = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
/* There are inconsistencies with the S1 & S2 operand ordering in the docs,
- but since it's a multiply it doesn't matter */
- decode_QQQF_table(BITSn(word0,0x07), BITSn(word0,0x08),
+ but since it's a multiply it doesn't matter */
+ decode_QQQF_table(BITSn(word0,0x07), BITSn(word0,0x08),
m_source, m_source2, m_destination);
- std::string sign;
- decode_kSign_table(BITSn(word0,0x40), sign);
- if (sign == "-")
- m_source = sign + m_source; // TODO: Probably silly for Instruction
+ decode_kSign_table(BITSn(word0,0x40), m_sign);
m_opcode = "mpy";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ std::string ts = m_sign;
+ if (ts != "-") ts = "";
+ retString = m_opcode + " " +
+ ts +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_source2;
+ std::string m_sign;
+ reg_id m_source2;
};
// MPY : 011m mKKK 1xx0 F0QQ : A-160 ///////////////////////////////////////////
@@ -2590,12 +2775,12 @@ class Mpy_2: public Instruction
public:
Mpy_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08),
+ decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08),
m_source, m_source2, m_destination);
m_opcode = "mpy";
@@ -2603,16 +2788,16 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_source2;
+ reg_id m_source2;
};
// MPY : 0001 0110 RRDD FQQQ : A-160 ///////////////////////////////////////////
@@ -2621,29 +2806,29 @@ class Mpy_3: public Instruction
public:
Mpy_3(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
+ decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
m_source, m_source2, m_destination);
-
+
m_opcode = "mpy";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_source2;
+ reg_id m_source2;
};
// MPYR : .... .... 1k01 FQQQ : A-162 //////////////////////////////////////////
@@ -2652,36 +2837,38 @@ class Mpyr: public Instruction
public:
Mpyr(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_sign = "-";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
/* There are inconsistencies with the S1 & S2 operand ordering in the docs,
- but since it's a multiply it doesn't matter */
- decode_QQQF_table(BITSn(word0,0x07), BITSn(word0,0x08),
+ but since it's a multiply it doesn't matter */
+ decode_QQQF_table(BITSn(word0,0x07), BITSn(word0,0x08),
m_source, m_source2, m_destination);
- std::string sign;
- decode_kSign_table(BITSn(word0,0x40), sign);
- if (sign == "-")
- m_source = sign + m_source; // TODO: Probably silly for Instruction
+ decode_kSign_table(BITSn(word0,0x40), m_sign);
m_opcode = "mpyr";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ std::string ts = m_sign;
+ if (ts != "-") ts = "";
+ retString = m_opcode + " " +
+ ts +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_source2;
+ std::string m_sign;
+ reg_id m_source2;
};
// MPYR : 011m mKKK 1--1 F0QQ : A-162 //////////////////////////////////////////
@@ -2690,12 +2877,12 @@ class Mpyr_2: public Instruction
public:
Mpyr_2(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08),
+ decode_QQF_table(BITSn(word0,0x03), BITSn(word0,0x08),
m_source, m_source2, m_destination);
m_opcode = "mpyr";
@@ -2703,16 +2890,16 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_source2;
+ reg_id m_source2;
};
// MPY(su,uu) : 0001 0101 1100 FsQQ : A-164 ////////////////////////////////////
@@ -2721,12 +2908,12 @@ class Mpysuuu: public Instruction
public:
Mpysuuu(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQF_special_table(BITSn(word0,0x0003), BITSn(word0,0x0008),
+ decode_QQF_special_table(BITSn(word0,0x0003), BITSn(word0,0x0008),
m_source, m_source2, m_destination);
std::string a;
@@ -2737,16 +2924,16 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_source2;
+ reg_id m_source2;
};
// NEG : .... .... 0110 F000 : A-166 ///////////////////////////////////////////
@@ -2766,7 +2953,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -2789,7 +2976,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -2830,18 +3017,14 @@ public:
{
decode_F_table(BITSn(word0,0x0008), m_destination);
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x0003), rNum);
- sprintf(temp, "R%d", rNum);
- m_source = temp;
+ decode_RR_table(BITSn(word0,0x0003), m_source);
m_opcode = "norm";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -2865,7 +3048,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -2882,14 +3065,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_JJF_table(BITSn(word0,0x03),BITSn(word0,0x08),
+ decode_JJF_table(BITSn(word0,0x03),BITSn(word0,0x08),
m_source, m_destination);
m_opcode = "or";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -2908,7 +3091,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
m_immediate = BITSn(word0,0x00ff);
-
+
decode_EE_table(BITSn(word0,0x0600), m_destination);
m_opcode = "ori";
// NEW // sprintf(opcode_str, "or(i)");
@@ -2919,12 +3102,12 @@ public:
char temp[32];
sprintf(temp, "#$%x", m_immediate);
// NEW // sprintf(temp, "#$%02x", BITSn(word0,0x00ff));
- retString = m_opcode + " " + std::string(temp) + "," + m_destination;
+ retString = m_opcode + " " + std::string(temp) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
UINT8 m_immediate;
};
@@ -2939,11 +3122,7 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x0003), rNum);
- sprintf(temp, "R%d", rNum);
- m_source = temp;
+ decode_RR_table(BITSn(word0,0x0003), m_source);
m_opcode = "rep";
return true;
@@ -2951,7 +3130,7 @@ public:
void disassemble(std::string& retString) const
{
char temp[32];
- sprintf(temp, "X:(%s)", m_source.c_str());
+ sprintf(temp, "X:(%s)", regIdAsString(m_source).c_str());
retString = m_opcode + " " + std::string(temp);
}
void evaluate(dsp56k_core* cpustate) {}
@@ -3000,14 +3179,14 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
decode_DDDDD_table(BITSn(word0,0x001f), m_source);
- if (m_source == "!!") return false;
-
+ if (m_source == iINVALID) return false;
+
m_opcode = "rep";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source;
+ retString = m_opcode + " " + regIdAsString(m_source);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3078,7 +3257,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3102,7 +3281,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3126,7 +3305,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3189,7 +3368,7 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_JF_table(BITSn(word0,0x01), BITSn(word0,0x08),
+ decode_JF_table(BITSn(word0,0x01), BITSn(word0,0x08),
m_source, m_destination);
m_opcode = "sbc";
@@ -3197,7 +3376,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3236,14 +3415,14 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08),
+ decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08),
m_source, m_destination);
m_opcode = "sub";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3260,7 +3439,7 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_uuuuF_table(BITSn(word0,0x17), BITSn(word0,0x08),
+ decode_uuuuF_table(BITSn(word0,0x17), BITSn(word0,0x08),
m_opcode, m_source, m_destination);
// TODO // m_opcode = "sub";
@@ -3268,7 +3447,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3288,13 +3467,13 @@ public:
/* There is only one option for the F table. This is a very strange opcode. */
if (!BITSn(word0,0x0008))
{
- m_source = "B";
- m_destination = "A";
+ m_source = iB;
+ m_destination = iA;
}
else
{
- m_source = "A";
- m_destination = "B";
+ m_source = iA;
+ m_destination = iB;
}
m_opcode = "subl";
@@ -3302,7 +3481,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3326,7 +3505,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3361,19 +3540,15 @@ class Tcc: public Instruction
public:
Tcc(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_destination2 = "";
+ m_destination2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_h0hF_table(BITSn(word0,0x0007),BITSn(word0,0x0008),
+ decode_h0hF_table(BITSn(word0,0x0007),BITSn(word0,0x0008),
m_source, m_destination);
-
- INT8 rNum;
- char temp[32];
- decode_RR_table(BITSn(word0,0x0030), rNum);
- sprintf(temp, "R%d", rNum);
- m_destination2 = temp;
+
+ decode_RR_table(BITSn(word0,0x0030), m_destination2);
std::string M;
decode_cccc_table(BITSn(word0,0x03c0), M);
@@ -3381,26 +3556,26 @@ public:
// NEW // sprintf(opcode_str, "t.%s", M);
if (m_source != m_destination)
return true;
- if (m_destination2 != "R0")
+ if (m_destination2 != iR0)
return true;
-
+
return false;
}
void disassemble(std::string& retString) const
{
retString = m_opcode;
if (m_source != m_destination)
- retString += std::string(" ") + m_source + "," + m_destination;
-
- if (m_destination2 != "R0")
- retString += std::string(" R0,") + m_destination2;
+ retString += std::string(" ") + regIdAsString(m_source) + "," + regIdAsString(m_destination);
+
+ if (m_destination2 != iR0)
+ retString += std::string(" R0,") + regIdAsString(m_destination2);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_destination2;
+ reg_id m_destination2;
};
// TFR : .... .... 0001 FJJJ : A-212 ///////////////////////////////////////////
@@ -3413,7 +3588,7 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08),
+ decode_JJJF_table(BITSn(word0,0x07), BITSn(word0,0x08),
m_source, m_destination);
m_opcode = "tfr";
@@ -3421,7 +3596,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3438,7 +3613,7 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_DDF_table(BITSn(word0,0x03), BITSn(word0,0x08),
+ decode_DDF_table(BITSn(word0,0x03), BITSn(word0,0x08),
m_source, m_destination);
m_opcode = "tfr";
@@ -3446,7 +3621,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3463,7 +3638,7 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_JF_table(BITSn(word0,0x0001),BITSn(word0,0x0008),
+ decode_JF_table(BITSn(word0,0x0001),BITSn(word0,0x0008),
m_destination, m_source);
m_opcode = "tfr2";
@@ -3471,7 +3646,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source + "," + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3484,46 +3659,49 @@ class Tfr3: public Instruction
public:
Tfr3(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
- m_destination2 = "";
+ m_W = 0;
+ m_ea = "";
+ m_SD = iINVALID;
+ m_source2 = iINVALID;
+ m_destination2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_DDF_table(BITSn(word0,0x0030), BITSn(word0,0x0008),
+ decode_DDF_table(BITSn(word0,0x0030), BITSn(word0,0x0008),
m_destination, m_source);
-
- std::string SD;
- decode_HHH_table(BITSn(word0,0x0007), SD);
+
+ decode_HHH_table(BITSn(word0,0x0007), m_SD);
// If the destination of the second move is the same as the first, you're invalid
- if (SD == m_destination && BITSn(word0,0x100)) return false;
-
- INT8 rNum;
- decode_RR_table(BITSn(word0,0x00c0), rNum);
+ if (m_SD == m_destination && BITSn(word0,0x0100)) return false;
- std::string ea;
- assemble_ea_from_m_table(BITSn(word0,0x0200), rNum, ea);
+ INT8 rNum = BITSn(word0,0x00c0);
+ assemble_ea_from_m_table(BITSn(word0,0x0200), rNum, m_ea);
- assemble_arguments_from_W_table(BITSn(word0,0x0100), 'X', SD, ea,
- m_source2, m_destination2);
+ m_W = BITSn(word0,0x0100);
m_opcode = "tfr3";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_destination + " " +
- m_source2 + "," + m_destination2;
+ std::string source2;
+ std::string destination2;
+ assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source2, destination2);
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," + regIdAsString(m_destination) + " " +
+ source2 + "," + destination2;
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
-
+
private:
- std::string m_source2;
- std::string m_destination2;
+ INT8 m_W;
+ reg_id m_SD;
+ std::string m_ea;
+ reg_id m_source2;
+ reg_id m_destination2;
};
// TST : .... .... 0010 F001 : A-218 ///////////////////////////////////////////
@@ -3543,7 +3721,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3567,7 +3745,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_source;
+ retString = m_opcode + " " + regIdAsString(m_source);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3613,7 +3791,7 @@ public:
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " + m_destination;
+ retString = m_opcode + " " + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
@@ -3626,44 +3804,44 @@ class Shfl: public Instruction
public:
Shfl(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
+ decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
m_source, m_source2, m_destination);
-
+
// This hackery amounts to a very strange QQQF table...
- if (m_source == "X0" && m_source2 == "X0") return false;
- if (m_source == "X1" && m_source2 == "X0") return false;
-
- if (m_source == "Y0" && m_source2 == "X1")
+ if (m_source == iX0 && m_source2 == iX0) return false;
+ if (m_source == iX1 && m_source2 == iX0) return false;
+
+ if (m_source == iY0 && m_source2 == iX1)
{
- m_source = "X1";
- m_source2 = "Y0";
+ m_source = iX1;
+ m_source2 = iY0;
}
- if (m_source == "Y1" && m_source2 == "X1")
+ if (m_source == iY1 && m_source2 == iX1)
{
- m_source = "X1";
- m_source2 = "Y1";
+ m_source = iX1;
+ m_source2 = iY1;
}
-
+
m_opcode = "shfl";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
private:
- std::string m_source2;
+ reg_id m_source2;
};
// SHFR : 0001 0101 1111 FQQQ : !!UNDOCUMENTED!! ///////////////////////////////
@@ -3672,44 +3850,44 @@ class Shfr: public Instruction
public:
Shfr(const Opcode* oco, const UINT16 word0, const UINT16 word1) : Instruction(oco)
{
- m_source2 = "";
+ m_source2 = iINVALID;
m_valid = decode(word0, word1);
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
+ decode_QQQF_table(BITSn(word0,0x0007), BITSn(word0,0x0008),
m_source, m_source2, m_destination);
-
+
// This hackery amounts to a very strange QQQF table...
- if (m_source == "X0" && m_source2 == "X0") return false;
- if (m_source == "X1" && m_source2 == "X0") return false;
-
- if (m_source == "Y0" && m_source2 == "X1")
+ if (m_source == iX0 && m_source2 == iX0) return false;
+ if (m_source == iX1 && m_source2 == iX0) return false;
+
+ if (m_source == iY0 && m_source2 == iX1)
{
- m_source = "X1";
- m_source2 = "Y0";
+ m_source = iX1;
+ m_source2 = iY0;
}
- if (m_source == "Y1" && m_source2 == "X1")
+ if (m_source == iY1 && m_source2 == iX1)
{
- m_source = "X1";
- m_source2 = "Y1";
+ m_source = iX1;
+ m_source2 = iY1;
}
-
+
m_opcode = "shfr";
return true;
}
void disassemble(std::string& retString) const
{
- retString = m_opcode + " " +
- m_source + "," +
- m_source2 + "," + m_destination;
+ retString = m_opcode + " " +
+ regIdAsString(m_source) + "," +
+ regIdAsString(m_source2) + "," + regIdAsString(m_destination);
}
void evaluate(dsp56k_core* cpustate) {}
size_t size() const { return 1; }
size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; }
private:
- std::string m_source2;
+ reg_id m_source2;
};
}
diff --git a/src/emu/cpu/dsp56k/opcode.c b/src/emu/cpu/dsp56k/opcode.c
index 597caae7ae6..a7e5d04fc48 100644
--- a/src/emu/cpu/dsp56k/opcode.c
+++ b/src/emu/cpu/dsp56k/opcode.c
@@ -67,8 +67,8 @@ size_t Opcode::evalSize() const
}
-const std::string& Opcode::instSource() const { return m_instruction->source(); }
-const std::string& Opcode::instDestination() const { return m_instruction->destination(); }
+const reg_id& Opcode::instSource() const { return m_instruction->source(); }
+const reg_id& Opcode::instDestination() const { return m_instruction->destination(); }
const size_t Opcode::instAccumulatorBitsModified() const { return m_instruction->accumulatorBitsModified(); }
std::string Opcode::dcString() const
diff --git a/src/emu/cpu/dsp56k/opcode.h b/src/emu/cpu/dsp56k/opcode.h
index 6ab83d39f9a..710cc27844a 100644
--- a/src/emu/cpu/dsp56k/opcode.h
+++ b/src/emu/cpu/dsp56k/opcode.h
@@ -30,10 +30,10 @@ public:
size_t evalSize() const;
// Peek through to the instruction
- const std::string& instSource() const;
- const std::string& instDestination() const;
+ const reg_id& instSource() const;
+ const reg_id& instDestination() const;
const size_t instAccumulatorBitsModified() const;
-
+
private:
Instruction* m_instruction;
ParallelMove* m_parallelMove;
diff --git a/src/emu/cpu/dsp56k/pmove.c b/src/emu/cpu/dsp56k/pmove.c
index 0e83f6a0dc2..37d60cc3a5e 100644
--- a/src/emu/cpu/dsp56k/pmove.c
+++ b/src/emu/cpu/dsp56k/pmove.c
@@ -3,8 +3,8 @@
namespace DSP56K
{
-const std::string& ParallelMove::opSource() const { return m_oco->instSource(); }
-const std::string& ParallelMove::opDestination() const { return m_oco->instDestination(); }
+const reg_id& ParallelMove::opSource() const { return m_oco->instSource(); }
+const reg_id& ParallelMove::opDestination() const { return m_oco->instDestination(); }
const size_t ParallelMove::opAccumulatorBitsModified() const { return m_oco->instAccumulatorBitsModified(); }
@@ -12,7 +12,7 @@ ParallelMove* ParallelMove::decodeParallelMove(const Opcode* opc, const UINT16 w
{
const UINT16 w0 = word0;
const UINT16 w1 = word1;
-
+
/* Dual X Memory Data Read : 011m mKKK .rr. .... : A-142*/
if ((w0 & 0xe000) == 0x6000)
{
diff --git a/src/emu/cpu/dsp56k/pmove.h b/src/emu/cpu/dsp56k/pmove.h
index 193b3c7112b..02ec5507b72 100644
--- a/src/emu/cpu/dsp56k/pmove.h
+++ b/src/emu/cpu/dsp56k/pmove.h
@@ -30,8 +30,8 @@ public:
const bool valid() const { return m_valid; }
// Peek through the opcode to see the instruction
- const std::string& opSource() const;
- const std::string& opDestination() const;
+ const reg_id& opSource() const;
+ const reg_id& opDestination() const;
const size_t opAccumulatorBitsModified() const;
protected:
@@ -54,20 +54,20 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- decode_RR_table(BITSn(word0,0x3000), rNum);
+ reg_id r;
+ decode_RR_table(BITSn(word0,0x3000), r);
- std::string SD;
+ reg_id SD;
decode_HHH_table(BITSn(word0,0x0e00), SD);
std::string ea;
- assemble_ea_from_m_table(BITSn(word0,0x4000), rNum, ea);
+ assemble_ea_from_m_table(BITSn(word0,0x4000), regIDAsNum(r), ea);
- assemble_arguments_from_W_table(BITSn(word0,0x0100), 'X', SD, ea,
+ assemble_arguments_from_W_table(BITSn(word0,0x0100), 'X', SD, ea,
m_source, m_destination);
// If the destination of the instruction overlaps with our destination, abort.
- if (registerOverlap(opDestination(), opAccumulatorBitsModified(), m_destination))
+ if (registerOverlap(opDestination(), opAccumulatorBitsModified(), stringAsRegID(m_destination)))
return false;
return true;
@@ -95,21 +95,21 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
std::string ea;
- if (opDestination() == "B")
+ if (opDestination() == iB)
ea = "(A1)";
- else if (opDestination() == "A")
+ else if (opDestination() == iA)
ea = "(B1)";
else
ea = "(A1)";
- std::string SD;
+ reg_id SD;
decode_HHH_table(BITSn(word0,0x0e00), SD);
- assemble_arguments_from_W_table(BITSn(word0,0x0100), 'X', SD, ea,
+ assemble_arguments_from_W_table(BITSn(word0,0x0100), 'X', SD, ea,
m_source, m_destination);
// If the destination of the instruction overlaps with our destination, abort.
- if (registerOverlap(opDestination(), opAccumulatorBitsModified(), m_destination))
+ if (registerOverlap(opDestination(), opAccumulatorBitsModified(), stringAsRegID(m_destination)))
return false;
return true;
@@ -119,7 +119,7 @@ public:
retString = m_source + "," + m_destination;
}
void evaluate() {}
-
+
private:
std::string m_source;
std::string m_destination;
@@ -136,34 +136,34 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- std::string D1 = "";
- std::string D2 = "";
+ reg_id r;
+ reg_id D1;
+ reg_id D2;
std::string ea1 = "";
std::string ea2 = "";
- decode_rr_table(BITSn(word0,0x0060), rNum);
+ decode_rr_table(BITSn(word0,0x0060), r);
decode_KKK_table(BITSn(word0,0x0700), D1, D2);
- assemble_eas_from_mm_table(BITSn(word0,0x1800), rNum, 3, ea1, ea2);
+ assemble_eas_from_mm_table(BITSn(word0,0x1800), regIDAsNum(r), 3, ea1, ea2);
/* Not documented, but extrapolated from docs on page A-133 */
- if (D1 == "^F")
+ if (D1 == iFHAT)
{
- if (opDestination() == "B")
- D1 = "A";
- else if (opDestination() == "A")
- D1 = "B";
+ if (opDestination() == iB)
+ D1 = iA;
+ else if (opDestination() == iA)
+ D1 = iB;
else
- D1 = "A"; /* In the case of no data ALU instruction */
+ D1 = iA; /* In the case of no data ALU instruction */
}
/* D1 and D2 may not specify the same register : A-142 */
- if (rNum == 3) return false;
+ if (r == iR3) return false;
char temp[32];
- sprintf(temp, "X:%s,%s", ea1.c_str(), D1.c_str());
+ sprintf(temp, "X:%s,%s", ea1.c_str(), regIdAsString(D1).c_str());
parallelMove = temp;
- sprintf(temp, "X:%s,%s", ea2.c_str(), D2.c_str());
+ sprintf(temp, "X:%s,%s", ea2.c_str(), regIdAsString(D2).c_str());
parallelMove2 = temp;
return true;
@@ -190,44 +190,44 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- decode_IIIIx_table(BITSn(word0,0x0f00), BITSn(word0,0x0008),
+ decode_IIIIx_table(BITSn(word0,0x0f00), BITSn(word0,0x0008),
m_source, m_destination);
- if (m_source == "!")
+ if (m_source == iINVALID)
return false;
- if (m_source == "F")
+ if (m_source == iF)
m_source = opDestination();
- if (m_destination == "^F")
+ if (m_destination == iFHAT)
{
- if (opDestination() == "B")
- m_destination = "A";
- else if (opDestination() == "A")
- m_destination = "B";
+ if (opDestination() == iB)
+ m_destination = iA;
+ else if (opDestination() == iA)
+ m_destination = iB;
else
- m_destination = "A"; /* In the case of no data ALU instruction */
+ m_destination = iA; /* In the case of no data ALU instruction */
}
// Don't return a failure, just let everything fall through (nop).
//if (m_source == "?" && m_destination == "?")
- // return false;
+ // return false;
return true;
}
void disassemble(std::string& retString) const
{
// (?,?) is a parallel nop
- if (m_source == "?" && m_destination == "?")
+ if (m_source == iWEIRD && m_destination == iWEIRD)
retString = "";
else
- retString = m_source + "," + m_destination;
+ retString = regIdAsString(m_source) + "," + regIdAsString(m_destination);
}
void evaluate() {}
-
+
private:
- std::string m_source;
- std::string m_destination;
+ reg_id m_source;
+ reg_id m_destination;
};
@@ -243,21 +243,21 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- std::string S;
- std::string Dnot;
+ reg_id r;
+ reg_id S;
+ reg_id Dnot;
char parallel_move_str[128];
char parallel_move_str2[128];
- if (opDestination() == "A") Dnot = "B";
- else Dnot = "A";
+ if (opDestination() == iA) Dnot = iB;
+ else Dnot = iA;
// NEW // decode_k_table(BITSn(word0,0x0100), Dnot);
- decode_RR_table(BITSn(word0,0x00c0), rNum);
+ decode_RR_table(BITSn(word0,0x00c0), r);
decode_DD_table(BITSn(word0,0x0030), S);
- sprintf(parallel_move_str, "%s,X:(R%d)+N%d", Dnot.c_str(), rNum, rNum);
- sprintf(parallel_move_str2, "%s,%s", S.c_str(), Dnot.c_str());
+ sprintf(parallel_move_str, "%s,X:(R%d)+N%d", regIdAsString(Dnot).c_str(), regIDAsNum(r), regIDAsNum(r));
+ sprintf(parallel_move_str2, "%s,%s", regIdAsString(S).c_str(), regIdAsString(Dnot).c_str());
pms = parallel_move_str;
pms2 = parallel_move_str2;
return true;
@@ -267,7 +267,7 @@ public:
retString = pms + " " + pms2;
}
void evaluate() {}
-
+
private:
std::string pms; // TODO
std::string pms2;
@@ -285,9 +285,9 @@ public:
}
bool decode(const UINT16 word0, const UINT16 word1)
{
- INT8 rNum;
- decode_RR_table(BITSn(word0,0x0300), rNum);
- assemble_ea_from_z_table(BITSn(word0,0x0400), rNum, m_ea);
+ reg_id r;
+ decode_RR_table(BITSn(word0,0x0300), r);
+ assemble_ea_from_z_table(BITSn(word0,0x0400), regIDAsNum(r), m_ea);
return true;
}
@@ -296,7 +296,7 @@ public:
retString = m_ea;
}
void evaluate() {}
-
+
private:
std::string m_ea;
};
@@ -315,7 +315,7 @@ public:
bool decode(const UINT16 word0, const UINT16 word1)
{
INT8 b;
- std::string SD;
+ reg_id SD;
std::string args;
b = (char)(word0 & 0x00ff);
@@ -329,7 +329,7 @@ public:
retString = m_source + "," + m_destination;
}
void evaluate() {}
-
+
private:
std::string m_source;
std::string m_destination;
diff --git a/src/emu/cpu/dsp56k/tables.c b/src/emu/cpu/dsp56k/tables.c
index 6191c7f3750..509a85de043 100644
--- a/src/emu/cpu/dsp56k/tables.c
+++ b/src/emu/cpu/dsp56k/tables.c
@@ -4,6 +4,7 @@
#include <cstdlib>
#include "tables.h"
+#include "dsp56def.h"
namespace DSP56K
{
@@ -11,7 +12,7 @@ namespace DSP56K
/******************/
/* Table decoding */
/******************/
-int decode_BBB_table(UINT16 BBB)
+bfShift decode_BBB_table(UINT16 BBB)
{
switch(BBB)
{
@@ -66,212 +67,212 @@ void decode_cccc_table(const UINT16 cccc, std::string& mnemonic)
// NEW // }
}
-void decode_DDDDD_table(const UINT16 DDDDD, std::string& SD)
+void decode_DDDDD_table(const UINT16 DDDDD, reg_id& SD)
{
switch(DDDDD)
{
- case 0x00: SD = "X0"; break;
- case 0x01: SD = "Y0"; break;
- case 0x02: SD = "X1"; break;
- case 0x03: SD = "Y1"; break;
- case 0x04: SD = "A"; break;
- case 0x05: SD = "B"; break;
- case 0x06: SD = "A0"; break;
- case 0x07: SD = "B0"; break;
- case 0x08: SD = "LC"; break;
- case 0x09: SD = "SR"; break;
- case 0x0a: SD = "OMR"; break;
- case 0x0b: SD = "SP"; break;
- case 0x0c: SD = "A1"; break;
- case 0x0d: SD = "B1"; break;
- case 0x0e: SD = "A2"; break;
- case 0x0f: SD = "B2"; break;
-
- case 0x10: SD = "R0"; break;
- case 0x11: SD = "R1"; break;
- case 0x12: SD = "R2"; break;
- case 0x13: SD = "R3"; break;
- case 0x14: SD = "M0"; break;
- case 0x15: SD = "M1"; break;
- case 0x16: SD = "M2"; break;
- case 0x17: SD = "M3"; break;
- case 0x18: SD = "SSH"; break;
- case 0x19: SD = "SSL"; break;
- case 0x1a: SD = "LA"; break;
- case 0x1b: SD = "!!"; break; /* no 0x1b */
- case 0x1c: SD = "N0"; break;
- case 0x1d: SD = "N1"; break;
- case 0x1e: SD = "N2"; break;
- case 0x1f: SD = "N3"; break;
- }
-}
-
-void decode_DD_table(const UINT16 DD, std::string& SD)
+ case 0x00: SD = iX0; break;
+ case 0x01: SD = iY0; break;
+ case 0x02: SD = iX1; break;
+ case 0x03: SD = iY1; break;
+ case 0x04: SD = iA; break;
+ case 0x05: SD = iB; break;
+ case 0x06: SD = iA0; break;
+ case 0x07: SD = iB0; break;
+ case 0x08: SD = iLC; break;
+ case 0x09: SD = iSR; break;
+ case 0x0a: SD = iOMR; break;
+ case 0x0b: SD = iSP; break;
+ case 0x0c: SD = iA1; break;
+ case 0x0d: SD = iB1; break;
+ case 0x0e: SD = iA2; break;
+ case 0x0f: SD = iB2; break;
+
+ case 0x10: SD = iR0; break;
+ case 0x11: SD = iR1; break;
+ case 0x12: SD = iR2; break;
+ case 0x13: SD = iR3; break;
+ case 0x14: SD = iM0; break;
+ case 0x15: SD = iM1; break;
+ case 0x16: SD = iM2; break;
+ case 0x17: SD = iM3; break;
+ case 0x18: SD = iSSH; break;
+ case 0x19: SD = iSSL; break;
+ case 0x1a: SD = iLA; break;
+ case 0x1b: SD = iINVALID; break; /* no 0x1b */
+ case 0x1c: SD = iN0; break;
+ case 0x1d: SD = iN1; break;
+ case 0x1e: SD = iN2; break;
+ case 0x1f: SD = iN3; break;
+ }
+}
+
+void decode_DD_table(const UINT16 DD, reg_id& SD)
{
switch (DD)
{
- case 0x0: SD = "X0"; break;
- case 0x1: SD = "Y0"; break;
- case 0x2: SD = "X1"; break;
- case 0x3: SD = "Y1"; break;
+ case 0x0: SD = iX0; break;
+ case 0x1: SD = iY0; break;
+ case 0x2: SD = iX1; break;
+ case 0x3: SD = iY1; break;
}
}
-void decode_DDF_table(const UINT16 DD, const UINT16 F, std::string& S, std::string& D)
+void decode_DDF_table(const UINT16 DD, const UINT16 F, reg_id& S, reg_id& D)
{
const UINT16 switchVal = (DD << 1) | F;
switch (switchVal)
{
- case 0x0: S = "X0"; D = "A"; break;
- case 0x1: S = "X0"; D = "B"; break;
- case 0x2: S = "Y0"; D = "A"; break;
- case 0x3: S = "Y0"; D = "B"; break;
- case 0x4: S = "X1"; D = "A"; break;
- case 0x5: S = "X1"; D = "B"; break;
- case 0x6: S = "Y1"; D = "A"; break;
- case 0x7: S = "Y1"; D = "B"; break;
+ case 0x0: S = iX0; D = iA; break;
+ case 0x1: S = iX0; D = iB; break;
+ case 0x2: S = iY0; D = iA; break;
+ case 0x3: S = iY0; D = iB; break;
+ case 0x4: S = iX1; D = iA; break;
+ case 0x5: S = iX1; D = iB; break;
+ case 0x6: S = iY1; D = iA; break;
+ case 0x7: S = iY1; D = iB; break;
}
}
-void decode_EE_table(const UINT16 EE, std::string& D)
+void decode_EE_table(const UINT16 EE, reg_id& D)
{
switch(EE)
{
- case 0x1: D = "MR"; break;
- case 0x3: D = "CCR"; break;
- case 0x2: D = "OMR"; break;
+ case 0x1: D = iMR; break;
+ case 0x3: D = iCCR; break;
+ case 0x2: D = iOMR; break;
}
}
-void decode_F_table(const UINT16 F, std::string& SD)
+void decode_F_table(const UINT16 F, reg_id& SD)
{
switch(F)
{
- case 0x0: SD = "A"; break;
- case 0x1: SD = "B"; break;
+ case 0x0: SD = iA; break;
+ case 0x1: SD = iB; break;
}
}
-void decode_h0hF_table(const UINT16 h0h, UINT16 F, std::string& S, std::string& D)
+void decode_h0hF_table(const UINT16 h0h, UINT16 F, reg_id& S, reg_id& D)
{
const UINT16 switchVal = (h0h << 1) | F;
switch (switchVal)
{
- case 0x8: S = "X0"; D = "A"; break;
- case 0x9: S = "X0"; D = "B"; break;
- case 0xa: S = "Y0"; D = "A"; break;
- case 0xb: S = "Y0"; D = "B"; break;
- case 0x2: S = "A"; D = "A"; break;
- case 0x1: S = "A"; D = "B"; break;
- case 0x0: S = "B"; D = "A"; break;
- case 0x3: S = "B"; D = "B"; break;
+ case 0x8: S = iX0; D = iA; break;
+ case 0x9: S = iX0; D = iB; break;
+ case 0xa: S = iY0; D = iA; break;
+ case 0xb: S = iY0; D = iB; break;
+ case 0x2: S = iA; D = iA; break;
+ case 0x1: S = iA; D = iB; break;
+ case 0x0: S = iB; D = iA; break;
+ case 0x3: S = iB; D = iB; break;
}
}
-void decode_HH_table(const UINT16 HH, std::string& SD)
+void decode_HH_table(const UINT16 HH, reg_id& SD)
{
switch(HH)
{
- case 0x0: SD = "X0"; break;
- case 0x1: SD = "Y0"; break;
- case 0x2: SD = "A"; break;
- case 0x3: SD = "B"; break;
+ case 0x0: SD = iX0; break;
+ case 0x1: SD = iY0; break;
+ case 0x2: SD = iA; break;
+ case 0x3: SD = iB; break;
}
}
-void decode_HHH_table(const UINT16 HHH, std::string& SD)
+void decode_HHH_table(const UINT16 HHH, reg_id& SD)
{
switch(HHH)
{
- case 0x0: SD = "X0"; break;
- case 0x1: SD = "Y0"; break;
- case 0x2: SD = "X1"; break;
- case 0x3: SD = "Y1"; break;
- case 0x4: SD = "A"; break;
- case 0x5: SD = "B"; break;
- case 0x6: SD = "A0"; break;
- case 0x7: SD = "B0"; break;
+ case 0x0: SD = iX0; break;
+ case 0x1: SD = iY0; break;
+ case 0x2: SD = iX1; break;
+ case 0x3: SD = iY1; break;
+ case 0x4: SD = iA; break;
+ case 0x5: SD = iB; break;
+ case 0x6: SD = iA0; break;
+ case 0x7: SD = iB0; break;
}
}
-void decode_IIIIx_table(const UINT16 IIII, const UINT16 x, std::string& S, std::string& D)
+void decode_IIIIx_table(const UINT16 IIII, const UINT16 x, reg_id& S, reg_id& D)
{
- S = D = "!";
+ S = D = iINVALID;
switch(IIII)
{
- case 0x0: S = "X0"; D = "^F"; break;
- case 0x1: S = "Y0"; D = "^F"; break;
- case 0x2: S = "X1"; D = "^F"; break;
- case 0x3: S = "Y1"; D = "^F"; break;
- case 0x4: S = "A"; D = "X0"; break;
- case 0x5: S = "B"; D = "Y0"; break;
- case 0x6: S = "A0"; D = "X0"; break;
- case 0x7: S = "B0"; D = "Y0"; break;
- case 0x8: if ( x) S = "F"; D = "^F"; break;
- case 0x9: if (!x) S = "F"; D = "^F"; break;
- case 0xa: S = "?"; D = "?"; break;
- case 0xb: S = "?"; D = "?"; break;
- case 0xc: S = "A"; D = "X1"; break;
- case 0xd: S = "B"; D = "Y1"; break;
- case 0xe: S = "A0"; D = "X1"; break;
- case 0xf: S = "B0"; D = "Y1"; break;
+ case 0x0: S = iX0; D = iFHAT; break;
+ case 0x1: S = iY0; D = iFHAT; break;
+ case 0x2: S = iX1; D = iFHAT; break;
+ case 0x3: S = iY1; D = iFHAT; break;
+ case 0x4: S = iA; D = iX0; break;
+ case 0x5: S = iB; D = iY0; break;
+ case 0x6: S = iA0; D = iX0; break;
+ case 0x7: S = iB0; D = iY0; break;
+ case 0x8: if ( x) S = iF; D = iFHAT; break;
+ case 0x9: if (!x) S = iF; D = iFHAT; break;
+ case 0xa: S = iWEIRD; D = iWEIRD; break;
+ case 0xb: S = iWEIRD; D = iWEIRD; break;
+ case 0xc: S = iA; D = iX1; break;
+ case 0xd: S = iB; D = iY1; break;
+ case 0xe: S = iA0; D = iX1; break;
+ case 0xf: S = iB0; D = iY1; break;
}
}
-void decode_JJJF_table(const UINT16 JJJ, const UINT16 F, std::string& S, std::string& D)
+void decode_JJJF_table(const UINT16 JJJ, const UINT16 F, reg_id& S, reg_id& D)
{
const UINT16 switchVal = (JJJ << 1) | F;
switch(switchVal)
{
- case 0x0: S = "B"; D = "A"; break;
- case 0x1: S = "A"; D = "B"; break;
- case 0x2: S = "!"; D = "!"; break;
- case 0x3: S = "!"; D = "!"; break;
- case 0x4: S = "X"; D = "A"; break;
- case 0x5: S = "X"; D = "B"; break;
- case 0x6: S = "Y"; D = "A"; break;
- case 0x7: S = "Y"; D = "B"; break;
- case 0x8: S = "X0"; D = "A"; break;
- case 0x9: S = "X0"; D = "B"; break;
- case 0xa: S = "Y0"; D = "A"; break;
- case 0xb: S = "Y0"; D = "B"; break;
- case 0xc: S = "X1"; D = "A"; break;
- case 0xd: S = "X1"; D = "B"; break;
- case 0xe: S = "Y1"; D = "A"; break;
- case 0xf: S = "Y1"; D = "B"; break;
+ case 0x0: S = iB; D = iA; break;
+ case 0x1: S = iA; D = iB; break;
+ case 0x2: S = iINVALID; D = iINVALID; break;
+ case 0x3: S = iINVALID; D = iINVALID; break;
+ case 0x4: S = iX; D = iA; break;
+ case 0x5: S = iX; D = iB; break;
+ case 0x6: S = iY; D = iA; break;
+ case 0x7: S = iY; D = iB; break;
+ case 0x8: S = iX0; D = iA; break;
+ case 0x9: S = iX0; D = iB; break;
+ case 0xa: S = iY0; D = iA; break;
+ case 0xb: S = iY0; D = iB; break;
+ case 0xc: S = iX1; D = iA; break;
+ case 0xd: S = iX1; D = iB; break;
+ case 0xe: S = iY1; D = iA; break;
+ case 0xf: S = iY1; D = iB; break;
}
}
-void decode_JJF_table(const UINT16 JJ, const UINT16 F, std::string& S, std::string& D)
+void decode_JJF_table(const UINT16 JJ, const UINT16 F, reg_id& S, reg_id& D)
{
const UINT16 switchVal = (JJ << 1) | F;
switch (switchVal)
{
- case 0x0: S = "X0"; D = "A"; break;
- case 0x1: S = "X0"; D = "B"; break;
- case 0x2: S = "Y0"; D = "A"; break;
- case 0x3: S = "Y0"; D = "B"; break;
- case 0x4: S = "X1"; D = "A"; break;
- case 0x5: S = "X1"; D = "B"; break;
- case 0x6: S = "Y1"; D = "A"; break;
- case 0x7: S = "Y1"; D = "B"; break;
+ case 0x0: S = iX0; D = iA; break;
+ case 0x1: S = iX0; D = iB; break;
+ case 0x2: S = iY0; D = iA; break;
+ case 0x3: S = iY0; D = iB; break;
+ case 0x4: S = iX1; D = iA; break;
+ case 0x5: S = iX1; D = iB; break;
+ case 0x6: S = iY1; D = iA; break;
+ case 0x7: S = iY1; D = iB; break;
}
}
-void decode_JF_table(const UINT16 J, const UINT16 F, std::string& S, std::string& D)
+void decode_JF_table(const UINT16 J, const UINT16 F, reg_id& S, reg_id& D)
{
const UINT16 switchVal = (J << 1) | F;
switch(switchVal)
{
- case 0x0: S = "X"; D = "A"; break;
- case 0x1: S = "X"; D = "B"; break;
- case 0x2: S = "Y"; D = "A"; break;
- case 0x3: S = "Y"; D = "B"; break;
+ case 0x0: S = iX; D = iA; break;
+ case 0x1: S = iX; D = iB; break;
+ case 0x2: S = iY; D = iA; break;
+ case 0x3: S = iY; D = iB; break;
}
}
@@ -293,98 +294,122 @@ void decode_kSign_table(const UINT16 k, std::string& plusMinus)
}
}
-void decode_KKK_table(const UINT16 KKK, std::string& D1, std::string& D2)
+void decode_KKK_table(const UINT16 KKK, reg_id& D1, reg_id& D2)
{
switch(KKK)
{
- case 0x0: D1 = "^F"; D2 = "X0"; break;
- case 0x1: D1 = "Y0"; D2 = "X0"; break;
- case 0x2: D1 = "X1"; D2 = "X0"; break;
- case 0x3: D1 = "Y1"; D2 = "X0"; break;
- case 0x4: D1 = "X0"; D2 = "X1"; break;
- case 0x5: D1 = "Y0"; D2 = "X1"; break;
- case 0x6: D1 = "^F"; D2 = "Y0"; break;
- case 0x7: D1 = "Y1"; D2 = "X1"; break;
+ case 0x0: D1 = iFHAT; D2 = iX0; break;
+ case 0x1: D1 = iY0; D2 = iX0; break;
+ case 0x2: D1 = iX1; D2 = iX0; break;
+ case 0x3: D1 = iY1; D2 = iX0; break;
+ case 0x4: D1 = iX0; D2 = iX1; break;
+ case 0x5: D1 = iY0; D2 = iX1; break;
+ case 0x6: D1 = iFHAT; D2 = iY0; break;
+ case 0x7: D1 = iY1; D2 = iX1; break;
}
}
-void decode_NN_table(UINT16 NN, INT8& ret)
+void decode_NN_table(UINT16 NN, reg_id& ret)
{
- ret = NN;
+ switch(NN)
+ {
+ case 0x0: ret = iN0; break;
+ case 0x1: ret = iN1; break;
+ case 0x2: ret = iN2; break;
+ case 0x3: ret = iN3; break;
+ }
}
-void decode_TT_table(UINT16 TT, INT8& ret)
+void decode_TT_table(UINT16 TT, reg_id& ret)
{
- ret = TT;
+ switch(TT)
+ {
+ case 0x0: ret = iR0; break;
+ case 0x1: ret = iR1; break;
+ case 0x2: ret = iR2; break;
+ case 0x3: ret = iR3; break;
+ }
}
-void decode_QQF_table(const UINT16 QQ, const UINT16 F, std::string& S1, std::string& S2, std::string& D)
+void decode_QQF_table(const UINT16 QQ, const UINT16 F, reg_id& S1, reg_id& S2, reg_id& D)
{
const UINT16 switchVal = (QQ << 1) | F;
switch(switchVal)
{
- case 0x0: S1 = "Y0"; S2 = "X0"; D = "A"; break;
- case 0x1: S1 = "Y0"; S2 = "X0"; D = "B"; break;
- case 0x2: S1 = "Y1"; S2 = "X0"; D = "A"; break;
- case 0x3: S1 = "Y1"; S2 = "X0"; D = "B"; break;
- case 0x4: S1 = "Y0"; S2 = "X1"; D = "A"; break;
- case 0x5: S1 = "Y0"; S2 = "X1"; D = "B"; break;
- case 0x6: S1 = "Y1"; S2 = "X1"; D = "A"; break;
- case 0x7: S1 = "Y1"; S2 = "X1"; D = "B"; break;
+ case 0x0: S1 = iY0; S2 = iX0; D = iA; break;
+ case 0x1: S1 = iY0; S2 = iX0; D = iB; break;
+ case 0x2: S1 = iY1; S2 = iX0; D = iA; break;
+ case 0x3: S1 = iY1; S2 = iX0; D = iB; break;
+ case 0x4: S1 = iY0; S2 = iX1; D = iA; break;
+ case 0x5: S1 = iY0; S2 = iX1; D = iB; break;
+ case 0x6: S1 = iY1; S2 = iX1; D = iA; break;
+ case 0x7: S1 = iY1; S2 = iX1; D = iB; break;
}
}
-void decode_QQF_special_table(const UINT16 QQ, const UINT16 F, std::string& S1, std::string& S2, std::string& D)
+void decode_QQF_special_table(const UINT16 QQ, const UINT16 F, reg_id& S1, reg_id& S2, reg_id& D)
{
const UINT16 switchVal = (QQ << 1) | F;
switch(switchVal)
{
- case 0x0: S1 = "Y0"; S2 = "X0"; D = "A"; break;
- case 0x1: S1 = "Y0"; S2 = "X0"; D = "B"; break;
- case 0x2: S1 = "Y1"; S2 = "X0"; D = "A"; break;
- case 0x3: S1 = "Y1"; S2 = "X0"; D = "B"; break;
- case 0x4: S1 = "X1"; S2 = "Y0"; D = "A"; break;
- case 0x5: S1 = "X1"; S2 = "Y0"; D = "B"; break;
- case 0x6: S1 = "X1"; S2 = "Y1"; D = "A"; break;
- case 0x7: S1 = "X1"; S2 = "Y1"; D = "B"; break;
+ case 0x0: S1 = iY0; S2 = iX0; D = iA; break;
+ case 0x1: S1 = iY0; S2 = iX0; D = iB; break;
+ case 0x2: S1 = iY1; S2 = iX0; D = iA; break;
+ case 0x3: S1 = iY1; S2 = iX0; D = iB; break;
+ case 0x4: S1 = iX1; S2 = iY0; D = iA; break;
+ case 0x5: S1 = iX1; S2 = iY0; D = iB; break;
+ case 0x6: S1 = iX1; S2 = iY1; D = iA; break;
+ case 0x7: S1 = iX1; S2 = iY1; D = iB; break;
}
}
-void decode_QQQF_table(const UINT16 QQQ, const UINT16 F, std::string& S1, std::string& S2, std::string& D)
+void decode_QQQF_table(const UINT16 QQQ, const UINT16 F, reg_id& S1, reg_id& S2, reg_id& D)
{
const UINT16 switchVal = (QQQ << 1) | F;
switch(switchVal)
{
- case 0x0: S1 = "X0"; S2 = "X0"; D = "A"; break;
- case 0x1: S1 = "X0"; S2 = "X0"; D = "B"; break;
- case 0x2: S1 = "X1"; S2 = "X0"; D = "A"; break;
- case 0x3: S1 = "X1"; S2 = "X0"; D = "B"; break;
- case 0x4: S1 = "A1"; S2 = "Y0"; D = "A"; break;
- case 0x5: S1 = "A1"; S2 = "Y0"; D = "B"; break;
- case 0x6: S1 = "B1"; S2 = "X0"; D = "A"; break;
- case 0x7: S1 = "B1"; S2 = "X0"; D = "B"; break;
- case 0x8: S1 = "Y0"; S2 = "X0"; D = "A"; break;
- case 0x9: S1 = "Y0"; S2 = "X0"; D = "B"; break;
- case 0xa: S1 = "Y1"; S2 = "X0"; D = "A"; break;
- case 0xb: S1 = "Y1"; S2 = "X0"; D = "B"; break;
- case 0xc: S1 = "Y0"; S2 = "X1"; D = "A"; break;
- case 0xd: S1 = "Y0"; S2 = "X1"; D = "B"; break;
- case 0xe: S1 = "Y1"; S2 = "X1"; D = "A"; break;
- case 0xf: S1 = "Y1"; S2 = "X1"; D = "B"; break;
+ case 0x0: S1 = iX0; S2 = iX0; D = iA; break;
+ case 0x1: S1 = iX0; S2 = iX0; D = iB; break;
+ case 0x2: S1 = iX1; S2 = iX0; D = iA; break;
+ case 0x3: S1 = iX1; S2 = iX0; D = iB; break;
+ case 0x4: S1 = iA1; S2 = iY0; D = iA; break;
+ case 0x5: S1 = iA1; S2 = iY0; D = iB; break;
+ case 0x6: S1 = iB1; S2 = iX0; D = iA; break;
+ case 0x7: S1 = iB1; S2 = iX0; D = iB; break;
+ case 0x8: S1 = iY0; S2 = iX0; D = iA; break;
+ case 0x9: S1 = iY0; S2 = iX0; D = iB; break;
+ case 0xa: S1 = iY1; S2 = iX0; D = iA; break;
+ case 0xb: S1 = iY1; S2 = iX0; D = iB; break;
+ case 0xc: S1 = iY0; S2 = iX1; D = iA; break;
+ case 0xd: S1 = iY0; S2 = iX1; D = iB; break;
+ case 0xe: S1 = iY1; S2 = iX1; D = iA; break;
+ case 0xf: S1 = iY1; S2 = iX1; D = iB; break;
}
}
-void decode_RR_table(UINT16 RR, INT8& ret)
+void decode_RR_table(UINT16 RR, reg_id& ret)
{
- ret = RR;
+ switch(RR)
+ {
+ case 0x0: ret = iR0; break;
+ case 0x1: ret = iR1; break;
+ case 0x2: ret = iR2; break;
+ case 0x3: ret = iR3; break;
+ }
}
-void decode_rr_table(UINT16 rr, INT8& ret)
+void decode_rr_table(UINT16 rr, reg_id& ret)
{
- ret = rr;
+ switch(rr)
+ {
+ case 0x0: ret = iR0; break;
+ case 0x1: ret = iR1; break;
+ case 0x2: ret = iR2; break;
+ case 0x3: ret = iR3; break;
+ }
}
void decode_s_table(const UINT16 s, std::string& arithmetic)
@@ -408,45 +433,45 @@ void decode_ss_table(const UINT16 ss, std::string& arithmetic)
}
}
-void decode_uuuuF_table(const UINT16 uuuu, const UINT16 F, std::string& arg, std::string& S, std::string& D)
+void decode_uuuuF_table(const UINT16 uuuu, const UINT16 F, std::string& arg, reg_id& S, reg_id& D)
{
const UINT16 switchVal = (uuuu << 1) | F;
- D = "sub?";
- S = "add";
+ //D = "sub?";
+ //S = "add";
arg = "invalid";
switch(switchVal)
{
- case 0x00: arg = "add"; S = "X0"; D = "A"; break;
- case 0x01: arg = "add"; S = "X0"; D = "B"; break;
- case 0x02: arg = "add"; S = "Y0"; D = "A"; break;
- case 0x03: arg = "add"; S = "Y0"; D = "B"; break;
- case 0x04: arg = "add"; S = "X1"; D = "A"; break;
- case 0x05: arg = "add"; S = "X1"; D = "B"; break;
- case 0x06: arg = "add"; S = "Y1"; D = "A"; break;
- case 0x07: arg = "add"; S = "Y1"; D = "B"; break;
+ case 0x00: arg = "add"; S = iX0; D = iA; break;
+ case 0x01: arg = "add"; S = iX0; D = iB; break;
+ case 0x02: arg = "add"; S = iY0; D = iA; break;
+ case 0x03: arg = "add"; S = iY0; D = iB; break;
+ case 0x04: arg = "add"; S = iX1; D = iA; break;
+ case 0x05: arg = "add"; S = iX1; D = iB; break;
+ case 0x06: arg = "add"; S = iY1; D = iA; break;
+ case 0x07: arg = "add"; S = iY1; D = iB; break;
- case 0x08: arg = "sub"; S = "X0"; D = "A"; break;
- case 0x09: arg = "sub"; S = "X0"; D = "B"; break;
- case 0x0a: arg = "sub"; S = "Y0"; D = "A"; break;
- case 0x0b: arg = "sub"; S = "Y0"; D = "B"; break;
- case 0x0c: arg = "sub"; S = "X1"; D = "A"; break;
- case 0x0d: arg = "sub"; S = "X1"; D = "B"; break;
- case 0x0e: arg = "sub"; S = "Y1"; D = "A"; break;
- case 0x0f: arg = "sub"; S = "Y1"; D = "B"; break;
+ case 0x08: arg = "sub"; S = iX0; D = iA; break;
+ case 0x09: arg = "sub"; S = iX0; D = iB; break;
+ case 0x0a: arg = "sub"; S = iY0; D = iA; break;
+ case 0x0b: arg = "sub"; S = iY0; D = iB; break;
+ case 0x0c: arg = "sub"; S = iX1; D = iA; break;
+ case 0x0d: arg = "sub"; S = iX1; D = iB; break;
+ case 0x0e: arg = "sub"; S = iY1; D = iA; break;
+ case 0x0f: arg = "sub"; S = iY1; D = iB; break;
- case 0x18: arg = "add"; S = "B"; D = "A"; break;
- case 0x19: arg = "add"; S = "A"; D = "B"; break;
+ case 0x18: arg = "add"; S = iB; D = iA; break;
+ case 0x19: arg = "add"; S = iA; D = iB; break;
- case 0x1a: arg = "sub"; S = "B"; D = "A"; break;
- case 0x1b: arg = "sub"; S = "A"; D = "B"; break;
+ case 0x1a: arg = "sub"; S = iB; D = iA; break;
+ case 0x1b: arg = "sub"; S = iA; D = iB; break;
- case 0x1c: arg = "tfr"; S = "B"; D = "A"; break;
- case 0x1d: arg = "tfr"; S = "A"; D = "B"; break;
+ case 0x1c: arg = "tfr"; S = iB; D = iA; break;
+ case 0x1d: arg = "tfr"; S = iA; D = iB; break;
- case 0x1e: arg = "move"; S = ""; D = ""; break;
- case 0x1f: arg = "move"; S = ""; D = ""; break;
+ case 0x1e: arg = "move"; S = iINVALID; D = iINVALID; break;
+ case 0x1f: arg = "move"; S = iINVALID; D = iINVALID; break;
}
}
@@ -465,7 +490,7 @@ void assemble_ea_from_m_table(const UINT16 m, const int n, std::string& ea)
char temp[32];
switch(m)
{
- case 0x0: sprintf(temp, "(R%d)+",n) ; break;
+ case 0x0: sprintf(temp, "(R%d)+",n) ; break;
case 0x1: sprintf(temp, "(R%d)+N%d", n, n); break;
}
ea = temp;
@@ -514,7 +539,7 @@ void assemble_ea_from_q_table(UINT16 q, int n, std::string& ea)
ea = temp;
}
-void assemble_ea_from_t_table(UINT16 t, UINT16 val, std::string& ea)
+void assemble_ea_from_t_table(UINT16 t, UINT16 val, std::string& ea)
{
char temp[32];
switch(t)
@@ -545,9 +570,9 @@ void assemble_D_from_P_table(UINT16 P, UINT16 ppppp, std::string& D)
switch(P)
{
- case 0x0:
- sprintf(temp, "X:<$%x", ppppp);
- // NEW // sprintf(temp, "X:$%02x", ppppp);
+ case 0x0:
+ sprintf(temp, "X:<$%x", ppppp);
+ // NEW // sprintf(temp, "X:$%02x", ppppp);
break;
case 0x1:
assemble_address_from_IO_short_address(ppppp, fullAddy);
@@ -558,7 +583,19 @@ void assemble_D_from_P_table(UINT16 P, UINT16 ppppp, std::string& D)
D = temp;
}
-void assemble_arguments_from_W_table(UINT16 W, char ma, const std::string& SD, const std::string& ea,
+void assemble_arguments_from_W_table(UINT16 W, char ma, const reg_id& SD, const std::string& ea,
+ std::string& source, std::string& destination)
+{
+ char temp[32];
+ sprintf(temp, "%c:%s", ma, ea.c_str());
+ switch(W)
+ {
+ case 0x0: source = regIdAsString(SD); destination = temp; break;
+ case 0x1: source = temp; destination = regIdAsString(SD); break;
+ }
+}
+
+void assemble_arguments_from_W_table(UINT16 W, char ma, const std::string& SD, const std::string& ea,
std::string& source, std::string& destination)
{
char temp[32];
@@ -570,7 +607,7 @@ void assemble_arguments_from_W_table(UINT16 W, char ma, const std::string& SD, c
}
}
-void assemble_reg_from_W_table(UINT16 W, char ma, const std::string& SD, const INT8 xx, std::string& S, std::string& D)
+void assemble_reg_from_W_table(UINT16 W, char ma, const reg_id& SD, const INT8 xx, std::string& S, std::string& D)
{
UINT8 abs_xx;
char temp[32];
@@ -587,8 +624,8 @@ void assemble_reg_from_W_table(UINT16 W, char ma, const std::string& SD, const I
// NEW // sprintf(temp, "%c:(R2%s$%02x)", ma, operation, abs_xx);
switch(W)
{
- case 0x0: S = SD; D = temp; break;
- case 0x1: S = temp; D = SD; break;
+ case 0x0: S = regIdAsString(SD); D = temp; break;
+ case 0x1: S = temp; D = regIdAsString(SD); break;
}
}
@@ -613,9 +650,9 @@ INT8 get_6_bit_signed_value(UINT16 bits)
}
-/*******************/
-/* HELPER FUNCTION */
-/*******************/
+/********************/
+/* HELPER FUNCTIONS */
+/********************/
UINT16 dsp56k_op_maskn(UINT16 cur, UINT16 mask)
{
@@ -638,24 +675,196 @@ UINT16 dsp56k_op_maskn(UINT16 cur, UINT16 mask)
return temp;
}
-bool registerOverlap(const std::string& r0, const size_t bmd, const std::string& r1)
+bool registerOverlap(const reg_id& r0, const size_t bmd, const reg_id& r1)
{
if (bmd == BM_NONE)
return false;
-
+
if (r0 == r1)
return true;
- if (r0 == "A" && (bmd & BM_LOW) && r1 == "A0") return true;
- if (r0 == "A" && (bmd & BM_MIDDLE) && r1 == "A1") return true;
- if (r0 == "A" && (bmd & BM_HIGH) && r1 == "A2") return true;
+ if (r0 == iA && (bmd & BM_LOW) && r1 == iA0) return true;
+ if (r0 == iA && (bmd & BM_MIDDLE) && r1 == iA1) return true;
+ if (r0 == iA && (bmd & BM_HIGH) && r1 == iA2) return true;
- if (r0 == "B" && (bmd & BM_LOW) && r1 == "B0") return true;
- if (r0 == "B" && (bmd & BM_MIDDLE) && r1 == "B1") return true;
- if (r0 == "B" && (bmd & BM_HIGH) && r1 == "B2") return true;
+ if (r0 == iB && (bmd & BM_LOW) && r1 == iB0) return true;
+ if (r0 == iB && (bmd & BM_MIDDLE) && r1 == iB1) return true;
+ if (r0 == iB && (bmd & BM_HIGH) && r1 == iB2) return true;
return false;
}
+UINT16 regValue16(dsp56k_core* cpustate, const reg_id& reg)
+{
+ if (reg == iX0) return X0;
+ if (reg == iX1) return X1;
+ if (reg == iY0) return Y0;
+ if (reg == iY1) return Y1;
+
+ if (reg == iA0) return A0;
+ if (reg == iA1) return A1;
+ if (reg == iB0) return B0;
+ if (reg == iB1) return B1;
+
+ if (reg == iR0) return R0;
+ if (reg == iR1) return R1;
+ if (reg == iR2) return R2;
+ if (reg == iR3) return R3;
+
+ if (reg == iN0) return N0;
+ if (reg == iN1) return N1;
+ if (reg == iN2) return N2;
+ if (reg == iN3) return N3;
+
+ if (reg == iM0) return M0;
+ if (reg == iM1) return M1;
+ if (reg == iM2) return M2;
+ if (reg == iM3) return M3;
+
+ mame_printf_debug("The dsp561xx core is requesting a 16 bit value from non-16 bit register!");
+ return 0xdead;
+}
+
+void setReg16(dsp56k_core* cpustate, const UINT16& value, const reg_id& reg)
+{
+ if (reg == iX0) X0 = value;
+ if (reg == iX1) X1 = value;
+ if (reg == iY0) Y0 = value;
+ if (reg == iY1) Y1 = value;
+
+ if (reg == iA0) A0 = value;
+ if (reg == iA1) A1 = value;
+ if (reg == iB0) B0 = value;
+ if (reg == iB1) B1 = value;
+
+ if (reg == iR0) R0 = value;
+ if (reg == iR1) R1 = value;
+ if (reg == iR2) R2 = value;
+ if (reg == iR3) R3 = value;
+
+ if (reg == iN0) N0 = value;
+ if (reg == iN1) N1 = value;
+ if (reg == iN2) N2 = value;
+ if (reg == iN3) N3 = value;
+
+ if (reg == iM0) M0 = value;
+ if (reg == iM1) M1 = value;
+ if (reg == iM2) M2 = value;
+ if (reg == iM3) M3 = value;
+}
+
+std::string regIdAsString(const reg_id& regId)
+{
+ switch(regId)
+ {
+ case iX: return "X"; break;
+ case iX0: return "X0"; break;
+ case iX1: return "X1"; break;
+ case iY: return "Y"; break;
+ case iY0: return "Y0"; break;
+ case iY1: return "Y1"; break;
+ case iA: return "A"; break;
+ case iA0: return "A0"; break;
+ case iA1: return "A1"; break;
+ case iA2: return "A2"; break;
+ case iB: return "B"; break;
+ case iB0: return "B0"; break;
+ case iB1: return "B1"; break;
+ case iB2: return "B2"; break;
+ case iR0: return "R0"; break;
+ case iR1: return "R1"; break;
+ case iR2: return "R2"; break;
+ case iR3: return "R3"; break;
+ case iN0: return "N0"; break;
+ case iN1: return "N1"; break;
+ case iN2: return "N2"; break;
+ case iN3: return "N3"; break;
+ case iM0: return "M0"; break;
+ case iM1: return "M1"; break;
+ case iM2: return "M2"; break;
+ case iM3: return "M3"; break;
+ case iLC: return "LC"; break;
+ case iSR: return "SR"; break;
+ case iOMR: return "OMR"; break;
+ case iSP: return "SP"; break;
+ case iSSH: return "SSH"; break;
+ case iSSL: return "SSL"; break;
+ case iLA: return "LA"; break;
+ case iMR: return "MR"; break;
+ case iCCR: return "CCR"; break;
+ case iF: return "F"; break;
+ case iFHAT: return "^F"; break;
+ case iINVALID: return "!!"; break;
+ case iWEIRD: return "?"; break;
+ }
+
+ return "INVALID_REG_ID";
+}
+
+reg_id stringAsRegID(const std::string& str)
+{
+ if (str == "X") return iX;
+ if (str == "X0") return iX0;
+ if (str == "X1") return iX1;
+ if (str == "Y") return iY;
+ if (str == "Y0") return iY0;
+ if (str == "Y1") return iY1;
+ if (str == "A") return iA;
+ if (str == "A0") return iA0;
+ if (str == "A1") return iA1;
+ if (str == "A2") return iA2;
+ if (str == "B") return iB;
+ if (str == "B0") return iB0;
+ if (str == "B1") return iB1;
+ if (str == "B2") return iB2;
+ if (str == "R0") return iR0;
+ if (str == "R1") return iR1;
+ if (str == "R2") return iR2;
+ if (str == "R3") return iR3;
+ if (str == "N0") return iN0;
+ if (str == "N1") return iN1;
+ if (str == "N2") return iN2;
+ if (str == "N3") return iN3;
+ if (str == "M0") return iM0;
+ if (str == "M1") return iM1;
+ if (str == "M2") return iM2;
+ if (str == "M3") return iM3;
+ if (str == "LC") return iLC;
+ if (str == "SR") return iSR;
+ if (str == "OMR") return iOMR;
+ if (str == "SP") return iSP;
+ if (str == "SSH") return iSSH;
+ if (str == "SSL") return iSSL;
+ if (str == "LA") return iLA;
+ if (str == "MR") return iMR;
+ if (str == "CCR") return iCCR;
+ if (str == "F") return iF;
+ if (str == "^F") return iFHAT;
+ if (str == "!!") return iINVALID;
+ if (str == "?") return iWEIRD;
+
+ return iINVALID;
+}
+
+UINT8 regIDAsNum(const reg_id& regId)
+{
+ if (regId == iR0) return 0;
+ if (regId == iR1) return 1;
+ if (regId == iR2) return 2;
+ if (regId == iR3) return 3;
+
+ if (regId == iN0) return 0;
+ if (regId == iN1) return 1;
+ if (regId == iN2) return 2;
+ if (regId == iN3) return 3;
+
+ if (regId == iM0) return 0;
+ if (regId == iM1) return 1;
+ if (regId == iM2) return 2;
+ if (regId == iM3) return 3;
+
+ return 255;
+}
+
}
diff --git a/src/emu/cpu/dsp56k/tables.h b/src/emu/cpu/dsp56k/tables.h
index 7bcc8329f16..e37cd02f91f 100644
--- a/src/emu/cpu/dsp56k/tables.h
+++ b/src/emu/cpu/dsp56k/tables.h
@@ -6,44 +6,55 @@
#include <cstdlib>
#include "emu.h"
+#include "dsp56k.h"
namespace DSP56K
{
#define BITSn(CUR,MASK) (dsp56k_op_maskn(CUR,MASK))
-enum bbbType {BBB_UPPER, BBB_MIDDLE, BBB_LOWER, BBB_INVALID};
-enum bitsModified {BM_NONE = 0x0,
- BM_LOW = 0x1,
- BM_MIDDLE = 0x2,
- BM_HIGH = 0x4};
+enum bitsModified {BM_NONE = 0x0, BM_LOW = 0x1, BM_MIDDLE = 0x2, BM_HIGH = 0x4};
-int decode_BBB_table(UINT16 BBB);
+enum bfShift {BBB_UPPER, BBB_MIDDLE, BBB_LOWER, BBB_INVALID};
+enum reg_id {iX, iX0, iX1,
+ iY, iY0, iY1,
+ iA, iA0, iA1, iA2,
+ iB, iB0, iB1, iB2,
+ iR0, iR1, iR2, iR3,
+ iN0, iN1, iN2, iN3,
+ iM0, iM1, iM2, iM3,
+ iLC, iSR, iOMR, iSP, iSSH, iSSL, iLA, iMR, iCCR,
+ iF, iFHAT,
+ iINVALID, iWEIRD};
+
+
+
+bfShift decode_BBB_table(UINT16 BBB);
void decode_cccc_table(const UINT16 cccc, std::string& mnemonic);
-void decode_DDDDD_table(const UINT16 DDDDD, std::string& SD);
-void decode_DD_table(const UINT16 DD, std::string& SD);
-void decode_DDF_table(const UINT16 DD, const UINT16 F, std::string& S, std::string& D);
-void decode_EE_table(const UINT16 EE, std::string& D);
-void decode_F_table(const UINT16 F, std::string& SD);
-void decode_h0hF_table(const UINT16 h0h, UINT16 F, std::string& S, std::string& D);
-void decode_HH_table(const UINT16 HH, std::string& SD);
-void decode_HHH_table(const UINT16 HHH, std::string& SD);
-void decode_IIIIx_table(const UINT16 IIII, const UINT16 x, std::string& S, std::string& D);
-void decode_JJJF_table(const UINT16 JJJ, const UINT16 F, std::string& S, std::string& D);
-void decode_JJF_table(const UINT16 JJ, const UINT16 F, std::string& S, std::string& D);
-void decode_JF_table(const UINT16 J, const UINT16 F, std::string& S, std::string& D);
+void decode_DDDDD_table(const UINT16 DDDDD, reg_id& SD);
+void decode_DD_table(const UINT16 DD, reg_id& SD);
+void decode_DDF_table(const UINT16 DD, const UINT16 F, reg_id& S, reg_id& D);
+void decode_EE_table(const UINT16 EE, reg_id& D);
+void decode_F_table(const UINT16 F, reg_id& SD);
+void decode_h0hF_table(const UINT16 h0h, UINT16 F, reg_id& S, reg_id& D);
+void decode_HH_table(const UINT16 HH, reg_id& SD);
+void decode_HHH_table(const UINT16 HHH, reg_id& SD);
+void decode_IIIIx_table(const UINT16 IIII, const UINT16 x, reg_id& S, reg_id& D);
+void decode_JJJF_table(const UINT16 JJJ, const UINT16 F, reg_id& S, reg_id& D);
+void decode_JJF_table(const UINT16 JJ, const UINT16 F, reg_id& S, reg_id& D);
+void decode_JF_table(const UINT16 J, const UINT16 F, reg_id& S, reg_id& D);
void decode_kSign_table(const UINT16 k, std::string& plusMinus);
-void decode_KKK_table(const UINT16 KKK, std::string& D1, std::string& D2);
-void decode_NN_table(UINT16 NN, INT8& ret);
-void decode_TT_table(UINT16 TT, INT8& ret);
-void decode_QQF_table(const UINT16 QQ, const UINT16 F, std::string& S1, std::string& S2, std::string& D);
-void decode_QQF_special_table(const UINT16 QQ, const UINT16 F, std::string& S1, std::string& S2, std::string& D);
-void decode_QQQF_table(const UINT16 QQQ, const UINT16 F, std::string& S1, std::string& S2, std::string& D);
-void decode_RR_table(UINT16 RR, INT8& ret);
-void decode_rr_table(UINT16 rr, INT8& ret);
+void decode_KKK_table(const UINT16 KKK, reg_id& D1, reg_id& D2);
+void decode_NN_table(UINT16 NN, reg_id& ret);
+void decode_TT_table(UINT16 TT, reg_id& ret);
+void decode_QQF_table(const UINT16 QQ, const UINT16 F, reg_id& S1, reg_id& S2, reg_id& D);
+void decode_QQF_special_table(const UINT16 QQ, const UINT16 F, reg_id& S1, reg_id& S2, reg_id& D);
+void decode_QQQF_table(const UINT16 QQQ, const UINT16 F, reg_id& S1, reg_id& S2, reg_id& D);
+void decode_RR_table(UINT16 RR, reg_id& ret);
+void decode_rr_table(UINT16 rr, reg_id& ret);
void decode_s_table(const UINT16 s, std::string& arithmetic);
void decode_ss_table(const UINT16 ss, std::string& arithmetic);
-void decode_uuuuF_table(const UINT16 uuuu, const UINT16 F, std::string& arg, std::string& S, std::string& D);
+void decode_uuuuF_table(const UINT16 uuuu, const UINT16 F, std::string& arg, reg_id& S, reg_id& D);
void decode_Z_table(const UINT16 Z, std::string& ea);
void assemble_ea_from_m_table(const UINT16 m, const int n, std::string& ea);
@@ -53,8 +64,9 @@ void assemble_ea_from_q_table(UINT16 q, int n, std::string& ea);
void assemble_ea_from_t_table(UINT16 t, UINT16 val, std::string& ea);
void assemble_ea_from_z_table(UINT16 z, int n, std::string& ea);
void assemble_D_from_P_table(UINT16 P, UINT16 ppppp, std::string& D);
+void assemble_arguments_from_W_table(UINT16 W, char ma, const reg_id& SD, const std::string& ea, std::string& S, std::string& D);
void assemble_arguments_from_W_table(UINT16 W, char ma, const std::string& SD, const std::string& ea, std::string& S, std::string& D);
-void assemble_reg_from_W_table(UINT16 W, char ma, const std::string& SD, const INT8 xx, std::string& S, std::string& D);
+void assemble_reg_from_W_table(UINT16 W, char ma, const reg_id& SD, const INT8 xx, std::string& S, std::string& D);
void assemble_address_from_IO_short_address(UINT16 pp, std::string& ea);
INT8 get_6_bit_signed_value(UINT16 bits);
@@ -62,7 +74,15 @@ INT8 get_6_bit_signed_value(UINT16 bits);
// Helpers
UINT16 dsp56k_op_maskn(UINT16 cur, UINT16 mask);
-bool registerOverlap(const std::string& r0, const size_t bmd, const std::string& r1);
+bool registerOverlap(const reg_id& r0, const size_t bmd, const reg_id& r1);
+
+UINT16 regValue16(dsp56k_core* cpustate, const reg_id& reg);
+void setReg16(dsp56k_core* cpustate, const UINT16& value, const reg_id& reg);
+
+std::string regIdAsString(const reg_id& regId);
+reg_id stringAsRegID(const std::string& str);
+UINT8 regIDAsNum(const reg_id& regId);
+
}
#endif