From 562c7367c038088c76033599ec7daf97c425e6f8 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Fri, 14 Feb 2014 18:43:35 +0000 Subject: [PATCH] i86: fix shifts by very large (> 32) amounts. fixes ibm xt detection by the multi unique floppy controllers. --- src/emu/cpu/i86/i86inline.h | 44 +++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/emu/cpu/i86/i86inline.h b/src/emu/cpu/i86/i86inline.h index 957874b9ae0..3998506ad72 100644 --- a/src/emu/cpu/i86/i86inline.h +++ b/src/emu/cpu/i86/i86inline.h @@ -811,7 +811,9 @@ inline void i8086_common_cpu_device::RORC_WORD() inline void i8086_common_cpu_device::SHL_BYTE(UINT8 c) { - m_dst <<= c; + while (c--) + m_dst <<= 1; + set_CFB(m_dst); set_SZPF_Byte(m_dst); PutbackRMByte(m_dst); @@ -819,7 +821,9 @@ inline void i8086_common_cpu_device::SHL_BYTE(UINT8 c) inline void i8086_common_cpu_device::SHL_WORD(UINT8 c) { - m_dst <<= c; + while (c--) + m_dst <<= 1; + set_CFW(m_dst); set_SZPF_Word(m_dst); PutbackRMWord(m_dst); @@ -827,36 +831,48 @@ inline void i8086_common_cpu_device::SHL_WORD(UINT8 c) inline void i8086_common_cpu_device::SHR_BYTE(UINT8 c) { - m_dst >>= c-1; - m_CarryVal = m_dst & 0x1; - m_dst >>= 1; + while (c--) + { + m_CarryVal = m_dst & 0x01; + m_dst >>= 1; + } + set_SZPF_Byte(m_dst); PutbackRMByte(m_dst); } inline void i8086_common_cpu_device::SHR_WORD(UINT8 c) { - m_dst >>= c-1; - m_CarryVal = m_dst & 0x1; - m_dst >>= 1; + while (c--) + { + m_CarryVal = m_dst & 0x01; + m_dst >>= 1; + } + set_SZPF_Word(m_dst); PutbackRMWord(m_dst); } inline void i8086_common_cpu_device::SHRA_BYTE(UINT8 c) { - m_dst = ((INT8)m_dst) >> (c-1); - m_CarryVal = m_dst & 0x1; - m_dst = m_dst >> 1; + while (c--) + { + m_CarryVal = m_dst & 0x01; + m_dst = ((INT8) m_dst) >> 1; + } + set_SZPF_Byte(m_dst); PutbackRMByte(m_dst); } inline void i8086_common_cpu_device::SHRA_WORD(UINT8 c) { - m_dst = ((INT16)m_dst) >> (c-1); - m_CarryVal = m_dst & 0x1; - m_dst = m_dst >> 1; + while (c--) + { + m_CarryVal = m_dst & 0x01; + m_dst = ((INT16) m_dst) >> 1; + } + set_SZPF_Word(m_dst); PutbackRMWord(m_dst); }