From bc0bbf08b08a4c2e016c174b4fb5a141c7129096 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 16 Jan 2019 01:08:18 -0500 Subject: [PATCH] tv955kb: Add bell and reset output --- src/mame/drivers/tv955.cpp | 10 +++++++-- src/mame/machine/tv955kb.cpp | 42 +++++++++++++++++++++++++++++++++--- src/mame/machine/tv955kb.h | 14 +++++++----- 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/src/mame/drivers/tv955.cpp b/src/mame/drivers/tv955.cpp index 722d0d167ea..dfc6f9f67c7 100644 --- a/src/mame/drivers/tv955.cpp +++ b/src/mame/drivers/tv955.cpp @@ -104,7 +104,13 @@ void tv955_state::control_latch_w(u8 data) WRITE_LINE_MEMBER(tv955_state::system_reset_w) { - // TODO + m_maincpu->set_input_line(INPUT_LINE_RESET, state ? CLEAR_LINE : ASSERT_LINE); + if (!state) + { + m_keybuart->reset(); + m_printuart->reset(); + m_hostuart->reset(); + } } void tv955_state::mem_map(address_map &map) @@ -213,4 +219,4 @@ ROM_START( tv955 ) ROM_LOAD( "t180002-26b.u45", 0x0000, 0x1000, CRC(69c9ebc7) SHA1(32282c816ec597a7c45e939acb7a4155d35ea584) ) ROM_END -COMP( 1985, tv955, 0, 0, tv955, tv955, tv955_state, empty_init, "TeleVideo Systems", "TeleVideo 955", MACHINE_IS_SKELETON ) +COMP( 1985, tv955, 0, 0, tv955, tv955, tv955_state, empty_init, "TeleVideo Systems", "TeleVideo 955", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/machine/tv955kb.cpp b/src/mame/machine/tv955kb.cpp index 6e5c2e23557..039eab9c602 100644 --- a/src/mame/machine/tv955kb.cpp +++ b/src/mame/machine/tv955kb.cpp @@ -17,6 +17,7 @@ Connector pinout: #include "emu.h" #include "machine/tv955kb.h" #include "machine/input_merger.h" +#include "speaker.h" DEFINE_DEVICE_TYPE(TV955_KEYBOARD, tv955kb_device, "tv955kb", "TeleVideo 955 Keyboard") @@ -25,7 +26,9 @@ tv955kb_device::tv955kb_device(const machine_config &mconfig, const char *tag, d , m_txd_cb(*this) , m_reset_cb(*this) , m_mcu(*this, "mcu") + , m_bell(*this, "bell") , m_keys(*this, "Y%u", 0U) + , m_bell_on(false) { } @@ -37,6 +40,27 @@ void tv955kb_device::device_resolve_objects() void tv955kb_device::device_start() { + m_bell_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tv955kb_device::bell_q8), this)); + + save_item(NAME(m_bell_on)); +} + +void tv955kb_device::device_reset() +{ + bell_reset(); +} + +TIMER_CALLBACK_MEMBER(tv955kb_device::bell_q8) +{ + m_bell_on = !m_bell_on; + m_bell->level_w(m_bell_on); +} + +void tv955kb_device::bell_reset() +{ + m_bell_on = false; + m_bell->level_w(0); + m_bell_timer->enable(false); } WRITE_LINE_MEMBER(tv955kb_device::write_rxd) @@ -59,7 +83,14 @@ u8 tv955kb_device::keys_r() WRITE_LINE_MEMBER(tv955kb_device::bell_w) { - // TODO + if (state && m_bell_timer->enabled()) + bell_reset(); + else if (!state && !m_bell_timer->enabled()) + { + // Speaker driven through 2N4401 from Q8 output of MC14040 clocked by ALE + attotime period = m_mcu->cycles_to_attotime(128); + m_bell_timer->adjust(period, 0, period); + } } WRITE_LINE_MEMBER(tv955kb_device::txd_w) @@ -69,6 +100,9 @@ WRITE_LINE_MEMBER(tv955kb_device::txd_w) WRITE_LINE_MEMBER(tv955kb_device::reset_w) { + m_mcu->set_input_line(INPUT_LINE_RESET, state ? CLEAR_LINE : ASSERT_LINE); + if (!state) + bell_reset(); m_reset_cb(state); } @@ -82,9 +116,11 @@ void tv955kb_device::device_add_mconfig(machine_config &config) m_mcu->t1_in_cb().set_ioport("FUNCT").bit(1); m_mcu->bus_in_cb().set(FUNC(tv955kb_device::keys_r)); - INPUT_MERGER_ALL_LOW(config, "resetctl").output_handler().set(FUNC(tv955kb_device::reset_w)); + input_merger_device &resetctl(INPUT_MERGER_ALL_LOW(config, "resetctl")); + resetctl.output_handler().set(FUNC(tv955kb_device::reset_w)).invert(); - // TODO: bell (MC14040 clocked by ALE) + SPEAKER(config, "mono").front_center(); + SPEAKER_SOUND(config, m_bell).add_route(ALL_OUTPUTS, "mono", 0.05); } static INPUT_PORTS_START(tv955kb) diff --git a/src/mame/machine/tv955kb.h b/src/mame/machine/tv955kb.h index d79f4df14ed..8b45986b622 100644 --- a/src/mame/machine/tv955kb.h +++ b/src/mame/machine/tv955kb.h @@ -7,9 +7,7 @@ #pragma once #include "cpu/mcs48/mcs48.h" -//#include "machine/ripple_counter.h" -//#include "sound/spkrdev.h" -//#include "speaker.h" +#include "sound/spkrdev.h" //************************************************************************** @@ -29,12 +27,11 @@ public: DECLARE_WRITE_LINE_MEMBER(write_rxd); - static constexpr feature_type unemulated_features() { return feature::SOUND; } - protected: // device-specific overrides virtual void device_resolve_objects() override; virtual void device_start() override; + virtual void device_reset() override; virtual void device_add_mconfig(machine_config &config) override; virtual ioport_constructor device_input_ports() const override; virtual const tiny_rom_entry *device_rom_region() const override; @@ -45,12 +42,19 @@ private: DECLARE_WRITE_LINE_MEMBER(txd_w); DECLARE_WRITE_LINE_MEMBER(reset_w); + TIMER_CALLBACK_MEMBER(bell_q8); + void bell_reset(); + // line output callbacks devcb_write_line m_txd_cb; devcb_write_line m_reset_cb; required_device m_mcu; + required_device m_bell; required_ioport_array<16> m_keys; + + emu_timer *m_bell_timer; + bool m_bell_on; }; // device type definition