ti99: Fixed crash with Corcomp floppy controller when accessing a drive that is not connected.

This commit is contained in:
Michael Zapf 2025-04-24 22:07:25 +02:00
parent fa360c3324
commit 59a9abe3eb

View File

@ -367,8 +367,10 @@ void corcomp_fdc_device::select_dsk(int state)
if (m_floppy[m_selected_drive-1]->get_device() != nullptr) if (m_floppy[m_selected_drive-1]->get_device() != nullptr)
{ {
m_wdc->set_floppy(m_floppy[m_selected_drive-1]->get_device()); m_wdc->set_floppy(m_floppy[m_selected_drive-1]->get_device());
m_floppy[m_selected_drive-1]->get_device()->ss_w(m_tms9901->read_bit(tms9901_device::INT15_P7)); side_select(m_tms9901->read_bit(tms9901_device::INT15_P7));
} }
else
LOGMASKED(LOG_WARN, "No drive connected as DSK%d\n", m_selected_drive);
} }
} }
@ -376,10 +378,15 @@ void corcomp_fdc_device::side_select(int state)
{ {
// Select side of disk (bit 7) // Select side of disk (bit 7)
if (m_selected_drive != 0) if (m_selected_drive != 0)
{
if (m_floppy[m_selected_drive-1]->get_device() != nullptr)
{ {
LOGMASKED(LOG_DRIVE, "Set side (bit 7) = %d on DSK%d\n", state, m_selected_drive); LOGMASKED(LOG_DRIVE, "Set side (bit 7) = %d on DSK%d\n", state, m_selected_drive);
m_floppy[m_selected_drive-1]->get_device()->ss_w(state); m_floppy[m_selected_drive-1]->get_device()->ss_w(state);
} }
else
LOGMASKED(LOG_WARN, "No drive connected as DSK%d\n", m_selected_drive);
}
} }
/* /*