From f6873f3dadbbb937a7cb7264af6e7e5cd95ae87c Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 10 Apr 2023 23:48:12 -0400 Subject: mn1880: Fix execution of various instructions --- src/devices/cpu/mn1880/mn1880.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/devices/cpu/mn1880/mn1880.cpp b/src/devices/cpu/mn1880/mn1880.cpp index eec91c67bec..32b14a8a640 100644 --- a/src/devices/cpu/mn1880/mn1880.cpp +++ b/src/devices/cpu/mn1880/mn1880.cpp @@ -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; -- cgit v1.2.3