From 9f476fa0ade4eca7e00f9d956090ff052c77b295 Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Wed, 4 Jul 2018 18:54:55 +0200 Subject: [PATCH] hp9122c: add motor off timer (nw) --- src/devices/bus/ieee488/hp9122c.cpp | 14 ++++++++++++++ src/devices/bus/ieee488/hp9122c.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/devices/bus/ieee488/hp9122c.cpp b/src/devices/bus/ieee488/hp9122c.cpp index 94c52a7512f..5075e01a38c 100644 --- a/src/devices/bus/ieee488/hp9122c.cpp +++ b/src/devices/bus/ieee488/hp9122c.cpp @@ -85,6 +85,16 @@ void hp9122c_device::device_start() save_item(NAME(m_index_int)); save_item(NAME(m_ds0)); save_item(NAME(m_ds1)); + + m_motor_timer = timer_alloc(0); +} + +void hp9122c_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + floppy_image_device *floppy0 = m_floppy[0]->get_device(); + floppy_image_device *floppy1 = m_floppy[1]->get_device(); + floppy0->mon_w(1); + floppy1->mon_w(1); } void hp9122c_device::device_reset() @@ -287,10 +297,14 @@ WRITE8_MEMBER(hp9122c_device::cmd_w) floppy0->mon_w(0); floppy0->ss_w(!(data & REG_CNTL_HEADSEL)); m_fdc->set_floppy(floppy0); + m_motor_timer->reset(); } else if (m_ds1) { floppy1->mon_w(0); floppy1->ss_w(!(data & REG_CNTL_HEADSEL)); m_fdc->set_floppy(floppy1); + m_motor_timer->reset(); + } else { + m_motor_timer->adjust(attotime::from_msec(2000)); } if (data & REG_CNTL_CLOCK_SEL) diff --git a/src/devices/bus/ieee488/hp9122c.h b/src/devices/bus/ieee488/hp9122c.h index 8b51af38e28..4bd51888e26 100644 --- a/src/devices/bus/ieee488/hp9122c.h +++ b/src/devices/bus/ieee488/hp9122c.h @@ -118,6 +118,7 @@ private: DECLARE_WRITE8_MEMBER(fdc_write); void cpu_map(address_map &map); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; required_device m_cpu; required_device m_i8291a; @@ -143,6 +144,8 @@ private: bool m_ds0; bool m_ds1; + + emu_timer *m_motor_timer; }; // device type definition