From bd420ede9a9e7bb323d9033944d67bae0aee6cd3 Mon Sep 17 00:00:00 2001 From: mamehaze Date: Fri, 26 Dec 2014 18:21:25 +0000 Subject: [PATCH 01/23] arcompact (nw) --- src/emu/cpu/arcompact/arcompact.h | 3 + src/emu/cpu/arcompact/arcompact_common.h | 2 + src/emu/cpu/arcompact/arcompact_execute.c | 96 +++++++++++++++++++++-- 3 files changed, 95 insertions(+), 6 deletions(-) diff --git a/src/emu/cpu/arcompact/arcompact.h b/src/emu/cpu/arcompact/arcompact.h index ec643f554f8..3e5fdb677d6 100644 --- a/src/emu/cpu/arcompact/arcompact.h +++ b/src/emu/cpu/arcompact/arcompact.h @@ -803,6 +803,8 @@ private: inline void WRITE16(UINT32 address, UINT16 data){ m_program->write_word(address << 1, data); } inline UINT8 READ8(UINT32 address) { return m_program->read_byte(address << 0); } inline void WRITE8(UINT32 address, UINT8 data){ m_program->write_byte(address << 0, data); } + + int check_condition(UINT8 condition); UINT32 m_regs[0x40]; @@ -842,6 +844,7 @@ private: // Condition 0x0c (LE) #define CONDITION_LE ((STATUS32_CHECK_Z) || (STATUS32_CHECK_N && !STATUS32_CHECK_V) || (!STATUS32_CHECK_N && STATUS32_CHECK_V)) // Z or (N and /V) or (/N and V) +#define CONDITION_EQ (STATUS32_CHECK_Z) extern const device_type ARCA5; diff --git a/src/emu/cpu/arcompact/arcompact_common.h b/src/emu/cpu/arcompact/arcompact_common.h index 8b7c4912cdf..f6d8c922a12 100644 --- a/src/emu/cpu/arcompact/arcompact_common.h +++ b/src/emu/cpu/arcompact/arcompact_common.h @@ -17,3 +17,5 @@ extern const char *opcodes_04[0x40]; #define REG_BLINK (0x1f) // r31 #define REG_SP (0x1c) // r28 +#define REG_ILINK1 (0x1d) // r29 +#define REG_ILINK2 (0x1e) // r30 diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index bfb3b1e6cca..93bccbe7cd1 100644 --- a/src/emu/cpu/arcompact/arcompact_execute.c +++ b/src/emu/cpu/arcompact/arcompact_execute.c @@ -129,6 +129,49 @@ 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: fatalerror("unhandled condition check %s", conditions[condition]); return -1; + case 0x03: fatalerror("unhandled condition check %s", conditions[condition]); return -1; + case 0x04: fatalerror("unhandled condition check %s", conditions[condition]); return -1; + case 0x05: fatalerror("unhandled condition check %s", conditions[condition]); return -1; + 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) { @@ -1883,13 +1926,17 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p10(OPS_32) } -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 +1944,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 +2002,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); } From 086a3d2933d6e0a51a78f090ae402a658c28ecd4 Mon Sep 17 00:00:00 2001 From: mamehaze Date: Fri, 26 Dec 2014 21:34:33 +0000 Subject: [PATCH 02/23] arcompact (nw) --- src/emu/cpu/arcompact/arcompact_execute.c | 72 ++++----- src/emu/cpu/arcompact/arcompact_make.py | 178 +++++++++++++--------- src/emu/cpu/arcompact/arcompactdasm_ops.c | 2 +- 3 files changed, 132 insertions(+), 120 deletions(-) diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index 93bccbe7cd1..38695ee1396 100644 --- a/src/emu/cpu/arcompact/arcompact_execute.c +++ b/src/emu/cpu/arcompact/arcompact_execute.c @@ -135,8 +135,7 @@ int arcompact_device::check_condition(UINT8 condition) { case 0x00: return 1; // AL case 0x01: return CONDITION_EQ; - - case 0x02: fatalerror("unhandled condition check %s", conditions[condition]); return -1; + case 0x02: return !CONDITION_EQ; // NE case 0x03: fatalerror("unhandled condition check %s", conditions[condition]); return -1; case 0x04: fatalerror("unhandled condition check %s", conditions[condition]); return -1; case 0x05: fatalerror("unhandled condition check %s", conditions[condition]); return -1; @@ -1144,8 +1143,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); } @@ -2219,47 +2244,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_04(OPS_32) { return a 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 diff --git a/src/emu/cpu/arcompact/arcompact_make.py b/src/emu/cpu/arcompact/arcompact_make.py index 54ce75b842a..0cd5904845e 100644 --- a/src/emu/cpu/arcompact/arcompact_make.py +++ b/src/emu/cpu/arcompact/arcompact_make.py @@ -32,7 +32,7 @@ def EmitGroup04_Flaghandler(f,funcname, opname, flagcondition, flaghandler): flaghandler(f, funcname, opname) print >>f, " }" -def EmitGroup04(f,funcname, opname, opexecute, ignore_a, breg_is_dst_only, flagcondition, flaghandler): +def EmitGroup04(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, breg_is_dst_only, flagcondition, flaghandler): # the mode 0x00 handler print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p00(OPS_32)" % (funcname) print >>f, "{" @@ -53,7 +53,9 @@ def EmitGroup04(f,funcname, opname, opexecute, ignore_a, breg_is_dst_only, flagc print >>f, " COMMON32_GET_areg;" elif ignore_a == 1: print >>f, " //COMMON32_GET_areg; // areg is reserved / not used" - + elif ignore_a == 2: + print >>f, " //COMMON32_GET_areg; // areg bits already used as opcode select" + print >>f, " " print >>f, " UINT32 c;" @@ -89,6 +91,7 @@ def EmitGroup04(f,funcname, opname, opexecute, ignore_a, breg_is_dst_only, flagc print >>f, " /* todo: is the limm, limm syntax valid? (it's pointless.) */" print >>f, " /* 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?) */" print >>f, " %s" % (opexecute) + print >>f, " %s" % (opwrite) print >>f, " " EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler) print >>f, " return m_pc + (size >> 0);" @@ -116,6 +119,8 @@ def EmitGroup04(f,funcname, opname, opexecute, ignore_a, breg_is_dst_only, flagc print >>f, " COMMON32_GET_areg;" elif ignore_a == 1: print >>f, " //COMMON32_GET_areg; // areg is reserved / not used" + elif ignore_a == 2: + print >>f, " //COMMON32_GET_areg; // areg bits already used as opcode select" print >>f, " " @@ -141,6 +146,7 @@ def EmitGroup04(f,funcname, opname, opexecute, ignore_a, breg_is_dst_only, flagc print >>f, " " print >>f, " /* 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?) */" print >>f, " %s" % (opexecute) + print >>f, " %s" % (opwrite) print >>f, " " EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler) print >>f, " return m_pc + (size >> 0);" @@ -149,73 +155,91 @@ def EmitGroup04(f,funcname, opname, opexecute, ignore_a, breg_is_dst_only, flagc print >>f, "" # the mode 0x10 handler print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p10(OPS_32)" % (funcname) - print >>f, "{" - print >>f, " int size = 4;" - - if breg_is_dst_only == 0: - print >>f, " UINT32 limm = 0;" - - print >>f, "/* int got_limm = 0; */" - print >>f, " " - print >>f, " COMMON32_GET_breg;" - - if flagcondition == -1: - print >>f, " COMMON32_GET_F;" - - print >>f, " COMMON32_GET_s12;" - - if ignore_a == 0: - print >>f, " COMMON32_GET_areg;" - elif ignore_a == 1: - print >>f, " //COMMON32_GET_areg; // areg is reserved / not used" - - print >>f, " " - print >>f, " UINT32 c;" - if breg_is_dst_only == 0: - print >>f, " UINT32 b;" + if ignore_a == 2: + print >>f, "{" + print >>f, " int size = 4;" + print >>f, " arcompact_fatal(\"illegal arcompact_handle%s_p10 (ares bits already used as opcode select, can't be used as s12) (%s)\\n\");" % (funcname, opname) + print >>f, " return m_pc + (size >> 0);" + print >>f, "}" + else: + print >>f, "{" + print >>f, " int size = 4;" + if breg_is_dst_only == 0: + print >>f, " UINT32 limm = 0;" + + print >>f, "/* int got_limm = 0; */" print >>f, " " - print >>f, " /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */" - print >>f, " if (breg == LIMM_REG)" - print >>f, " {" - print >>f, " GET_LIMM_32;" - print >>f, " size = 8;" - print >>f, "/* got_limm = 1; */" - print >>f, " b = limm;" - print >>f, " }" - print >>f, " else" - print >>f, " {" - print >>f, " b = m_regs[breg];" - print >>f, " }" + print >>f, " COMMON32_GET_breg;" - print >>f, " " - print >>f, " c = (UINT32)S;" - print >>f, " " - print >>f, " /* 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?) */" - print >>f, " %s" % (opexecute) - print >>f, " " - EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + if flagcondition == -1: + print >>f, " COMMON32_GET_F;" + + print >>f, " COMMON32_GET_s12;" + + # areg can't be used here, it's used for s12 bits + + print >>f, " " + print >>f, " UINT32 c;" + if breg_is_dst_only == 0: + print >>f, " UINT32 b;" + print >>f, " " + print >>f, " /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */" + print >>f, " if (breg == LIMM_REG)" + print >>f, " {" + print >>f, " GET_LIMM_32;" + print >>f, " size = 8;" + print >>f, "/* got_limm = 1; */" + print >>f, " b = limm;" + print >>f, " }" + print >>f, " else" + print >>f, " {" + print >>f, " b = m_regs[breg];" + print >>f, " }" + + print >>f, " " + print >>f, " c = (UINT32)S;" + print >>f, " " + print >>f, " /* 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?) */" + print >>f, " %s" % (opexecute) + print >>f, " %s" % (opwrite_alt) + print >>f, " " + EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler) + print >>f, " return m_pc + (size >> 0);" + print >>f, "}" + print >>f, "" + print >>f, "" # the mode 0x11 m0 handler print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p11_m0(OPS_32)" % (funcname) - print >>f, "{" - print >>f, " int size = 4;" - print >>f, " arcompact_fatal(\"arcompact_handle%s_p11_m0 (%s)\\n\");" % (funcname, opname) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + if ignore_a == 2: + print >>f, "{" + print >>f, " int size = 4;" + print >>f, " arcompact_fatal(\"illegal arcompact_handle%s_p11_m0 (ares bits already used as opcode select, can't be used as Q condition) (%s)\\n\");" % (funcname, opname) + print >>f, " return m_pc + (size >> 0);" + print >>f, "}" + else: + print >>f, "{" + print >>f, " int size = 4;" + print >>f, " arcompact_fatal(\"arcompact_handle%s_p11_m0 (%s)\\n\");" % (funcname, opname) + print >>f, " return m_pc + (size >> 0);" + print >>f, "}" + print >>f, "" + print >>f, "" # the mode 0x11 m1 handler print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p11_m1(OPS_32)" % (funcname) - print >>f, "{" - print >>f, " int size = 4;" - print >>f, " arcompact_fatal(\"arcompact_handle%s_p11_m1 (%s)\\n\");" % (funcname, opname) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + if ignore_a == 2: + print >>f, "{" + print >>f, " int size = 4;" + print >>f, " arcompact_fatal(\"illegal arcompact_handle%s_p11_m1 (ares bits already used as opcode select, can't be used as Q condition) (%s)\\n\");" % (funcname, opname) + print >>f, " return m_pc + (size >> 0);" + print >>f, "}" + else: + print >>f, "{" + print >>f, " int size = 4;" + print >>f, " arcompact_fatal(\"arcompact_handle%s_p11_m1 (%s)\\n\");" % (funcname, opname) + print >>f, " return m_pc + (size >> 0);" + print >>f, "}" + print >>f, "" + print >>f, "" # xxx_S b, b, u5 format opcodes def EmitGroup17(f,funcname, opname, opexecute): @@ -244,25 +268,29 @@ except Exception, err: sys.exit(1) -EmitGroup04(f, "04_00", "ADD", "UINT32 result = b + c; m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_00", "ADD", "UINT32 result = b + c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_02", "SUB", "UINT32 result = b - c; m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_02", "SUB", "UINT32 result = b - c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_04", "AND", "UINT32 result = b & c; m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_05", "OR", "UINT32 result = b | c; m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_06", "BIC", "UINT32 result = b & (~c); m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_07", "XOR", "UINT32 result = b ^ c; m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_04", "AND", "UINT32 result = b & c;", "if (areg != LIMM_REG) { m_regs[areg] = result; }", "if (breg != LIMM_REG) { m_regs[breg] = result; }", 0,0, -1, EmitGroup04_Handle_NZ_Flags ) +EmitGroup04(f, "04_05", "OR", "UINT32 result = b | c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_06", "BIC", "UINT32 result = b & (~c);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_07", "XOR", "UINT32 result = b ^ c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_0a", "MOV", "UINT32 result = c; m_regs[breg] = result;", 1,1, -1, EmitGroup04_Handle_NZ_Flags ) +EmitGroup04(f, "04_0a", "MOV", "UINT32 result = c;", "m_regs[breg] = result;", "m_regs[breg] = result;", 1,1, -1, EmitGroup04_Handle_NZ_Flags ) # special case, result always goes to breg -EmitGroup04(f, "04_0f", "BSET", "UINT32 result = b | (1 << (c & 0x1f)); m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_0f", "BSET", "UINT32 result = b | (1 << (c & 0x1f));", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_15", "ADD2", "UINT32 result = b + (c << 2); m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_16", "ADD3", "UINT32 result = b + (c << 3); m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_15", "ADD2", "UINT32 result = b + (c << 2);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_16", "ADD3", "UINT32 result = b + (c << 3);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "05_00", "ASL", "UINT32 result = b << (c&0x1f); m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "05_01", "LSR", "UINT32 result = b >> (c&0x1f); m_regs[areg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "05_00", "ASL", "UINT32 result = b << (c&0x1f);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "05_01", "LSR", "UINT32 result = b >> (c&0x1f);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) + +# the 04_2f subgroup uses the same encoding, but the areg is already used as sub-opcode select, so any modes relying on areg bits for other reasons (sign, condition) (modes 10, 11m0, 11m1) are illegal. the destination is also breg not areg +EmitGroup04(f, "04_2f_07", "EXTB", "UINT32 result = c & 0x000000ff;", "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_unsupported_Flags ) # no alt handler (invalid path) + # xxx_S b, b, u5 format opcodes EmitGroup17(f, "17_00", "ASL_S", "m_regs[breg] = m_regs[breg] << (u&0x1f);" ) diff --git a/src/emu/cpu/arcompact/arcompactdasm_ops.c b/src/emu/cpu/arcompact/arcompactdasm_ops.c index b630a28a152..20e413b7b60 100644 --- a/src/emu/cpu/arcompact/arcompactdasm_ops.c +++ b/src/emu/cpu/arcompact/arcompactdasm_ops.c @@ -129,7 +129,7 @@ int arcompact_handle00_00_dasm(DASM_OPS_32) // 0000 0sss ssss sss0 SSSS SSSS SSNQ QQQQ INT32 address = (op & 0x07fe0000) >> 17; address |= ((op & 0x0000ffc0) >> 6) << 10; - if (address & 0x800000) address = -0x800000 + (address & 0x7fffff); + if (address & 0x80000) address = -0x80000 + (address & 0x7ffff); int n = (op & 0x00000020) >> 5; op &= ~0x00000020; COMMON32_GET_CONDITION From c640f66a7a251c5e7afaa9576c79ee6f9073e542 Mon Sep 17 00:00:00 2001 From: mariuszw Date: Sat, 27 Dec 2014 00:04:18 +0100 Subject: [PATCH 03/23] New clones added -------------------- Dominos 4 (Coctail) [Mariusz Wojcieszek] --- src/mame/drivers/sprint2.c | 86 ++++++++++++++++++++++++++++--------- src/mame/includes/sprint2.h | 3 ++ src/mame/mame.lst | 1 + 3 files changed, 70 insertions(+), 20 deletions(-) diff --git a/src/mame/drivers/sprint2.c b/src/mame/drivers/sprint2.c index 26bff4ed055..8bfed5bd433 100644 --- a/src/mame/drivers/sprint2.c +++ b/src/mame/drivers/sprint2.c @@ -39,6 +39,14 @@ DRIVER_INIT_MEMBER(sprint2_state,dominos) m_game = 3; } +DRIVER_INIT_MEMBER(sprint2_state,dominos4) +{ + m_game = 3; + m_maincpu->space(AS_PROGRAM).install_read_port(0x0880, 0x0880, "SELFTTEST"); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x0c50, 0x0c5f, write8_delegate(FUNC(sprint2_state::dominos4_lamp3_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x0c60, 0x0c6f, write8_delegate(FUNC(sprint2_state::dominos4_lamp4_w),this)); +} + int sprint2_state::service_mode() { UINT8 v = ioport("INB")->read(); @@ -234,8 +242,17 @@ WRITE8_MEMBER(sprint2_state::sprint2_lamp2_w) set_led_status(machine(), 1, offset & 1); } +WRITE8_MEMBER(sprint2_state::dominos4_lamp3_w) +{ + set_led_status(machine(), 2, offset & 1); +} +WRITE8_MEMBER(sprint2_state::dominos4_lamp4_w) +{ + set_led_status(machine(), 3, offset & 1); +} static ADDRESS_MAP_START( sprint2_map, AS_PROGRAM, 8, sprint2_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3fff) AM_RANGE(0x0000, 0x03ff) AM_READWRITE(sprint2_wram_r,sprint2_wram_w) AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(sprint2_video_ram_w) AM_SHARE("video_ram") AM_RANGE(0x0818, 0x081f) AM_READ(sprint2_input_A_r) @@ -261,7 +278,6 @@ static ADDRESS_MAP_START( sprint2_map, AS_PROGRAM, 8, sprint2_state ) AM_RANGE(0x1400, 0x17ff) AM_READ(sprint2_collision2_r) AM_RANGE(0x1800, 0x1800) AM_READNOP /* debugger ROM location? */ AM_RANGE(0x2000, 0x3fff) AM_ROM - AM_RANGE(0xe000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -441,6 +457,32 @@ static INPUT_PORTS_START( dominos ) PORT_ADJUSTER( 50, "R23 - Tone Freq" ) INPUT_PORTS_END +static INPUT_PORTS_START( dominos4 ) + PORT_INCLUDE(dominos) + + PORT_MODIFY("INA") /* input A */ + PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) + PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) + PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) + PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) + PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) + PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) + PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) + PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) + + PORT_MODIFY("INB") /* input A */ + PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(3) + PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(3) + PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(3) + PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(3) + PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(4) + PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(4) + PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(4) + PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(4) + + PORT_START("SELFTTEST") + PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) +INPUT_PORTS_END static const gfx_layout tile_layout = { @@ -542,17 +584,12 @@ static MACHINE_CONFIG_DERIVED( dominos, sprint2 ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END - ROM_START( sprint1 ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "6290-01.b1", 0x2000, 0x0800, CRC(41fc985e) SHA1(7178846480cbf8d15955ccd987d0b0e902ab9f90) ) - ROM_RELOAD( 0xe000, 0x0800 ) ROM_LOAD( "6291-01.c1", 0x2800, 0x0800, CRC(07f7a920) SHA1(845f65d2bd290eb295ca6bae2575f27aaa08c0dd) ) - ROM_RELOAD( 0xe800, 0x0800 ) ROM_LOAD( "6442-01.d1", 0x3000, 0x0800, CRC(e9ff0124) SHA1(42fe028e2e595573ccc0821de3bb6970364c585d) ) - ROM_RELOAD( 0xf000, 0x0800 ) ROM_LOAD( "6443-01.e1", 0x3800, 0x0800, CRC(d6bb00d0) SHA1(cdcd4bb7b32be7a11480d3312fcd8d536e2d0caf) ) - ROM_RELOAD( 0xf800, 0x0800 ) ROM_REGION( 0x0200, "gfx1", 0 ) /* tiles */ ROM_LOAD_NIB_HIGH( "6396-01.p4", 0x0000, 0x0200, CRC(801b42dd) SHA1(1db58390d803f404253cbf36d562016441ca568d) ) @@ -571,13 +608,9 @@ ROM_END ROM_START( sprint2 ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "6290-01.b1", 0x2000, 0x0800, CRC(41fc985e) SHA1(7178846480cbf8d15955ccd987d0b0e902ab9f90) ) - ROM_RELOAD( 0xe000, 0x0800 ) ROM_LOAD( "6291-01.c1", 0x2800, 0x0800, CRC(07f7a920) SHA1(845f65d2bd290eb295ca6bae2575f27aaa08c0dd) ) - ROM_RELOAD( 0xe800, 0x0800 ) ROM_LOAD( "6404.d1", 0x3000, 0x0800, CRC(d2878ff6) SHA1(b742a8896c1bf1cfacf48d06908920d88a2c9ea8) ) - ROM_RELOAD( 0xf000, 0x0800 ) ROM_LOAD( "6405.e1", 0x3800, 0x0800, CRC(6c991c80) SHA1(c30a5b340f05dd702c7a186eb62607a48fa19f72) ) - ROM_RELOAD( 0xf800, 0x0800 ) ROM_REGION( 0x0200, "gfx1", 0 ) /* tiles */ ROM_LOAD_NIB_HIGH( "6396-01.p4", 0x0000, 0x0200, CRC(801b42dd) SHA1(1db58390d803f404253cbf36d562016441ca568d) ) @@ -596,13 +629,9 @@ ROM_END ROM_START( sprint2a ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "6290-01.b1", 0x2000, 0x0800, CRC(41fc985e) SHA1(7178846480cbf8d15955ccd987d0b0e902ab9f90) ) - ROM_RELOAD( 0xe000, 0x0800 ) ROM_LOAD( "6291-01.c1", 0x2800, 0x0800, CRC(07f7a920) SHA1(845f65d2bd290eb295ca6bae2575f27aaa08c0dd) ) - ROM_RELOAD( 0xe800, 0x0800 ) ROM_LOAD( "6404.d1", 0x3000, 0x0800, CRC(d2878ff6) SHA1(b742a8896c1bf1cfacf48d06908920d88a2c9ea8) ) - ROM_RELOAD( 0xf000, 0x0800 ) ROM_LOAD( "6405-02.e1", 0x3800, 0x0800, CRC(e80fd249) SHA1(7bcf7dfd72ca83fdd80593eaf392570da1f71298) ) - ROM_RELOAD( 0xf800, 0x0800 ) ROM_REGION( 0x0200, "gfx1", 0 ) /* tiles */ ROM_LOAD_NIB_HIGH( "6396-01.p4", 0x0000, 0x0200, CRC(801b42dd) SHA1(1db58390d803f404253cbf36d562016441ca568d) ) @@ -621,13 +650,9 @@ ROM_END ROM_START( sprint2h ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "6290-01.b1", 0x2000, 0x0800, CRC(41fc985e) SHA1(7178846480cbf8d15955ccd987d0b0e902ab9f90) ) - ROM_RELOAD( 0xe000, 0x0800 ) ROM_LOAD( "6291-01.c1", 0x2800, 0x0800, CRC(07f7a920) SHA1(845f65d2bd290eb295ca6bae2575f27aaa08c0dd) ) - ROM_RELOAD( 0xe800, 0x0800 ) ROM_LOAD( "6404.d1", 0x3000, 0x0800, CRC(d2878ff6) SHA1(b742a8896c1bf1cfacf48d06908920d88a2c9ea8) ) - ROM_RELOAD( 0xf000, 0x0800 ) ROM_LOAD( "6405-02.e1", 0x3800, 0x0800, CRC(6de291f1) SHA1(00c2826011d80ac0784649a7bc156a97c26565fd) ) // sldh - ROM_RELOAD( 0xf800, 0x0800 ) ROM_REGION( 0x0200, "gfx1", 0 ) /* tiles */ ROM_LOAD_NIB_HIGH( "6396-01.p4", 0x0000, 0x0200, CRC(801b42dd) SHA1(1db58390d803f404253cbf36d562016441ca568d) ) @@ -646,9 +671,7 @@ ROM_END ROM_START( dominos ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "7352-02.d1", 0x3000, 0x0800, CRC(738b4413) SHA1(3a90ab25bb5f65504692f97da43f03e21392dcd8) ) - ROM_RELOAD( 0xf000, 0x0800 ) ROM_LOAD( "7438-02.e1", 0x3800, 0x0800, CRC(c84e54e2) SHA1(383b388a1448a195f28352fc5e4ff1a2af80cc95) ) - ROM_RELOAD( 0xf800, 0x0800 ) ROM_REGION( 0x200, "gfx1", 0 ) /* tiles */ ROM_LOAD_NIB_HIGH( "7439-01.p4", 0x0000, 0x0200, CRC(4f42fdd6) SHA1(f8ea4b582e26cad37b746174cdc9f1c7ae0819c3) ) @@ -662,9 +685,32 @@ ROM_START( dominos ) ROM_LOAD( "6401-01.e2", 0x0100, 0x0020, CRC(857df8db) SHA1(06313d5bde03220b2bc313d18e50e4bb1d0cfbbb) ) /* address */ ROM_END +ROM_START( dominos4 ) // built from original Atari source code + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD_NIB_HIGH( "007754-01.l1", 0x3000, 0x0400, CRC(03fae4a9) SHA1(a132bd8bc866e33cdf6b4881064c8d265c2b25f4) ) + ROM_LOAD_NIB_LOW ( "007755-01.l0", 0x3000, 0x0400, CRC(fa2d0c04) SHA1(fcf618c7089db46d55933d58ea04701af515ad49) ) + ROM_LOAD_NIB_HIGH( "007756-01.m1", 0x3400, 0x0400, CRC(d2acb1b5) SHA1(ad81eed9dd0a2d5ecfd42daf90825726e64063b3) ) + ROM_LOAD_NIB_LOW ( "007757-01.m0", 0x3400, 0x0400, CRC(69f2db90) SHA1(a064c840599c4e7cb65670e5480adeb310247f16) ) + ROM_LOAD_NIB_HIGH( "007758-01.n1", 0x3800, 0x0400, CRC(b49083b4) SHA1(41999e8d3fd6104c42f3a034045f9f9c75d8247a) ) + ROM_LOAD_NIB_LOW ( "007759-01.n0", 0x3800, 0x0400, CRC(542200c7) SHA1(111f06e942e247b00b9f90fae2986c3c8d9ec8c5) ) + ROM_LOAD_NIB_HIGH( "007760-01.p1", 0x3c00, 0x0400, CRC(7dc2a7a1) SHA1(9d02572cf689c6476b33226a5358dd1f72c4e61d) ) + ROM_LOAD_NIB_LOW ( "007761-01.p0", 0x3c00, 0x0400, CRC(04365e0d) SHA1(fefc3c04e55f1aa8c80b1e5e1e403af8698c3530) ) + + ROM_REGION( 0x200, "gfx1", 0 ) /* tiles */ + ROM_LOAD_NIB_HIGH( "007764-01.p4", 0x0000, 0x0200, CRC(e4332dc0) SHA1(1f16c5b9f9fd7d478fd729cc79968f17746111f4) ) + ROM_LOAD_NIB_LOW ( "007765-01.r4", 0x0000, 0x0200, CRC(6e4e6c75) SHA1(0fc77fecaa73eac57baf778bc51387c75883aad4) ) + + ROM_REGION( 0x200, "gfx2", 0 ) /* sprites, not used */ + ROM_FILL( 0x0000, 0x0200, 0 ) + + ROM_REGION( 0x0120, "proms", 0 ) + ROM_LOAD( "6400-01.m2", 0x0000, 0x0100, CRC(b8094b4c) SHA1(82dc6799a19984f3b204ee3aeeb007e55afc8be3) ) /* SYNC */ + ROM_LOAD( "6401-01.e2", 0x0100, 0x0020, CRC(857df8db) SHA1(06313d5bde03220b2bc313d18e50e4bb1d0cfbbb) ) /* address */ +ROM_END GAME( 1978, sprint1, 0, sprint1, sprint1, sprint2_state, sprint1, ROT0, "Atari (Kee Games)", "Sprint 1", 0 ) GAME( 1976, sprint2, sprint1, sprint2, sprint2, sprint2_state, sprint2, ROT0, "Atari (Kee Games)", "Sprint 2 (set 1)", 0 ) GAME( 1976, sprint2a, sprint1, sprint2, sprint2, sprint2_state, sprint2, ROT0, "Atari (Kee Games)", "Sprint 2 (set 2)", 0 ) GAME( 1976, sprint2h, sprint1, sprint2, sprint2, sprint2_state, sprint2, ROT0, "hack", "Sprint 2 (color kit, Italy)", GAME_WRONG_COLORS ) // Italian hack, supposedly is color instead of b/w? how? GAME( 1977, dominos, 0, dominos, dominos, sprint2_state, dominos, ROT0, "Atari", "Dominos", 0 ) +GAME( 1977, dominos4, dominos, dominos, dominos4,sprint2_state, dominos4,ROT0, "Atari", "Dominos 4 (Coctail)", 0 ) diff --git a/src/mame/includes/sprint2.h b/src/mame/includes/sprint2.h index 93cf0df632a..392b75c7dc6 100644 --- a/src/mame/includes/sprint2.h +++ b/src/mame/includes/sprint2.h @@ -54,6 +54,8 @@ public: DECLARE_WRITE8_MEMBER(sprint2_wram_w); DECLARE_WRITE8_MEMBER(sprint2_lamp1_w); DECLARE_WRITE8_MEMBER(sprint2_lamp2_w); + DECLARE_WRITE8_MEMBER(dominos4_lamp3_w); + DECLARE_WRITE8_MEMBER(dominos4_lamp4_w); DECLARE_READ8_MEMBER(sprint2_collision1_r); DECLARE_READ8_MEMBER(sprint2_collision2_r); DECLARE_WRITE8_MEMBER(sprint2_collision_reset1_w); @@ -66,6 +68,7 @@ public: DECLARE_DRIVER_INIT(sprint1); DECLARE_DRIVER_INIT(sprint2); DECLARE_DRIVER_INIT(dominos); + DECLARE_DRIVER_INIT(dominos4); TILE_GET_INFO_MEMBER(get_tile_info); virtual void video_start(); DECLARE_PALETTE_INIT(sprint2); diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 04ea02a760d..49894e15b35 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -6860,6 +6860,7 @@ sprint4 // 008716 1977/12 [6502] sprint4a // 008716 1977/12 [6502] nitedrvr // 006321 1976/10 [6502] dominos // 007305 1977/01 [6502] +dominos4 // 007754-007765 ??????? [6502] triplhnt // 008422-008791 1977/04 [6800] sprint8 // ?????? 1977/05 [6800] sprint8a // ?????? 1977/05 [6800] From 6216b82a849ad3d1342de8da069a5267407fb8c3 Mon Sep 17 00:00:00 2001 From: mariuszw Date: Sat, 27 Dec 2014 00:38:20 +0100 Subject: [PATCH 04/23] spelling fix (nw) --- src/mame/drivers/sprint2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/sprint2.c b/src/mame/drivers/sprint2.c index 8bfed5bd433..9082b60688c 100644 --- a/src/mame/drivers/sprint2.c +++ b/src/mame/drivers/sprint2.c @@ -713,4 +713,4 @@ GAME( 1976, sprint2, sprint1, sprint2, sprint2, sprint2_state, sprint2, ROT0, " GAME( 1976, sprint2a, sprint1, sprint2, sprint2, sprint2_state, sprint2, ROT0, "Atari (Kee Games)", "Sprint 2 (set 2)", 0 ) GAME( 1976, sprint2h, sprint1, sprint2, sprint2, sprint2_state, sprint2, ROT0, "hack", "Sprint 2 (color kit, Italy)", GAME_WRONG_COLORS ) // Italian hack, supposedly is color instead of b/w? how? GAME( 1977, dominos, 0, dominos, dominos, sprint2_state, dominos, ROT0, "Atari", "Dominos", 0 ) -GAME( 1977, dominos4, dominos, dominos, dominos4,sprint2_state, dominos4,ROT0, "Atari", "Dominos 4 (Coctail)", 0 ) +GAME( 1977, dominos4, dominos, dominos, dominos4,sprint2_state, dominos4,ROT0, "Atari", "Dominos 4 (Cocktail)", 0 ) From 3b359283955547bc8cae7fe3cd85cc4b03ba299d Mon Sep 17 00:00:00 2001 From: mamehaze Date: Fri, 26 Dec 2014 23:42:10 +0000 Subject: [PATCH 05/23] arcompact - start to add the hardware loop support (nw) --- src/emu/cpu/arcompact/arcompact.c | 17 ++++ src/emu/cpu/arcompact/arcompact.h | 8 +- src/emu/cpu/arcompact/arcompact_common.h | 1 + src/emu/cpu/arcompact/arcompact_execute.c | 115 ++++++++-------------- src/emu/cpu/arcompact/arcompact_make.py | 14 ++- src/emu/cpu/arcompact/arcompactdasm_ops.c | 2 +- 6 files changed, 80 insertions(+), 77 deletions(-) diff --git a/src/emu/cpu/arcompact/arcompact.c b/src/emu/cpu/arcompact/arcompact.c index f586bf23af3..735a9ecd893 100644 --- a/src/emu/cpu/arcompact/arcompact.c +++ b/src/emu/cpu/arcompact/arcompact.c @@ -63,6 +63,8 @@ void arcompact_device::device_start() state_add( 0, "PC", m_debugger_temp).callimport().callexport().formatstr("%08X"); state_add( 0x10, "STATUS32", m_debugger_temp).callimport().callexport().formatstr("%08X"); + state_add( 0x11, "LP_START", m_debugger_temp).callimport().callexport().formatstr("%08X"); + state_add( 0x12, "LP_END", m_debugger_temp).callimport().callexport().formatstr("%08X"); state_add(STATE_GENPC, "GENPC", m_debugger_temp).callexport().noshow(); @@ -88,6 +90,12 @@ void arcompact_device::state_export(const device_state_entry &entry) case 0x10: m_debugger_temp = m_status32; break; + case 0x11: + m_debugger_temp = m_LP_START; + break; + case 0x12: + m_debugger_temp = m_LP_END; + break; case STATE_GENPC: m_debugger_temp = m_pc; @@ -116,6 +124,12 @@ void arcompact_device::state_import(const device_state_entry &entry) case 0x10: m_status32 = m_debugger_temp; break; + case 0x11: + m_LP_START = m_debugger_temp; + break; + case 0x12: + m_LP_END = m_debugger_temp; + break; default: if ((index >= 0x100) && (index < 0x140)) @@ -137,6 +151,9 @@ void arcompact_device::device_reset() m_regs[i] = 0; m_status32 = 0; + m_LP_START = 0; + m_LP_END = 0; + } /*****************************************************************************/ diff --git a/src/emu/cpu/arcompact/arcompact.h b/src/emu/cpu/arcompact/arcompact.h index 3e5fdb677d6..94e3f77a6ff 100644 --- a/src/emu/cpu/arcompact/arcompact.h +++ b/src/emu/cpu/arcompact/arcompact.h @@ -186,7 +186,7 @@ protected: ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_00(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_01(OPS_32); - ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_03(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_04(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_05(OPS_32); @@ -778,6 +778,7 @@ protected: ARCOMPACT_HANDLER04_TYPE_PM(04_16); ARCOMPACT_HANDLER04_TYPE_PM(04_20); + ARCOMPACT_HANDLER04_TYPE_PM(04_2f_02); ARCOMPACT_HANDLER04_TYPE_PM(04_2f_07); ARCOMPACT_HANDLER04_TYPE_PM(04_2f_08); @@ -815,6 +816,10 @@ private: // f e d c| b a 9 8| 7 6 5 4| 3 2 1 0 // - - - L| Z N C V| U DE AE A2|A1 E2 E1 H UINT32 m_status32; + + UINT32 m_LP_START; + UINT32 m_LP_END; + }; #define V_OVERFLOW_FLAG (0x00000100) @@ -845,6 +850,7 @@ private: // Condition 0x0c (LE) #define CONDITION_LE ((STATUS32_CHECK_Z) || (STATUS32_CHECK_N && !STATUS32_CHECK_V) || (!STATUS32_CHECK_N && STATUS32_CHECK_V)) // Z or (N and /V) or (/N and V) #define CONDITION_EQ (STATUS32_CHECK_Z) +#define CONDITION_CS (STATUS32_CHECK_C) extern const device_type ARCA5; diff --git a/src/emu/cpu/arcompact/arcompact_common.h b/src/emu/cpu/arcompact/arcompact_common.h index f6d8c922a12..9eca6c2a182 100644 --- a/src/emu/cpu/arcompact/arcompact_common.h +++ b/src/emu/cpu/arcompact/arcompact_common.h @@ -19,3 +19,4 @@ extern const char *opcodes_04[0x40]; #define REG_SP (0x1c) // r28 #define REG_ILINK1 (0x1d) // r29 #define REG_ILINK2 (0x1e) // r30 +#define REG_LP_COUNT (0x3c) // r60 diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index 38695ee1396..855f3d8647c 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--; } @@ -138,7 +149,7 @@ int arcompact_device::check_condition(UINT8 condition) case 0x02: return !CONDITION_EQ; // NE case 0x03: fatalerror("unhandled condition check %s", conditions[condition]); return -1; case 0x04: fatalerror("unhandled condition check %s", conditions[condition]); return -1; - case 0x05: fatalerror("unhandled condition check %s", conditions[condition]); return -1; + 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; @@ -2054,23 +2065,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("> 0); + m_LP_END = PC_ALIGNED32 + (u * 2); + return m_pc + (size>>0); + } + } - arcompact_log("unimplemented LPcc %08x", op); return m_pc + (size>>0); } @@ -2211,83 +2245,16 @@ 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 -// 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 ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_0b(OPS_32) { return arcompact_handle04_2f_helper(PARAMS, "RCL"); } // RLC diff --git a/src/emu/cpu/arcompact/arcompact_make.py b/src/emu/cpu/arcompact/arcompact_make.py index 0cd5904845e..d7a3987ba24 100644 --- a/src/emu/cpu/arcompact/arcompact_make.py +++ b/src/emu/cpu/arcompact/arcompact_make.py @@ -9,6 +9,16 @@ def EmitGroup04_Handle_NZ_Flags(f, funcname, opname): print >>f, " if (result == 0x00000000) { STATUS32_SET_Z; }" print >>f, " else { STATUS32_CLEAR_Z; }" +def EmitGroup04_Handle_NZC_LSR1_Flags(f, funcname, opname): + print >>f, " if (result & 0x80000000) { STATUS32_SET_N; }" + print >>f, " else { STATUS32_CLEAR_N; }" + print >>f, " if (result == 0x00000000) { STATUS32_SET_Z; }" + print >>f, " else { STATUS32_CLEAR_Z; }" + print >>f, " if (c == 0x00000001) { STATUS32_SET_C; }" + print >>f, " else { STATUS32_CLEAR_C; }" + + + def EmitGroup04_no_Flags(f, funcname, opname): print >>f, " // no flag changes" @@ -289,7 +299,9 @@ EmitGroup04(f, "05_00", "ASL", "UINT32 result = b << (c&0x1f);", "m_regs[areg] = EmitGroup04(f, "05_01", "LSR", "UINT32 result = b >> (c&0x1f);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) # the 04_2f subgroup uses the same encoding, but the areg is already used as sub-opcode select, so any modes relying on areg bits for other reasons (sign, condition) (modes 10, 11m0, 11m1) are illegal. the destination is also breg not areg -EmitGroup04(f, "04_2f_07", "EXTB", "UINT32 result = c & 0x000000ff;", "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_unsupported_Flags ) # no alt handler (invalid path) +EmitGroup04(f, "04_2f_02", "LSR1", "UINT32 result = c >> 1;", "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_Handle_NZC_LSR1_Flags ) # no alt handler (invalid path) +EmitGroup04(f, "04_2f_07", "EXTB", "UINT32 result = c & 0x000000ff;", "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_unsupported_Flags ) # ^ +EmitGroup04(f, "04_2f_08", "EXTW", "UINT32 result = c & 0x0000ffff;", "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_unsupported_Flags ) # ^ # xxx_S b, b, u5 format opcodes diff --git a/src/emu/cpu/arcompact/arcompactdasm_ops.c b/src/emu/cpu/arcompact/arcompactdasm_ops.c index 20e413b7b60..4cdf09a37a0 100644 --- a/src/emu/cpu/arcompact/arcompactdasm_ops.c +++ b/src/emu/cpu/arcompact/arcompactdasm_ops.c @@ -887,7 +887,7 @@ int arcompact_handle04_28_dasm(DASM_OPS_32) // LPcc (loop setup) { // 0010 0RRR 1110 1000 0RRR uuuu uu1Q QQQQ COMMON32_GET_u6 COMMON32_GET_CONDITION - output += sprintf(output, "LP<%s> (start %08x, end %08x)", conditions[condition], pc + 4, pc + u*2); + output += sprintf(output, "LP<%s> (start %08x, end %08x)", conditions[condition], pc + 4, PC_ALIGNED32 + u*2); int unused = (op & 0x00000020)>>5; if (unused==0) output += sprintf(output, "(unused bit not set)"); From e2bc8a0295703f234550efa8e7751698aa58811e Mon Sep 17 00:00:00 2001 From: etabeta78 Date: Sat, 27 Dec 2014 00:59:26 +0100 Subject: [PATCH 06/23] (MESS) softlist: misc additions. nw. --- hash/gba.xml | 22 ++++++++++++ hash/n64.xml | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++ hash/pc98.xml | 63 ++++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+) diff --git a/hash/gba.xml b/hash/gba.xml index 2877bf692cf..461154d5355 100644 --- a/hash/gba.xml +++ b/hash/gba.xml @@ -26332,6 +26332,17 @@ Note: In the AGB-E05-XX and AGB-E06-XX pcbs, the chip name is hidden under the b + + Overstorm (Euro, Prototype Demo) + 2003 + Polyzoom + + + + + + + Ozzy & Drix (USA) 2003 @@ -29115,6 +29126,17 @@ Note: In the AGB-E05-XX and AGB-E06-XX pcbs, the chip name is hidden under the b + + Resident Evil 2 (Euro, Prototype Demo) + 2000? + Raylight Studios + + + + + + + The Revenge of Shinobi (Euro, Prototype) 2003 diff --git a/hash/n64.xml b/hash/n64.xml index 0a0ef2e0e72..b957e352fe0 100644 --- a/hash/n64.xml +++ b/hash/n64.xml @@ -3084,6 +3084,61 @@ Info on N64 chip labels (from The Cart Scan Repository) + + Conker's Bad Fur Day (Prototype Debug) + 2001? + Rare + + + + + + + + + Conker's Bad Fur Day (ECTS Demo) + 2001? + Rare + + + + + + + + + + + Conker's Bad Fur Day (Prototype Debug, Decrypted) + 2001? + Rare + + + + + + + + + Conker's Bad Fur Day (ECTS Demo, Decrypted) + 2001? + Rare + + + + + + + Cruis'n Exotica (USA) 2000 @@ -7778,6 +7833,45 @@ Info on N64 chip labels (from The Cart Scan Repository) + + Perfect Dark (Euro, Prototype Debug) + 2000 + Nintendo + + + + + + + + + Perfect Dark (USA, Prototype Debug) + 2000 + Nintendo + + + + + + + + + + Perfect Dark (USA, Prototype Debug, Decrypted) + 2000 + Nintendo + + + + + + + PGA European Tour (USA) 2000 diff --git a/hash/pc98.xml b/hash/pc98.xml index c19686ce35c..b95ebc2c2ed 100644 --- a/hash/pc98.xml +++ b/hash/pc98.xml @@ -46805,6 +46805,19 @@ Requires MS-DOS 5.00H plus an unknown procedure (HDD install?) + + LoopyQ + 1992 + 日本ソフテック (Nihon Softec) + + + + + + + + + Lotus 1-2-3 (Demo) 19?? @@ -49263,6 +49276,56 @@ Requires MS-DOS 5.00H plus an unknown procedure (HDD install?) + + Ultra Sakusen - Kagaku Tokusoutai Shutsugeki Seyo! + 1992 + バンプレスト (Banpresto) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Vermilion 1990 From 608d95207449d30f14d1273f429994ac14e3b12c Mon Sep 17 00:00:00 2001 From: etabeta78 Date: Sat, 27 Dec 2014 01:00:48 +0100 Subject: [PATCH 07/23] (MESS) megadriv: slightly improved support for CodeMasters 2-in-1 carts and added a pair of unlicensed game dumps. nw. --- hash/megadriv.xml | 30 ++++++++++++++++++++++++++---- src/emu/bus/megadrive/md_slot.c | 2 +- src/emu/bus/megadrive/rom.c | 2 +- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/hash/megadriv.xml b/hash/megadriv.xml index 6650788b6cd..340162e90ab 100644 --- a/hash/megadriv.xml +++ b/hash/megadriv.xml @@ -119,9 +119,9 @@ Info on Sega chip labels (from Sunbeam / Digital Corruption) - - - + + + @@ -9602,7 +9602,7 @@ Info on Sega chip labels (from Sunbeam / Digital Corruption) Codemasters - + @@ -30078,6 +30078,17 @@ Notice that these are not working on real hardware due to bugged code with VDP i + + Link Dragon + 1993 + Songtly + + + + + + + Lion King 3 (Alt?) 199? @@ -30173,6 +30184,17 @@ Notice that these are not working on real hardware due to bugged code with VDP i + + Super Tank War + 199? + Gamtec + + + + + + + diff --git a/src/emu/bus/megadrive/md_slot.c b/src/emu/bus/megadrive/md_slot.c index dd9bd986c36..5cc2c124ecb 100644 --- a/src/emu/bus/megadrive/md_slot.c +++ b/src/emu/bus/megadrive/md_slot.c @@ -384,7 +384,7 @@ int base_md_cart_slot_device::load_list() m_type = md_get_pcb_id(slot_name); // handle mirroring of ROM, unless it's SSF2 or Pier Solar - if (m_type != SSF2 && m_type != PSOLAR) + if (m_type != SSF2 && m_type != PSOLAR && m_type != CM_2IN1) m_cart->rom_map_setup(length); return IMAGE_INIT_PASS; diff --git a/src/emu/bus/megadrive/rom.c b/src/emu/bus/megadrive/rom.c index c5c5b93c49f..a2c08860134 100644 --- a/src/emu/bus/megadrive/rom.c +++ b/src/emu/bus/megadrive/rom.c @@ -531,7 +531,7 @@ WRITE16_MEMBER(md_rom_ssf2_device::write_a13) CODEMASTERS 2 IN 1 (RESET BASED) -------------------------------------------------*/ -#define MD_ADDR_CM2IN1(a) (m_base == 0 ? ((a << 1) & 0x1fffff)/2 : (((a << 1) & 0x7ffff) + 0x200000)/2) +#define MD_ADDR_CM2IN1(a) (m_base == 0 ? ((a << 1) & 0x1fffff)/2 : (((a << 1) & 0x1fffff) + 0x200000)/2) READ16_MEMBER(md_rom_cm2in1_device::read) { From 0b0f6429bdfecaef64729752f1b05f89e8fc0033 Mon Sep 17 00:00:00 2001 From: etabeta78 Date: Sat, 27 Dec 2014 01:02:09 +0100 Subject: [PATCH 08/23] documentation fix. nw. --- hash/sol20_cass.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/sol20_cass.xml b/hash/sol20_cass.xml index be1f05b7eed..1e8acc2a198 100644 --- a/hash/sol20_cass.xml +++ b/hash/sol20_cass.xml @@ -166,7 +166,7 @@ User Manual at http://www.sol20.org/manuals/atc.pdf Air Traffic Control 1978 - Processor Technology Corporation + Creative Computing Software From d59a524856c0a62811a3b5a276139273929ac2d0 Mon Sep 17 00:00:00 2001 From: mamehaze Date: Sat, 27 Dec 2014 00:29:35 +0000 Subject: [PATCH 09/23] checkpoint (nw) --- src/emu/cpu/arcompact/arcompact.h | 5 +- src/emu/cpu/arcompact/arcompact_execute.c | 106 ++++------------------ src/emu/cpu/arcompact/arcompact_make.py | 32 +++++++ 3 files changed, 52 insertions(+), 91 deletions(-) diff --git a/src/emu/cpu/arcompact/arcompact.h b/src/emu/cpu/arcompact/arcompact.h index 94e3f77a6ff..974df138c97 100644 --- a/src/emu/cpu/arcompact/arcompact.h +++ b/src/emu/cpu/arcompact/arcompact.h @@ -165,7 +165,7 @@ protected: ARCOMPACT_RETTYPE arcompact_handle04_10(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_11(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_12(OPS_32); - ARCOMPACT_RETTYPE arcompact_handle04_13(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_13(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_14(OPS_32); // ARCOMPACT_RETTYPE arcompact_handle04_15(OPS_32); // ARCOMPACT_RETTYPE arcompact_handle04_16(OPS_32); @@ -774,6 +774,7 @@ protected: ARCOMPACT_HANDLER04_TYPE_PM(04_07); ARCOMPACT_HANDLER04_TYPE_PM(04_0a); ARCOMPACT_HANDLER04_TYPE_PM(04_0f); + ARCOMPACT_HANDLER04_TYPE_PM(04_13); ARCOMPACT_HANDLER04_TYPE_PM(04_15); ARCOMPACT_HANDLER04_TYPE_PM(04_16); ARCOMPACT_HANDLER04_TYPE_PM(04_20); @@ -851,6 +852,8 @@ private: #define CONDITION_LE ((STATUS32_CHECK_Z) || (STATUS32_CHECK_N && !STATUS32_CHECK_V) || (!STATUS32_CHECK_N && STATUS32_CHECK_V)) // Z or (N and /V) or (/N and V) #define CONDITION_EQ (STATUS32_CHECK_Z) #define CONDITION_CS (STATUS32_CHECK_C) +#define CONDITION_LT ((STATUS32_CHECK_N && !STATUS32_CHECK_V) || (!STATUS32_CHECK_N && STATUS32_CHECK_V)) + extern const device_type ARCA5; diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index 855f3d8647c..da8d90f53ee 100644 --- a/src/emu/cpu/arcompact/arcompact_execute.c +++ b/src/emu/cpu/arcompact/arcompact_execute.c @@ -1861,10 +1861,7 @@ 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) { @@ -2705,90 +2702,20 @@ 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); } @@ -2800,20 +2727,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_18(OPS_16) { return arco 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); - - m_regs[breg] = m_regs[creg] << 1; - - 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); } @@ -3302,7 +3215,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 { diff --git a/src/emu/cpu/arcompact/arcompact_make.py b/src/emu/cpu/arcompact/arcompact_make.py index d7a3987ba24..ca80ae7f408 100644 --- a/src/emu/cpu/arcompact/arcompact_make.py +++ b/src/emu/cpu/arcompact/arcompact_make.py @@ -251,6 +251,25 @@ def EmitGroup04(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, b print >>f, "" print >>f, "" +# xxx_S b <- b,c format opcodes +def EmitGroup0f(f,funcname, opname, opexecute, opwrite): + print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s(OPS_16)"% (funcname) + print >>f, "{" + print >>f, " int breg, creg;" + print >>f, "" + print >>f, " COMMON16_GET_breg;" + print >>f, " COMMON16_GET_creg;" + print >>f, "" + print >>f, " REG_16BIT_RANGE(breg);" + print >>f, " REG_16BIT_RANGE(creg);" + print >>f, "" + print >>f, " %s" % (opexecute) + print >>f, " %s" % (opwrite) + print >>f, "" + print >>f, " return m_pc + (2 >> 0);" + print >>f, "}" + + # xxx_S b, b, u5 format opcodes def EmitGroup17(f,funcname, opname, opexecute): print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s(OPS_16)" % (funcname) @@ -291,6 +310,10 @@ EmitGroup04(f, "04_0a", "MOV", "UINT32 result = c;", "m_regs[breg] = result;", " EmitGroup04(f, "04_0f", "BSET", "UINT32 result = b | (1 << (c & 0x1f));", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_13", "BMSK", "UINT32 result = b & ((1<<(c+1))-1);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) + + + EmitGroup04(f, "04_15", "ADD2", "UINT32 result = b + (c << 2);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) EmitGroup04(f, "04_16", "ADD3", "UINT32 result = b + (c << 3);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) @@ -303,6 +326,15 @@ EmitGroup04(f, "04_2f_02", "LSR1", "UINT32 result = c >> 1;", "m_regs[b EmitGroup04(f, "04_2f_07", "EXTB", "UINT32 result = c & 0x000000ff;", "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_unsupported_Flags ) # ^ EmitGroup04(f, "04_2f_08", "EXTW", "UINT32 result = c & 0x0000ffff;", "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_unsupported_Flags ) # ^ +# xxx_S b <- b,c format opcodes (or in some cases xxx_S b,c) +EmitGroup0f(f, "0f_02", "SUB_S", "UINT32 result = m_regs[breg] - m_regs[creg];", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_04", "AND_S", "UINT32 result = m_regs[breg] & m_regs[creg];", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_05", "OR_S", "UINT32 result = m_regs[breg] | m_regs[creg];", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_07", "XOR_S", "UINT32 result = m_regs[breg] ^ m_regs[creg];", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_0f", "EXTB_S","UINT32 result = m_regs[creg] & 0x000000ff;", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_10", "EXTW_S","UINT32 result = m_regs[creg] & 0x0000ffff;", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_1b", "ASL1_S","UINT32 result = m_regs[creg] << 1;", "m_regs[breg] = result;" ) + # xxx_S b, b, u5 format opcodes EmitGroup17(f, "17_00", "ASL_S", "m_regs[breg] = m_regs[breg] << (u&0x1f);" ) From 3b4803da9a482ffdcbb1394a3e2106b2b70d5f84 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 27 Dec 2014 12:43:23 +1100 Subject: [PATCH 10/23] (MESS) excalibur : more unused code (nw) --- src/lib/formats/excali64_dsk.c | 42 ---------------------------------- src/lib/formats/excali64_dsk.h | 28 ----------------------- src/lib/lib.mak | 1 - 3 files changed, 71 deletions(-) delete mode 100644 src/lib/formats/excali64_dsk.c delete mode 100644 src/lib/formats/excali64_dsk.h diff --git a/src/lib/formats/excali64_dsk.c b/src/lib/formats/excali64_dsk.c deleted file mode 100644 index 5de86815099..00000000000 --- a/src/lib/formats/excali64_dsk.c +++ /dev/null @@ -1,42 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert -/********************************************************************* - - formats/excali64_dsk.c - - Excalibur 64 disk image format - -*********************************************************************/ - -#include "emu.h" -#include "formats/excali64_dsk.h" - -excali64_format::excali64_format() : wd177x_format(formats) -{ -} - -const char *excali64_format::name() const -{ - return "excali64"; -} - -const char *excali64_format::description() const -{ - return "Excalibur 64 disk image"; -} - -const char *excali64_format::extensions() const -{ - return "raw"; -} - -// Unverified gap sizes -const excali64_format::format excali64_format::formats[] = { - { /* 800K 19cm double density */ - floppy_image::FF_525, floppy_image::DSDD, floppy_image::MFM, - 2000, 5, 80, 2, 1024, {}, 1, {}, 100, 22, 84 - }, - {} -}; - -const floppy_format_type FLOPPY_EXCALI64_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/excali64_dsk.h b/src/lib/formats/excali64_dsk.h deleted file mode 100644 index 37b62265c1c..00000000000 --- a/src/lib/formats/excali64_dsk.h +++ /dev/null @@ -1,28 +0,0 @@ -/********************************************************************* - - formats/excali64_dsk.h - - Excalibur 64 disk image format - -*********************************************************************/ - -#ifndef EXCALI64_DSK_H_ -#define EXCALI64_DSK_H_ - -#include "wd177x_dsk.h" - -class excali64_format : public wd177x_format { -public: - excali64_format(); - - virtual const char *name() const; - virtual const char *description() const; - virtual const char *extensions() const; - -private: - static const format formats[]; -}; - -extern const floppy_format_type FLOPPY_EXCALI64_FORMAT; - -#endif diff --git a/src/lib/lib.mak b/src/lib/lib.mak index c95cfe2ecfc..34ba901389d 100644 --- a/src/lib/lib.mak +++ b/src/lib/lib.mak @@ -148,7 +148,6 @@ FORMATSOBJS = \ $(LIBOBJ)/formats/ep64_dsk.o \ $(LIBOBJ)/formats/esq8_dsk.o \ $(LIBOBJ)/formats/esq16_dsk.o \ - $(LIBOBJ)/formats/excali64_dsk.o\ $(LIBOBJ)/formats/fc100_cas.o \ $(LIBOBJ)/formats/fdi_dsk.o \ $(LIBOBJ)/formats/fdd_dsk.o \ From c522f8371e0b74a26cb62f98eadc354afbae364a Mon Sep 17 00:00:00 2001 From: Osso Date: Sat, 27 Dec 2014 08:14:41 +0100 Subject: [PATCH 11/23] sf2amf: working inputs (MT05808) [darq] --- src/mame/drivers/cps1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/cps1.c b/src/mame/drivers/cps1.c index 03f055b847e..71fa6d0d688 100644 --- a/src/mame/drivers/cps1.c +++ b/src/mame/drivers/cps1.c @@ -1855,7 +1855,7 @@ INPUT_PORTS_END /* SWB.4, SWB.5 and SWB.6 need to be enabled simultaneously for turbo mode */ static INPUT_PORTS_START( sf2amf ) - PORT_INCLUDE( sf2 ) + PORT_INCLUDE( sf2hack ) PORT_MODIFY("DSWB") PORT_DIPNAME( 0x08, 0x08, "Turbo Mode Switch 1 of 3" ) PORT_DIPLOCATION("SW(B):4") @@ -11666,7 +11666,7 @@ GAME( 1992, sf2v004, sf2ce, cps1_12MHz, sf2, cps_state, cps1, GAME( 1992, sf2acc, sf2ce, cps1_12MHz, sf2, cps_state, cps1, ROT0, "bootleg", "Street Fighter II': Champion Edition (Accelerator!, bootleg, set 1)", GAME_SUPPORTS_SAVE ) // 920313 - based on World version GAME( 1992, sf2acca, sf2ce, cps1_12MHz, sf2, cps_state, cps1, ROT0, "bootleg", "Street Fighter II': Champion Edition (Accelerator!, bootleg, set 2)", GAME_SUPPORTS_SAVE ) // 920313 - based on World version GAME( 1992, sf2accp2, sf2ce, cps1_12MHz, sf2, cps_state, cps1, ROT0, "bootleg", "Street Fighter II': Champion Edition (Accelerator Pt.II, bootleg)", GAME_SUPPORTS_SAVE ) // 920313 - based on World version -GAME( 1992, sf2amf, sf2ce, cps1_12MHz, sf2amf, cps_state, cps1, ROT0, "bootleg", "Street Fighter II': Champion Edition (Alpha Magic-F, bootleg)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // 920313 - based on World version +GAME( 1992, sf2amf, sf2ce, cps1_12MHz, sf2amf, cps_state, sf2hack, ROT0, "bootleg", "Street Fighter II': Champion Edition (Alpha Magic-F, bootleg)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // 920313 - based on World version GAME( 1992, sf2amf2, sf2ce, cps1_12MHz, sf2hack, cps_state, sf2hack, ROT0, "bootleg", "Street Fighter II': Champion Edition (L735 Test Rom, bootleg)", GAME_SUPPORTS_SAVE ) // 920313 - based on World version GAME( 1992, sf2dkot2, sf2ce, cps1_12MHz, sf2, cps_state, cps1, ROT0, "bootleg", "Street Fighter II': Champion Edition (Double K.O. Turbo II, bootleg)", GAME_SUPPORTS_SAVE ) // 902140 !!! - based on USA version GAME( 1992, sf2ceblp, sf2ce, cps1_10MHz, sf2, cps_state, sf2ceblp, ROT0, "bootleg", "Street Fighter II': Champion Edition (protected bootleg on non-dash board)", GAME_SUPPORTS_SAVE ) // 920313 - based on USA version From 8716f1e4678da1681f30749affd7aecad281879a Mon Sep 17 00:00:00 2001 From: Osso Date: Sat, 27 Dec 2014 12:09:52 +0100 Subject: [PATCH 12/23] abc99_device:: fixed "ROMENTRY_ISREGION(region)" assert, now asserts in z8536.c (nw) --- src/emu/bus/abckb/abc99.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/emu/bus/abckb/abc99.c b/src/emu/bus/abckb/abc99.c index 972067ddf23..499da9c2e16 100644 --- a/src/emu/bus/abckb/abc99.c +++ b/src/emu/bus/abckb/abc99.c @@ -80,12 +80,11 @@ const device_type ABC99 = &device_creator; //------------------------------------------------- ROM_START( abc99 ) + ROM_REGION( 0x1000, I8035_Z2_TAG, 0 ) ROM_DEFAULT_BIOS("107268") ROM_SYSTEM_BIOS( 0, "107268", "107268-17" ) - ROM_SYSTEM_BIOS( 1, "106819", "106819-09" ) - - ROM_REGION( 0x1000, I8035_Z2_TAG, 0 ) ROMX_LOAD( "107268-17.z3", 0x0000, 0x0800, CRC(2f60cc35) SHA1(ebc6af9cd0a49a0d01698589370e628eebb6221c), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "106819", "106819-09" ) ROMX_LOAD( "106819-09.z3", 0x0000, 0x1000, CRC(ffe32a71) SHA1(fa2ce8e0216a433f9bbad0bdd6e3dc0b540f03b7), ROM_BIOS(2) ) // ABC 99 6490423-01 ROM_REGION( 0x800, I8035_Z5_TAG, 0 ) From 413e4c9a83af88dacddcbd78b409302c29d6aa14 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sat, 27 Dec 2014 12:18:38 +0100 Subject: [PATCH 13/23] Robert, is that your idea of a joke? (nw) Revert "(MESS) excalibur : removed unused code (nw)" Revert "(MESS) excalibur : more unused code (nw)" This reverts commit 82e58068109f8932732da1cc80761f0ae62e7638. This reverts commit 3b4803da9a482ffdcbb1394a3e2106b2b70d5f84. --- src/lib/formats/excali64_dsk.c | 42 ++++++++++++++++++++ src/lib/formats/excali64_dsk.h | 28 ++++++++++++++ src/lib/lib.mak | 1 + src/mess/drivers/excali64.c | 71 +++++++++++++++++++++++++++++++++- 4 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 src/lib/formats/excali64_dsk.c create mode 100644 src/lib/formats/excali64_dsk.h diff --git a/src/lib/formats/excali64_dsk.c b/src/lib/formats/excali64_dsk.c new file mode 100644 index 00000000000..5de86815099 --- /dev/null +++ b/src/lib/formats/excali64_dsk.c @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/********************************************************************* + + formats/excali64_dsk.c + + Excalibur 64 disk image format + +*********************************************************************/ + +#include "emu.h" +#include "formats/excali64_dsk.h" + +excali64_format::excali64_format() : wd177x_format(formats) +{ +} + +const char *excali64_format::name() const +{ + return "excali64"; +} + +const char *excali64_format::description() const +{ + return "Excalibur 64 disk image"; +} + +const char *excali64_format::extensions() const +{ + return "raw"; +} + +// Unverified gap sizes +const excali64_format::format excali64_format::formats[] = { + { /* 800K 19cm double density */ + floppy_image::FF_525, floppy_image::DSDD, floppy_image::MFM, + 2000, 5, 80, 2, 1024, {}, 1, {}, 100, 22, 84 + }, + {} +}; + +const floppy_format_type FLOPPY_EXCALI64_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/excali64_dsk.h b/src/lib/formats/excali64_dsk.h new file mode 100644 index 00000000000..37b62265c1c --- /dev/null +++ b/src/lib/formats/excali64_dsk.h @@ -0,0 +1,28 @@ +/********************************************************************* + + formats/excali64_dsk.h + + Excalibur 64 disk image format + +*********************************************************************/ + +#ifndef EXCALI64_DSK_H_ +#define EXCALI64_DSK_H_ + +#include "wd177x_dsk.h" + +class excali64_format : public wd177x_format { +public: + excali64_format(); + + virtual const char *name() const; + virtual const char *description() const; + virtual const char *extensions() const; + +private: + static const format formats[]; +}; + +extern const floppy_format_type FLOPPY_EXCALI64_FORMAT; + +#endif diff --git a/src/lib/lib.mak b/src/lib/lib.mak index 34ba901389d..c95cfe2ecfc 100644 --- a/src/lib/lib.mak +++ b/src/lib/lib.mak @@ -148,6 +148,7 @@ FORMATSOBJS = \ $(LIBOBJ)/formats/ep64_dsk.o \ $(LIBOBJ)/formats/esq8_dsk.o \ $(LIBOBJ)/formats/esq16_dsk.o \ + $(LIBOBJ)/formats/excali64_dsk.o\ $(LIBOBJ)/formats/fc100_cas.o \ $(LIBOBJ)/formats/fdi_dsk.o \ $(LIBOBJ)/formats/fdd_dsk.o \ diff --git a/src/mess/drivers/excali64.c b/src/mess/drivers/excali64.c index 94e359d97d3..fda5eabd966 100644 --- a/src/mess/drivers/excali64.c +++ b/src/mess/drivers/excali64.c @@ -19,7 +19,7 @@ Notes: ToDo: - Colours are approximate. -- Disk controller, using the old wd17xx because new wd crashes on loading a disk. +- Disk controller, works with old wd17xx but crashes on new wd. - Hardware supports 20cm and 13cm floppies, but we only support 13cm as this is the only software that exists. - The schematic shows the audio counter connected to 2MHz, but this produces @@ -29,11 +29,15 @@ ToDo: ****************************************************************************/ +#define NEWFDC 0 + + #include "emu.h" #include "cpu/z80/z80.h" #include "video/mc6845.h" #include "machine/i8251.h" #include "bus/rs232/rs232.h" +//#include "machine/clock.h" #include "machine/pit8253.h" #include "machine/i8255.h" #include "bus/centronics/ctronics.h" @@ -43,9 +47,14 @@ ToDo: #include "machine/z80dma.h" #include "machine/rescap.h" #include "machine/74123.h" +#if NEWFDC +#include "machine/wd_fdc.h" +#include "formats/excali64_dsk.h" +#else #include "machine/wd17xx.h" #include "imagedev/flopdrv.h" #include "formats/basicdsk.h" +#endif class excali64_state : public driver_device { @@ -61,6 +70,10 @@ public: , m_u12(*this, "u12") , m_centronics(*this, "centronics") , m_fdc(*this, "fdc") +#if NEWFDC + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") +#endif { } DECLARE_PALETTE_INIT(excali64); @@ -73,6 +86,9 @@ public: DECLARE_WRITE8_MEMBER(porte4_w); DECLARE_READ8_MEMBER(porte8_r); DECLARE_WRITE8_MEMBER(portec_w); +#if NEWFDC + DECLARE_FLOPPY_FORMATS(floppy_formats); +#endif DECLARE_WRITE_LINE_MEMBER(cent_busy_w); DECLARE_WRITE_LINE_MEMBER(busreq_w); DECLARE_READ8_MEMBER(memory_read_byte); @@ -103,7 +119,13 @@ private: required_device m_dma; required_device m_u12; required_device m_centronics; +#if NEWFDC + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; +#else required_device m_fdc; +#endif }; static ADDRESS_MAP_START(excali64_mem, AS_PROGRAM, 8, excali64_state) @@ -129,7 +151,11 @@ static ADDRESS_MAP_START(excali64_io, AS_IO, 8, excali64_state) AM_RANGE(0xe4, 0xe7) AM_WRITE(porte4_w) AM_RANGE(0xe8, 0xeb) AM_READ(porte8_r) AM_RANGE(0xec, 0xef) AM_WRITE(portec_w) +#if NEWFDC + AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("fdc", wd2793_t, read, write) +#else AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("fdc", wd2793_device, read, write) +#endif ADDRESS_MAP_END @@ -220,6 +246,15 @@ WRITE_LINE_MEMBER( excali64_state::cent_busy_w ) m_centronics_busy = state; } +#if NEWFDC +FLOPPY_FORMATS_MEMBER( excali64_state::floppy_formats ) + FLOPPY_EXCALI64_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( excali64_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END +#else static LEGACY_FLOPPY_OPTIONS_START(excali64) LEGACY_FLOPPY_OPTION(excali64_ds, "raw", "Excalibur 64 DS disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, HEADS([2]) @@ -235,15 +270,21 @@ static const floppy_interface excali64_floppy_interface = LEGACY_FLOPPY_OPTIONS_NAME(excali64), NULL }; +#endif // pulses from port E4 bit 5 restart the 74123. After 3.6 secs without a pulse, the motor gets turned off. WRITE8_MEMBER( excali64_state::motor_w ) { m_motor = BIT(data, 0); +#if NEWFDC + m_floppy1->get_device()->mon_w(!m_motor); + m_floppy0->get_device()->mon_w(!m_motor); +#else legacy_floppy_image_device *flop = subdevice(FLOPPY_0); flop->floppy_mon_w(!m_motor); // motor on flop = subdevice(FLOPPY_1); flop->floppy_mon_w(!m_motor); // motor on +#endif } READ8_MEMBER( excali64_state::porte8_r ) @@ -253,6 +294,20 @@ READ8_MEMBER( excali64_state::porte8_r ) WRITE8_MEMBER( excali64_state::porte4_w ) { +#if NEWFDC + floppy_image_device *floppy = NULL; + if (BIT(data, 0)) + floppy = m_floppy0->get_device(); + + if (BIT(data, 1)) + floppy = m_floppy1->get_device(); + + if (floppy) + { + m_fdc->set_floppy(floppy); + floppy->ss_w(BIT(data, 4)); + } +#else if BIT(data, 0) m_fdc->set_drive(0); @@ -260,6 +315,7 @@ WRITE8_MEMBER( excali64_state::porte4_w ) m_fdc->set_drive(1); m_fdc->set_side(BIT(data, 4)); +#endif m_u12->b_w(space,offset, BIT(data, 5)); // motor pulse } @@ -271,7 +327,11 @@ d2 = density select (0 = double) */ WRITE8_MEMBER( excali64_state::portec_w ) { +#if NEWFDC + m_fdc->dden_w(BIT(data, 2)); +#else m_fdc->dden_w(!BIT(data, 2)); +#endif } WRITE_LINE_MEMBER( excali64_state::busreq_w ) @@ -592,11 +652,18 @@ static MACHINE_CONFIG_START( excali64, excali64_state ) /* Devices */ MCFG_CASSETTE_ADD( "cassette" ) +#if NEWFDC + MCFG_WD2793x_ADD("fdc", XTAL_16MHz / 16) + MCFG_WD_FDC_FORCE_READY + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", excali64_floppies, "525dd", floppy_image_device::default_floppy_formats)// excali64_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", excali64_floppies, "525dd", floppy_image_device::default_floppy_formats) +#else MCFG_DEVICE_ADD("fdc", WD2793, 0) MCFG_WD17XX_DEFAULT_DRIVE2_TAGS MCFG_WD17XX_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(excali64_floppy_interface) - +#endif MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_16MHz/4) MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(excali64_state, busreq_w)) MCFG_Z80DMA_IN_MREQ_CB(READ8(excali64_state, memory_read_byte)) From 1a43f69fe85066e7a897d1ae9b19a31e4b4c8a6a Mon Sep 17 00:00:00 2001 From: Osso Date: Sat, 27 Dec 2014 12:35:59 +0100 Subject: [PATCH 14/23] mc1502.c: fixed hardlocking regression for pk88 (nw) --- src/mess/drivers/mc1502.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mess/drivers/mc1502.c b/src/mess/drivers/mc1502.c index e87e60644e4..5a2b4fba8bc 100644 --- a/src/mess/drivers/mc1502.c +++ b/src/mess/drivers/mc1502.c @@ -326,9 +326,8 @@ static MACHINE_CONFIG_START( mc1502, mc1502_state ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( pk88, mc1502 ) - MCFG_CPU_REPLACE("maincpu", I8088, XTAL_16MHz/3) + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(pk88_map) - MCFG_CPU_IO_MAP(mc1502_io) MACHINE_CONFIG_END From 03baaf7e99f162a7b2d1d19a58b685c00d1c9fef Mon Sep 17 00:00:00 2001 From: mariuszw Date: Sat, 27 Dec 2014 12:47:53 +0100 Subject: [PATCH 15/23] New clones added -------------------- Super Breakout (Cocktail, prototype) [Mariusz Wojcieszek] --- src/mame/drivers/sbrkout.c | 90 +++++++++++++++++++++++++++++++++++--- src/mame/mame.lst | 1 + 2 files changed, 86 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/sbrkout.c b/src/mame/drivers/sbrkout.c index d60c3bba6a4..4f1c871a93e 100644 --- a/src/mame/drivers/sbrkout.c +++ b/src/mame/drivers/sbrkout.c @@ -6,7 +6,8 @@ Games supported: * Super Breakout - * Super Breakout (Canyon and Vertical Breakout, prototype) - built from original source code + * Super Breakout (Canyon and Vertical Breakout, prototype) + * Super Breakout (Cocktail, prototype) Known issues: * none at this time @@ -59,11 +60,13 @@ public: UINT8 m_pot_trigger[2]; DECLARE_WRITE8_MEMBER(irq_ack_w); DECLARE_READ8_MEMBER(switches_r); + DECLARE_READ8_MEMBER(sbrkoutct_switches_r); DECLARE_WRITE8_MEMBER(pot_mask1_w); DECLARE_WRITE8_MEMBER(pot_mask2_w); DECLARE_WRITE8_MEMBER(start_1_led_w); DECLARE_WRITE8_MEMBER(start_2_led_w); DECLARE_WRITE8_MEMBER(serve_led_w); + DECLARE_WRITE8_MEMBER(serve_2_led_w); DECLARE_WRITE8_MEMBER(coincount_w); DECLARE_READ8_MEMBER(sync_r); DECLARE_READ8_MEMBER(sync2_r); @@ -212,6 +215,23 @@ READ8_MEMBER(sbrkout_state::switches_r) return result; } +READ8_MEMBER(sbrkout_state::sbrkoutct_switches_r) +{ + UINT8 result = 0xff; + + switch( offset ) + { + case 0x28: result = ioport("SELECT")->read(); break; + case 0x2e: result = ioport("SERVE")->read(); break; + case 0x2f: result = ioport("SERVE2")->read(); break; + case 0x30: result = (ioport("DIPS")->read() & 0x03) << 6; break; + case 0x31: result = (ioport("DIPS")->read() & 0x0c) << 4; break; + case 0x32: result = ioport("DIPS")->read() & 0xc0; break; + case 0x33: result = (ioport("DIPS")->read() & 0x30) << 2; break; + default: logerror("Unknown port read %x\n", offset); break; + } + return result; +} void sbrkout_state::update_nmi_state() { @@ -275,6 +295,10 @@ WRITE8_MEMBER(sbrkout_state::serve_led_w) output_set_led_value(0, ~offset & 1); } +WRITE8_MEMBER(sbrkout_state::serve_2_led_w) +{ + output_set_led_value(1, ~offset & 1); +} WRITE8_MEMBER(sbrkout_state::coincount_w) { @@ -387,6 +411,27 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, sbrkout_state ) AM_RANGE(0x2800, 0x3fff) AM_ROM ADDRESS_MAP_END +static ADDRESS_MAP_START( sbrkoutct_main_map, AS_PROGRAM, 8, sbrkout_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3fff) + AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x380) AM_RAMBANK("bank1") + AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(sbrkout_videoram_w) AM_SHARE("videoram") + AM_RANGE(0x0800, 0x083f) AM_READ(sbrkoutct_switches_r) + AM_RANGE(0x0840, 0x0840) AM_MIRROR(0x003f) AM_READ_PORT("COIN") + AM_RANGE(0x0880, 0x0880) AM_MIRROR(0x003f) AM_READ_PORT("START") + AM_RANGE(0x08c0, 0x08c0) AM_MIRROR(0x003f) AM_READ_PORT("SERVICE") + AM_RANGE(0x0c00, 0x0c00) AM_MIRROR(0x03ff) AM_READ(sync_r) + AM_RANGE(0x0c10, 0x0c11) AM_MIRROR(0x000e) AM_WRITE(serve_led_w) + AM_RANGE(0x0c20, 0x0c21) AM_MIRROR(0x000e) AM_WRITE(serve_2_led_w) + AM_RANGE(0x0c30, 0x0c31) AM_MIRROR(0x000e) AM_WRITE(start_1_led_w) + AM_RANGE(0x0c40, 0x0c41) AM_MIRROR(0x000e) AM_WRITE(start_2_led_w) + AM_RANGE(0x0c50, 0x0c51) AM_MIRROR(0x000e) AM_WRITE(pot_mask1_w) + AM_RANGE(0x0c60, 0x0c61) AM_MIRROR(0x000e) AM_WRITE(pot_mask2_w) + AM_RANGE(0x0c70, 0x0c71) AM_MIRROR(0x000e) AM_WRITE(coincount_w) + AM_RANGE(0x0c80, 0x0c80) AM_MIRROR(0x007f) AM_WRITE(watchdog_reset_w) + AM_RANGE(0x0e00, 0x0e00) AM_MIRROR(0x007f) AM_WRITE(irq_ack_w) + AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x03ff) AM_READ(sync2_r) + AM_RANGE(0x2800, 0x3fff) AM_ROM +ADDRESS_MAP_END /************************************* @@ -475,6 +520,19 @@ static INPUT_PORTS_START( sbrkoutc ) PORT_CONFSETTING( 0x02, "Vertical" ) INPUT_PORTS_END +static INPUT_PORTS_START( sbrkoutct ) + PORT_INCLUDE(sbrkout) + + PORT_START("SERVE2") + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) + + PORT_MODIFY("SELECT") + PORT_CONFNAME(0x80, 0x00, "Game Select" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x80, DEF_STR( On ) ) +INPUT_PORTS_END + /************************************* * * Graphics definitions @@ -543,6 +601,10 @@ static MACHINE_CONFIG_START( sbrkout, sbrkout_state ) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED(sbrkoutct, sbrkout) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(sbrkoutct_main_map) +MACHINE_CONFIG_END /************************************* * @@ -598,7 +660,7 @@ ROM_START( sbrkout3 ) // rev 03; main cpu roms are on 1024x4bit (82s137 or equiv ROM_LOAD( "006401.e2", 0x0100, 0x0020, CRC(857df8db) SHA1(06313d5bde03220b2bc313d18e50e4bb1d0cfbbb) ) /* memory mapper */ ROM_END -ROM_START( sbrkoutc ) +ROM_START( sbrkoutc ) // built from original Atari source code ROM_REGION( 0x4000, "maincpu", 0 ) ROM_LOAD( "a33443.bin", 0x2800, 0x1800, CRC(bf418976) SHA1(d766e220a284a7b9caf876207e8191aff0497a03) ) @@ -614,6 +676,23 @@ ROM_START( sbrkoutc ) ROM_LOAD( "006401.e2", 0x0100, 0x0020, CRC(857df8db) SHA1(06313d5bde03220b2bc313d18e50e4bb1d0cfbbb) ) /* memory mapper */ ROM_END +ROM_START( sbrkoutct ) // built from original Atari source code + ROM_REGION( 0x4000, "maincpu", 0 ) + ROM_LOAD( "034555-01.c1", 0x2800, 0x0800, CRC(2da82521) SHA1(1f53e549676052647486cea6738c5c7a45133538) ) + ROM_LOAD( "034556-01.d11", 0x3000, 0x0800, CRC(5a6497ae) SHA1(96c2a136fb1e649e2db17bcb12bdc2a8d250a63e) ) + ROM_LOAD( "034557-01.ef1", 0x3800, 0x0800, CRC(b6b3b07b) SHA1(c4d2cdcca89c2944afd4a4ed0bb5003b3eca4c7e) ) + + ROM_REGION( 0x0400, "gfx1", 0 ) + ROM_LOAD( "034559-01.r4", 0x0000, 0x0200, CRC(84368539) SHA1(50b2c3f443346e3a355492ed1f7ec0a8cc6364d4) ) + ROM_LOAD( "034558-01.p4", 0x0200, 0x0200, CRC(cc0f81f2) SHA1(a2180280991c9cf43f4e941d9ba4fe5654d1af65) ) + + ROM_REGION( 0x0020, "gfx2", 0 ) + ROM_LOAD( "033282.k6", 0x0000, 0x0020, CRC(6228736b) SHA1(bc176261dba11521df19d545ce604f8cc294287a) ) + + ROM_REGION( 0x0120, "proms", 0 ) + ROM_LOAD( "006400.m2", 0x0000, 0x0100, CRC(b8094b4c) SHA1(82dc6799a19984f3b204ee3aeeb007e55afc8be3) ) /* sync (not used) */ + ROM_LOAD( "006401.e2", 0x0100, 0x0020, CRC(857df8db) SHA1(06313d5bde03220b2bc313d18e50e4bb1d0cfbbb) ) /* memory mapper */ +ROM_END /************************************* * @@ -621,6 +700,7 @@ ROM_END * *************************************/ -GAMEL( 1978, sbrkout, 0, sbrkout, sbrkout, driver_device, 0, ROT270, "Atari", "Super Breakout (rev 04)", GAME_SUPPORTS_SAVE, layout_sbrkout ) -GAMEL( 1978, sbrkout3, sbrkout, sbrkout, sbrkout, driver_device, 0, ROT270, "Atari", "Super Breakout (rev 03)", GAME_SUPPORTS_SAVE, layout_sbrkout ) -GAMEL( 1978, sbrkoutc, sbrkout, sbrkout, sbrkoutc, driver_device, 0, ROT270, "Atari", "Super Breakout (Canyon and Vertical Breakout, prototype)", GAME_SUPPORTS_SAVE, layout_sbrkout ) +GAMEL( 1978, sbrkout, 0, sbrkout, sbrkout, driver_device, 0, ROT270, "Atari", "Super Breakout (rev 04)", GAME_SUPPORTS_SAVE, layout_sbrkout ) +GAMEL( 1978, sbrkout3, sbrkout, sbrkout, sbrkout, driver_device, 0, ROT270, "Atari", "Super Breakout (rev 03)", GAME_SUPPORTS_SAVE, layout_sbrkout ) +GAMEL( 1978, sbrkoutc, sbrkout, sbrkout, sbrkoutc, driver_device, 0, ROT270, "Atari", "Super Breakout (Canyon and Vertical Breakout, prototype)", GAME_SUPPORTS_SAVE, layout_sbrkout ) +GAMEL( 1978, sbrkoutct, sbrkout, sbrkoutct, sbrkoutct, driver_device, 0, ROT270, "Atari", "Super Breakout (Cocktail, prototype)", GAME_SUPPORTS_SAVE, layout_sbrkout ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 49894e15b35..846f27922b0 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -6887,6 +6887,7 @@ skydiver // 009787 1978/06 [6800] sbrkout3 // 033442-033452 1978/09 [6502] sbrkout // 033453-033455 1978/09 [6502] sbrkoutc // unrealeased proto +sbrkoutct // 034555-034559 proto ???? [6502] atarifb // 033xxx 1978/10 [6502] atarifb1 // 033xxx 1978/10 [6502] atarifb2 // 035330-035350 ??? [6502] From 6ae1429c9230b07282e3a0cb62efd53f522c3b88 Mon Sep 17 00:00:00 2001 From: mamehaze Date: Sat, 27 Dec 2014 13:39:22 +0000 Subject: [PATCH 16/23] arcompact - it's actually executing code in cartridge space now (nw) --- src/emu/cpu/arcompact/arcompact.c | 8 + src/emu/cpu/arcompact/arcompact.h | 31 ++-- src/emu/cpu/arcompact/arcompact_execute.c | 132 ++++++---------- src/emu/cpu/arcompact/arcompact_make.py | 181 ++++++++++++++-------- src/mess/drivers/leapster.c | 1 + 5 files changed, 193 insertions(+), 160 deletions(-) diff --git a/src/emu/cpu/arcompact/arcompact.c b/src/emu/cpu/arcompact/arcompact.c index 735a9ecd893..4f229f7a291 100644 --- a/src/emu/cpu/arcompact/arcompact.c +++ b/src/emu/cpu/arcompact/arcompact.c @@ -24,9 +24,14 @@ const device_type ARCA5 = &device_creator; +static ADDRESS_MAP_START( arcompact_auxreg_map, AS_IO, 32, arcompact_device ) +ADDRESS_MAP_END + + arcompact_device::arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : cpu_device(mconfig, ARCA5, "ARCtangent-A5", tag, owner, clock, "arca5", __FILE__) , m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0) // some docs describe these as 'middle endian'?! + , m_io_config( "io", ENDIANNESS_LITTLE, 32, 34, 0, ADDRESS_MAP_NAME( arcompact_auxreg_map ) ) // IO space is 32 bits of dwords, so 34-bits { } @@ -59,6 +64,7 @@ void arcompact_device::device_start() m_debugger_temp = 0; m_program = &space(AS_PROGRAM); + m_io = &space(AS_IO); state_add( 0, "PC", m_debugger_temp).callimport().callexport().formatstr("%08X"); @@ -156,7 +162,9 @@ void arcompact_device::device_reset() } + /*****************************************************************************/ + void arcompact_device::execute_set_input(int irqline, int state) { diff --git a/src/emu/cpu/arcompact/arcompact.h b/src/emu/cpu/arcompact/arcompact.h index 974df138c97..4bf491daf00 100644 --- a/src/emu/cpu/arcompact/arcompact.h +++ b/src/emu/cpu/arcompact/arcompact.h @@ -77,7 +77,7 @@ protected: virtual void execute_set_input(int inputnum, int state); // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } // device_state_interface overrides virtual void state_import(const device_state_entry &entry); @@ -160,18 +160,18 @@ protected: ARCOMPACT_RETTYPE arcompact_handle04_0b(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_0c(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_0d(OPS_32); - ARCOMPACT_RETTYPE arcompact_handle04_0e(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_0e(OPS_32); // ARCOMPACT_RETTYPE arcompact_handle04_0f(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_10(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_11(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_12(OPS_32); // ARCOMPACT_RETTYPE arcompact_handle04_13(OPS_32); - ARCOMPACT_RETTYPE arcompact_handle04_14(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_14(OPS_32); // ARCOMPACT_RETTYPE arcompact_handle04_15(OPS_32); // ARCOMPACT_RETTYPE arcompact_handle04_16(OPS_32); - ARCOMPACT_RETTYPE arcompact_handle04_17(OPS_32); - ARCOMPACT_RETTYPE arcompact_handle04_18(OPS_32); - ARCOMPACT_RETTYPE arcompact_handle04_19(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_17(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_18(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_19(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_1a(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_1b(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_1c(OPS_32); @@ -183,7 +183,7 @@ protected: ARCOMPACT_RETTYPE arcompact_handle04_28(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_29(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32); - ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_00(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_01(OPS_32); // ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32); @@ -773,11 +773,17 @@ protected: ARCOMPACT_HANDLER04_TYPE_PM(04_06); ARCOMPACT_HANDLER04_TYPE_PM(04_07); ARCOMPACT_HANDLER04_TYPE_PM(04_0a); + ARCOMPACT_HANDLER04_TYPE_PM(04_0e); ARCOMPACT_HANDLER04_TYPE_PM(04_0f); ARCOMPACT_HANDLER04_TYPE_PM(04_13); + ARCOMPACT_HANDLER04_TYPE_PM(04_14); ARCOMPACT_HANDLER04_TYPE_PM(04_15); ARCOMPACT_HANDLER04_TYPE_PM(04_16); + ARCOMPACT_HANDLER04_TYPE_PM(04_17); + ARCOMPACT_HANDLER04_TYPE_PM(04_18); + ARCOMPACT_HANDLER04_TYPE_PM(04_19); ARCOMPACT_HANDLER04_TYPE_PM(04_20); + ARCOMPACT_HANDLER04_TYPE_PM(04_2b); ARCOMPACT_HANDLER04_TYPE_PM(04_2f_02); ARCOMPACT_HANDLER04_TYPE_PM(04_2f_07); @@ -788,11 +794,14 @@ protected: private: - address_space_config m_program_config; + const address_space_config m_program_config; + const address_space_config m_io_config; UINT32 m_pc; address_space *m_program; + address_space *m_io; + int m_icount; UINT32 m_debugger_temp; @@ -806,6 +815,10 @@ private: inline UINT8 READ8(UINT32 address) { return m_program->read_byte(address << 0); } inline void WRITE8(UINT32 address, UINT8 data){ m_program->write_byte(address << 0, data); } + inline UINT64 READAUX(UINT64 address) { return m_io->read_dword(address *4); } + inline void WRITEAUX(UINT64 address, UINT32 data) { m_io->write_dword(address *4, data); } + + int check_condition(UINT8 condition); UINT32 m_regs[0x40]; @@ -853,7 +866,7 @@ private: #define CONDITION_EQ (STATUS32_CHECK_Z) #define CONDITION_CS (STATUS32_CHECK_C) #define CONDITION_LT ((STATUS32_CHECK_N && !STATUS32_CHECK_V) || (!STATUS32_CHECK_N && STATUS32_CHECK_V)) - +#define CONDITION_MI (STATUS32_CHECK_N) extern const device_type ARCA5; diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index da8d90f53ee..e5623089737 100644 --- a/src/emu/cpu/arcompact/arcompact_execute.c +++ b/src/emu/cpu/arcompact/arcompact_execute.c @@ -148,7 +148,7 @@ int arcompact_device::check_condition(UINT8 condition) case 0x01: return CONDITION_EQ; case 0x02: return !CONDITION_EQ; // NE case 0x03: fatalerror("unhandled condition check %s", conditions[condition]); return -1; - case 0x04: 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; @@ -1501,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 { @@ -1840,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) @@ -1863,29 +1871,9 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_12(OPS_32) -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); @@ -1913,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) { @@ -1934,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); @@ -1945,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); } @@ -1954,7 +1968,7 @@ 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); } @@ -2148,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) { @@ -2672,7 +2636,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);} @@ -2719,12 +2683,10 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_0e(OPS_16) { return arco 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); } diff --git a/src/emu/cpu/arcompact/arcompact_make.py b/src/emu/cpu/arcompact/arcompact_make.py index ca80ae7f408..9268a6c55e0 100644 --- a/src/emu/cpu/arcompact/arcompact_make.py +++ b/src/emu/cpu/arcompact/arcompact_make.py @@ -17,6 +17,30 @@ def EmitGroup04_Handle_NZC_LSR1_Flags(f, funcname, opname): print >>f, " if (c == 0x00000001) { STATUS32_SET_C; }" print >>f, " else { STATUS32_CLEAR_C; }" +def EmitGroup04_Handle_NZCV_ADD_Flags(f, funcname, opname): + print >>f, " if (result & 0x80000000) { STATUS32_SET_N; }" + print >>f, " else { STATUS32_CLEAR_N; }" + print >>f, " if (result == 0x00000000) { STATUS32_SET_Z; }" + print >>f, " else { STATUS32_CLEAR_Z; }" + print >>f, " if ((b & 0x80000000) == (c & 0x80000000))" + print >>f, " {" + print >>f, " if ((result & 0x80000000) != (b & 0x80000000))" + print >>f, " {" + print >>f, " STATUS32_SET_V;" + print >>f, " }" + print >>f, " else" + print >>f, " {" + print >>f, " STATUS32_CLEAR_V;" + print >>f, " }" + print >>f, " }" + print >>f, " if (b < c)" + print >>f, " {" + print >>f, " STATUS32_SET_C;" + print >>f, " }" + print >>f, " else" + print >>f, " {" + print >>f, " STATUS32_CLEAR_C;" + print >>f, " }" def EmitGroup04_no_Flags(f, funcname, opname): @@ -42,6 +66,53 @@ def EmitGroup04_Flaghandler(f,funcname, opname, flagcondition, flaghandler): flaghandler(f, funcname, opname) print >>f, " }" +def EmitGroup04_u5fragment(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, breg_is_dst_only, flagcondition, flaghandler): + print >>f, " int size = 4;" + + if breg_is_dst_only == 0: + print >>f, " UINT32 limm = 0;" + + print >>f, "/* int got_limm = 0; */" + print >>f, " " + print >>f, " COMMON32_GET_breg;" + + if flagcondition == -1: + print >>f, " COMMON32_GET_F;" + + print >>f, " COMMON32_GET_u6;" + + if ignore_a == 0: + print >>f, " COMMON32_GET_areg;" + elif ignore_a == 1: + print >>f, " //COMMON32_GET_areg; // areg is reserved / not used" + elif ignore_a == 2: + print >>f, " //COMMON32_GET_areg; // areg bits already used as opcode select" + elif ignore_a == 3: + print >>f, " //COMMON32_GET_areg; // areg bits already used as condition code select" + print >>f, " " + + print >>f, " UINT32 c;" + if breg_is_dst_only == 0: + print >>f, " UINT32 b;" + print >>f, " " + print >>f, " /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */" + print >>f, " if (breg == LIMM_REG)" + print >>f, " {" + print >>f, " GET_LIMM_32;" + print >>f, " size = 8;" + print >>f, "/* got_limm = 1; */" + print >>f, " b = limm;" + print >>f, " }" + print >>f, " else" + print >>f, " {" + print >>f, " b = m_regs[breg];" + print >>f, " }" + + print >>f, " " + print >>f, " c = u;" + print >>f, " " + print >>f, " /* 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?) */" + def EmitGroup04(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, breg_is_dst_only, flagcondition, flaghandler): # the mode 0x00 handler print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p00(OPS_32)" % (funcname) @@ -56,15 +127,15 @@ def EmitGroup04(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, b if flagcondition == -1: print >>f, " COMMON32_GET_F;" - + print >>f, " COMMON32_GET_creg;" if ignore_a == 0: print >>f, " COMMON32_GET_areg;" elif ignore_a == 1: - print >>f, " //COMMON32_GET_areg; // areg is reserved / not used" + print >>f, " //COMMON32_GET_areg; // areg is reserved / not used" elif ignore_a == 2: - print >>f, " //COMMON32_GET_areg; // areg bits already used as opcode select" + print >>f, " //COMMON32_GET_areg; // areg bits already used as opcode select" print >>f, " " @@ -111,50 +182,7 @@ def EmitGroup04(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, b # the mode 0x01 handler print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p01(OPS_32)" % (funcname) print >>f, "{" - print >>f, " int size = 4;" - - if breg_is_dst_only == 0: - print >>f, " UINT32 limm = 0;" - - print >>f, "/* int got_limm = 0; */" - print >>f, " " - print >>f, " COMMON32_GET_breg;" - - if flagcondition == -1: - print >>f, " COMMON32_GET_F;" - - print >>f, " COMMON32_GET_u6;" - - if ignore_a == 0: - print >>f, " COMMON32_GET_areg;" - elif ignore_a == 1: - print >>f, " //COMMON32_GET_areg; // areg is reserved / not used" - elif ignore_a == 2: - print >>f, " //COMMON32_GET_areg; // areg bits already used as opcode select" - - print >>f, " " - - print >>f, " UINT32 c;" - if breg_is_dst_only == 0: - print >>f, " UINT32 b;" - print >>f, " " - print >>f, " /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */" - print >>f, " if (breg == LIMM_REG)" - print >>f, " {" - print >>f, " GET_LIMM_32;" - print >>f, " size = 8;" - print >>f, "/* got_limm = 1; */" - print >>f, " b = limm;" - print >>f, " }" - print >>f, " else" - print >>f, " {" - print >>f, " b = m_regs[breg];" - print >>f, " }" - - print >>f, " " - print >>f, " c = u;" - print >>f, " " - print >>f, " /* 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?) */" + EmitGroup04_u5fragment(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, breg_is_dst_only, flagcondition, flaghandler) print >>f, " %s" % (opexecute) print >>f, " %s" % (opwrite) print >>f, " " @@ -244,8 +272,15 @@ def EmitGroup04(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, b print >>f, "}" else: print >>f, "{" - print >>f, " int size = 4;" - print >>f, " arcompact_fatal(\"arcompact_handle%s_p11_m1 (%s)\\n\");" % (funcname, opname) + EmitGroup04_u5fragment(f,funcname, opname, opexecute, opwrite, opwrite_alt, 3, breg_is_dst_only, flagcondition, flaghandler) + print >>f, " COMMON32_GET_CONDITION;" + print >>f, " if (!check_condition(condition))" + print >>f, " return m_pc + (size>>0);" + print >>f, "" + print >>f, " %s" % (opexecute) + print >>f, " %s" % (opwrite_alt) + print >>f, " " + EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler) print >>f, " return m_pc + (size >> 0);" print >>f, "}" print >>f, "" @@ -297,25 +332,32 @@ except Exception, err: sys.exit(1) -EmitGroup04(f, "04_00", "ADD", "UINT32 result = b + c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_00", "ADD", "UINT32 result = b + c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_Handle_NZCV_ADD_Flags ) -EmitGroup04(f, "04_02", "SUB", "UINT32 result = b - c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_02", "SUB", "UINT32 result = b - c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_04", "AND", "UINT32 result = b & c;", "if (areg != LIMM_REG) { m_regs[areg] = result; }", "if (breg != LIMM_REG) { m_regs[breg] = result; }", 0,0, -1, EmitGroup04_Handle_NZ_Flags ) -EmitGroup04(f, "04_05", "OR", "UINT32 result = b | c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_06", "BIC", "UINT32 result = b & (~c);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_07", "XOR", "UINT32 result = b ^ c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_04", "AND", "UINT32 result = b & c;", "if (areg != LIMM_REG) { m_regs[areg] = result; }", "if (breg != LIMM_REG) { m_regs[breg] = result; }", 0,0, -1, EmitGroup04_Handle_NZ_Flags ) +EmitGroup04(f, "04_05", "OR", "UINT32 result = b | c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_06", "BIC", "UINT32 result = b & (~c);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_07", "XOR", "UINT32 result = b ^ c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_0a", "MOV", "UINT32 result = c;", "m_regs[breg] = result;", "m_regs[breg] = result;", 1,1, -1, EmitGroup04_Handle_NZ_Flags ) # special case, result always goes to breg +EmitGroup04(f, "04_0a", "MOV", "UINT32 result = c;", "m_regs[breg] = result;", "m_regs[breg] = result;", 1,1, -1, EmitGroup04_Handle_NZ_Flags ) # special case, result always goes to breg +EmitGroup04(f, "04_0e", "RSUB", "UINT32 result = c - b;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) EmitGroup04(f, "04_0f", "BSET", "UINT32 result = b | (1 << (c & 0x1f));", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_13", "BMSK", "UINT32 result = b & ((1<<(c+1))-1);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_13", "BMSK", "UINT32 result = b & ((1<<(c+1))-1);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_14", "ADD1", "UINT32 result = b + (c << 1);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_15", "ADD2", "UINT32 result = b + (c << 2);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_16", "ADD3", "UINT32 result = b + (c << 3);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_17", "SUB1", "UINT32 result = b - (c << 1);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_18", "SUB2", "UINT32 result = b - (c << 2);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) +EmitGroup04(f, "04_19", "SUB3", "UINT32 result = b - (c << 3);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) + +EmitGroup04(f, "04_2b", "SR", "WRITEAUX(c,b);", "", "", 1,0, -1, EmitGroup04_unsupported_Flags ) # this can't be conditional (todo) -EmitGroup04(f, "04_15", "ADD2", "UINT32 result = b + (c << 2);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) -EmitGroup04(f, "04_16", "ADD3", "UINT32 result = b + (c << 3);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) EmitGroup04(f, "05_00", "ASL", "UINT32 result = b << (c&0x1f);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags ) @@ -327,13 +369,20 @@ EmitGroup04(f, "04_2f_07", "EXTB", "UINT32 result = c & 0x000000ff;", "m_regs[b EmitGroup04(f, "04_2f_08", "EXTW", "UINT32 result = c & 0x0000ffff;", "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_unsupported_Flags ) # ^ # xxx_S b <- b,c format opcodes (or in some cases xxx_S b,c) -EmitGroup0f(f, "0f_02", "SUB_S", "UINT32 result = m_regs[breg] - m_regs[creg];", "m_regs[breg] = result;" ) -EmitGroup0f(f, "0f_04", "AND_S", "UINT32 result = m_regs[breg] & m_regs[creg];", "m_regs[breg] = result;" ) -EmitGroup0f(f, "0f_05", "OR_S", "UINT32 result = m_regs[breg] | m_regs[creg];", "m_regs[breg] = result;" ) -EmitGroup0f(f, "0f_07", "XOR_S", "UINT32 result = m_regs[breg] ^ m_regs[creg];", "m_regs[breg] = result;" ) -EmitGroup0f(f, "0f_0f", "EXTB_S","UINT32 result = m_regs[creg] & 0x000000ff;", "m_regs[breg] = result;" ) -EmitGroup0f(f, "0f_10", "EXTW_S","UINT32 result = m_regs[creg] & 0x0000ffff;", "m_regs[breg] = result;" ) -EmitGroup0f(f, "0f_1b", "ASL1_S","UINT32 result = m_regs[creg] << 1;", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_02", "SUB_S", "UINT32 result = m_regs[breg] - m_regs[creg];", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_04", "AND_S", "UINT32 result = m_regs[breg] & m_regs[creg];", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_05", "OR_S", "UINT32 result = m_regs[breg] | m_regs[creg];", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_07", "XOR_S", "UINT32 result = m_regs[breg] ^ m_regs[creg];", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_0f", "EXTB_S","UINT32 result = m_regs[creg] & 0x000000ff;", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_10", "EXTW_S","UINT32 result = m_regs[creg] & 0x0000ffff;", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_13", "NEG_S"," UINT32 result = 0 - m_regs[creg];", "m_regs[breg] = result;" ) + +EmitGroup0f(f, "0f_14", "ADD1_S"," UINT32 result = m_regs[breg] + (m_regs[creg] <<1);", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_15", "ADD2_S"," UINT32 result = m_regs[breg] + (m_regs[creg] <<2);", "m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_16", "ADD3_S"," UINT32 result = m_regs[breg] + (m_regs[creg] <<3);", "m_regs[breg] = result;" ) + +EmitGroup0f(f, "0f_19", "LSR_S", "UINT32 result = m_regs[breg] >> (m_regs[creg]&0x1f);","m_regs[breg] = result;" ) +EmitGroup0f(f, "0f_1b", "ASL1_S","UINT32 result = m_regs[creg] << 1;", "m_regs[breg] = result;" ) # xxx_S b, b, u5 format opcodes diff --git a/src/mess/drivers/leapster.c b/src/mess/drivers/leapster.c index 57f951bd16b..5d25830036c 100644 --- a/src/mess/drivers/leapster.c +++ b/src/mess/drivers/leapster.c @@ -284,6 +284,7 @@ static ADDRESS_MAP_START( leapster_map, AS_PROGRAM, 32, leapster_state ) AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_MIRROR(0x40000000) // pointers in the bios region seem to be to the 40xxxxxx region, either we mirror there or something (real bios?) is acutally missing AM_RANGE(0x0180D800, 0x0180D803) AM_READ(leapster_random_r) AM_RANGE(0x03000000, 0x030007ff) AM_RAM // puts stack here, writes a pointer @ 0x03000000 on startup + AM_RANGE(0x3c000000, 0x3c1fffff) AM_RAM // really ram, or has our code execution gone wrong? // AM_RANGE(0x80000000, 0x807fffff) AM_ROMBANK("cartrom") // game ROM pointers are all to the 80xxxxxx region, so I assume it maps here - installed if a cart is present ADDRESS_MAP_END From 61ed3c962397dd86903971e5ae42f3185dd12c6e Mon Sep 17 00:00:00 2001 From: mamehaze Date: Sat, 27 Dec 2014 14:45:56 +0000 Subject: [PATCH 17/23] (nw) --- src/emu/cpu/arcompact/arcompact_execute.c | 36 ----------------------- src/emu/cpu/arcompact/arcompact_make.py | 26 ++++++++++++++++ 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index e5623089737..8e79c587ba1 100644 --- a/src/emu/cpu/arcompact/arcompact_execute.c +++ b/src/emu/cpu/arcompact/arcompact_execute.c @@ -2440,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) { diff --git a/src/emu/cpu/arcompact/arcompact_make.py b/src/emu/cpu/arcompact/arcompact_make.py index 9268a6c55e0..110595c6585 100644 --- a/src/emu/cpu/arcompact/arcompact_make.py +++ b/src/emu/cpu/arcompact/arcompact_make.py @@ -286,6 +286,27 @@ def EmitGroup04(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, b print >>f, "" print >>f, "" + +# xxx_S c, b, u3 format opcodes (note c is destination) +def EmitGroup0d(f,funcname, opname, opexecute, opwrite): + print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s(OPS_16)" % (funcname) + print >>f, "{" + print >>f, " int u, breg, creg;" + print >>f, "" + print >>f, " COMMON16_GET_u3;" + print >>f, " COMMON16_GET_breg;" + print >>f, " COMMON16_GET_creg;" + print >>f, "" + print >>f, " REG_16BIT_RANGE(breg);" + print >>f, " REG_16BIT_RANGE(creg);" + print >>f, "" + print >>f, " %s" % (opexecute) + print >>f, " %s" % (opwrite) + print >>f, "" + print >>f, " return m_pc + (2 >> 0);" + print >>f, "}" + + # xxx_S b <- b,c format opcodes def EmitGroup0f(f,funcname, opname, opexecute, opwrite): print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s(OPS_16)"% (funcname) @@ -368,6 +389,11 @@ EmitGroup04(f, "04_2f_02", "LSR1", "UINT32 result = c >> 1;", "m_regs[b EmitGroup04(f, "04_2f_07", "EXTB", "UINT32 result = c & 0x000000ff;", "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_unsupported_Flags ) # ^ EmitGroup04(f, "04_2f_08", "EXTW", "UINT32 result = c & 0x0000ffff;", "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_unsupported_Flags ) # ^ +# xxx_S c, b, u3 format opcodes (note c is destination) +EmitGroup0d(f, "0d_00", "ADD_S", "UINT32 result = m_regs[breg] + u;", "m_regs[creg] = result;" ) +EmitGroup0d(f, "0d_01", "SUB_S", "UINT32 result = m_regs[breg] - u;", "m_regs[creg] = result;" ) +EmitGroup0d(f, "0d_02", "ASL_S", "UINT32 result = m_regs[breg] << u;", "m_regs[creg] = result;" ) + # xxx_S b <- b,c format opcodes (or in some cases xxx_S b,c) EmitGroup0f(f, "0f_02", "SUB_S", "UINT32 result = m_regs[breg] - m_regs[creg];", "m_regs[breg] = result;" ) EmitGroup0f(f, "0f_04", "AND_S", "UINT32 result = m_regs[breg] & m_regs[creg];", "m_regs[breg] = result;" ) From f3e001859ecb8e3927bf0c977370a6e9d7dff77a Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sat, 27 Dec 2014 22:02:35 +0100 Subject: [PATCH 18/23] Didn't need that much to boot (nw) --- src/mess/drivers/excali64.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mess/drivers/excali64.c b/src/mess/drivers/excali64.c index fda5eabd966..3c937265a20 100644 --- a/src/mess/drivers/excali64.c +++ b/src/mess/drivers/excali64.c @@ -302,11 +302,10 @@ WRITE8_MEMBER( excali64_state::porte4_w ) if (BIT(data, 1)) floppy = m_floppy1->get_device(); + m_fdc->set_floppy(floppy); if (floppy) - { - m_fdc->set_floppy(floppy); floppy->ss_w(BIT(data, 4)); - } + #else if BIT(data, 0) m_fdc->set_drive(0); @@ -654,10 +653,9 @@ static MACHINE_CONFIG_START( excali64, excali64_state ) MCFG_CASSETTE_ADD( "cassette" ) #if NEWFDC MCFG_WD2793x_ADD("fdc", XTAL_16MHz / 16) - MCFG_WD_FDC_FORCE_READY MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", excali64_floppies, "525dd", floppy_image_device::default_floppy_formats)// excali64_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", excali64_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", excali64_floppies, "525dd", excali64_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", excali64_floppies, "525dd", excali64_state::floppy_formats) #else MCFG_DEVICE_ADD("fdc", WD2793, 0) MCFG_WD17XX_DEFAULT_DRIVE2_TAGS From f8ff30f8f4326cdb0e14406ad66b37cd0545db00 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Sat, 27 Dec 2014 21:50:51 -0500 Subject: [PATCH 19/23] Small comment fixes/addenda. (n/w) --- src/mame/audio/dkong.c | 2 +- src/mess/drivers/sdk86.c | 4 ++-- src/mess/drivers/tispeak.c | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mame/audio/dkong.c b/src/mame/audio/dkong.c index ff959d4df52..4680b3ac5e0 100644 --- a/src/mame/audio/dkong.c +++ b/src/mame/audio/dkong.c @@ -1145,7 +1145,7 @@ Addresses found at @0x510, cpu2 0: 14 16 ... checkpoint charlie 1: 14 18 ... checkpoint bravo 2: 14 1A ... checkpoint alpha - 3: 1C You'll notice + 3: 1C Use Caution (sounds kinda like 'You'll notice') 4: 1E 1E Complete attack mission 5: 10 10 10 trouble, trouble, trouble 6: 12 12 all pilots climb up diff --git a/src/mess/drivers/sdk86.c b/src/mess/drivers/sdk86.c index 51bcbd4c954..5b8f2a6bcbb 100644 --- a/src/mess/drivers/sdk86.c +++ b/src/mess/drivers/sdk86.c @@ -9,8 +9,7 @@ 22/06/2011 Working [Robbbert] TODO: - Add 8251A for serial - Add optional 2x 8255A + Add optional 2x 8255A port read/write logging @@ -19,6 +18,7 @@ This is an evaluation kit for the 8086 cpu. There is no speaker or storage facility in the standard kit. Download the User Manual to get the operating procedures. +The user manual is available from: http://www.bitsavers.org/pdf/intel/8086/9800698A_SDK-86_Users_Man_Apr79.pdf ToDo: - Artwork diff --git a/src/mess/drivers/tispeak.c b/src/mess/drivers/tispeak.c index 5bf841e7825..100fdd14e5c 100644 --- a/src/mess/drivers/tispeak.c +++ b/src/mess/drivers/tispeak.c @@ -18,9 +18,10 @@ #include "tispeak.lh" // The master clock is a single stage RC oscillator into TMS5100 RCOSC: -// C is 68pf, R is a 50kohm trimpot wich is set to 33.6kohm. CPUCLK is this/2, ROMCLK is this/4. +// In an early 1979 Speak & Spell, C is 68pf, R is a 50kohm trimpot which is set to around 33.6kohm +// (measured in-circuit). CPUCLK is this osc freq /2, ROMCLK is this osc freq /4. // The typical osc freq curve for TMS5100 is unknown. Let's assume it is set to the default frequency, -// which is 640kHz according to the TMS5100 documentation. +// which is 640kHz for 8KHz according to the TMS5100 documentation. #define MASTER_CLOCK (640000) From 3cf2859bdaf114f392d7a150e1ed1b088df2bebd Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 28 Dec 2014 16:50:41 +1100 Subject: [PATCH 20/23] z80dma : fixed buffer overflow. Fixes altos5 and wmbullet floppies. --- src/emu/machine/z80dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emu/machine/z80dma.c b/src/emu/machine/z80dma.c index 44f1463ce57..e98cf6a764b 100644 --- a/src/emu/machine/z80dma.c +++ b/src/emu/machine/z80dma.c @@ -688,7 +688,7 @@ void z80dma_device::write(UINT8 data) if (LOG) logerror("Z80DMA '%s' CMD Read status Byte\n", tag()); READ_MASK = 1; assert(m_read_num_follow < ARRAY_LENGTH(m_read_regs_follow)); - m_read_regs_follow[m_read_num_follow++] = m_status; + m_read_regs_follow[0] = m_status; break; case COMMAND_RESET_AND_DISABLE_INTERRUPTS: WR3 &= ~0x20; From 32600e4210d997c9daa4bec6af424bd703d33ce8 Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 28 Dec 2014 23:01:46 +1100 Subject: [PATCH 21/23] removed no-longer-needed asserts from z80dma --- src/emu/machine/z80dma.c | 2 -- src/mess/drivers/altos5.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/emu/machine/z80dma.c b/src/emu/machine/z80dma.c index e98cf6a764b..d75afbf4409 100644 --- a/src/emu/machine/z80dma.c +++ b/src/emu/machine/z80dma.c @@ -596,7 +596,6 @@ UINT8 z80dma_device::read() if(m_read_num_follow == 0) // special case: Legend of Kage on X1 Turbo res = m_status; else { - assert(m_read_cur_follow < ARRAY_LENGTH(m_read_regs_follow)); res = m_read_regs_follow[m_read_cur_follow]; } @@ -687,7 +686,6 @@ void z80dma_device::write(UINT8 data) case COMMAND_READ_STATUS_BYTE: if (LOG) logerror("Z80DMA '%s' CMD Read status Byte\n", tag()); READ_MASK = 1; - assert(m_read_num_follow < ARRAY_LENGTH(m_read_regs_follow)); m_read_regs_follow[0] = m_status; break; case COMMAND_RESET_AND_DISABLE_INTERRUPTS: diff --git a/src/mess/drivers/altos5.c b/src/mess/drivers/altos5.c index bfa0b71e053..1d6ae952999 100644 --- a/src/mess/drivers/altos5.c +++ b/src/mess/drivers/altos5.c @@ -221,7 +221,7 @@ READ8_MEMBER(altos5_state::memory_read_byte) WRITE8_MEMBER(altos5_state::memory_write_byte) { address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.write_byte(offset, data); + prog_space.write_byte(offset, data); } READ8_MEMBER(altos5_state::io_read_byte) @@ -233,7 +233,7 @@ READ8_MEMBER(altos5_state::io_read_byte) WRITE8_MEMBER(altos5_state::io_write_byte) { address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.write_byte(offset, data); + prog_space.write_byte(offset, data); } WRITE_LINE_MEMBER( altos5_state::busreq_w ) From 00e13528546bb1dc6918ef784743f90c6213fb40 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 28 Dec 2014 17:08:09 +0100 Subject: [PATCH 22/23] removed identical romsets --- src/mess/drivers/tispeak.c | 58 ++++++++++---------------------------- src/mess/mess.lst | 2 -- 2 files changed, 15 insertions(+), 45 deletions(-) diff --git a/src/mess/drivers/tispeak.c b/src/mess/drivers/tispeak.c index 100fdd14e5c..61e22e5c49d 100644 --- a/src/mess/drivers/tispeak.c +++ b/src/mess/drivers/tispeak.c @@ -5,6 +5,12 @@ Texas Instruments Speak & Spell hardware (still need to write notes here..) + + Other stuff on similar hardware: + - Language Tutor/Translator + - Touch & Tell, but it runs on a TMS1100! + - Speak & Spell Compact, Speak & Write (UK version), TMS1100? TMS0980? + - Speak & Read ***************************************************************************/ @@ -455,7 +461,7 @@ MACHINE_CONFIG_END ROM_START( snspell ) ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // typed in from patent 4189779, may have errors ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_default_ipla.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) @@ -484,22 +490,6 @@ ROM_START( snspella ) ROM_LOAD( "cd2350a.vsm", 0x0000, 0x4000, CRC(2adda742) SHA1(3f868ed8284b723c815a30343057e03467c043b5) ) ROM_END -ROM_START( snspellp ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // typed in from patent 4189779, may have errors - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_default_ipla.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_cd2708_mpla.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // taken from cd2708, need to verify if it's same as tmc0271 - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_opla.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) - - ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge - ROM_LOAD( "tmc0351.vsm", 0x0000, 0x4000, CRC(beea3373) SHA1(8b0f7586d2f12c3d4a885fdb528cf23feffa1a3b) ) - ROM_LOAD( "tmc0352.vsm", 0x4000, 0x4000, CRC(d51f0587) SHA1(ddaa484be1bba5fef46b481cafae517e4acaa8ed) ) -ROM_END - ROM_START( snspelluk ) ROM_REGION( 0x1000, "maincpu", 0 ) ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have @@ -550,14 +540,16 @@ ROM_END ROM_START( snmath ) ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4946391_t2074", 0x0000, 0x1000, BAD_DUMP CRC(011f0c2d) SHA1(d2e14d72e03ca864abd51da78ffb71a9da82f624) ) // placeholder, use the one we have + // typed in from patent 4946391, verified with source code (mark BAD_DUMP just to be unsure) + // BTANB note: Mix It does not work at all, this is an original bug in the prototype. There are probably other minor bugs too. + ROM_LOAD( "us4946391_t2074", 0x0000, 0x1000, BAD_DUMP CRC(011f0c2d) SHA1(d2e14d72e03ca864abd51da78ffb71a9da82f624) ) ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_default_ipla.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_cd2708_mpla.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // placeholder, use the one we have + ROM_LOAD( "tms0270_cd2708_mpla.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // taken from cd2708, need to verify if it's same as cd2704 ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_cd2708_opla.pla", 0, 1246, BAD_DUMP CRC(1abad753) SHA1(53d20b519ed73ce248368047a056836afbe3cd46) ) // placeholder, use the one we have + ROM_LOAD( "tms0270_cd2708_opla.pla", 0, 1246, BAD_DUMP CRC(1abad753) SHA1(53d20b519ed73ce248368047a056836afbe3cd46) ) // " ROM_REGION( 0x8000, "tms6100", 0 ) ROM_LOAD( "cd2392.vsm", 0x0000, 0x4000, CRC(4ed2e920) SHA1(8896f29e25126c1e4d9a47c9a325b35dddecc61f) ) @@ -583,33 +575,13 @@ ROM_START( snmatha ) ROM_RELOAD( 0x7000, 0x1000 ) ROM_END -ROM_START( snmathp ) - ROM_REGION( 0x1000, "maincpu", 0 ) - // typed in from patent 4946391, verified with source code (mark BAD_DUMP just to be unsure) - // BTANB note: Mix It does not work at all, this is an original bug in the prototype. There are probably other minor bugs too. - ROM_LOAD( "us4946391_t2074", 0x0000, 0x1000, BAD_DUMP CRC(011f0c2d) SHA1(d2e14d72e03ca864abd51da78ffb71a9da82f624) ) - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_default_ipla.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_cd2708_mpla.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // taken from cd2708, need to verify if it's same as cd2704 - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_cd2708_opla.pla", 0, 1246, BAD_DUMP CRC(1abad753) SHA1(53d20b519ed73ce248368047a056836afbe3cd46) ) // " - - ROM_REGION( 0x8000, "tms6100", 0 ) - ROM_LOAD( "cd2392.vsm", 0x0000, 0x4000, CRC(4ed2e920) SHA1(8896f29e25126c1e4d9a47c9a325b35dddecc61f) ) - ROM_LOAD( "cd2393.vsm", 0x4000, 0x4000, CRC(571d5b5a) SHA1(83284755d9b77267d320b5b87fdc39f352433715) ) -ROM_END - -COMP( 1978, snspell, 0, 0, snspell, snspell, driver_device, 0, "Texas Instruments", "Speak & Spell (US set 1)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) +COMP( 1978, snspell, 0, 0, snspell, snspell, driver_device, 0, "Texas Instruments", "Speak & Spell (US prototype)", GAME_IMPERFECT_SOUND ) // also US set 1 COMP( 1980, snspella, snspell, 0, snspell, snspell, driver_device, 0, "Texas Instruments", "Speak & Spell (US set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) -COMP( 1978, snspellp, snspell, 0, snspell, snspell, driver_device, 0, "Texas Instruments", "Speak & Spell (US prototype)", GAME_IMPERFECT_SOUND ) COMP( 1978, snspelluk, snspell, 0, snspell, snspell, driver_device, 0, "Texas Instruments", "Speak & Spell (UK set 1)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) COMP( 1981, snspelluka, snspell, 0, snspell, snspell, driver_device, 0, "Texas Instruments", "Speak & Spell (UK set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) // different voice actor -COMP( 1980, ladictee, snspell, 0, snspell, snspell, driver_device, 0, "Texas Instruments", "La Dictee Magnifique (France)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) // doesn't work, custom MCU ROM? +COMP( 1980, ladictee, snspell, 0, snspell, snspell, driver_device, 0, "Texas Instruments", "La Dictee Magnifique (France)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) // doesn't work due to missing CD2702 MCU dump, German version has CD2702 too -COMP( 1980, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US set 1)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) +COMP( 1980, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US prototype)", GAME_IMPERFECT_SOUND ) // also US set 1 COMP( 1986, snmatha, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) -COMP( 1980, snmathp, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US prototype)", GAME_IMPERFECT_SOUND ) diff --git a/src/mess/mess.lst b/src/mess/mess.lst index 5b3339dd922..966a4e1f334 100644 --- a/src/mess/mess.lst +++ b/src/mess/mess.lst @@ -1064,14 +1064,12 @@ avigo_it // 1997 Avigo (Italian) // TI Speak & Spell snspell -snspellp snspella snspelluk snspelluka ladictee snmath snmatha -snmathp // Texas Instruments Calculators tisr16 // 1974 SR-16 From 4e9265719006f635c16a6197f903717a9b9c0f7e Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sun, 28 Dec 2014 17:26:05 +0100 Subject: [PATCH 23/23] Add a TEA1002 color encoder device and use it for the Aquarius. It might make sense to make this a direct descendent of the palette_device instead. Color information based on TEA1002 datasheet. [Dirk Best, nitrofurano, Bruce Abbott] --- src/emu/video/tea1002.c | 86 ++++++++++++++++++++++++++++++++++++ src/emu/video/tea1002.h | 67 ++++++++++++++++++++++++++++ src/emu/video/video.mak | 9 ++++ src/mess/drivers/aquarius.c | 1 + src/mess/includes/aquarius.h | 3 ++ src/mess/mess.mak | 1 + src/mess/video/aquarius.c | 23 +--------- 7 files changed, 168 insertions(+), 22 deletions(-) create mode 100644 src/emu/video/tea1002.c create mode 100644 src/emu/video/tea1002.h diff --git a/src/emu/video/tea1002.c b/src/emu/video/tea1002.c new file mode 100644 index 00000000000..f9d014ae113 --- /dev/null +++ b/src/emu/video/tea1002.c @@ -0,0 +1,86 @@ +/*************************************************************************** + + TEA1002 + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + PAL colour encoder and video summer + +***************************************************************************/ + +#include "tea1002.h" + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +const float tea1002_device::m_luminance[] = +{ + 0, 22.5, 44, 66.5, 8.5, 31, 52.5, 100, // INV = 0 + 75, 52.5, 31, 8.5, 66.5, 44, 22.5, 0 // INV = 1 +}; + +const int tea1002_device::m_phase[] = +{ + 0, 103, 241, 167, 347, 61, 283, 0, // INV = 0 + 0, 283, 61, 347, 167, 241, 103, 0 // INV = 1 +}; + +const int tea1002_device::m_amplitute[] = +{ + 0, 48, 44, 33, 33, 44, 48, 0, // INV = 0 + 0, 24, 22, 17, 17, 22, 24, 0 // INV = 1 +}; + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type TEA1002 = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// paula_device - constructor +//------------------------------------------------- + +tea1002_device::tea1002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, TEA1002, "TEA1002 PAL colour encoder", tag, owner, clock, "tea1002", __FILE__) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tea1002_device::device_start() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +// this could be done in device_start() and cached, but it's only +// accessed once at PALETTE_INIT anyway +rgb_t tea1002_device::color(int index) +{ + // calculate yuv + double y = m_luminance[index] / 100; + double u = cos((m_phase[index] + m_tint) * M_PI / 180) * m_amplitute[index] / 100; + double v = sin((m_phase[index] + m_tint) * M_PI / 180) * m_amplitute[index] / 100; + + // and convert to rgb + double r = y + v * 1.14; + double g = y - u * 0.395 - v * 0.581; + double b = y + u * 2.032; + + return rgb_t(rgb_t::clamp(r * 255), rgb_t::clamp(g * 255), rgb_t::clamp(b * 255)); +} diff --git a/src/emu/video/tea1002.h b/src/emu/video/tea1002.h new file mode 100644 index 00000000000..d4e20c56e6d --- /dev/null +++ b/src/emu/video/tea1002.h @@ -0,0 +1,67 @@ +/*************************************************************************** + + TEA1002 + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + PAL colour encoder and video summer + + _____ _____ + INV 1 |* \_/ | 18 CBLNK + R 2 | | 17 3,54 MHz + G 3 | | 16 GND + B 4 | | 15 CBF + _CSYNC 5 | TEA1002 | 14 8,86 MHz + lum. delay line 6 | | 13 8,86 MHz + lum. delay line 7 | | 12 PAL switch + comp. video to mod. 8 | | 11 chroma band limiting + d.c. adj. / colour bar 9 |_____________| 10 Vp + +***************************************************************************/ + +#pragma once + +#ifndef __TEA1002_H__ +#define __TEA1002_H__ + +#include "emu.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_TEA1002_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, TEA1002, _clock) + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> tea1002_device + +class tea1002_device : public device_t +{ +public: + // construction/destruction + tea1002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + rgb_t color(int index); + +protected: + // device_t overrides + virtual void device_start(); + +private: + static const int m_tint = -6; // what is this based on? + static const float m_luminance[16]; + static const int m_phase[16]; + static const int m_amplitute[16]; +}; + +// device type definition +extern const device_type TEA1002; + +#endif // __TEA1002_H__ diff --git a/src/emu/video/video.mak b/src/emu/video/video.mak index 72ce5eb341f..ff88683af5d 100644 --- a/src/emu/video/video.mak +++ b/src/emu/video/video.mak @@ -481,6 +481,15 @@ ifneq ($(filter T6A04,$(VIDEOS)),) VIDEOOBJS+= $(VIDEOOBJ)/t6a04.o endif +#------------------------------------------------- +# +#@src/emu/video/tea1002.h,VIDEOS += TEA1002 +#------------------------------------------------- + +ifneq ($(filter TEA1002,$(VIDEOS)),) +VIDEOOBJS += $(VIDEOOBJ)/tea1002.o +endif + #------------------------------------------------- # #@src/emu/video/tlc34076.h,VIDEOS += TLC34076 diff --git a/src/mess/drivers/aquarius.c b/src/mess/drivers/aquarius.c index 87632a46d15..24966318e45 100644 --- a/src/mess/drivers/aquarius.c +++ b/src/mess/drivers/aquarius.c @@ -357,6 +357,7 @@ static MACHINE_CONFIG_START( aquarius, aquarius_state ) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", aquarius ) + MCFG_TEA1002_ADD("encoder", XTAL_8_867238MHz) MCFG_PALETTE_ADD("palette", 512) MCFG_PALETTE_INDIRECT_ENTRIES(16) MCFG_PALETTE_INIT_OWNER(aquarius_state, aquarius) diff --git a/src/mess/includes/aquarius.h b/src/mess/includes/aquarius.h index bc052d1f6a5..4716a3ea370 100644 --- a/src/mess/includes/aquarius.h +++ b/src/mess/includes/aquarius.h @@ -9,6 +9,7 @@ #include "emu.h" #include "cpu/z80/z80.h" +#include "video/tea1002.h" #include "imagedev/cassette.h" #include "machine/ram.h" #include "sound/ay8910.h" @@ -38,6 +39,7 @@ public: m_y7(*this, "Y7"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), + m_tea1002(*this, "encoder"), m_palette(*this, "palette") { } @@ -58,6 +60,7 @@ public: required_ioport m_y7; required_device m_gfxdecode; required_device m_screen; + required_device m_tea1002; required_device m_palette; UINT8 m_scrambler; diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 9c283ba4bfe..a2b8e696682 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -313,6 +313,7 @@ VIDEOS += SED1520 VIDEOS += SNES_PPU VIDEOS += STVVDP VIDEOS += T6A04 +VIDEOS += TEA1002 #VIDEOS += TLC34076 #VIDEOS += TMS34061 VIDEOS += TMS3556 diff --git a/src/mess/video/aquarius.c b/src/mess/video/aquarius.c index 7799a778bc8..f61f1ba0f5c 100644 --- a/src/mess/video/aquarius.c +++ b/src/mess/video/aquarius.c @@ -10,27 +10,6 @@ #include "includes/aquarius.h" - -static const rgb_t aquarius_colors[] = -{ - rgb_t::black, /* Black */ - rgb_t(0xff, 0x00, 0x00), /* Red */ - rgb_t(0x00, 0xff, 0x00), /* Green */ - rgb_t(0xff, 0xff, 0x00), /* Yellow */ - rgb_t(0x00, 0x00, 0xff), /* Blue */ - rgb_t(0x7f, 0x00, 0x7f), /* Violet */ - rgb_t(0x7f, 0xff, 0xff), /* Light Blue-Green */ - rgb_t::white, /* White */ - rgb_t(0xc0, 0xc0, 0xc0), /* Light Gray */ - rgb_t(0x00, 0xff, 0xff), /* Blue-Green */ - rgb_t(0xff, 0x00, 0xff), /* Magenta */ - rgb_t(0x00, 0x00, 0x7f), /* Dark Blue */ - rgb_t(0xff, 0xff, 0x7f), /* Light Yellow */ - rgb_t(0x7f, 0xff, 0x7f), /* Light Green */ - rgb_t(0xff, 0x7f, 0x00), /* Orange */ - rgb_t(0x7f, 0x7f, 0x7f) /* Dark Gray */ -}; - static const unsigned short aquarius_palette[] = { 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0,10, 0,11, 0,12, 0,13, 0,14, 0,15, 0, @@ -56,7 +35,7 @@ PALETTE_INIT_MEMBER(aquarius_state, aquarius) int i; for (i = 0; i < 16; i++) - m_palette->set_indirect_color(i, aquarius_colors[i]); + m_palette->set_indirect_color(i, m_tea1002->color(i)); for (i = 0; i < 512; i++) m_palette->set_pen_indirect(i, aquarius_palette[i]);