summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/tms32082/mp_ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/cpu/tms32082/mp_ops.c')
-rw-r--r--src/emu/cpu/tms32082/mp_ops.c186
1 files changed, 93 insertions, 93 deletions
diff --git a/src/emu/cpu/tms32082/mp_ops.c b/src/emu/cpu/tms32082/mp_ops.c
index 03292557cd3..404f9e8a32d 100644
--- a/src/emu/cpu/tms32082/mp_ops.c
+++ b/src/emu/cpu/tms32082/mp_ops.c
@@ -18,15 +18,15 @@
#define ROTATE_L(x, r) ((x << r) | (x >> (32-r)))
#define ROTATE_R(x, r) ((x >> r) | (x << (32-r)))
-#define CMP_OVERFLOW32(r, s, d) ((((d) ^ (s)) & ((d) ^ (r)) & 0x80000000) ? 1 : 0)
-#define CMP_OVERFLOW16(r, s, d) ((((d) ^ (s)) & ((d) ^ (r)) & 0x8000) ? 1 : 0)
-#define CMP_OVERFLOW8(r, s, d) ((((d) ^ (s)) & ((d) ^ (r)) & 0x80) ? 1 : 0)
-#define CARRY32(x) (((x) & (((UINT64)1) << 32)) ? 1 : 0)
-#define CARRY16(x) (((x) & 0x10000) ? 1 : 0)
-#define CARRY8(x) (((x) & 0x100) ? 1 : 0)
-#define SIGN32(x) (((x) & 0x80000000) ? 1 : 0)
-#define SIGN16(x) (((x) & 0x8000) ? 1 : 0)
-#define SIGN8(x) (((x) & 0x80) ? 1 : 0)
+#define CMP_OVERFLOW32(r, s, d) ((((d) ^ (s)) & ((d) ^ (r)) & 0x80000000) ? 1 : 0)
+#define CMP_OVERFLOW16(r, s, d) ((((d) ^ (s)) & ((d) ^ (r)) & 0x8000) ? 1 : 0)
+#define CMP_OVERFLOW8(r, s, d) ((((d) ^ (s)) & ((d) ^ (r)) & 0x80) ? 1 : 0)
+#define CARRY32(x) (((x) & (((UINT64)1) << 32)) ? 1 : 0)
+#define CARRY16(x) (((x) & 0x10000) ? 1 : 0)
+#define CARRY8(x) (((x) & 0x100) ? 1 : 0)
+#define SIGN32(x) (((x) & 0x80000000) ? 1 : 0)
+#define SIGN16(x) (((x) & 0x8000) ? 1 : 0)
+#define SIGN8(x) (((x) & 0x80) ? 1 : 0)
@@ -34,31 +34,31 @@ bool tms32082_mp_device::test_condition(int condition, UINT32 value)
{
switch (condition)
{
- case 0x00: return false; // never, byte
- case 0x01: return (INT8)(value) > 0; // greater than zero, byte
- case 0x02: return (INT8)(value) == 0; // equals zero, byte
- case 0x03: return (INT8)(value) >= 0; // greater than or equal to zero, byte
- case 0x04: return (INT8)(value) < 0; // less than zero, byte
- case 0x05: return (INT8)(value) != 0; // not equal to zero, byte
- case 0x06: return (INT8)(value) <= 0; // less than or equal to zero, byte
- case 0x07: return true; // always, byte
- case 0x08: return false; // never, word
- case 0x09: return (INT16)(value) > 0; // greater than zero, word
- case 0x0a: return (INT16)(value) == 0; // equals zero, word
- case 0x0b: return (INT16)(value) >= 0; // greater than or equal to zero, word
- case 0x0c: return (INT16)(value) < 0; // less than zero, word
- case 0x0d: return (INT16)(value) != 0; // not equal to zero, word
- case 0x0e: return (INT16)(value) <= 0; // less than or equal to zero, word
- case 0x0f: return true; // always, word
- case 0x10: return false; // never, dword
- case 0x11: return (INT32)(value) > 0; // greater than zero, dword
- case 0x12: return (INT32)(value) == 0; // equals zero, dword
- case 0x13: return (INT32)(value) >= 0; // greater than or equal to zero, dword
- case 0x14: return (INT32)(value) < 0; // less than zero, dword
- case 0x15: return (INT32)(value) != 0; // not equal to zero, dword
- case 0x16: return (INT32)(value) <= 0; // less than or equal to zero, dword
- case 0x17: return true; // always, dword
- default: return false; // reserved
+ case 0x00: return false; // never, byte
+ case 0x01: return (INT8)(value) > 0; // greater than zero, byte
+ case 0x02: return (INT8)(value) == 0; // equals zero, byte
+ case 0x03: return (INT8)(value) >= 0; // greater than or equal to zero, byte
+ case 0x04: return (INT8)(value) < 0; // less than zero, byte
+ case 0x05: return (INT8)(value) != 0; // not equal to zero, byte
+ case 0x06: return (INT8)(value) <= 0; // less than or equal to zero, byte
+ case 0x07: return true; // always, byte
+ case 0x08: return false; // never, word
+ case 0x09: return (INT16)(value) > 0; // greater than zero, word
+ case 0x0a: return (INT16)(value) == 0; // equals zero, word
+ case 0x0b: return (INT16)(value) >= 0; // greater than or equal to zero, word
+ case 0x0c: return (INT16)(value) < 0; // less than zero, word
+ case 0x0d: return (INT16)(value) != 0; // not equal to zero, word
+ case 0x0e: return (INT16)(value) <= 0; // less than or equal to zero, word
+ case 0x0f: return true; // always, word
+ case 0x10: return false; // never, dword
+ case 0x11: return (INT32)(value) > 0; // greater than zero, dword
+ case 0x12: return (INT32)(value) == 0; // equals zero, dword
+ case 0x13: return (INT32)(value) >= 0; // greater than or equal to zero, dword
+ case 0x14: return (INT32)(value) < 0; // less than zero, dword
+ case 0x15: return (INT32)(value) != 0; // not equal to zero, dword
+ case 0x16: return (INT32)(value) <= 0; // less than or equal to zero, dword
+ case 0x17: return true; // always, dword
+ default: return false; // reserved
}
}
@@ -66,7 +66,7 @@ void tms32082_mp_device::execute_short_imm()
{
switch ((m_ir >> 15) & 0x7f)
{
- case 0x04: // rdcr
+ case 0x04: // rdcr
{
int rd = OP_RD();
INT32 imm = OP_SIMM15();
@@ -78,7 +78,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x05: // swcr
+ case 0x05: // swcr
{
int rd = OP_RD();
int rs = OP_RS();
@@ -92,7 +92,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x0b: // shift.ez
+ case 0x0b: // shift.ez
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -109,11 +109,11 @@ void tms32082_mp_device::execute_short_imm()
UINT32 compmask = endmask & shiftmask;
UINT32 res = 0;
- if (r) // right
+ if (r) // right
{
res = ROTATE_R(source, rot) & compmask;
}
- else // left
+ else // left
{
res = ROTATE_L(source, rot) & compmask;
}
@@ -123,7 +123,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x0e: // shift.iz
+ case 0x0e: // shift.iz
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -139,11 +139,11 @@ void tms32082_mp_device::execute_short_imm()
UINT32 compmask = endmask & ~shiftmask;
UINT32 res = 0;
- if (r) // right
+ if (r) // right
{
res = ROTATE_R(source, rot) & compmask;
}
- else // left
+ else // left
{
res = ROTATE_L(source, rot) & compmask;
}
@@ -153,7 +153,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x11: // and
+ case 0x11: // and
{
int rd = OP_RD();
int rs = OP_RS();
@@ -164,7 +164,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x17: // or
+ case 0x17: // or
{
int rd = OP_RD();
int rs = OP_RS();
@@ -176,7 +176,7 @@ void tms32082_mp_device::execute_short_imm()
}
case 0x36:
- case 0x32: // st
+ case 0x32: // st
{
int rd = OP_RD();
int base = OP_BASE();
@@ -192,7 +192,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x49: // bbz.a
+ case 0x49: // bbz.a
{
int bitnum = OP_BITNUM();
INT32 offset = OP_SIMM15();
@@ -205,7 +205,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x4b: // bbo.a
+ case 0x4b: // bbo.a
{
int bitnum = OP_BITNUM();
INT32 offset = OP_SIMM15();
@@ -218,7 +218,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x4d: // bcnd.a
+ case 0x4d: // bcnd.a
{
INT32 offset = OP_SIMM15();
int code = OP_RD();
@@ -231,7 +231,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x50: // cmp
+ case 0x50: // cmp
{
UINT32 src1 = OP_SIMM15();
UINT32 src2 = m_reg[OP_RS()];
@@ -262,45 +262,45 @@ void tms32082_mp_device::execute_short_imm()
UINT32 flags = 0;
// 32-bits (bits 20-29)
- flags |= ((c32) & 1) << 29; // higher than or same (C)
- flags |= ((~c32) & 1) << 28; // lower than (~C)
- flags |= ((~c32|z32) & 1) << 27; // lower than or same (~C|Z)
- flags |= ((c32&~z32) & 1) << 26; // higher than (C&~Z)
- flags |= (((n32&v32)|(~n32&~v32)) & 1) << 25; // greater than or equal (N&V)|(~N&~V)
- flags |= (((n32&~v32)|(~n32&v32)) & 1) << 24; // less than (N&~V)|(~N&V)
- flags |= (((n32&~v32)|(~n32&v32)|(z32)) & 1) << 23; // less than or equal (N&~V)|(~N&V)|Z
- flags |= (((n32&v32&~z32)|(~n32&~v32&~z32)) & 1) << 22; // greater than (N&V&~Z)|(~N&~V&~Z)
- flags |= ((~z32) & 1) << 21; // not equal (~Z)
- flags |= ((z32) & 1) << 20; // equal (Z)
+ flags |= ((c32) & 1) << 29; // higher than or same (C)
+ flags |= ((~c32) & 1) << 28; // lower than (~C)
+ flags |= ((~c32|z32) & 1) << 27; // lower than or same (~C|Z)
+ flags |= ((c32&~z32) & 1) << 26; // higher than (C&~Z)
+ flags |= (((n32&v32)|(~n32&~v32)) & 1) << 25; // greater than or equal (N&V)|(~N&~V)
+ flags |= (((n32&~v32)|(~n32&v32)) & 1) << 24; // less than (N&~V)|(~N&V)
+ flags |= (((n32&~v32)|(~n32&v32)|(z32)) & 1) << 23; // less than or equal (N&~V)|(~N&V)|Z
+ flags |= (((n32&v32&~z32)|(~n32&~v32&~z32)) & 1) << 22; // greater than (N&V&~Z)|(~N&~V&~Z)
+ flags |= ((~z32) & 1) << 21; // not equal (~Z)
+ flags |= ((z32) & 1) << 20; // equal (Z)
// 16-bits (bits 10-19)
- flags |= ((c16) & 1) << 19; // higher than or same (C)
- flags |= ((~c16) & 1) << 18; // lower than (~C)
- flags |= ((~c16|z16) & 1) << 17; // lower than or same (~C|Z)
- flags |= ((c16&~z16) & 1) << 16; // higher than (C&~Z)
- flags |= (((n16&v16)|(~n16&~v16)) & 1) << 15; // greater than or equal (N&V)|(~N&~V)
- flags |= (((n16&~v16)|(~n16&v16)) & 1) << 14; // less than (N&~V)|(~N&V)
- flags |= (((n16&~v16)|(~n16&v16)|(z16)) & 1) << 13; // less than or equal (N&~V)|(~N&V)|Z
- flags |= (((n16&v16&~z16)|(~n16&~v16&~z16)) & 1) << 12; // greater than (N&V&~Z)|(~N&~V&~Z)
- flags |= ((~z16) & 1) << 11; // not equal (~Z)
- flags |= ((z16) & 1) << 10; // equal (Z)
+ flags |= ((c16) & 1) << 19; // higher than or same (C)
+ flags |= ((~c16) & 1) << 18; // lower than (~C)
+ flags |= ((~c16|z16) & 1) << 17; // lower than or same (~C|Z)
+ flags |= ((c16&~z16) & 1) << 16; // higher than (C&~Z)
+ flags |= (((n16&v16)|(~n16&~v16)) & 1) << 15; // greater than or equal (N&V)|(~N&~V)
+ flags |= (((n16&~v16)|(~n16&v16)) & 1) << 14; // less than (N&~V)|(~N&V)
+ flags |= (((n16&~v16)|(~n16&v16)|(z16)) & 1) << 13; // less than or equal (N&~V)|(~N&V)|Z
+ flags |= (((n16&v16&~z16)|(~n16&~v16&~z16)) & 1) << 12; // greater than (N&V&~Z)|(~N&~V&~Z)
+ flags |= ((~z16) & 1) << 11; // not equal (~Z)
+ flags |= ((z16) & 1) << 10; // equal (Z)
// 8-bits (bits 0-9)
- flags |= ((c8) & 1) << 9; // higher than or same (C)
- flags |= ((~c8) & 1) << 8; // lower than (~C)
- flags |= ((~c8|z8) & 1) << 7; // lower than or same (~C|Z)
- flags |= ((c8&~z8) & 1) << 6; // higher than (C&~Z)
- flags |= (((n8&v8)|(~n8&~v8)) & 1) << 5; // greater than or equal (N&V)|(~N&~V)
- flags |= (((n8&~v8)|(~n8&v8)) & 1) << 4; // less than (N&~V)|(~N&V)
- flags |= (((n8&~v8)|(~n8&v8)|(z8)) & 1) << 3; // less than or equal (N&~V)|(~N&V)|Z
- flags |= (((n8&v8&~z8)|(~n8&~v8&~z8)) & 1) << 2; // greater than (N&V&~Z)|(~N&~V&~Z)
- flags |= ((~z8) & 1) << 1; // not equal (~Z)
- flags |= ((z8) & 1) << 0; // equal (Z)
+ flags |= ((c8) & 1) << 9; // higher than or same (C)
+ flags |= ((~c8) & 1) << 8; // lower than (~C)
+ flags |= ((~c8|z8) & 1) << 7; // lower than or same (~C|Z)
+ flags |= ((c8&~z8) & 1) << 6; // higher than (C&~Z)
+ flags |= (((n8&v8)|(~n8&~v8)) & 1) << 5; // greater than or equal (N&V)|(~N&~V)
+ flags |= (((n8&~v8)|(~n8&v8)) & 1) << 4; // less than (N&~V)|(~N&V)
+ flags |= (((n8&~v8)|(~n8&v8)|(z8)) & 1) << 3; // less than or equal (N&~V)|(~N&V)|Z
+ flags |= (((n8&v8&~z8)|(~n8&~v8&~z8)) & 1) << 2; // greater than (N&V&~Z)|(~N&~V&~Z)
+ flags |= ((~z8) & 1) << 1; // not equal (~Z)
+ flags |= ((z8) & 1) << 0; // equal (Z)
if (rd)
m_reg[rd] = flags;
break;
}
- case 0x59: // addu
+ case 0x59: // addu
{
INT32 imm = OP_SIMM15();
int rd = OP_RD();
@@ -327,7 +327,7 @@ void tms32082_mp_device::execute_reg_long_imm()
switch ((m_ir >> 12) & 0xff)
{
- case 0x04: // cmnd
+ case 0x04: // cmnd
{
UINT32 data = has_imm ? imm32 : m_reg[OP_SRC1()];
@@ -335,7 +335,7 @@ void tms32082_mp_device::execute_reg_long_imm()
break;
}
- case 0x16: // shift.ez
+ case 0x16: // shift.ez
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -352,11 +352,11 @@ void tms32082_mp_device::execute_reg_long_imm()
UINT32 compmask = endmask & shiftmask;
UINT32 res = 0;
- if (r) // right
+ if (r) // right
{
res = ROTATE_R(source, rot) & compmask;
}
- else // left
+ else // left
{
res = ROTATE_L(source, rot) & compmask;
}
@@ -367,7 +367,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0x24:
- case 0x25: // and.tf
+ case 0x25: // and.tf
{
int rd = OP_RD();
int rs = OP_RS();
@@ -379,7 +379,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0x2e:
- case 0x2f: // or
+ case 0x2f: // or
{
int rd = OP_RD();
int rs = OP_RS();
@@ -389,7 +389,7 @@ void tms32082_mp_device::execute_reg_long_imm()
break;
}
- case 0x43: // ld.h
+ case 0x43: // ld.h
case 0x4b:
{
int shift = (m_ir & (1 << 11)) ? 1 : 0;
@@ -401,7 +401,7 @@ void tms32082_mp_device::execute_reg_long_imm()
UINT32 address = m_reg[base] + ((has_imm ? imm32 : m_reg[OP_SRC1()]) << shift);
UINT32 r = m_program->read_word(address);
if (r & 0x8000) r |= 0xffff0000;
-
+
if (rd)
m_reg[rd] = r;
@@ -411,7 +411,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0x6d:
- case 0x65: // st
+ case 0x65: // st
{
int shift = (m_ir & (1 << 11)) ? 2 : 0;
int m = m_ir & (1 << 15);
@@ -427,7 +427,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0x88:
- case 0x89: // jsr
+ case 0x89: // jsr
{
int link = OP_LINK();
int base = OP_BASE();
@@ -445,7 +445,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0x8a:
- case 0x8b: // jsr.a
+ case 0x8b: // jsr.a
{
int link = OP_LINK();
int base = OP_BASE();
@@ -458,7 +458,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0xb2:
- case 0xb3: // addu
+ case 0xb3: // addu
{
int rd = OP_RD();
int rs = OP_RS();
@@ -488,4 +488,4 @@ void tms32082_mp_device::execute()
execute_reg_long_imm();
break;
}
-} \ No newline at end of file
+}