summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Patrick Mackinlay <pmackinlay@hotmail.com>2020-10-08 16:17:01 +0700
committer Patrick Mackinlay <pmackinlay@hotmail.com>2020-10-08 16:17:01 +0700
commitc348d8aba90350210d976c5691b87a62a0359b33 (patch)
tree41c11515cf8929dca5af52bf2eb3db67dcb93472
parent435485fd013698c150780005dddd293aee76e04e (diff)
ns32000: consume execution clock cycles
-rw-r--r--src/devices/cpu/ns32000/ns32000.cpp248
1 files changed, 229 insertions, 19 deletions
diff --git a/src/devices/cpu/ns32000/ns32000.cpp b/src/devices/cpu/ns32000/ns32000.cpp
index b0807bdab8d..acfddfcdd29 100644
--- a/src/devices/cpu/ns32000/ns32000.cpp
+++ b/src/devices/cpu/ns32000/ns32000.cpp
@@ -14,14 +14,14 @@ DEFINE_DEVICE_TYPE(NS32032, ns32032_device, "ns32032", "National Semiconductor N
/*
* TODO:
* - prefetch queue
- * - fetch/ea/data/rmw cycles
+ * - fetch/ea/data/rmw bus cycles
* - address translation/abort
- * - floating point and other unimplemented instructions
+ * - unimplemented instructions
* - format 6: subp,addp
- * - format 7: cmpm
* - format 8: movus/movsu
+ * - format 14: rdval,wrval,lmr,smr
* - cascaded interrupts
- * - instruction cycles
+ * - opcode/operand/memory clock cycles
* - 32332, 32532
*/
@@ -589,6 +589,7 @@ template <int Width> void ns32000_device<Width>::execute_run()
u8 const opbyte = space(0).read_byte(m_pc);
unsigned bytes = 1;
+ unsigned tcy = 1;
m_sequential = true;
if ((opbyte & 15) == 10)
@@ -602,7 +603,10 @@ template <int Width> void ns32000_device<Width>::execute_run()
{
m_pc += dst;
m_sequential = false;
+ tcy = 6;
}
+ else
+ tcy = 7;
}
else if ((opbyte & 15) == 2)
{
@@ -620,6 +624,7 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_pc += dst;
m_sequential = false;
+ tcy = 6;
}
break;
case 0x1:
@@ -633,6 +638,7 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_pc = addr;
m_sequential = false;
+ tcy = 2;
}
break;
case 0x2:
@@ -653,6 +659,7 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_sb = space(0).read_dword_unaligned(m_mod + 0);
m_pc = space(0).read_dword_unaligned(m_mod + 8) + u16(descriptor >> 16);
m_sequential = false;
+ tcy = 16;
}
break;
case 0x3:
@@ -669,6 +676,7 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_sb = space(0).read_dword_unaligned(m_mod + 0);
SP += constant;
m_sequential = false;
+ tcy = 2;
}
break;
case 0x4:
@@ -690,6 +698,7 @@ template <int Width> void ns32000_device<Width>::execute_run()
SP += constant;
m_sequential = false;
+ tcy = 35;
}
else
interrupt(ILL, m_pc);
@@ -711,6 +720,7 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_sb = space(0).read_dword_unaligned(m_mod);
m_sequential = false;
+ tcy = 39;
}
else
interrupt(ILL, m_pc);
@@ -721,12 +731,14 @@ template <int Width> void ns32000_device<Width>::execute_run()
{
u8 const reglist = space(0).read_byte(m_pc + bytes++);
+ tcy = 13;
for (unsigned i = 0; i < 8; i++)
{
if (BIT(reglist, i))
{
SP -= 4;
space(0).write_dword_unaligned(SP, m_r[i]);
+ tcy += 4;
}
}
}
@@ -737,12 +749,14 @@ template <int Width> void ns32000_device<Width>::execute_run()
{
u8 const reglist = space(0).read_byte(m_pc + bytes++);
+ tcy = 12;
for (unsigned i = 0; i < 8; i++)
{
if (BIT(reglist, i))
{
m_r[7 - i] = space(0).read_dword_unaligned(SP);
SP += 4;
+ tcy += 5;
}
}
}
@@ -759,12 +773,14 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_fp = SP;
SP -= constant;
+ tcy = 18;
for (unsigned i = 0; i < 8; i++)
{
if (BIT(reglist, i))
{
SP -= 4;
space(0).write_dword_unaligned(SP, m_r[i]);
+ tcy += 4;
}
}
}
@@ -775,12 +791,14 @@ template <int Width> void ns32000_device<Width>::execute_run()
{
u8 const reglist = space(0).read_byte(m_pc + bytes++);
+ tcy = 17;
for (unsigned i = 0; i < 8; i++)
{
if (BIT(reglist, i))
{
m_r[7 - i] = space(0).read_dword_unaligned(SP);
SP += 4;
+ tcy += 5;
}
}
SP = m_fp;
@@ -790,27 +808,37 @@ template <int Width> void ns32000_device<Width>::execute_run()
break;
case 0xa:
// NOP
+ tcy = 3;
break;
case 0xb:
// WAIT
m_wait = true;
+ tcy = 6;
break;
case 0xc:
// DIA
m_wait = true;
+ tcy = 3;
break;
case 0xd:
// FLAG
if (m_psr & PSR_F)
+ {
interrupt(FLG, m_pc);
+ tcy = 44;
+ }
+ else
+ tcy = 6;
break;
case 0xe:
// SVC
interrupt(SVC, m_pc);
+ tcy = 40;
break;
case 0xf:
// BPT
interrupt(BPT, m_pc);
+ tcy = 40;
break;
}
}
@@ -843,6 +871,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
flags(src1, src2, dst, size, false);
gen_write(mode[0], dst);
+
+ tcy = (mode[0].type == REG) ? 4 : 6;
}
break;
case 1:
@@ -870,6 +900,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
|| ((size == SIZE_W && u16(src1) > u16(src2))
|| ((size == SIZE_B && u8(src1) > u8(src2)))))
m_psr |= PSR_L;
+
+ tcy = 3;
}
break;
case 2:
@@ -910,15 +942,23 @@ template <int Width> void ns32000_device<Width>::execute_run()
gen_write(mode[0], m_mod);
break;
}
+
+ // TODO: tcy 21-27
+ tcy = 21;
break;
case 3:
// Scondi dst
// gen
// write.i
- mode[0].write_i(size);
- decode(mode, bytes);
+ {
+ mode[0].write_i(size);
+ decode(mode, bytes);
+
+ bool const dst = condition(quick);
+ gen_write(mode[0], dst);
- gen_write(mode[0], condition(quick));
+ tcy = dst ? 10 : 9;
+ }
break;
case 4:
// ACBi inc,index,dst
@@ -939,7 +979,11 @@ template <int Width> void ns32000_device<Width>::execute_run()
{
m_pc += dst;
m_sequential = false;
+
+ tcy = (mode[0].type == REG) ? 17 : 15;
}
+ else
+ tcy = (mode[0].type == REG) ? 18 : 16;
}
break;
case 5:
@@ -950,6 +994,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
decode(mode, bytes);
gen_write(mode[0], s32(quick << 28) >> 28);
+
+ tcy = (mode[0].type == REG) ? 3 : 2;
break;
case 6:
// LPRi procreg,src
@@ -998,6 +1044,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
interrupt(UND, m_pc);
break;
}
+
+ // TODO: tcy 19-33
+ tcy = 19;
break;
case 7:
// format 3: gggg gooo o111 11ii
@@ -1023,6 +1072,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_sb = space(0).read_dword_unaligned(m_mod + 0);
m_pc = space(0).read_dword_unaligned(m_mod + 8) + u16(descriptor >> 16);
m_sequential = false;
+
+ tcy = 13;
}
else
interrupt(UND, m_pc);
@@ -1041,6 +1092,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u16 const src = gen_read(mode[0]);
m_psr &= ~src;
+
+ tcy = (size == SIZE_B) ? 18 : 30;
}
else
interrupt(ILL, m_pc);
@@ -1059,6 +1112,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_pc = ea(mode[0]);
m_sequential = false;
+
+ tcy = 2;
}
else
interrupt(UND, m_pc);
@@ -1077,6 +1132,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u16 const src = gen_read(mode[0]);
m_psr |= src;
+
+ tcy = (size == SIZE_B) ? 18 : 30;
}
else
interrupt(ILL, m_pc);
@@ -1095,6 +1152,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
s32 const src = gen_read_sx(mode[0]);
SP -= src;
+
+ tcy = 6;
}
break;
case 0xc:
@@ -1111,6 +1170,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_pc = ea(mode[0]);
m_sequential = false;
+
+ tcy = 5;
}
else
interrupt(UND, m_pc);
@@ -1127,9 +1188,10 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_pc += src;
m_sequential = false;
+
+ tcy = 4;
}
break;
-
default:
interrupt(UND, m_pc);
break;
@@ -1164,6 +1226,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
flags(src1, src2, dst, size, false);
gen_write(mode[1], dst);
+
+ tcy = (mode[1].type == REG) ? 4 : 3;
}
break;
case 0x1:
@@ -1192,6 +1256,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
|| ((size == SIZE_W && u16(src1) > u16(src2))
|| ((size == SIZE_B && u8(src1) > u8(src2)))))
m_psr |= PSR_L;
+
+ tcy = 3;
}
break;
case 0x2:
@@ -1207,6 +1273,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const dst = gen_read(mode[1]);
gen_write(mode[1], dst & ~src);
+
+ tcy = (mode[1].type == REG) ? 4 : 3;
}
break;
case 0x4:
@@ -1225,6 +1293,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
flags(src1, src2, dst, size, false);
gen_write(mode[1], dst);
+
+ tcy = (mode[1].type == REG) ? 4 : 3;
}
break;
case 0x5:
@@ -1239,6 +1309,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const src = gen_read(mode[0]);
gen_write(mode[1], src);
+
+ tcy = (mode[1].type == REG) ? 3 : 1;
}
break;
case 0x6:
@@ -1254,6 +1326,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const dst = gen_read(mode[1]);
gen_write(mode[1], src | dst);
+
+ tcy = (mode[1].type == REG) ? 4 : 3;
}
break;
case 0x8:
@@ -1272,6 +1346,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
flags(src1, src2, dst, size, true);
gen_write(mode[1], dst);
+
+ tcy = (mode[1].type == REG) ? 4 : 3;
}
break;
case 0x9:
@@ -1285,6 +1361,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
decode(mode, bytes);
gen_write(mode[1], ea(mode[0]));
+
+ tcy = (mode[1].type == REG) ? 3 : 2;
}
else
interrupt(UND, m_pc);
@@ -1302,6 +1380,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const dst = gen_read(mode[1]);
gen_write(mode[1], src & dst);
+
+ tcy = (mode[1].type == REG) ? 4 : 3;
}
break;
case 0xc:
@@ -1320,6 +1400,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
flags(src1, src2, dst, size, true);
gen_write(mode[1], dst);
+
+ tcy = (mode[1].type == REG) ? 4 : 3;
}
break;
case 0xd:
@@ -1339,6 +1421,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_psr |= PSR_F;
else
m_psr &= ~PSR_F;
+
+ tcy = 4;
}
else
{
@@ -1348,6 +1432,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_psr |= PSR_F;
else
m_psr &= ~PSR_F;
+
+ tcy = 14;
}
}
break;
@@ -1364,6 +1450,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const dst = gen_read(mode[1]);
gen_write(mode[1], src ^ dst);
+
+ tcy = (mode[1].type == REG) ? 4 : 3;
}
break;
}
@@ -1387,6 +1475,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
{
case 0:
// MOVSi options
+ tcy = (translate || backward || uw) ? 54 : 18;
+
m_psr &= ~PSR_F;
while (m_r[0])
{
@@ -1398,6 +1488,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
if (translate)
data = space(0).read_byte(m_r[3] + u8(data));
+ tcy += translate ? 27 : (backward || uw) ? 24 : 13;
+
bool const match = !((m_r[4] ^ data) & size_mask[size]);
if ((uw == 1 && !match) || (uw == 3 && match))
{
@@ -1428,6 +1520,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
break;
case 1:
// CMPSi options
+ tcy = 53;
+
m_psr |= PSR_Z;
m_psr &= ~(PSR_N | PSR_F | PSR_L);
while (m_r[0])
@@ -1444,6 +1538,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
if (translate)
src1 = space(0).read_byte(m_r[3] + u8(src1));
+ tcy += translate ? 38 : 35;
+
bool const match = !((m_r[4] ^ src1) & size_mask[size]);
if ((uw == 1 && !match) || (uw == 3 && match))
{
@@ -1486,12 +1582,18 @@ template <int Width> void ns32000_device<Width>::execute_run()
// SETCFG cfglist
// short
if (!(m_psr & PSR_U))
+ {
m_cfg = (opword >> 7) & 15;
+
+ tcy = 15;
+ }
else
interrupt(ILL, m_pc);
break;
case 3:
// SKPSi options
+ tcy = 51;
+
m_psr &= ~PSR_F;
while (m_r[0])
{
@@ -1503,6 +1605,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
if (translate)
data = space(0).read_byte(m_r[3] + u8(data));
+ tcy += translate ? 30 : 27;
+
bool const match = !((m_r[4] ^ data) & size_mask[size]);
if ((uw == 1 && !match) || (uw == 3 && match))
{
@@ -1551,6 +1655,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const dst = ((src << (count & limit)) & size_mask[size]) | ((src & size_mask[size]) >> (limit - (count & limit) + 1));
gen_write(mode[1], dst);
+
+ tcy = 14 + (count & limit);
}
break;
case 0x1:
@@ -1568,6 +1674,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const dst = (count < 0) ? (src >> -count) : (src << count);
gen_write(mode[1], dst);
+
+ tcy = 14 + std::abs(count);
}
break;
case 0x2:
@@ -1593,6 +1701,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_psr &= ~PSR_F;
m_r[mode[1].gen] &= ~(1U << (offset & 31));
+
+ tcy = 7;
}
else
{
@@ -1605,6 +1715,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_psr &= ~PSR_F;
space(0).write_byte(byte_ea, byte & ~(1U << (offset & 7)));
+
+ tcy = 15;
}
}
break;
@@ -1626,6 +1738,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const dst = (count < 0) ? (src >> -count) : (src << count);
gen_write(mode[1], dst);
+
+ tcy = 14 + std::abs(count);
}
break;
case 0x6:
@@ -1651,6 +1765,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_psr &= ~PSR_F;
m_r[mode[1].gen] |= (1U << (offset & 31));
+
+ tcy = 7;
}
else
{
@@ -1663,6 +1779,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_psr &= ~PSR_F;
space(0).write_byte(byte_ea, byte | (1U << (offset & 7)));
+
+ tcy = 15;
}
}
break;
@@ -1692,6 +1810,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_psr |= PSR_F;
gen_write(mode[1], src);
}
+
+ tcy = 5;
}
break;
case 0x9:
@@ -1706,6 +1826,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const src = gen_read(mode[0]);
gen_write(mode[1], src ^ 1U);
+
+ tcy = 5;
}
break;
case 0xa:
@@ -1716,6 +1838,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
// gen,gen
// read.i,rmw.i
fatalerror("unimplemented: subp (%s)\n", machine().describe_context());
+
+ // TODO: tcy 16/18
break;
case 0xc:
// ABSi src,dst
@@ -1736,6 +1860,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
}
else
gen_write(mode[1], std::abs(src));
+
+ tcy = (src < 0) ? 9 : 8;
}
break;
case 0xd:
@@ -1750,6 +1876,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const src = gen_read(mode[0]);
gen_write(mode[1], ~src);
+
+ tcy = 7;
}
break;
case 0xe:
@@ -1771,6 +1899,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_psr &= ~PSR_F;
m_r[mode[1].gen] ^= (1U << (offset & 31));
+
+ tcy = 9;
}
else
{
@@ -1783,6 +1913,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
m_psr &= ~PSR_F;
space(0).write_byte(byte_ea, byte ^ (1U << (offset & 7)));
+
+ tcy = 17;
}
}
break;
@@ -1791,6 +1923,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
// gen,gen
// read.i,rmw.i
fatalerror("unimplemented: addp (%s)\n", machine().describe_context());
+
+ // TODO: tcy 16/18
break;
}
}
@@ -1835,6 +1969,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
block1 += (size + 1);
block2 += (size + 1);
}
+
+ tcy = 20 + 3 * num;
}
break;
case 0x1:
@@ -1850,6 +1986,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 block2 = ea(mode[1]);
unsigned const num = displacement(bytes) / (size + 1) + 1;
+ tcy = 24;
+
m_psr |= PSR_Z;
m_psr &= ~(PSR_N | PSR_L);
@@ -1878,6 +2016,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
break;
}
+ tcy += 9;
+
if (int1 != int2)
{
m_psr &= ~PSR_Z;
@@ -1911,6 +2051,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const base = gen_read(mode[1]);
gen_write(mode[1], (base & ~mask) | ((src << offset) & mask));
+
+ // TODO: tcy 39-49
+ tcy = 39;
}
break;
case 0x3:
@@ -1930,6 +2073,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const dst = (base >> offset) & mask;
gen_write(mode[1], dst);
+
+ // TODO: tcy 26-36
+ tcy = 26;
}
break;
case 0x4:
@@ -1946,6 +2092,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
s16 const dst = s8(src);
gen_write(mode[1], dst);
+
+ tcy = 6;
}
else
interrupt(UND, m_pc);
@@ -1964,6 +2112,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u16 const dst = src;
gen_write(mode[1], dst);
+
+ tcy = 5;
}
else
interrupt(UND, m_pc);
@@ -1981,6 +2131,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const src = gen_read(mode[0]);
gen_write(mode[1], src);
+
+ tcy = 5;
}
else
interrupt(UND, m_pc);
@@ -1999,6 +2151,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
s32 const dst = (size == SIZE_W) ? s16(src) : s8(src);
gen_write(mode[1], dst);
+
+ tcy = 6;
}
else
interrupt(UND, m_pc);
@@ -2018,6 +2172,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const dst = src1 * src2;
gen_write(mode[1], dst);
+
+ tcy = 15;
}
break;
case 0x9:
@@ -2026,15 +2182,16 @@ template <int Width> void ns32000_device<Width>::execute_run()
// read.i,rmw.2i
{
mode[0].read_i(size);
- mode[1].rmw_i(size);
+ mode[1].rmw_i(size_code(size * 2 + 1));
decode(mode, bytes);
u32 const src1 = gen_read(mode[0]);
- u32 const src2 = gen_read(mode[1]);
+ u32 const src2 = ((mode[1].type == REG)
+ ? m_r[mode[1].gen ^ 0]
+ : gen_read(mode[1])) & size_mask[size];
u64 const dst = mulu_32x32(src1, src2);
- mode[1].rmw_i(size_code(size * 2 + 1));
if (mode[1].type == REG)
{
m_r[mode[1].gen ^ 0] = (m_r[mode[1].gen ^ 0] & ~size_mask[size]) | ((dst >> 0) & size_mask[size]);
@@ -2042,6 +2199,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
}
else
gen_write(mode[1], dst);
+
+ tcy = 23;
}
break;
case 0xa:
@@ -2059,9 +2218,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const src1 = gen_read(mode[0]);
if (src1)
{
- u64 const src2 = (mode[1].type == REG) ?
- (u64(m_r[mode[1].gen ^ 1] & size_mask[size]) << ((size + 1) * 8)) | (m_r[mode[1].gen ^ 0] & size_mask[size]) :
- gen_read(mode[1]);
+ u64 const src2 = (mode[1].type == REG)
+ ? (u64(m_r[mode[1].gen ^ 1] & size_mask[size]) << ((size + 1) * 8)) | (m_r[mode[1].gen ^ 0] & size_mask[size])
+ : gen_read(mode[1]);
u32 const quotient = src2 / src1;
u32 const remainder = src2 % src1;
@@ -2070,9 +2229,15 @@ template <int Width> void ns32000_device<Width>::execute_run()
{
m_r[mode[1].gen ^ 0] = (m_r[mode[1].gen ^ 0] & ~size_mask[size]) | (remainder & size_mask[size]);
m_r[mode[1].gen ^ 1] = (m_r[mode[1].gen ^ 1] & ~size_mask[size]) | (quotient & size_mask[size]);
+
+ tcy = 31;
}
else
+ {
gen_write(mode[1], (u64(quotient) << ((size + 1) * 8)) | remainder);
+
+ tcy = 38;
+ }
}
else
{
@@ -2101,6 +2266,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
s32 const dst = src2 / src1;
gen_write(mode[1], dst);
+
+ // TODO: tcy 49-55
+ tcy = 49;
}
else
{
@@ -2129,6 +2297,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
s32 const dst = src2 % src1;
gen_write(mode[1], dst);
+
+ // TODO: tcy 57-62
+ tcy = 57;
}
else
{
@@ -2157,6 +2328,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
s32 const dst = (src1 + (src2 % src1)) % src1;
gen_write(mode[1], dst);
+
+ // TODO: tcy 54-73
+ tcy = 54;
}
else
{
@@ -2189,6 +2363,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
gen_write(mode[1], quotient - 1);
else
gen_write(mode[1], quotient);
+
+ // TODO: tcy 58-68
+ tcy = 58;
}
else
{
@@ -2238,10 +2415,18 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const base = space(0).read_dword_unaligned(base_ea);
dst = (base >> (offset & 7));
+
+ // TODO: tcy 17-51
+ tcy = 17;
}
else
+ {
dst = (m_r[mode[0].gen] >> (offset & 31));
+ // TODO: tcy 19-29
+ tcy = 19;
+ }
+
gen_write(mode[1], dst & mask);
}
break;
@@ -2259,6 +2444,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const base = ea(mode[0]);
gen_write(mode[1], base * 8 + offset);
+
+ tcy = 7;
}
else
interrupt(UND, m_pc);
@@ -2283,6 +2470,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const mask = ((1U << length) - 1) << (offset & 31);
dst = (base & ~mask) | ((src << (offset & 31)) & mask);
+
+ // TODO: tcy 29-39
+ tcy = 29;
}
else
{
@@ -2291,6 +2481,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const mask = ((1U << length) - 1) << (offset & 7);
dst = (base & ~mask) | ((src << (offset & 7)) & mask);
+
+ // TODO: tcy 28-96
+ tcy = 28;
}
gen_write(mode[1], dst);
@@ -2333,9 +2526,15 @@ template <int Width> void ns32000_device<Width>::execute_run()
{
m_psr &= ~PSR_F;
m_r[reg] = src - lower;
+
+ tcy = 11;
}
else
+ {
m_psr |= PSR_F;
+
+ tcy = (src >= lower) ? 7 : 10;
+ }
}
break;
case 4:
@@ -2351,6 +2550,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
u32 const index = gen_read(mode[1]);
m_r[reg] = m_r[reg] * (length + 1) + index;
+
+ tcy = 25;
}
break;
case 5:
@@ -2377,6 +2578,9 @@ template <int Width> void ns32000_device<Width>::execute_run()
offset++;
gen_write(mode[1], offset & (limit - 1));
+
+ // TODO: tcy 24-28
+ tcy = 24;
}
break;
case 6:
@@ -2389,6 +2593,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
decode(mode, bytes);
fatalerror("unimplemented: movsu/movus (%s)\n", machine().describe_context());
+
+ tcy = 33;
}
break;
}
@@ -2673,7 +2879,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
// addr
mode[0].addr();
decode(mode, bytes);
- logerror("rdval (%s)\n", machine().describe_context());
+
+ tcy = 21;
break;
case 1:
// WRVAL loc
@@ -2681,7 +2888,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
// addr
mode[0].addr();
decode(mode, bytes);
- logerror("wrval (%s)\n", machine().describe_context());
+
+ tcy = 21;
break;
case 2:
// LMR mmureg,src
@@ -2689,7 +2897,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
// read.D
mode[0].read_i(size);
decode(mode, bytes);
- logerror("lmr (%s)\n", machine().describe_context());
+
+ tcy = 30;
break;
case 3:
// SMR mmureg,dst
@@ -2697,7 +2906,8 @@ template <int Width> void ns32000_device<Width>::execute_run()
// write.D
mode[0].write_i(size);
decode(mode, bytes);
- logerror("smr (%s)\n", machine().describe_context());
+
+ tcy = 25;
break;
default:
interrupt(UND, m_pc);
@@ -2738,7 +2948,7 @@ template <int Width> void ns32000_device<Width>::execute_run()
if (m_psr & PSR_P)
interrupt(TRC, m_pc);
- m_icount--;
+ m_icount -= tcy;
}
}