From 345997fc5dd4d67a0868c8ba576e47698f68fb56 Mon Sep 17 00:00:00 2001 From: mamehaze Date: Sun, 21 Dec 2014 15:53:34 +0000 Subject: arcompact: execute first few MOVs (nw) --- src/emu/cpu/arcompact/arcompact.h | 17 ++-- src/emu/cpu/arcompact/arcompact_common.c | 12 +-- src/emu/cpu/arcompact/arcompact_execute.c | 160 ++++++++++++++++++++++++++++-- src/emu/cpu/arcompact/arcompactdasm_ops.c | 2 +- 4 files changed, 169 insertions(+), 22 deletions(-) diff --git a/src/emu/cpu/arcompact/arcompact.h b/src/emu/cpu/arcompact/arcompact.h index 4b70e2767dc..de16973f9bf 100644 --- a/src/emu/cpu/arcompact/arcompact.h +++ b/src/emu/cpu/arcompact/arcompact.h @@ -18,7 +18,7 @@ #define ARCOMPACT_HANDLER04_P11_TYPE(name) \ -ARCOMPACT_RETTYPE arcompact_handle##name##_p11(OPS_16) \ +ARCOMPACT_RETTYPE arcompact_handle##name##_p11(OPS_32) \ { \ int M = (op & 0x00000020) >> 5; \ \ @@ -32,7 +32,7 @@ ARCOMPACT_RETTYPE arcompact_handle##name##_p11(OPS_16) \ }; \ #define ARCOMPACT_HANDLER04_TYPE(name) \ -ARCOMPACT_RETTYPE arcompact_handle##name(OPS_16) \ +ARCOMPACT_RETTYPE arcompact_handle##name(OPS_32) \ { \ int p = (op & 0x00c00000) >> 22; \ \ @@ -49,11 +49,11 @@ ARCOMPACT_RETTYPE arcompact_handle##name(OPS_16) \ #define ARCOMPACT_HANDLER04_TYPE_PM(name) \ - ARCOMPACT_RETTYPE arcompact_handle##name##_p00(OPS_16); \ - ARCOMPACT_RETTYPE arcompact_handle##name##_p01(OPS_16); \ - ARCOMPACT_RETTYPE arcompact_handle##name##_p10(OPS_16); \ - ARCOMPACT_RETTYPE arcompact_handle##name##_p11_m0(OPS_16); \ - ARCOMPACT_RETTYPE arcompact_handle##name##_p11_m1(OPS_16); \ + ARCOMPACT_RETTYPE arcompact_handle##name##_p00(OPS_32); \ + ARCOMPACT_RETTYPE arcompact_handle##name##_p01(OPS_32); \ + ARCOMPACT_RETTYPE arcompact_handle##name##_p10(OPS_32); \ + ARCOMPACT_RETTYPE arcompact_handle##name##_p11_m0(OPS_32); \ + ARCOMPACT_RETTYPE arcompact_handle##name##_p11_m1(OPS_32); \ ARCOMPACT_HANDLER04_P11_TYPE(name); \ ARCOMPACT_HANDLER04_TYPE(name); \ @@ -156,7 +156,7 @@ protected: ARCOMPACT_RETTYPE arcompact_handle04_07(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_08(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_09(OPS_32); - ARCOMPACT_RETTYPE arcompact_handle04_0a(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_0a(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_0b(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_0c(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_0d(OPS_32); @@ -769,6 +769,7 @@ protected: ARCOMPACT_HANDLER04_TYPE_PM(04_20); + ARCOMPACT_HANDLER04_TYPE_PM(04_0a); private: diff --git a/src/emu/cpu/arcompact/arcompact_common.c b/src/emu/cpu/arcompact/arcompact_common.c index bd2e9e55a62..c2c12208b1e 100644 --- a/src/emu/cpu/arcompact/arcompact_common.c +++ b/src/emu/cpu/arcompact/arcompact_common.c @@ -337,12 +337,12 @@ const char *regnames[0x40] = /* 17 */ "r23", /* 18 */ "r24", /* 19 */ "r25", - /* 1a */ "r26(GP)", - /* 1b */ "r27(FP)", - /* 1c */ "r28(SP)", - /* 1d */ "r29(ILINK1)", - /* 1e */ "r30(ILINK2)", - /* 1f */ "r31(BLINK)", + /* 1a */ "r26_GP", + /* 1b */ "r27_FP", + /* 1c */ "r28_SP", + /* 1d */ "r29_ILINK1", + /* 1e */ "r30_ILINK2", + /* 1f */ "r31_BLINK", /* 20 */ "r32(ext)", /* 21 */ "r33(ext)", diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index 74835fd6ab3..cf0c0fc602d 100644 --- a/src/emu/cpu/arcompact/arcompact_execute.c +++ b/src/emu/cpu/arcompact/arcompact_execute.c @@ -4,7 +4,7 @@ #include "arcompact.h" #include "arcompact_common.h" -#define ARCOMPACT_LOGGING 0 +#define ARCOMPACT_LOGGING 1 #define arcompact_fatal if (ARCOMPACT_LOGGING) fatalerror #define arcompact_log if (ARCOMPACT_LOGGING) fatalerror @@ -1392,10 +1392,102 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_09(OPS_32) } +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p00(OPS_32) +{ + // p00 formats not listed in appendix? + + int size = 4; + UINT32 limm = 0; + int got_limm = 0; + + COMMON32_GET_breg + COMMON32_GET_creg + COMMON32_GET_F + + if (creg == LIMM_REG) + { + // opcode iiii iBBB ppII IIII FBBB CCCC CC-- ---- + // MOV b <- limm 0010 0RRR 0000 1010 0RRR 1111 10RR RRRR [LIMM] (creg = LIMM) + // MOV.F b <- limm 0010 0RRR 0000 1010 1RRR 1111 10RR RRRR [LIMM] (creg = LIMM) + + if (!got_limm) + { + GET_LIMM_32; + size = 8; + } + + m_regs[breg] = limm; + + if (F) + { // currently not supported + arcompact_fatal("unimplemented MOV.F %08x", op); + } + + return m_pc + (size>>0); + + } + else + { + // opcode iiii iBBB ppII IIII FBBB CCCC CC-- ---- + // MOV b <- c 0010 0RRR 0000 1010 0RRR cccc ccRR RRRR + // MOV.F b <- c 0010 0RRR 0000 1010 1RRR cccc ccRR RRRR + + arcompact_fatal("unimplemented MOV b <- c %08x", op); + } + + return m_pc + (size>>0); + +} + +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p01(OPS_32) +{ + // opcode iiii i--- ppII IIII F--- uuuu uu-- ---- + // MOV b <- u6 0010 0RRR 0100 1010 0RRR uuuu uuRR RRRR + // MOV.F b <- u6 0010 0RRR 0100 1010 1RRR uuuu uuRR RRRR + + int size = 4; + + COMMON32_GET_breg + COMMON32_GET_u6 + COMMON32_GET_F + + m_regs[breg] = u; + + if (F) + { // currently not supported + arcompact_fatal("unimplemented MOV.F b <- u6 %08x", op); + } + + return m_pc + (size>>0); +} + +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); +} + +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p11_m0(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handle04_0a_p11_m0\n"); + return m_pc + (size >> 0); +} + +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p11_m1(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handle04_0a_p11_m1\n"); + return m_pc + (size >> 0); +} + +#if 0 ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a(OPS_32) { return arcompact_handle04_helper(PARAMS, opcodes_04[0x0a], /*"MOV"*/ 1,0); } +#endif ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0b(OPS_32) { @@ -1492,9 +1584,44 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1d(OPS_32) return arcompact_handle04_helper(PARAMS, opcodes_04[0x1d], /*"MPYU"*/ 0,0); } // * +/* handler template for c+p +ARCOMPACT_RETTYPE arcompact_device::arcompact_handleXX_xx_p00(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handleXX_xx_p00\n"); + return m_pc + (size >> 0); +} +ARCOMPACT_RETTYPE arcompact_device::arcompact_handleXX_xx_p01(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handleXX_xx_p01\n"); + return m_pc + (size >> 0); +} + +ARCOMPACT_RETTYPE arcompact_device::arcompact_handleXX_xx_p10(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handleXX_xx_p10\n"); + return m_pc + (size >> 0); +} + +ARCOMPACT_RETTYPE arcompact_device::arcompact_handleXX_xx_p11_m0(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handleXX_xx_p11_m0\n"); + return m_pc + (size >> 0); +} -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p00(OPS_16) +ARCOMPACT_RETTYPE arcompact_device::arcompact_handleXX_xx_p11_m1(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handleXX_xx_p11_m1\n"); + return m_pc + (size >> 0); +} +*/ + +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p00(OPS_32) { int size = 4; UINT32 limm = 0; @@ -1502,8 +1629,11 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p00(OPS_16) COMMON32_GET_creg - if (creg == LIMM_REG) + if (creg == LIMM_REG) { + // opcode iiii i--- ppII IIII F--- CCCC CC-- ---- + // J limm 0010 0RRR 0010 0000 0RRR 1111 10RR RRRR [LIMM] (creg = LIMM) + if (!got_limm) { GET_LIMM_32; @@ -1514,28 +1644,37 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p00(OPS_16) } else { + // opcode iiii i--- ppII IIII F--- CCCC CC-- ---- + // J [c] 0010 0RRR 0010 0000 0RRR CCCC CCRR RRRR + // 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); } return m_pc + (size>>0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p01(OPS_16) +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); return m_pc + (size>>0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p10(OPS_16) +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); return m_pc + (size>>0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m0(OPS_16) +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m0(OPS_32) { int size = 4; // UINT32 limm = 0; @@ -1545,6 +1684,8 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m0(OPS_16) if (creg == LIMM_REG) { + // opcode iiii i--- ppII IIII F--- cccc ccmq qqqq + // Jcc limm 0010 0RRR 1110 0000 0RRR 1111 100Q QQQQ [LIUMM] if (!got_limm) { //GET_LIMM_32; @@ -1555,13 +1696,18 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m0(OPS_16) } 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); } return m_pc + (size>>0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m1(OPS_16) +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); return m_pc + (size>>0); diff --git a/src/emu/cpu/arcompact/arcompactdasm_ops.c b/src/emu/cpu/arcompact/arcompactdasm_ops.c index 2dff4e1fc2f..a3a2b2fbd0e 100644 --- a/src/emu/cpu/arcompact/arcompactdasm_ops.c +++ b/src/emu/cpu/arcompact/arcompactdasm_ops.c @@ -505,7 +505,7 @@ int arcompact_handle04_p01_helper_dasm(DASM_OPS_32, const char* optext, int igno if (breg) output += sprintf(output, "reserved(%s), ", regnames[breg]); } - output += sprintf(output, "U(%02x) ", u); + output += sprintf(output, " 0x%02x ", u); if (ignore_dst == 0) { if (areg != LIMM_REG) output += sprintf(output, "DST(%s)", regnames[areg]); -- cgit v1.2.3