From d13ad48606983c12c428ba70274096c28d6fa932 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sat, 23 Jan 2021 17:35:08 +0100 Subject: iwm, swim1: devsel makes more sense now, I think --- src/devices/machine/iwm.cpp | 20 ++++++++++++-------- src/devices/machine/swim1.cpp | 4 +++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/devices/machine/iwm.cpp b/src/devices/machine/iwm.cpp index 9c9525fc9a2..68e1c9b9b6b 100644 --- a/src/devices/machine/iwm.cpp +++ b/src/devices/machine/iwm.cpp @@ -86,7 +86,7 @@ void iwm_device::device_reset() m_rsh = 0x00; m_flux_write_start = 0; m_flux_write_count = 0; - m_devsel_cb(1); + m_devsel_cb(0); } void iwm_device::device_timer(emu_timer &, device_timer_id, int, void *) @@ -95,8 +95,7 @@ void iwm_device::device_timer(emu_timer &, device_timer_id, int, void *) m_active = MODE_IDLE; if(m_floppy && !m_disable_mon) m_floppy->mon_w(true); - if(m_disable_mon) - m_devsel_cb(0); + m_devsel_cb(0); m_status &= ~0x20; } } @@ -108,10 +107,10 @@ void iwm_device::set_floppy(floppy_image_device *floppy) sync(); - if(m_floppy && !m_disable_mon) + if(m_floppy && (m_control & 0x10) && !m_disable_mon) m_floppy->mon_w(true); m_floppy = floppy; - if(m_floppy && !m_disable_mon) + if(m_floppy && (m_control & 0x10) && !m_disable_mon) m_floppy->mon_w(false); update_phases(); } @@ -167,18 +166,23 @@ u8 iwm_device::control(int offset, u8 data) changed ^= m_control | (m_phases & 0xf); - if(changed & 0x20) - m_devsel_cb(m_control & 0x20 ? 2 : 1); + if(changed & 0x30) + m_devsel_cb(m_control & 0x10 ? m_control & 0x20 ? 2 : 1 : 0); if(changed & 0x10) { if(m_control & 0x10) { m_active = MODE_ACTIVE; m_status |= 0x20; + if(m_floppy && !m_disable_mon) + m_floppy->mon_w(false); } else { if(m_mode & 0x04) { m_active = MODE_IDLE; m_status &= ~0x20; + if(m_floppy && !m_disable_mon) + m_floppy->mon_w(true); } else { + m_devsel_cb(m_control & 0x20 ? 2 : 1); m_active = MODE_DELAY; m_timer->adjust(cycles_to_time(8388608)); } @@ -249,7 +253,7 @@ u8 iwm_device::control(int offset, u8 data) switch(m_control & 0xc0) { case 0x00: return m_active ? m_data : 0xff; - case 0x40: return (m_status & 0x7f) | (!m_floppy || m_floppy->wpt_r() ? 0x80 : 0);; + case 0x40: return (m_status & 0x7f) | ((!m_floppy || m_floppy->wpt_r()) ? 0x80 : 0);; case 0x80: return m_whd; case 0xc0: if(offset & 1) { if(m_active) data_w(data); else mode_w(data); } return 0xff; } diff --git a/src/devices/machine/swim1.cpp b/src/devices/machine/swim1.cpp index 15f3e3b1a59..331c25f62aa 100644 --- a/src/devices/machine/swim1.cpp +++ b/src/devices/machine/swim1.cpp @@ -93,6 +93,8 @@ void swim1_device::set_floppy(floppy_image_device *floppy) if(m_floppy == floppy) return; + sync(); + m_floppy = floppy; update_phases(); if(m_ism_mode & 0x40) @@ -284,8 +286,8 @@ u8 swim1_device::iwm_control(int offset, u8 data) if(m_iwm_mode & 0x04) { m_iwm_active = MODE_IDLE; m_iwm_status &= ~0x20; - m_devsel_cb(0); } else { + m_devsel_cb(m_iwm_control & 0x20 ? 2 : 1); m_iwm_active = MODE_DELAY; m_timer->adjust(cycles_to_time(8388608)); } -- cgit v1.2.3