From 28a9629787dfa97702fd1d036d9bee5ab85516be Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Fri, 12 Feb 2021 09:37:34 +0100 Subject: [PATCH] apple floppy: Correct the dskchg polarity. --- src/devices/imagedev/floppy.cpp | 4 ++-- src/devices/machine/iwm.cpp | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index 34606eca8c1..07de93a523a 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -2461,7 +2461,7 @@ bool mac_floppy_device::wpt_r() return mon; case 0x3: // Disk change signal - return dskchg; + return !dskchg; case 0x4: case 0xc: // Index pulse, probably only on the superdrive though @@ -2571,7 +2571,7 @@ void mac_floppy_device::seek_phase_w(int phases) case 0xc: // Clear dskchg logerror("cmd clear dskchg\n"); - dskchg = 0; + dskchg = 1; break; case 0xd: // GCR mode on diff --git a/src/devices/machine/iwm.cpp b/src/devices/machine/iwm.cpp index af955e30978..d1dcf79046a 100644 --- a/src/devices/machine/iwm.cpp +++ b/src/devices/machine/iwm.cpp @@ -144,6 +144,7 @@ void iwm_device::flush_write() u8 iwm_device::control(int offset, u8 data) { sync(); + // logerror("control trigger %x, %02x\n", offset, data); u8 changed = m_control | (m_phases & 0xf); if(offset < 8) { @@ -336,6 +337,8 @@ u64 iwm_device::write_sync_half_window_size() const return m_mode & 0x08 ? 2 : 4; } +static u64 ssx1 = 0, ssx2 = 0; + void iwm_device::sync() { if(!m_active) @@ -355,6 +358,12 @@ void iwm_device::sync() next_flux_change = flux.is_never() ? u64(-1) : time_to_cycles(flux); if(next_flux_change <= m_last_sync) next_flux_change = m_last_sync+1; + if(!ssx1) + ssx1 = ssx2 = next_flux_change; + if(ssx2 != next_flux_change) { + ssx1 = ssx2; + ssx2 = next_flux_change; + } } if(next_sync < m_next_state_change) { m_last_sync = next_sync; @@ -399,7 +408,6 @@ void iwm_device::sync() } else if(m_rsh >= 0x80) { m_data = m_rsh; m_async_update = 0; - // logerror("%s %010d DATAR %s %02x\n", cycles_to_time(m_last_sync).to_string(), m_last_sync, m_floppy->tag(), m_data); m_rsh = 0; } break; @@ -429,7 +437,6 @@ void iwm_device::sync() m_last_sync = m_next_state_change; switch(m_rw_state) { case S_IDLE: - // logerror("%s: idle\n", attotime::from_ticks(m_last_sync, clock()).to_string()); m_flux_write_count = 0; if(m_mode & 0x02) { m_rw_state = SW_WINDOW_LOAD; @@ -446,9 +453,7 @@ void iwm_device::sync() break; case SW_WINDOW_LOAD: - // logerror("%s: window load\n", attotime::from_ticks(m_last_sync, clock()).to_string()); if(m_whd & 0x80) { - // logerror("Underrun\n"); m_whd &= ~0x40; m_rw_state = S_IDLE; m_last_sync = next_sync; @@ -461,7 +466,6 @@ void iwm_device::sync() break; case SW_WINDOW_MIDDLE: - // logerror("%s: window middle\n", attotime::from_ticks(m_last_sync, clock()).to_string()); if(m_wsh & 0x80) m_flux_write[m_flux_write_count++] = m_last_sync; m_wsh <<= 1; @@ -473,7 +477,6 @@ void iwm_device::sync() break; case SW_WINDOW_END: - // logerror("%s: window end\n", attotime::from_ticks(m_last_sync, clock()).to_string()); if(m_flux_write_count == m_flux_write.size()) flush_write(); if(m_mode & 0x02) {