arcompact (nw)

This commit is contained in:
mamehaze 2014-12-26 13:31:13 +00:00
parent 1d6aa90414
commit cab6ab55ae
3 changed files with 58 additions and 93 deletions

View File

@ -148,7 +148,7 @@ protected:
ARCOMPACT_RETTYPE arcompact_handle03(OPS_32);
// ARCOMPACT_RETTYPE arcompact_handle04_00(OPS_32);
ARCOMPACT_RETTYPE arcompact_handle04_01(OPS_32);
ARCOMPACT_RETTYPE arcompact_handle04_02(OPS_32);
// ARCOMPACT_RETTYPE arcompact_handle04_02(OPS_32);
ARCOMPACT_RETTYPE arcompact_handle04_03(OPS_32);
// ARCOMPACT_RETTYPE arcompact_handle04_04(OPS_32);
// ARCOMPACT_RETTYPE arcompact_handle04_05(OPS_32);
@ -167,7 +167,7 @@ protected:
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_15(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);
@ -767,12 +767,14 @@ protected:
ARCOMPACT_RETTYPE get_insruction(OPS_32);
ARCOMPACT_HANDLER04_TYPE_PM(04_00);
ARCOMPACT_HANDLER04_TYPE_PM(04_02);
ARCOMPACT_HANDLER04_TYPE_PM(04_04);
ARCOMPACT_HANDLER04_TYPE_PM(04_05);
ARCOMPACT_HANDLER04_TYPE_PM(04_06);
ARCOMPACT_HANDLER04_TYPE_PM(04_07);
ARCOMPACT_HANDLER04_TYPE_PM(04_0a);
ARCOMPACT_HANDLER04_TYPE_PM(04_0f);
ARCOMPACT_HANDLER04_TYPE_PM(04_15);
ARCOMPACT_HANDLER04_TYPE_PM(04_16);
ARCOMPACT_HANDLER04_TYPE_PM(04_20);
@ -838,6 +840,8 @@ private:
#define STATUS32_CLEAR_Z (m_status32 &= ~Z_ZERO_FLAG)
#define STATUS32_CHECK_Z (m_status32 & Z_ZERO_FLAG)
// 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)
extern const device_type ARCA5;

View File

@ -1727,10 +1727,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_01(OPS_32)
return arcompact_handle04_helper(PARAMS, opcodes_04[0x01], /*"ADC"*/ 0,0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_02(OPS_32)
{
return arcompact_handle04_helper(PARAMS, opcodes_04[0x02], /*"SUB"*/ 0,0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_03(OPS_32)
{
@ -1900,10 +1897,6 @@ 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_15(OPS_32)
{
return arcompact_handle04_helper(PARAMS, opcodes_04[0x15], /*"ADD2"*/ 0,0);
}
@ -3036,98 +3029,18 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle_l7_0x_helper(OPS_16, const
return m_pc + (2 >> 0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_00(OPS_16) // ASL_S b, b, u5
{
int breg, u;
COMMON16_GET_breg;
COMMON16_GET_u5;
REG_16BIT_RANGE(breg);
// only bottom 5 bits are used if ASL operations, we only have 5 bits anyway here
m_regs[breg] = m_regs[breg] << (u&0x1f);
return m_pc + (2 >> 0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_01(OPS_16)
{
return arcompact_handle_l7_0x_helper(PARAMS, "LSR_S");
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_02(OPS_16) // ASR_S b,b,u5
{
int breg, u;
COMMON16_GET_breg;
COMMON16_GET_u5;
REG_16BIT_RANGE(breg);
// only bottom 5 bits are used if ASR operations, we only have 5 bits anyway here
INT32 temp = (INT32)m_regs[breg]; // treat it as a signed value, so sign extension occurs during shift
m_regs[breg] = temp >> (u&0x1f);
return m_pc + (2 >> 0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_03(OPS_16) // SUB_S b,b,u5
{
int breg, u;
COMMON16_GET_breg;
COMMON16_GET_u5;
REG_16BIT_RANGE(breg);
m_regs[breg] = m_regs[breg] - u;
return m_pc + (2 >> 0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_04(OPS_16) // BSET_S b,b,u5
{
int breg, u;
COMMON16_GET_breg;
COMMON16_GET_u5;
REG_16BIT_RANGE(breg);
m_regs[breg] = m_regs[breg] | (1 << (u & 0x1f));
return m_pc + (2 >> 0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_05(OPS_16)
{
return arcompact_handle_l7_0x_helper(PARAMS, "BCLR_S");
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_06(OPS_16) // BMSK b,b,u5
{
int breg, u;
COMMON16_GET_breg;
COMMON16_GET_u5;
REG_16BIT_RANGE(breg);
u &= 0x1f;
m_regs[breg] = m_regs[breg] | ((1 << (u + 1)) - 1);
return m_pc + (2 >> 0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_07(OPS_16)
{
return arcompact_handle_l7_0x_helper(PARAMS, "BTST_S");
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_0x_helper(OPS_16, const char* optext, int st)
{
arcompact_log("unimplemented %s %04x (0x18_0x group)", optext, op);
@ -3460,7 +3373,21 @@ 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_03(OPS_16) { return arcompact_handle1e_03_0x_helper(PARAMS, "BLE_S"); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_03(OPS_16) // BLE_S
{
if (CONDITION_LE)
{
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_04(OPS_16) { return arcompact_handle1e_03_0x_helper(PARAMS, "BHI_S"); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_05(OPS_16) { return arcompact_handle1e_03_0x_helper(PARAMS, "BHS_S"); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_06(OPS_16) { return arcompact_handle1e_03_0x_helper(PARAMS, "BLO_S"); }

View File

@ -155,6 +155,26 @@ def EmitGroup04(f,funcname, opname, opexecute):
print >>f, ""
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)
print >>f, "{"
print >>f, " int breg, u;"
print >>f, " "
print >>f, " COMMON16_GET_breg;"
print >>f, " COMMON16_GET_u5;"
print >>f, " "
print >>f, " REG_16BIT_RANGE(breg);"
print >>f, " "
print >>f, " %s" % (opexecute)
print >>f, " "
print >>f, " return m_pc + (2 >> 0);"
print >>f, "}"
print >>f, ""
print >>f, ""
try:
f = open(sys.argv[1], "w")
except Exception, err:
@ -164,6 +184,8 @@ except Exception, err:
EmitGroup04(f, "04_00", "ADD", "m_regs[areg] = b + c;" )
EmitGroup04(f, "04_02", "SUB", "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);" )
@ -171,10 +193,22 @@ 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_15", "ADD2", "m_regs[areg] = b + (c << 2);" )
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);" )
# xxx_S b, b, u5 format opcodes
EmitGroup17(f, "17_00", "ASL_S", "m_regs[breg] = m_regs[breg] << (u&0x1f);" )
EmitGroup17(f, "17_01", "LSR_S", "m_regs[breg] = m_regs[breg] >> (u&0x1f);" )
EmitGroup17(f, "17_02", "ASR_S", "INT32 temp = (INT32)m_regs[breg]; m_regs[breg] = temp >> (u&0x1f); // treat it as a signed value, so sign extension occurs during shift" )
EmitGroup17(f, "17_03", "SUB_S", "m_regs[breg] = m_regs[breg] - u;" )
EmitGroup17(f, "17_04", "BSET_S", "m_regs[breg] = m_regs[breg] | (1 << (u & 0x1f));" )
EmitGroup17(f, "17_06", "BMSK_S", "m_regs[breg] = m_regs[breg] | ((1 << (u + 1)) - 1);" )