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.c545
1 files changed, 216 insertions, 329 deletions
diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c
index bfb3b1e6cca..8e79c587ba1 100644
--- a/src/emu/cpu/arcompact/arcompact_execute.c
+++ b/src/emu/cpu/arcompact/arcompact_execute.c
@@ -36,6 +36,17 @@ void arcompact_device::execute_run()
m_pc = get_insruction(op);
}
+ // hardware loops
+ if (m_pc == m_LP_END)
+ {
+ if (m_regs[REG_LP_COUNT] != 1)
+ {
+ m_pc = m_LP_START;
+ }
+ m_regs[REG_LP_COUNT]--;
+
+ }
+
m_icount--;
}
@@ -129,6 +140,48 @@ void arcompact_device::execute_run()
#define PC_ALIGNED32 \
(m_pc&0xfffffffc)
+int arcompact_device::check_condition(UINT8 condition)
+{
+ switch (condition & 0x1f)
+ {
+ case 0x00: return 1; // AL
+ case 0x01: return CONDITION_EQ;
+ case 0x02: return !CONDITION_EQ; // NE
+ case 0x03: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x04: return CONDITION_MI; // MI (N)
+ case 0x05: return CONDITION_CS; // CS (Carry Set / Lower than)
+ case 0x06: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x07: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x08: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x09: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x0a: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x0b: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x0c: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x0d: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x0e: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x0f: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x10: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x11: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x12: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x13: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x14: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x15: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x16: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x17: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x18: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x19: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x1a: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x1b: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x1c: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x1d: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x1e: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ case 0x1f: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
+ }
+
+ return -1;
+
+}
+
ARCOMPACT_RETTYPE arcompact_device::get_insruction(OPS_32)
{
@@ -1101,8 +1154,34 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03(OPS_16)
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle00_00(OPS_32)
{
int size = 4;
+
+ COMMON32_GET_CONDITION
+
+ if (!check_condition(condition))
+ return m_pc + (size>>0);
+
// Branch Conditionally
- arcompact_log("unimplemented Bcc %08x", op);
+ // 0000 0sss ssss sss0 SSSS SSSS SSNQ QQQQ
+ INT32 address = (op & 0x07fe0000) >> 17;
+ address |= ((op & 0x0000ffc0) >> 6) << 10;
+ if (address & 0x80000) address = -0x80000 + (address & 0x7ffff);
+ int n = (op & 0x00000020) >> 5; op &= ~0x00000020;
+
+ UINT32 realaddress = PC_ALIGNED32 + (address * 2);
+
+ if (n)
+ {
+ m_delayactive = 1;
+ m_delayjump = realaddress;
+ m_delaylinks = 0; // don't link
+ }
+ else
+ {
+ // m_regs[REG_BLINK] = m_pc + (size >> 0); // don't link
+ return realaddress;
+ }
+
+
return m_pc + (size>>0);
}
@@ -1422,7 +1501,19 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_03(OPS_32)
return m_pc + (size>>0);
}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_04(OPS_32) { return arcompact_01_01_01_helper(PARAMS, "BRLO"); }
+ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_04(OPS_32) // register - immediate BRLO
+{
+ BR_REGIMM_SETUP
+
+ // BRLO (unsigned operation)
+ if (b < c)
+ {
+ BR_TAKEJUMP
+ }
+
+ return m_pc + (size>>0);
+
+}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_05(OPS_32) // register - immediate BRHS
{
@@ -1761,10 +1852,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0d(OPS_32)
return arcompact_handle04_helper(PARAMS, opcodes_04[0x0d], /*"RCMP"*/ 1,0);
}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0e(OPS_32)
-{
- return arcompact_handle04_helper(PARAMS, opcodes_04[0x0e], /*"RSUB"*/ 0,0);
-}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_10(OPS_32)
@@ -1782,34 +1869,11 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_12(OPS_32)
return arcompact_handle04_helper(PARAMS, opcodes_04[0x12], /*"BXOR"*/ 0,0);
}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_13(OPS_32)
-{
- return arcompact_handle04_helper(PARAMS, opcodes_04[0x13], /*"BMSK"*/ 0,0);
-}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_14(OPS_32)
-{
- return arcompact_handle04_helper(PARAMS, opcodes_04[0x14], /*"ADD1"*/ 0,0);
-}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_17(OPS_32)
-{
- return arcompact_handle04_helper(PARAMS, opcodes_04[0x17], /*"SUB1"*/ 0,0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_18(OPS_32)
-{
- return arcompact_handle04_helper(PARAMS, opcodes_04[0x18], /*"SUB2"*/ 0,0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_19(OPS_32)
-{
- return arcompact_handle04_helper(PARAMS, opcodes_04[0x19], /*"SUB3"*/ 0,0);
-}
-
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1a(OPS_32)
{
return arcompact_handle04_helper(PARAMS, opcodes_04[0x1a], /*"MPY"*/ 0,0);
@@ -1837,6 +1901,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p00(OPS_32)
int got_limm = 0;
COMMON32_GET_creg
+ COMMON32_GET_F
if (creg == LIMM_REG)
{
@@ -1858,7 +1923,32 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p00(OPS_32)
// J.F [ilink1] 0010 0RRR 0010 0000 1RRR 0111 01RR RRRR (creg = ILINK1, FLAG must be set)
// J.F [ilink2] 0010 0RRR 0010 0000 1RRR 0111 10RR RRRR (creg = ILINE2, FLAG must be set)
- arcompact_log("unimplemented J %08x", op);
+ if (F)
+ {
+ if ((creg == REG_ILINK1) || (creg == REG_ILINK2))
+ {
+ arcompact_log("1 unimplemented J.F %08x", op);
+ }
+ else
+ {
+ // should not use .F unless jumping to ILINK1/2
+ arcompact_fatal ("illegal 1 unimplemented J.F (F should not be set) %08x", op);
+ }
+
+ }
+ else
+ {
+ if ((creg == REG_ILINK1) || (creg == REG_ILINK2))
+ {
+ // should only jumping to ILINK1/2 if .F is set
+ arcompact_fatal("illegal 1 unimplemented J (F not set) %08x", op);
+ }
+ else
+ {
+
+ return m_regs[creg];
+ }
+ }
}
return m_pc + (size>>0);
@@ -1869,7 +1959,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p01(OPS_32)
// opcode iiii i--- ppII IIII F--- uuuu uu-- ----
// J u6 0010 0RRR 0110 0000 0RRR uuuu uuRR RRRR
int size = 4;
- arcompact_log("unimplemented J %08x", op);
+ arcompact_log("2 unimplemented J %08x", op);
return m_pc + (size>>0);
}
@@ -1878,18 +1968,22 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p10(OPS_32)
// opcode iiii i--- ppII IIII F--- ssss ssSS SSSS
// J s12 0010 0RRR 1010 0000 0RRR ssss ssSS SSSS
int size = 4;
- arcompact_log("unimplemented J %08x", op);
+ arcompact_log("3 unimplemented J %08x", op);
return m_pc + (size>>0);
}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m0(OPS_32)
+ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m0(OPS_32) // Jcc (no link, no delay)
{
int size = 4;
-// UINT32 limm = 0;
+ UINT32 limm = 0;
int got_limm = 0;
COMMON32_GET_creg
+ COMMON32_GET_CONDITION;
+ COMMON32_GET_F
+
+ UINT32 c = 0;
if (creg == LIMM_REG)
{
@@ -1897,19 +1991,56 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m0(OPS_32)
// Jcc limm 0010 0RRR 1110 0000 0RRR 1111 100Q QQQQ [LIUMM]
if (!got_limm)
{
- //GET_LIMM_32;
+ GET_LIMM_32;
size = 8;
}
- arcompact_log("unimplemented J %08x", op);
+ c = limm;
+
}
else
{
// opcode iiii i--- ppII IIII F--- cccc ccmq qqqq
// Jcc [c] 0010 0RRR 1110 0000 0RRR CCCC CC0Q QQQQ
// no conditional links to ILINK1, ILINK2?
- arcompact_log("unimplemented J %08x", op);
+
+ c = m_regs[creg];
}
+
+ if (!check_condition(condition))
+ return m_pc + (size>>0);
+
+ if (!F)
+ {
+ // if F isn't set then the destination can't be ILINK1 or ILINK2
+
+ if ((creg == REG_ILINK1) || (creg == REG_ILINK1))
+ {
+ arcompact_fatal ("fatal arcompact_handle04_20_p11_m0 J %08x (F not set but ILINK1 or ILINK2 used as dst)", op);
+ }
+ else
+ {
+ UINT32 realaddress = c;
+ return realaddress;
+ }
+ }
+
+ if (F)
+ {
+ // if F is set then the destination MUST be ILINK1 or ILINK2
+
+ if ((creg == REG_ILINK1) || (creg == REG_ILINK1))
+ {
+ arcompact_log("unimplemented arcompact_handle04_20_p11_m0 J %08x (F set)", op);
+ }
+ else
+ {
+ arcompact_fatal ("fatal arcompact_handle04_20_p11_m0 J %08x (F set but not ILINK1 or ILINK2 used as dst)", op);
+
+ }
+ }
+
+
return m_pc + (size>>0);
}
@@ -1918,7 +2049,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m1(OPS_32)
// opcode iiii i--- ppII IIII F--- uuuu uumq qqqq
// Jcc u6 0010 0RRR 1110 0000 0RRR uuuu uu1Q QQQQ
int size = 4;
- arcompact_log("unimplemented J %08x", op);
+ arcompact_log("unimplemented arcompact_handle04_20_p11_m1 J %08x (u6)", op);
return m_pc + (size>>0);
}
@@ -1945,23 +2076,46 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_23(OPS_32)
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_28(OPS_32) // LPcc (loop setup)
{
int size = 4;
-
+// COMMON32_GET_breg; // breg is reserved
COMMON32_GET_p;
-
+
if (p == 0x00)
{
+ arcompact_fatal("<illegal LPcc, p = 0x00)");
}
else if (p == 0x01)
{
+ arcompact_fatal("<illegal LPcc, p = 0x01)");
}
else if (p == 0x02) // Loop unconditional
- {
+ { // 0010 0RRR 1010 1000 0RRR ssss ssSS SSSS
+ COMMON32_GET_s12
+ if (S & 0x800) S = -0x800 + (S&0x7ff);
+
+ arcompact_fatal("Lp unconditional not supported %d", S);
}
else if (p == 0x03) // Loop conditional
- {
+ { // 0010 0RRR 1110 1000 0RRR uuuu uu1Q QQQQ
+ COMMON32_GET_u6
+ COMMON32_GET_CONDITION
+ //arcompact_fatal("Lp conditional %s not supported %d", conditions[condition], u);
+
+ // if the loop condition fails then just jump to after the end of the loop, don't set any registers
+ if (!check_condition(condition))
+ {
+ UINT32 realoffset = PC_ALIGNED32 + (u * 2);
+ return realoffset;
+ }
+ else
+ {
+ // otherwise set up the loop positions
+ m_LP_START = m_pc + (size >> 0);
+ m_LP_END = PC_ALIGNED32 + (u * 2);
+ return m_pc + (size>>0);
+ }
+
}
- arcompact_log("unimplemented LPcc %08x", op);
return m_pc + (size>>0);
}
@@ -2008,56 +2162,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2a(OPS_32) // Load FROM
return m_pc + (size>>0);
}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2b(OPS_32) // Store TO Auxiliary register FROM register
-{
- int size = 4;
-// UINT32 limm = 0;
- int got_limm = 0;
-
- COMMON32_GET_p;
- COMMON32_GET_breg;
-
- if (breg == LIMM_REG)
- {
- //GET_LIMM_32;
- size = 8;
- got_limm = 1;
-
- }
- else
- {
- }
-
- if (p == 0)
- {
-
- COMMON32_GET_creg
-
- if (creg == LIMM_REG)
- {
- if (!got_limm)
- {
- //GET_LIMM_32;
- size = 8;
- }
- }
- else
- {
- }
- }
- else if (p == 1)
- {
- }
- else if (p == 2)
- {
- }
- else if (p == 3)
- {
- }
-
- arcompact_log("unimplemented SR %08x", op);
- return m_pc + (size>>0);
-}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_29(OPS_32)
{
@@ -2102,123 +2206,15 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_helper(OPS_32, const c
}
-#define SETUP_HANDLE04_2f_0x_P00 \
- int size = 4; \
- UINT32 limm = 0; \
- \
- COMMON32_GET_breg; \
- COMMON32_GET_F; \
- COMMON32_GET_creg; \
- \
- UINT32 c; \
- \
- if (creg == LIMM_REG) \
- { \
- GET_LIMM_32; \
- size = 8; \
- c = limm; \
- } \
- else \
- { \
- c = m_regs[creg]; \
- } \
- /* todo: is the limm, limm syntax valid? (it's pointless.) */ \
- /* todo: if breg = 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_2f_00(OPS_32) { return arcompact_handle04_2f_helper(PARAMS, "ASL"); } // ASL
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_01(OPS_32) { return arcompact_handle04_2f_helper(PARAMS, "ASR"); } // ASR
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_02(OPS_32) { return arcompact_handle04_2f_helper(PARAMS, "LSR"); } // LSR
+
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_03(OPS_32) { return arcompact_handle04_2f_helper(PARAMS, "ROR"); } // ROR
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_04(OPS_32) { return arcompact_handle04_2f_helper(PARAMS, "RCC"); } // RCC
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_05(OPS_32) { return arcompact_handle04_2f_helper(PARAMS, "SEXB"); } // SEXB
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_06(OPS_32) { return arcompact_handle04_2f_helper(PARAMS, "SEXW"); } // SEXW
-// EXTB
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_07_p00(OPS_32) // note 'b' destination for 04_2f_07_xx group
-{
- SETUP_HANDLE04_2f_0x_P00;
-
- m_regs[breg] = c & 0x000000ff;
- if (F)
- {
- arcompact_fatal("arcompact_handle04_2f_08_p00 (EXTW) (F set)\n"); // not yet supported
- }
-
- return m_pc + (size >> 0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_07_p01(OPS_32)
-{
- int size = 4;
- arcompact_fatal("arcompact_handle04_2f_07_p01 (EXTB)\n");
- return m_pc + (size >> 0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_07_p10(OPS_32)
-{
- int size = 4;
- arcompact_fatal("illegal 04_2f_07_p10 (EXTB)\n"); // illegal mode because 'S' bits have already been used for opcode select
- return m_pc + (size >> 0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_07_p11_m0(OPS_32)
-{
- int size = 4;
- arcompact_fatal("arcompact_handle04_2f_07_p11_m0 (EXTB)\n"); // illegal mode because 'Q' bits have already been used for opcode select
- return m_pc + (size >> 0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_07_p11_m1(OPS_32)
-{
- int size = 4;
- arcompact_fatal("arcompact_handle04_2f_07_p11_m1 (EXTB)\n"); // illegal mode because 'Q' bits have already been used for opcode select
- return m_pc + (size >> 0);
-}
-
-// EXTW b <- c or EXTW b <- limm or EXTW limm <- c (no result) or EXTW limm, limm (invalid?)
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_08_p00(OPS_32) // note 'b' destination for 04_2f_08_xx group
-{
- SETUP_HANDLE04_2f_0x_P00;
-
- m_regs[breg] = c & 0x0000ffff;
- if (F)
- {
- arcompact_fatal("arcompact_handle04_2f_08_p00 (EXTW) (F set)\n"); // not yet supported
- }
-
- return m_pc + (size >> 0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_08_p01(OPS_32)
-{
- int size = 4;
- arcompact_fatal("arcompact_handle04_2f_08_p01 (EXTW)\n");
- return m_pc + (size >> 0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_08_p10(OPS_32)
-{
- int size = 4;
- arcompact_fatal("illegal 04_2f_08_p10 (EXTW)\n"); // illegal mode because 'S' bits have already been used for opcode select
- return m_pc + (size >> 0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_08_p11_m0(OPS_32)
-{
- int size = 4;
- arcompact_fatal("arcompact_handle04_2f_08_p11_m0 (EXTW)\n"); // illegal mode because 'Q' bits have already been used for opcode select
- return m_pc + (size >> 0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_08_p11_m1(OPS_32)
-{
- int size = 4;
- arcompact_fatal("arcompact_handle04_2f_08_p11_m1 (EXTW)\n"); // illegal mode because 'Q' bits have already been used for opcode select
- return m_pc + (size >> 0);
-}
-
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_09(OPS_32) { return arcompact_handle04_2f_helper(PARAMS, "ABS"); } // ABS
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_0a(OPS_32) { return arcompact_handle04_2f_helper(PARAMS, "NOT"); } // NOT
@@ -2444,42 +2440,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0d_helper(OPS_16, const char
}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0d_00(OPS_16) // ADD_S c, b, u3 (note, c destination)
-{
- int u, breg, creg;
-
- COMMON16_GET_u3;
- COMMON16_GET_breg;
- COMMON16_GET_creg;
-
- REG_16BIT_RANGE(breg);
- REG_16BIT_RANGE(creg);
-
- m_regs[creg] = m_regs[breg] + u;
-
- return m_pc + (2 >> 0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0d_01(OPS_16)
-{
- return arcompact_handle0d_helper(PARAMS, "SUB_S");
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0d_02(OPS_16) // ASL_S c, b asl u3 (note, c destination)
-{
- int u, breg, creg;
-
- COMMON16_GET_u3;
- COMMON16_GET_breg;
- COMMON16_GET_creg;
-
- REG_16BIT_RANGE(breg);
- REG_16BIT_RANGE(creg);
-
- m_regs[creg] = m_regs[breg] << u;
-
- return m_pc + (2 >> 0);
-}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0d_03(OPS_16)
{
@@ -2640,7 +2600,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_06(OPS_16) { return a
// Zero parameters (ZOP)
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_00(OPS_16) { arcompact_log("NOP_S"); return m_pc + (2 >> 0);}
+ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_00(OPS_16) { /*arcompact_log("NOP_S");*/ return m_pc + (2 >> 0);}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_01(OPS_16) { arcompact_log("UNIMP_S"); return m_pc + (2 >> 0);} // Unimplemented Instruction, same as illegal, but recommended to fill blank space
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_04(OPS_16) { arcompact_log("JEQ_S [blink]"); return m_pc + (2 >> 0);}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_05(OPS_16) { arcompact_log("JNE_S [blink]"); return m_pc + (2 >> 0);}
@@ -2670,115 +2630,29 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_0x_helper(OPS_16, const c
return m_pc + (2 >> 0);
}
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_02(OPS_16) // SUB_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_04(OPS_16) // AND_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_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); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_0c(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "MUL64_S",2); } // actual destination is special multiply registers
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_0d(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "SEXB_S",0); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_0e(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "SEXW_S",0); }
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_0f(OPS_16) // EXTB_S
-{
- int breg, creg;
-
- COMMON16_GET_breg;
- COMMON16_GET_creg;
-
- REG_16BIT_RANGE(breg);
- REG_16BIT_RANGE(creg);
-
- m_regs[breg] = m_regs[creg] & 0x000000ff;
- return m_pc + (2 >> 0);
-}
-
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_10(OPS_16) // EXTW_S
-{
- int breg, creg;
-
- COMMON16_GET_breg;
- COMMON16_GET_creg;
-
- REG_16BIT_RANGE(breg);
- REG_16BIT_RANGE(creg);
-
- m_regs[breg] = m_regs[creg] & 0x0000ffff;
-
- return m_pc + (2 >> 0);
-}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_11(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "ABS_S",0); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_12(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "NOT_S",0); }
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_13(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "NEG_S",0); }
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_14(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "ADD1_S",0); }
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_15(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "ADD2_S",0); }
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_16(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "ADD3_S",0); }
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_18(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "ASL_S",0); }
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_19(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "LSR_S",0); }
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1a(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "ASR_S",0); }
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1b(OPS_16) // ASL b, c asl 1 (can also be impleneted as b = c + c)
-{
- int breg, creg;
- COMMON16_GET_breg;
- COMMON16_GET_creg;
-
- REG_16BIT_RANGE(breg);
- REG_16BIT_RANGE(creg);
+ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_18(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "ASL_S",0); }
- m_regs[breg] = m_regs[creg] << 1;
+ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1a(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "ASR_S",0); }
- return m_pc + (2 >> 0);
-}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1c(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "ASR1_S",0); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1d(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "LSR1_S",0); }
@@ -3267,7 +3141,20 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_0x_helper(OPS_16, cons
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_00(OPS_16) { return arcompact_handle1e_03_0x_helper(PARAMS, "BGT_S"); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_01(OPS_16) { return arcompact_handle1e_03_0x_helper(PARAMS, "BGE_S"); }
-ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_02(OPS_16) { return arcompact_handle1e_03_0x_helper(PARAMS, "BLT_S"); }
+
+ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_02(OPS_16) // BLT_S
+{
+ if (CONDITION_LT)
+ {
+ int s = (op & 0x003f) >> 0; op &= ~0x003f;
+ if (s & 0x020) s = -0x20 + (s & 0x1f);
+ UINT32 realaddress = PC_ALIGNED32 + (s * 2);
+ //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link
+ return realaddress;
+ }
+
+ return m_pc + (2 >> 0);
+}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_03(OPS_16) // BLE_S
{