wd_fdc: Add a MON callback so that drives, which are unselected early, do not spin forever.

This commit is contained in:
Michael Zapf 2020-03-20 00:56:15 +01:00
parent 207da844b8
commit f62ad5e394
4 changed files with 86 additions and 60 deletions

View File

@ -16,8 +16,6 @@
Another switch is included (SW2) labeled "Turbo" on schematics, but which Another switch is included (SW2) labeled "Turbo" on schematics, but which
is not present on all boards. It may require a different ROM. is not present on all boards. It may require a different ROM.
Known issue: On error, the drive may continue spinning.
Michael Zapf Michael Zapf
March 2020 March 2020
@ -255,6 +253,17 @@ WRITE_LINE_MEMBER( myarc_fdc_device::fdc_drq_w )
LOGMASKED(LOG_DRQ, "DRQ callback = %d\n", state); LOGMASKED(LOG_DRQ, "DRQ callback = %d\n", state);
} }
WRITE_LINE_MEMBER( myarc_fdc_device::fdc_mon_w )
{
LOGMASKED(LOG_DRIVE, "MON callback = %d\n", state);
// All MON lines are connected
// Do not start the motors when no drive is selected. However, motors
// can always be stopped.
if (m_selected_drive != 0 || state==1)
for (int i=0; i < 3; i++)
if (m_floppy[i] != nullptr) m_floppy[i]->mon_w(state);
}
/* /*
Callbacks from the 74LS259 latch Callbacks from the 74LS259 latch
*/ */
@ -322,7 +331,6 @@ WRITE_LINE_MEMBER( myarc_fdc_device::drivesel_w )
} }
} }
void myarc_fdc_device::device_start() void myarc_fdc_device::device_start()
{ {
m_dsrrom = memregion(TI99_DSRROM)->base(); m_dsrrom = memregion(TI99_DSRROM)->base();
@ -403,8 +411,13 @@ void myarc_fdc_device::device_add_mconfig(machine_config& config)
m_wd1770->intrq_wr_callback().set(FUNC(myarc_fdc_device::fdc_irq_w)); m_wd1770->intrq_wr_callback().set(FUNC(myarc_fdc_device::fdc_irq_w));
m_wd1770->drq_wr_callback().set(FUNC(myarc_fdc_device::fdc_drq_w)); m_wd1770->drq_wr_callback().set(FUNC(myarc_fdc_device::fdc_drq_w));
m_wd1770->mon_wr_callback().set(FUNC(myarc_fdc_device::fdc_mon_w));
m_wd1770->set_disable_motor_control(true);
m_wd1772->intrq_wr_callback().set(FUNC(myarc_fdc_device::fdc_irq_w)); m_wd1772->intrq_wr_callback().set(FUNC(myarc_fdc_device::fdc_irq_w));
m_wd1772->drq_wr_callback().set(FUNC(myarc_fdc_device::fdc_drq_w)); m_wd1772->drq_wr_callback().set(FUNC(myarc_fdc_device::fdc_drq_w));
m_wd1772->mon_wr_callback().set(FUNC(myarc_fdc_device::fdc_mon_w));
m_wd1772->set_disable_motor_control(true);
LS259(config, m_drivelatch); // U10 LS259(config, m_drivelatch); // U10
m_drivelatch->q_out_cb<0>().set(FUNC(myarc_fdc_device::den_w)); m_drivelatch->q_out_cb<0>().set(FUNC(myarc_fdc_device::den_w));

View File

@ -52,6 +52,8 @@ private:
// Callback methods // Callback methods
DECLARE_WRITE_LINE_MEMBER( fdc_irq_w ); DECLARE_WRITE_LINE_MEMBER( fdc_irq_w );
DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
DECLARE_WRITE_LINE_MEMBER( fdc_mon_w );
DECLARE_WRITE_LINE_MEMBER( den_w ); DECLARE_WRITE_LINE_MEMBER( den_w );
DECLARE_WRITE_LINE_MEMBER( wdreset_w ); DECLARE_WRITE_LINE_MEMBER( wdreset_w );
DECLARE_WRITE_LINE_MEMBER( sidsel_w ); DECLARE_WRITE_LINE_MEMBER( sidsel_w );

View File

@ -87,7 +87,8 @@ wd_fdc_device_base::wd_fdc_device_base(const machine_config &mconfig, device_typ
enp_cb(*this), enp_cb(*this),
sso_cb(*this), sso_cb(*this),
ready_cb(*this), // actually output by the drive, not by the FDC ready_cb(*this), // actually output by the drive, not by the FDC
enmf_cb(*this) enmf_cb(*this),
mon_cb(*this)
{ {
force_ready = false; force_ready = false;
disable_motor_control = false; disable_motor_control = false;
@ -113,6 +114,7 @@ void wd_fdc_device_base::device_start()
sso_cb.resolve(); sso_cb.resolve();
ready_cb.resolve(); ready_cb.resolve();
enmf_cb.resolve(); enmf_cb.resolve();
mon_cb.resolve_safe();
if (!has_enmf && !enmf_cb.isnull()) if (!has_enmf && !enmf_cb.isnull())
logerror("Warning, this chip doesn't have an ENMF line.\n"); logerror("Warning, this chip doesn't have an ENMF line.\n");
@ -217,6 +219,9 @@ void wd_fdc_device_base::set_floppy(floppy_image_device *_floppy)
int next_ready = floppy ? floppy->ready_r() : 1; int next_ready = floppy ? floppy->ready_r() : 1;
if (motor_control)
mon_cb(status & S_MON ? 0 : 1);
if(floppy) { if(floppy) {
if(motor_control && !disable_motor_control) if(motor_control && !disable_motor_control)
floppy->mon_w(status & S_MON ? 0 : 1); floppy->mon_w(status & S_MON ? 0 : 1);
@ -1296,6 +1301,8 @@ void wd_fdc_device_base::spinup()
} }
status |= S_MON|S_SPIN; status |= S_MON|S_SPIN;
mon_cb(0);
if(floppy && !disable_motor_control) if(floppy && !disable_motor_control)
floppy->mon_w(0); floppy->mon_w(0);
} }
@ -1335,6 +1342,7 @@ void wd_fdc_device_base::index_callback(floppy_image_device *floppy, int state)
motor_timeout ++; motor_timeout ++;
if(motor_control && motor_timeout >= 5) { if(motor_control && motor_timeout >= 5) {
status &= ~S_MON; status &= ~S_MON;
mon_cb(1);
if(floppy && !disable_motor_control) if(floppy && !disable_motor_control)
floppy->mon_w(1); floppy->mon_w(1);
} }

View File

@ -57,6 +57,8 @@ public:
auto ready_wr_callback() { return ready_cb.bind(); } auto ready_wr_callback() { return ready_cb.bind(); }
auto enmf_rd_callback() { return enmf_cb.bind(); } auto enmf_rd_callback() { return enmf_cb.bind(); }
auto mon_wr_callback() { return mon_cb.bind(); }
void soft_reset(); void soft_reset();
DECLARE_WRITE_LINE_MEMBER(dden_w); DECLARE_WRITE_LINE_MEMBER(dden_w);
@ -295,6 +297,7 @@ private:
devcb_write_line intrq_cb, drq_cb, hld_cb, enp_cb, sso_cb, ready_cb; devcb_write_line intrq_cb, drq_cb, hld_cb, enp_cb, sso_cb, ready_cb;
devcb_read_line enmf_cb; devcb_read_line enmf_cb;
devcb_write_line mon_cb;
uint8_t format_last_byte; uint8_t format_last_byte;
int format_last_byte_count; int format_last_byte_count;