diff --git a/src/emu/cpu/arcompact/arcompact.h b/src/emu/cpu/arcompact/arcompact.h index cffbbb4f001..d1d42f8380e 100644 --- a/src/emu/cpu/arcompact/arcompact.h +++ b/src/emu/cpu/arcompact/arcompact.h @@ -146,7 +146,7 @@ protected: ARCOMPACT_RETTYPE arcompact_handle01_01_01_0f(OPS_32); ARCOMPACT_RETTYPE arcompact_handle02(OPS_32); ARCOMPACT_RETTYPE arcompact_handle03(OPS_32); - ARCOMPACT_RETTYPE arcompact_handle04_00(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_00(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_01(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_02(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_03(OPS_32); @@ -767,10 +767,9 @@ protected: ARCOMPACT_RETTYPE get_insruction(OPS_32); - - ARCOMPACT_HANDLER04_TYPE_PM(04_20); + ARCOMPACT_HANDLER04_TYPE_PM(04_00); ARCOMPACT_HANDLER04_TYPE_PM(04_0a); - + ARCOMPACT_HANDLER04_TYPE_PM(04_20); private: address_space_config m_program_config; diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index 5f7348790f9..19d46c3afe4 100644 --- a/src/emu/cpu/arcompact/arcompact_execute.c +++ b/src/emu/cpu/arcompact/arcompact_execute.c @@ -1288,7 +1288,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_05(OPS_32) // regis b = limm; } - // BRHS + // BRHS" if (b >= c) // check { // take jump @@ -1510,11 +1510,86 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_helper(OPS_32, const char return m_pc + (size>>0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00(OPS_32) + +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p00(OPS_32) { - return arcompact_handle04_helper(PARAMS, opcodes_04[0x00], /*"ADD"*/ 0,0); + int size = 4; + UINT32 limm = 0; + int got_limm = 0; + + COMMON32_GET_breg; + COMMON32_GET_F; + COMMON32_GET_creg + COMMON32_GET_areg + + UINT32 b, c; + + if (breg == LIMM_REG) + { + GET_LIMM_32; + size = 8; + got_limm = 1; + b = limm; + } + else + { + b = m_regs[breg]; + } + + if (creg == LIMM_REG) + { + if (!got_limm) + { + GET_LIMM_32; + size = 8; + } + c = limm; + } + else + { + c = m_regs[creg]; + } + + // 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?) + m_regs[areg] = b + c; + + if (F) + { + arcompact_fatal("arcompact_handle04_00_p00 (ADD) (F set)\n"); // not yet supported + } + + return m_pc + (size >> 0); } +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p01(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handle04_00_p01 (ADD)\n"); + return m_pc + (size >> 0); +} + +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p10(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handle04_00_p10 (ADD)\n"); + return m_pc + (size >> 0); +} + +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p11_m0(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handle04_00_p11_m0 (ADD)\n"); + return m_pc + (size >> 0); +} + +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p11_m1(OPS_32) +{ + int size = 4; + arcompact_fatal("arcompact_handle04_00_p11_m1 (ADD)\n"); + return m_pc + (size >> 0); +} + + ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_01(OPS_32) { return arcompact_handle04_helper(PARAMS, opcodes_04[0x01], /*"ADC"*/ 0,0); diff --git a/src/emu/cpu/arcompact/arcompactdasm_ops.c b/src/emu/cpu/arcompact/arcompactdasm_ops.c index 91b0c87e02b..22d1a783891 100644 --- a/src/emu/cpu/arcompact/arcompactdasm_ops.c +++ b/src/emu/cpu/arcompact/arcompactdasm_ops.c @@ -404,24 +404,11 @@ int arcompact_handle04_p00_helper_dasm(DASM_OPS_32, const char* optext, int igno // output += sprintf( output, " p(%d)", p); - if (!b_reserved) + if ((!b_reserved) && (breg == LIMM_REG)) { - if (breg == LIMM_REG) - { - GET_LIMM_32; - size = 8; - got_limm = 1; - output += sprintf(output, " 0x%08x ", limm); - - } - else - { - output += sprintf(output, " %s, ", regnames[breg]); - } - } - else - { - if (breg) output += sprintf(output, "reserved(%s), ", regnames[breg]); + GET_LIMM_32; + size = 8; + got_limm = 1; } if (creg == LIMM_REG) @@ -431,42 +418,42 @@ int arcompact_handle04_p00_helper_dasm(DASM_OPS_32, const char* optext, int igno GET_LIMM_32; size = 8; } + } - output += sprintf(output, " 0x%08x ", limm); - if (ignore_dst == 0) - { - if (areg != LIMM_REG) output += sprintf(output, "DST(%s)", regnames[areg]); - else output += sprintf(output, ""); - } + // areg can be LIMM too, but in that case LIMM indicates 'no destination' rather than an actual LIMM value following + + if (ignore_dst == 0) + { + if (areg != LIMM_REG) output += sprintf(output, " %s <-", regnames[areg]); + else output += sprintf(output, " <-"); + } + else if (ignore_dst == 1) // certain opcode types ignore the 'a' field entirely, it should be set to 0. + { + if (areg) output += sprintf(output, " <-", areg); + } + else if (ignore_dst == 2) // for multiply operations areg should always be set to LIMM + { + if (areg != LIMM_REG) output += sprintf(output, " <-", areg); + else output += sprintf(output, " <-"); + } + + if (!b_reserved) + { + if (breg == LIMM_REG) + output += sprintf(output, " 0x%08x,", limm); else - { - if (ignore_dst == 1) { if (areg) output += sprintf(output, "unused(%s)", regnames[areg]); } - else - { - if (areg != LIMM_REG) output += sprintf(output, "invalid(%s)", regnames[areg]); - else output += sprintf(output, ""); - } // mul operations expect A to be set to LIMM (no output) - } + output += sprintf(output, " %s,", regnames[breg]); } else { - output += sprintf(output, "C(%s) ", regnames[creg]); - if (ignore_dst == 0) - { - if (areg != LIMM_REG) output += sprintf(output, "DST(%s)", regnames[areg]); - else output += sprintf(output, ""); - } - else - { - if (ignore_dst == 1) { if (areg) output += sprintf(output, "unused(%s)", regnames[areg]); } - else - { - if (areg != LIMM_REG) output += sprintf(output, "invalid(%s)", regnames[areg]); - else output += sprintf(output, ""); - } // mul operations expect A to be set to LIMM (no output) - } - + if (breg) output += sprintf(output, ",", breg); } + + if (creg == LIMM_REG) + output += sprintf(output, " 0x%08x", limm); + else + output += sprintf(output, " %s", regnames[creg]); + return size; }