mn1880: Fix execution of various instructions

This commit is contained in:
AJR 2023-04-10 23:48:12 -04:00
parent 657c19f2a7
commit f6873f3dad

View File

@ -75,6 +75,9 @@
which contain neither internal ROM nor RAM, has been emulated only
to the extent required by psr500, though it likely has a few other
features and quirks.
* In DF mode, MOV (da),(YP) and MOV (XP),(da) apparently need to take
the high byte of the direct address from the opposite pointer,
despite MN1870 documentation suggesting these use the same pointer.
***************************************************************************/
@ -705,7 +708,7 @@ void mn1880_device::execute_run()
case microstate::MOV36_1:
if (BIT(cpu.fs, 5))
m_da |= cpu.xp & 0xff00;
m_da |= cpu.yp & 0xff00;
m_ustate = microstate::MOV36_2;
break;
@ -724,7 +727,7 @@ void mn1880_device::execute_run()
m_tmp1 = m_data.read_byte(mmu_data_translate(m_da));
m_da = input;
if (BIT(cpu.fs, 5))
m_da |= cpu.yp & 0xff00;
m_da |= cpu.xp & 0xff00;
m_ustate = microstate::MOV56_2;
break;
@ -2168,7 +2171,7 @@ void mn1880_device::execute_run()
case microstate::ADDRE8_1:
++cpu.ip;
if (BIT(cpu.fs, 5))
m_da |= cpu.yp & 0x00ff;
m_da |= cpu.yp & 0xff00;
m_tmp2 = input;
m_ustate = microstate::ADDRE8_2;
break;
@ -2177,15 +2180,15 @@ void mn1880_device::execute_run()
m_tmp1 = m_data.read_byte(mmu_data_translate(m_da));
m_da = m_tmp2;
if (BIT(cpu.fs, 5))
m_da |= cpu.xp & 0x00ff;
m_da |= cpu.xp & 0xff00;
m_ustate = microstate::ADDRE8_3;
break;
case microstate::ADDRE8_3:
if (BIT(cpu.ir, 1))
setl(cpu.yp, cpu.addcz(cpu.yp & 0x00ff, m_data.read_byte(mmu_data_translate(m_da)), false, false));
setl(cpu.yp, cpu.addcz(m_tmp1, m_data.read_byte(mmu_data_translate(m_da)), false, false));
else
setl(cpu.xp, cpu.addcz(cpu.xp & 0x00ff, m_data.read_byte(mmu_data_translate(m_da)), false, false));
setl(cpu.xp, cpu.addcz(m_tmp1, m_data.read_byte(mmu_data_translate(m_da)), false, false));
m_ustate = microstate::NOP_1; // TODO: output queue (XPl only?)
break;
@ -2194,7 +2197,7 @@ void mn1880_device::execute_run()
m_tmp2 = m_da & 0x00ff;
m_da = input;
if (BIT(cpu.fs, 5))
m_da |= (BIT(cpu.ir, 1) ? cpu.yp : cpu.xp) & 0x00ff;
m_da |= (BIT(cpu.ir, 1) ? cpu.yp : cpu.xp) & 0xff00;
m_ustate = microstate::ADDRE9_2;
break;