diff options
Diffstat (limited to 'src/devices/bus/hp_dio/human_interface.cpp')
-rw-r--r-- | src/devices/bus/hp_dio/human_interface.cpp | 72 |
1 files changed, 44 insertions, 28 deletions
diff --git a/src/devices/bus/hp_dio/human_interface.cpp b/src/devices/bus/hp_dio/human_interface.cpp index 509a2151a3b..669c77e4ffb 100644 --- a/src/devices/bus/hp_dio/human_interface.cpp +++ b/src/devices/bus/hp_dio/human_interface.cpp @@ -19,10 +19,9 @@ //#define VERBOSE 1 #include "logmacro.h" -DEFINE_DEVICE_TYPE_NS(HPDIO_HUMAN_INTERFACE, bus::hp_dio, human_interface_device, "human_interface", "HP human interface card") +DEFINE_DEVICE_TYPE(HPDIO_HUMAN_INTERFACE, bus::hp_dio::human_interface_device, "human_interface", "HP human interface card") -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { void human_interface_device::device_add_mconfig(machine_config &config) { @@ -108,19 +107,30 @@ human_interface_device::human_interface_device(const machine_config &mconfig, de m_sound(*this, "sn76494"), m_tms9914(*this, "tms9914"), m_rtc(*this, "rtc"), - m_ieee488(*this, IEEE488_TAG) + m_ieee488(*this, IEEE488_TAG), + m_hil_read(false), + m_kbd_nmi(false), + m_gpib_irq_line(false), + m_gpib_dma_line(false), + m_old_latch_enable(false), + m_gpib_dma_enable(false), + m_hil_data(0), + m_latch_data(0), + m_rtc_data(0), + m_ppoll_sc(0), + m_ppoll_mask(0) { } void human_interface_device::device_start() { program_space().install_readwrite_handler(0x420000, 0x420003, 0x0003, 0xfffc, 0, - read8_delegate(FUNC(upi41_cpu_device::upi41_master_r), &(*m_iocpu)), - write8_delegate(FUNC(upi41_cpu_device::upi41_master_w), &(*m_iocpu)), 0x00ff00ff); + read8sm_delegate(*m_iocpu, FUNC(upi41_cpu_device::upi41_master_r)), + write8sm_delegate(*m_iocpu, FUNC(upi41_cpu_device::upi41_master_w)), 0x00ff00ff); program_space().install_readwrite_handler(0x470000, 0x47001f, 0x1f, 0xffe0, 0, - read8_delegate(FUNC(human_interface_device::gpib_r), this), - write8_delegate(FUNC(human_interface_device::gpib_w), this), 0x00ff00ff); + read8sm_delegate(*this, FUNC(human_interface_device::gpib_r)), + write8sm_delegate(*this, FUNC(human_interface_device::gpib_w)), 0x00ff00ff); save_item(NAME(m_hil_read)); save_item(NAME(m_kbd_nmi)); @@ -137,10 +147,17 @@ void human_interface_device::device_start() void human_interface_device::device_reset() { - m_ppoll_sc = 0; - m_gpib_irq_line = false; + m_hil_read = false; m_kbd_nmi = false; + m_gpib_irq_line = false; + m_gpib_dma_line = false; + m_gpib_dma_enable = false; m_old_latch_enable = true; + m_ppoll_sc = 0; + m_hil_data = 0; + m_latch_data = 0; + m_rtc_data = 0; + m_ppoll_mask = 0; m_rtc->cs1_w(ASSERT_LINE); m_rtc->cs2_w(CLEAR_LINE); m_rtc->write_w(CLEAR_LINE); @@ -149,7 +166,7 @@ void human_interface_device::device_reset() m_iocpu->reset(); } -WRITE_LINE_MEMBER(human_interface_device::reset_in) +void human_interface_device::reset_in(int state) { if (state) device_reset(); @@ -161,7 +178,7 @@ void human_interface_device::update_gpib_irq() ((m_ppoll_sc & (PPOLL_IR|PPOLL_IE)) == (PPOLL_IR|PPOLL_IE))) ? ASSERT_LINE : CLEAR_LINE); } -WRITE_LINE_MEMBER(human_interface_device::gpib_irq) +void human_interface_device::gpib_irq(int state) { m_gpib_irq_line = state; update_gpib_irq(); @@ -172,13 +189,13 @@ void human_interface_device::update_gpib_dma() dmar0_out(m_gpib_dma_enable && m_gpib_dma_line); } -WRITE_LINE_MEMBER(human_interface_device::gpib_dreq) +void human_interface_device::gpib_dreq(int state) { m_gpib_dma_line = state; update_gpib_dma(); } -WRITE8_MEMBER(human_interface_device::ieee488_dio_w) +void human_interface_device::ieee488_dio_w(uint8_t data) { if (m_ieee488->atn_r() || m_ieee488->eoi_r()) return; @@ -191,7 +208,7 @@ WRITE8_MEMBER(human_interface_device::ieee488_dio_w) } } -WRITE8_MEMBER(human_interface_device::gpib_w) +void human_interface_device::gpib_w(offs_t offset, uint8_t data) { if (offset & 0x08) { m_tms9914->write(offset & 0x07, data); @@ -217,7 +234,7 @@ WRITE8_MEMBER(human_interface_device::gpib_w) if (m_ppoll_sc & PPOLL_IE) { LOG("%s: start parallel poll\n", __func__); - ieee488_dio_w(space, 0, m_ieee488->dio_r(space, 0)); + ieee488_dio_w(m_ieee488->dio_r()); } break; case 4: @@ -229,7 +246,7 @@ WRITE8_MEMBER(human_interface_device::gpib_w) LOG("gpib_w: %s %02X = %02X\n", machine().describe_context().c_str(), offset, data); } -READ8_MEMBER(human_interface_device::gpib_r) +uint8_t human_interface_device::gpib_r(offs_t offset) { uint8_t data = 0xff; @@ -266,7 +283,7 @@ READ8_MEMBER(human_interface_device::gpib_r) } -WRITE8_MEMBER(human_interface_device::iocpu_port1_w) +void human_interface_device::iocpu_port1_w(uint8_t data) { m_hil_data = data; m_rtc->d0_w(data & 0x01 ? ASSERT_LINE : CLEAR_LINE); @@ -275,12 +292,12 @@ WRITE8_MEMBER(human_interface_device::iocpu_port1_w) m_rtc->d3_w(data & 0x08 ? ASSERT_LINE : CLEAR_LINE); } -WRITE8_MEMBER(human_interface_device::iocpu_port2_w) +void human_interface_device::iocpu_port2_w(uint8_t data) { bool latch_enable = data & LATCH_EN; if ((data & (HIL_CS|HIL_WE)) == 0) - m_mlc->write(space, (m_latch_data & 0xc0) >> 6, m_hil_data, 0xff); + m_mlc->write((m_latch_data & 0xc0) >> 6, m_hil_data); if ((data & SN76494_EN) == 0) m_sound->write(m_hil_data); @@ -307,21 +324,21 @@ WRITE8_MEMBER(human_interface_device::iocpu_port2_w) m_old_latch_enable = latch_enable; } -READ8_MEMBER(human_interface_device::iocpu_port1_r) +uint8_t human_interface_device::iocpu_port1_r() { if (m_hil_read) - return m_mlc->read(space, (m_latch_data & 0xc0) >> 6, 0xff); + return m_mlc->read((m_latch_data & 0xc0) >> 6); if (m_latch_data & 0x20) return m_rtc_data; return 0xff; } -READ8_MEMBER(human_interface_device::iocpu_test0_r) +uint8_t human_interface_device::iocpu_test0_r() { return !m_mlc->get_int(); } -WRITE_LINE_MEMBER(human_interface_device::rtc_d0_w) +void human_interface_device::rtc_d0_w(int state) { if (state) m_rtc_data |= 1; @@ -330,7 +347,7 @@ WRITE_LINE_MEMBER(human_interface_device::rtc_d0_w) } -WRITE_LINE_MEMBER(human_interface_device::rtc_d1_w) +void human_interface_device::rtc_d1_w(int state) { if (state) m_rtc_data |= 2; @@ -338,7 +355,7 @@ WRITE_LINE_MEMBER(human_interface_device::rtc_d1_w) m_rtc_data &= ~2; } -WRITE_LINE_MEMBER(human_interface_device::rtc_d2_w) +void human_interface_device::rtc_d2_w(int state) { if (state) m_rtc_data |= 4; @@ -347,7 +364,7 @@ WRITE_LINE_MEMBER(human_interface_device::rtc_d2_w) } -WRITE_LINE_MEMBER(human_interface_device::rtc_d3_w) +void human_interface_device::rtc_d3_w(int state) { if (state) m_rtc_data |= 8; @@ -371,4 +388,3 @@ uint8_t human_interface_device::dmack_r_in(int channel) } } // namespace bus::hp_dio -} // namespace bus |