From 7f6658b5f67d65719d0c7c1eada2627b673c8373 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 24 May 2021 18:44:27 +0200 Subject: swim: Fixed bugs linked to device selection --- src/devices/machine/swim1.cpp | 11 +++++++++-- src/devices/machine/swim2.cpp | 2 +- src/devices/machine/swim3.cpp | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/devices/machine/swim1.cpp b/src/devices/machine/swim1.cpp index 75c3b12b186..8e747a219bd 100644 --- a/src/devices/machine/swim1.cpp +++ b/src/devices/machine/swim1.cpp @@ -298,8 +298,12 @@ void swim1_device::ism_write(offs_t offset, u8 data) m_ism_mode &= ~data; m_ism_param_idx = 0; ism_show_mode(); - if(!(m_ism_mode & 0x40)) + if(!(m_ism_mode & 0x40)) { logerror("switch to iwm\n"); + u8 ism_devsel = m_ism_mode & 0x80 ? (m_ism_mode >> 1) & 3 : 0; + if(ism_devsel != m_iwm_devsel) + m_devsel_cb(m_iwm_devsel); + } break; case 0x7: @@ -315,7 +319,7 @@ void swim1_device::ism_write(offs_t offset, u8 data) if(m_ism_mode & 0x01) ism_fifo_clear(); - if((m_ism_mode ^ prev_mode) & 0x06) + if((m_ism_mode ^ prev_mode) & 0x86) m_devsel_cb(m_ism_mode & 0x80 ? (m_ism_mode >> 1) & 3 : 0); if((m_ism_mode ^ prev_mode) & 0x20) m_hdsel_cb((m_ism_mode >> 5) & 1); @@ -533,6 +537,9 @@ u8 swim1_device::iwm_control(int offset, u8 data) if(data & 0x40) { m_ism_mode |= 0x40; logerror("switch to ism\n"); + u8 ism_devsel = m_ism_mode & 0x80 ? (m_ism_mode >> 1) & 3 : 0; + if(ism_devsel != m_iwm_devsel) + m_devsel_cb(ism_devsel); } break; } diff --git a/src/devices/machine/swim2.cpp b/src/devices/machine/swim2.cpp index da26c70cb41..69b718a4cef 100644 --- a/src/devices/machine/swim2.cpp +++ b/src/devices/machine/swim2.cpp @@ -297,7 +297,7 @@ void swim2_device::write(offs_t offset, u8 data) if(m_mode & 0x01) fifo_clear(); - if((m_mode ^ prev_mode) & 0x06) + if((m_mode ^ prev_mode) & 0x86) m_devsel_cb(m_mode & 0x80 ? (m_mode >> 1) & 3 : 0); if((m_mode ^ prev_mode) & 0x20) m_hdsel_cb((m_mode >> 5) & 1); diff --git a/src/devices/machine/swim3.cpp b/src/devices/machine/swim3.cpp index ec24c6e2606..1be0e9937f6 100644 --- a/src/devices/machine/swim3.cpp +++ b/src/devices/machine/swim3.cpp @@ -254,7 +254,7 @@ void swim3_device::write(offs_t offset, u8 data) break; } - if((m_mode ^ prev_mode) & 0x06) + if((m_mode ^ prev_mode) & 0x86) m_devsel_cb((m_mode >> 1) & 3); if((m_mode ^ prev_mode) & 0x20) m_hdsel_cb((m_mode >> 5) & 1); -- cgit v1.2.3