tv955kb: Add bell and reset output

This commit is contained in:
AJR 2019-01-16 01:08:18 -05:00
parent bede44aafd
commit bc0bbf08b0
3 changed files with 56 additions and 10 deletions

View File

@ -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 )

View File

@ -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)

View File

@ -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<mcs48_cpu_device> m_mcu;
required_device<speaker_sound_device> m_bell;
required_ioport_array<16> m_keys;
emu_timer *m_bell_timer;
bool m_bell_on;
};
// device type definition