summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/arcompact/arcompact_execute.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/cpu/arcompact/arcompact_execute.c')
-rw-r--r--src/emu/cpu/arcompact/arcompact_execute.c103
1 files changed, 90 insertions, 13 deletions
diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c
index 1563423b8b8..98b2862659f 100644
--- a/src/emu/cpu/arcompact/arcompact_execute.c
+++ b/src/emu/cpu/arcompact/arcompact_execute.c
@@ -80,7 +80,7 @@ void arcompact_device::execute_run()
int S_temp = (op & 0x0000003f) >> 0; \
int s_temp = (op & 0x00000fc0) >> 6; \
INT32 S = s_temp | (S_temp<<6); \
- if (S & 0x800) S = -0x800 + (S&0x7ff) /* sign extend */ \
+ if (S & 0x800) S = -0x800 + (S&0x7ff); /* sign extend */ \
#define COMMON32_GET_CONDITION \
UINT8 condition = op & 0x0000001f;
@@ -1784,6 +1784,35 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_helper(OPS_32, const char
/* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */ \
+#define SETUP_HANDLE04_0x_P10 \
+ int size = 4; \
+ UINT32 limm = 0; \
+/* int got_limm = 0; */ \
+ \
+ COMMON32_GET_breg; \
+ COMMON32_GET_F; \
+ COMMON32_GET_s12; \
+ COMMON32_GET_areg; \
+ \
+ UINT32 b, c; \
+ \
+ /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */ \
+ if (breg == LIMM_REG) \
+ { \
+ GET_LIMM_32; \
+ size = 8; \
+/* got_limm = 1; */ \
+ b = limm; \
+ } \
+ else \
+ { \
+ b = m_regs[breg]; \
+ } \
+ \
+ c = (UINT32)S; \
+ \
+ /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */ \
+
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p00(OPS_32)
{
@@ -1880,8 +1909,14 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p01(OPS_32)
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p10(OPS_32)
{
- int size = 4;
- arcompact_fatal("arcompact_handle04_04_p10 (AND)\n");
+ SETUP_HANDLE04_0x_P10
+ m_regs[areg] = b & c;
+
+ if (F)
+ {
+ arcompact_fatal("arcompact_handle04_04_p10 (AND) (F set)\n"); // not yet supported
+ }
+
return m_pc + (size >> 0);
}
@@ -1917,10 +1952,16 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p00(OPS_32)
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p01(OPS_32)
{
- int size = 4;
- arcompact_fatal("arcompact_handle04_05_p01 (OR)\n");
- return m_pc + (size >> 0);
-}
+ SETUP_HANDLE04_0x_P01
+
+ m_regs[areg] = b | c;
+
+ if (F)
+ {
+ arcompact_fatal("arcompact_handle04_05_p01 (OR) (F set)\n"); // not yet supported
+ }
+
+ return m_pc + (size >> 0);}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p10(OPS_32)
{
@@ -2119,9 +2160,19 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p01(OPS_32)
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p10(OPS_32)
{
int size = 4;
- arcompact_fatal("arcompact_handle04_0a_p10\n");
- return m_pc + (size >> 0);
-}
+
+ COMMON32_GET_breg;
+ COMMON32_GET_s12;
+ COMMON32_GET_F;
+
+ m_regs[breg] = S;
+
+ if (F)
+ { // currently not supported
+ arcompact_fatal("unimplemented MOV.F b <- s12 %08x", op);
+ }
+
+ return m_pc + (size>>0);}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p11_m0(OPS_32)
{
@@ -3218,7 +3269,22 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_04(OPS_16) // AND_S b <-
return m_pc + (2 >> 0);
}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_05(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "OR_S",0); }
+ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_05(OPS_16) // OR_S b <- b,c
+{
+ int breg, creg;
+
+ COMMON16_GET_breg;
+ COMMON16_GET_creg;
+
+ REG_16BIT_RANGE(breg);
+ REG_16BIT_RANGE(creg);
+
+ m_regs[breg] = m_regs[breg] | m_regs[creg];
+
+ return m_pc + (2 >> 0);
+}
+
+
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_06(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "BIC_S",0); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_07(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "XOR_S",0); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_0b(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "TST_S",1); }
@@ -3488,9 +3554,20 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_05(OPS_16)
return arcompact_handle_l7_0x_helper(PARAMS, "BCLR_S");
}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_06(OPS_16)
+ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_06(OPS_16) // BMSK b,b,u5
{
- return arcompact_handle_l7_0x_helper(PARAMS, "BSMK_S");
+ int breg, u;
+
+ COMMON16_GET_breg;
+ COMMON16_GET_u5;
+
+ REG_16BIT_RANGE(breg);
+
+ u &= 0x1f;
+
+ m_regs[breg] = m_regs[breg] | ((1 << (u + 1)) - 1);
+
+ return m_pc + (2 >> 0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_07(OPS_16)