From 1010f859bc74a328fa383d97bec1ac35deb8bb94 Mon Sep 17 00:00:00 2001 From: mamehaze Date: Fri, 26 Dec 2014 11:46:23 +0000 Subject: [PATCH] arcompact (nw) --- src/emu/cpu/arcompact/arcompact_execute.c | 563 +--------------------- src/emu/cpu/arcompact/arcompact_make.py | 180 +++++++ src/emu/cpu/cpu.mak | 12 +- 3 files changed, 190 insertions(+), 565 deletions(-) create mode 100644 src/emu/cpu/arcompact/arcompact_make.py diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index b3c74858429..9baee57f125 100644 --- a/src/emu/cpu/arcompact/arcompact_execute.c +++ b/src/emu/cpu/arcompact/arcompact_execute.c @@ -1720,155 +1720,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_helper(OPS_32, const char } -#define SETUP_HANDLE04_0x_P00 \ - int size = 4; \ - UINT32 limm = 0; \ - int got_limm = 0; \ - \ - COMMON32_GET_breg; \ - COMMON32_GET_F; \ - COMMON32_GET_creg; \ - COMMON32_GET_areg; \ - \ - UINT32 b, c; \ - \ - if (breg == LIMM_REG) \ - { \ - GET_LIMM_32; \ - size = 8; \ - got_limm = 1; \ - b = limm; \ - } \ - else \ - { \ - b = m_regs[breg]; \ - } \ - \ - if (creg == LIMM_REG) \ - { \ - if (!got_limm) \ - { \ - GET_LIMM_32; \ - size = 8; \ - } \ - c = limm; \ - } \ - else \ - { \ - c = m_regs[creg]; \ - } \ - /* todo: is the limm, limm syntax valid? (it's pointless.) */ \ - /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */ \ - -#define SETUP_HANDLE04_0x_P01 \ - int size = 4; \ - UINT32 limm = 0; \ -/* int got_limm = 0; */ \ - \ - COMMON32_GET_breg; \ - COMMON32_GET_F; \ - COMMON32_GET_u6; \ - COMMON32_GET_areg; \ - \ - UINT32 b, c; \ - \ - /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */ \ - if (breg == LIMM_REG) \ - { \ - GET_LIMM_32; \ - size = 8; \ -/* got_limm = 1; */ \ - b = limm; \ - } \ - else \ - { \ - b = m_regs[breg]; \ - } \ - \ - c = u; \ - \ - /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */ \ - - -#define SETUP_HANDLE04_0x_P10 \ - int size = 4; \ - UINT32 limm = 0; \ -/* int got_limm = 0; */ \ - \ - COMMON32_GET_breg; \ - COMMON32_GET_F; \ - COMMON32_GET_s12; \ - COMMON32_GET_areg; \ - \ - UINT32 b, c; \ - \ - /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */ \ - if (breg == LIMM_REG) \ - { \ - GET_LIMM_32; \ - size = 8; \ -/* got_limm = 1; */ \ - b = limm; \ - } \ - else \ - { \ - b = m_regs[breg]; \ - } \ - \ - c = (UINT32)S; \ - \ - /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */ \ - - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p00(OPS_32) -{ - SETUP_HANDLE04_0x_P00 - - m_regs[areg] = b + c; - - if (F) - { - arcompact_fatal("arcompact_handle04_00_p00 (ADD) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p01(OPS_32) -{ - SETUP_HANDLE04_0x_P01 - - m_regs[areg] = b + c; - - if (F) - { - arcompact_fatal("arcompact_handle04_00_p01 (ADD) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p10(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_00_p10 (ADD)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p11_m0(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_00_p11_m0 (ADD)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p11_m1(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_00_p11_m1 (ADD)\n"); - return m_pc + (size >> 0); -} - +#include "cpu/arcompact/arcompact.inc" ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_01(OPS_32) { @@ -1885,205 +1737,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_03(OPS_32) return arcompact_handle04_helper(PARAMS, opcodes_04[0x03], /*"SBC"*/ 0,0); } - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p00(OPS_32) -{ - SETUP_HANDLE04_0x_P00 - - m_regs[areg] = b & c; - - if (F) - { - arcompact_fatal("arcompact_handle04_04_p00 (AND) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p01(OPS_32) -{ - SETUP_HANDLE04_0x_P01 - m_regs[areg] = b & c; - - if (F) - { - arcompact_fatal("arcompact_handle04_04_p01 (AND) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p10(OPS_32) -{ - SETUP_HANDLE04_0x_P10 - m_regs[areg] = b & c; - - if (F) - { - arcompact_fatal("arcompact_handle04_04_p10 (AND) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p11_m0(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_04_p11_m0 (AND)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p11_m1(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_04_p11_m1 (AND)\n"); - return m_pc + (size >> 0); -} - - -// OR -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p00(OPS_32) -{ - SETUP_HANDLE04_0x_P00 - - m_regs[areg] = b | c; - - if (F) - { - arcompact_fatal("arcompact_handle04_05_p00 (OR) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p01(OPS_32) -{ - SETUP_HANDLE04_0x_P01 - - m_regs[areg] = b | c; - - if (F) - { - arcompact_fatal("arcompact_handle04_05_p01 (OR) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0);} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p10(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_05_p10 (OR)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p11_m0(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_05_p11_m0 (OR)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p11_m1(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_05_p11_m1 (OR)\n"); - return m_pc + (size >> 0); -} - -// Bitwise AND Operation with Inverted Source -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_06_p00(OPS_32) // BIC -{ - SETUP_HANDLE04_0x_P00 - - m_regs[areg] = b & (~c); - - if (F) - { - arcompact_fatal("arcompact_handle04_06_p00 (BIC) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_06_p01(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_06_p01 (BIC)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_06_p10(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_06_p10 (BIC)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_06_p11_m0(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_06_p11_m0 (BIC)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_06_p11_m1(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_06_p11_m1 (BIC)\n"); - return m_pc + (size >> 0); -} - - - - -// XOR -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07_p00(OPS_32) // XOR -{ - SETUP_HANDLE04_0x_P00 - m_regs[areg] = b ^ c; - - if (F) - { - arcompact_fatal("arcompact_handle04_07_p00 (XOR) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07_p01(OPS_32) -{ - SETUP_HANDLE04_0x_P01 - m_regs[areg] = b ^ c; - - if (F) - { - arcompact_fatal("arcompact_handle04_07_p01 (XOR) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07_p10(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_07_p10 (XOR)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07_p11_m0(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_07_p11_m0 (XOR)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07_p11_m1(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_07_p11_m1 (XOR)\n"); - return m_pc + (size >> 0); -} - ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_08(OPS_32) { return arcompact_handle04_helper(PARAMS, opcodes_04[0x08], /*"MAX"*/ 0,0); @@ -2222,48 +1875,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0e(OPS_32) } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f_p00(OPS_32) -{ - SETUP_HANDLE04_0x_P00 - - m_regs[areg] = b | (1 << (c & 0x1f)); - - if (F) - { - arcompact_fatal("arcompact_handle04_06_p00 (BSET) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f_p01(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_0f_p01 (BSET)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f_p10(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_0f_p10 (BSET)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f_p11_m0(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_0f_p11_m0 (BSET)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f_p11_m1(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_0f_p11_m1 (BSET)\n"); - return m_pc + (size >> 0); -} - ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_10(OPS_32) { return arcompact_handle04_helper(PARAMS, opcodes_04[0x10], /*"BCLR"*/ 0,0); @@ -2295,48 +1906,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_15(OPS_32) } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_16_p00(OPS_32) // ADD3 -{ - int size = 4; - arcompact_fatal("arcompact_handle04_16_p00 (ADD3)\n"); - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_16_p01(OPS_32) -{ - SETUP_HANDLE04_0x_P01 - - m_regs[areg] = b + (c << 3); // c = u - - if (F) - { - arcompact_fatal("arcompact_handle04_16_p01 (ADD3) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_16_p10(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_16_p10 (ADD3)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_16_p11_m0(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_16_p11_m0 (ADD3)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_16_p11_m1(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle04_16_p11_m1 (ADD3)\n"); - return m_pc + (size >> 0); -} ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_17(OPS_32) { @@ -2373,43 +1942,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1d(OPS_32) return arcompact_handle04_helper(PARAMS, opcodes_04[0x1d], /*"MPYU"*/ 0,0); } // * -/* handler template for c+p -ARCOMPACT_RETTYPE arcompact_device::arcompact_handleXX_xx_p00(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handleXX_xx_p00\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handleXX_xx_p01(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handleXX_xx_p01\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handleXX_xx_p10(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handleXX_xx_p10\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handleXX_xx_p11_m0(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handleXX_xx_p11_m0\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handleXX_xx_p11_m1(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handleXX_xx_p11_m1\n"); - return m_pc + (size >> 0); -} -*/ - ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p00(OPS_32) { int size = 4; @@ -2872,99 +2404,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_37(OPS_32) { return arco -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_00_p00(OPS_32) // ASL -{ - SETUP_HANDLE04_0x_P00 - - m_regs[areg] = b << (c&0x1f); // c = c - - if (F) - { - arcompact_fatal("arcompact_handle05_00_p00 (ASL) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_00_p01(OPS_32) -{ - SETUP_HANDLE04_0x_P01 - - m_regs[areg] = b << (c&0x1f); // c = u - - if (F) - { - arcompact_fatal("arcompact_handle05_00_p01 (ASL) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0);} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_00_p10(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle05_00_p10 (ASL)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_00_p11_m0(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle05_00_p11_m0 (ASL)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_00_p11_m1(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle05_00_p11_m1 (ASL)\n"); - return m_pc + (size >> 0); -} - - - - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_01_p00(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle05_01_p00 (LSR)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_01_p01(OPS_32) -{ - SETUP_HANDLE04_0x_P01 - - m_regs[areg] = b >> (c&0x1f); // c = u - - if (F) - { - arcompact_fatal("arcompact_handle05_01_p01 (LSR) (F set)\n"); // not yet supported - } - - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_01_p10(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle05_01_p10 (LSR)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_01_p11_m0(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle05_01_p11_m0 (LSR)\n"); - return m_pc + (size >> 0); -} - -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_01_p11_m1(OPS_32) -{ - int size = 4; - arcompact_fatal("arcompact_handle05_01_p11_m1 (LSR)\n"); - return m_pc + (size >> 0); -} - ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_02(OPS_32) { return arcompact_handle04_helper(PARAMS, "ASR", 0,0); } ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_03(OPS_32) { return arcompact_handle04_helper(PARAMS, "ROR", 0,0); } diff --git a/src/emu/cpu/arcompact/arcompact_make.py b/src/emu/cpu/arcompact/arcompact_make.py new file mode 100644 index 00000000000..3524af4542d --- /dev/null +++ b/src/emu/cpu/arcompact/arcompact_make.py @@ -0,0 +1,180 @@ +#!/usr/bin/python + +import sys +import re + + +def EmitGroup04(f,funcname, opname, opexecute): + # the mode 0x00 handler + print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p00(OPS_32)" % (funcname) + print >>f, "{" + print >>f, " int size = 4;" + print >>f, " UINT32 limm = 0;" + print >>f, " int got_limm = 0;" + print >>f, " " + print >>f, " COMMON32_GET_breg;" + print >>f, " COMMON32_GET_F;" + print >>f, " COMMON32_GET_creg;" + print >>f, " COMMON32_GET_areg;" + print >>f, " " + print >>f, " UINT32 b, c;" + print >>f, " " + 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, " if (creg == LIMM_REG)" + print >>f, " {" + print >>f, " if (!got_limm)" + print >>f, " {" + print >>f, " GET_LIMM_32;" + print >>f, " size = 8;" + print >>f, " }" + print >>f, " c = limm;" + print >>f, " }" + print >>f, " else" + print >>f, " {" + print >>f, " c = m_regs[creg];" + print >>f, " }" + 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, " " + print >>f, " if (F)" + print >>f, " {" + print >>f, " arcompact_fatal(\"arcompact_handle%s_p00 (%s) (F set)\\n\"); // not yet supported" % (funcname, opname) + print >>f, " }" + print >>f, " return m_pc + (size >> 0);" + print >>f, "}" + print >>f, "" + print >>f, "" + # the mode 0x01 handler + print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p01(OPS_32)" % (funcname) + print >>f, "{" + print >>f, " int size = 4;" + print >>f, " UINT32 limm = 0;" + print >>f, "/* int got_limm = 0; */" + print >>f, " " + print >>f, " COMMON32_GET_breg;" + print >>f, " COMMON32_GET_F;" + print >>f, " COMMON32_GET_u6;" + print >>f, " COMMON32_GET_areg;" + print >>f, " " + print >>f, " UINT32 b, c;" + 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?) */" + print >>f, " %s" % (opexecute) + print >>f, " " + print >>f, " if (F)" + print >>f, " {" + print >>f, " arcompact_fatal(\"arcompact_handle%s_p01 (%s) (F set)\\n\"); // not yet supported" % (funcname, opname) + print >>f, " }" + print >>f, " return m_pc + (size >> 0);" + print >>f, "}" + print >>f, "" + 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;" + print >>f, " UINT32 limm = 0;" + print >>f, "/* int got_limm = 0; */" + print >>f, " " + print >>f, " COMMON32_GET_breg;" + print >>f, " COMMON32_GET_F;" + print >>f, " COMMON32_GET_s12;" + print >>f, " COMMON32_GET_areg;" + print >>f, " " + print >>f, " UINT32 b, c;" + 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, " " + print >>f, " if (F)" + print >>f, " {" + print >>f, " arcompact_fatal(\"arcompact_handle%s_p01 (%s) (F set)\\n\"); // not yet supported" % (funcname, opname) + print >>f, " }" + 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, "" + # 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, "" + +try: + f = open(sys.argv[1], "w") +except Exception, err: + logging.error("cannot write file %s [%s]", fname, err) + sys.exit(1) + + +EmitGroup04(f, "04_00", "ADD", "m_regs[areg] = b + c;" ) + +EmitGroup04(f, "04_04", "AND", "m_regs[areg] = b & c;" ) +EmitGroup04(f, "04_05", "OR", "m_regs[areg] = b | c;" ) +EmitGroup04(f, "04_06", "BIC", "m_regs[areg] = b & (~c);" ) +EmitGroup04(f, "04_07", "XOR", "m_regs[areg] = b ^ c;" ) + +EmitGroup04(f, "04_0f", "BSET", "m_regs[areg] = b | (1 << (c & 0x1f));" ) + +EmitGroup04(f, "04_16", "ADD3", "m_regs[areg] = b + (c << 3);" ) + + +EmitGroup04(f, "05_00", "ASL", "m_regs[areg] = b << (c&0x1f);" ) +EmitGroup04(f, "05_01", "LSR", "m_regs[areg] = b >> (c&0x1f);" ) + + diff --git a/src/emu/cpu/cpu.mak b/src/emu/cpu/cpu.mak index 20310e53750..64cfc56c729 100644 --- a/src/emu/cpu/cpu.mak +++ b/src/emu/cpu/cpu.mak @@ -106,11 +106,13 @@ endif $(CPUOBJ)/arcompact/arcompact.o: $(CPUSRC)/arcompact/arcompact.c \ $(CPUSRC)/arcompact/arcompact.h \ - $(CPUSRC)/arcompact/arcompact_common.h + $(CPUSRC)/arcompact/arcompact_common.h \ + $(CPUOBJ)/arcompact/arcompact.inc $(CPUOBJ)/arcompact/arcompact_execute.o: $(CPUSRC)/arcompact/arcompact_execute.c \ $(CPUSRC)/arcompact/arcompact.h \ - $(CPUSRC)/arcompact/arcompact_common.h + $(CPUSRC)/arcompact/arcompact_common.h \ + $(CPUOBJ)/arcompact/arcompact.inc $(CPUOBJ)/arcompact/arcompactdasm_dispatch.o: $(CPUSRC)/arcompact/arcompactdasm_dispatch.c \ $(CPUSRC)/arcompact/arcompactdasm_dispatch.h \ @@ -123,7 +125,11 @@ $(CPUOBJ)/arcompact/arcompactdasm_ops.o: $(CPUSRC)/arcompact/arcompactdasm_ops. $(CPUOBJ)/arcompact/arcompact_common.o: $(CPUSRC)/arcompact/arcompact_common.c \ $(CPUSRC)/arcompact/arcompact_common.h - +# rule to generate the C files +$(CPUOBJ)/arcompact/arcompact.inc: $(CPUSRC)/arcompact/arcompact_make.py + @echo Generating arcompact source .inc files... + $(PYTHON) $(CPUSRC)/arcompact/arcompact_make.py $@ + #------------------------------------------------- # Acorn ARM series #