apple floppy: Correct the dskchg polarity.

This commit is contained in:
Olivier Galibert 2021-02-12 09:37:34 +01:00
parent 4a8a497828
commit 28a9629787
2 changed files with 11 additions and 8 deletions

View File

@ -2461,7 +2461,7 @@ bool mac_floppy_device::wpt_r()
return mon; return mon;
case 0x3: // Disk change signal case 0x3: // Disk change signal
return dskchg; return !dskchg;
case 0x4: case 0x4:
case 0xc: // Index pulse, probably only on the superdrive though 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 case 0xc: // Clear dskchg
logerror("cmd clear dskchg\n"); logerror("cmd clear dskchg\n");
dskchg = 0; dskchg = 1;
break; break;
case 0xd: // GCR mode on case 0xd: // GCR mode on

View File

@ -144,6 +144,7 @@ void iwm_device::flush_write()
u8 iwm_device::control(int offset, u8 data) u8 iwm_device::control(int offset, u8 data)
{ {
sync(); sync();
// logerror("control trigger %x, %02x\n", offset, data); // logerror("control trigger %x, %02x\n", offset, data);
u8 changed = m_control | (m_phases & 0xf); u8 changed = m_control | (m_phases & 0xf);
if(offset < 8) { if(offset < 8) {
@ -336,6 +337,8 @@ u64 iwm_device::write_sync_half_window_size() const
return m_mode & 0x08 ? 2 : 4; return m_mode & 0x08 ? 2 : 4;
} }
static u64 ssx1 = 0, ssx2 = 0;
void iwm_device::sync() void iwm_device::sync()
{ {
if(!m_active) if(!m_active)
@ -355,6 +358,12 @@ void iwm_device::sync()
next_flux_change = flux.is_never() ? u64(-1) : time_to_cycles(flux); next_flux_change = flux.is_never() ? u64(-1) : time_to_cycles(flux);
if(next_flux_change <= m_last_sync) if(next_flux_change <= m_last_sync)
next_flux_change = m_last_sync+1; 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) { if(next_sync < m_next_state_change) {
m_last_sync = next_sync; m_last_sync = next_sync;
@ -399,7 +408,6 @@ void iwm_device::sync()
} else if(m_rsh >= 0x80) { } else if(m_rsh >= 0x80) {
m_data = m_rsh; m_data = m_rsh;
m_async_update = 0; 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; m_rsh = 0;
} }
break; break;
@ -429,7 +437,6 @@ void iwm_device::sync()
m_last_sync = m_next_state_change; m_last_sync = m_next_state_change;
switch(m_rw_state) { switch(m_rw_state) {
case S_IDLE: case S_IDLE:
// logerror("%s: idle\n", attotime::from_ticks(m_last_sync, clock()).to_string());
m_flux_write_count = 0; m_flux_write_count = 0;
if(m_mode & 0x02) { if(m_mode & 0x02) {
m_rw_state = SW_WINDOW_LOAD; m_rw_state = SW_WINDOW_LOAD;
@ -446,9 +453,7 @@ void iwm_device::sync()
break; break;
case SW_WINDOW_LOAD: case SW_WINDOW_LOAD:
// logerror("%s: window load\n", attotime::from_ticks(m_last_sync, clock()).to_string());
if(m_whd & 0x80) { if(m_whd & 0x80) {
// logerror("Underrun\n");
m_whd &= ~0x40; m_whd &= ~0x40;
m_rw_state = S_IDLE; m_rw_state = S_IDLE;
m_last_sync = next_sync; m_last_sync = next_sync;
@ -461,7 +466,6 @@ void iwm_device::sync()
break; break;
case SW_WINDOW_MIDDLE: case SW_WINDOW_MIDDLE:
// logerror("%s: window middle\n", attotime::from_ticks(m_last_sync, clock()).to_string());
if(m_wsh & 0x80) if(m_wsh & 0x80)
m_flux_write[m_flux_write_count++] = m_last_sync; m_flux_write[m_flux_write_count++] = m_last_sync;
m_wsh <<= 1; m_wsh <<= 1;
@ -473,7 +477,6 @@ void iwm_device::sync()
break; break;
case SW_WINDOW_END: 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()) if(m_flux_write_count == m_flux_write.size())
flush_write(); flush_write();
if(m_mode & 0x02) { if(m_mode & 0x02) {