From f66261b713ed8b0d1f53b43416943a4b45687bb6 Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 10 Dec 2016 10:15:57 -0500 Subject: [PATCH] i960: added scanbyte and IP-relative lda opcodes, masked low bits of branch targets [R. Belmont] --- src/devices/cpu/i960/i960.cpp | 24 ++++++++++++++++++++++++ src/mame/drivers/gkigt.cpp | 5 ++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/devices/cpu/i960/i960.cpp b/src/devices/cpu/i960/i960.cpp index 1f9db2d385e..acdb0c4e927 100644 --- a/src/devices/cpu/i960/i960.cpp +++ b/src/devices/cpu/i960/i960.cpp @@ -105,6 +105,13 @@ uint32_t i960_cpu_device::get_ea(uint32_t opcode) switch(mode) { case 0x4: return m_r[abase]; + + case 0x5: // address of this instruction + the offset dword + 8 + // which in reality is "address of next instruction + the offset dword" + ret = m_direct->read_dword(m_IP); + m_IP += 4; + ret += m_IP; + return ret; case 0x7: return m_r[abase] + (m_r[index] << scale); @@ -357,6 +364,7 @@ void i960_cpu_device::bxx(uint32_t opcode, int mask) { if(m_AC & mask) { m_IP += get_disp(opcode); + m_IP &= ~3; } } @@ -364,6 +372,7 @@ void i960_cpu_device::bxx_s(uint32_t opcode, int mask) { if(m_AC & mask) { m_IP += get_disp_s(opcode); + m_IP &= ~3; } } @@ -1068,6 +1077,21 @@ void i960_cpu_device::execute_op(uint32_t opcode) cmp_s(t1, t2); set_ri(opcode, t2-1); break; + + case 0xc: // scanbyte + m_icount -= 2; + m_AC &= ~7; // clear CC + t1 = get_1_ri(opcode); + t2 = get_2_ri(opcode); + printf("t1 %08x t2 %08x\n", t1, t2); + if ((t1 & 0xff000000) == (t2 & 0xff000000) || + (t1 & 0x00ff0000) == (t2 & 0x00ff0000) || + (t1 & 0x0000ff00) == (t2 & 0x0000ff00) || + (t1 & 0x000000ff) == (t2 & 0x000000ff)) + { + m_AC |= 2; + } + break; case 0xe: // chkbit m_icount -= 2; diff --git a/src/mame/drivers/gkigt.cpp b/src/mame/drivers/gkigt.cpp index 3805c43a5a8..ff8a31a8369 100644 --- a/src/mame/drivers/gkigt.cpp +++ b/src/mame/drivers/gkigt.cpp @@ -143,11 +143,14 @@ static ADDRESS_MAP_START( igt_gameking_mem, AS_PROGRAM, 32, igt_gameking_state ) AM_RANGE(0x10000000, 0x1000001f) AM_RAM AM_RANGE(0x10000020, 0x1000021f) AM_RAM // strange range to test, correct or CPU issue? AM_RANGE(0x10000220, 0x1003ffff) AM_RAM + + AM_RANGE(0x1807d000, 0x1807dfff) AM_RAM // used by MS3 for the restart IAC and afterwards AM_RANGE(0x28010008, 0x2801000b) AM_READ(igt_gk_28010008_r) + AM_RANGE(0x28020000, 0x280205ff) AM_RAM AM_RANGE(0x28030000, 0x28030003) AM_READ(igt_gk_28030000_r) - + AM_RANGE(0xa1000000, 0xa1011fff) AM_RAM // used by gkkey for restart IAC ADDRESS_MAP_END