From 97b67170277437131adf6ed4d60139c172529e4f Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 26 Mar 2019 11:13:37 +1100 Subject: (nw) Clean up the mess on master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release. --- src/devices/video/mm5445.cpp | 106 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 src/devices/video/mm5445.cpp (limited to 'src/devices/video/mm5445.cpp') diff --git a/src/devices/video/mm5445.cpp b/src/devices/video/mm5445.cpp new file mode 100644 index 00000000000..6b857ed19b3 --- /dev/null +++ b/src/devices/video/mm5445.cpp @@ -0,0 +1,106 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + + National Semiconductor MM5445 series VFD Driver + + TODO: + - brightness control input pin (sets output voltage level) + +*/ + +#include "emu.h" +#include "video/mm5445.h" + + +DEFINE_DEVICE_TYPE(MM5445, mm5445_device, "mm5445", "MM5445 VFD Driver") +DEFINE_DEVICE_TYPE(MM5446, mm5446_device, "mm5446", "MM5446 VFD Driver") +DEFINE_DEVICE_TYPE(MM5447, mm5447_device, "mm5447", "MM5447 VFD Driver") +DEFINE_DEVICE_TYPE(MM5448, mm5448_device, "mm5448", "MM5448 VFD Driver") + +//------------------------------------------------- +// constructor +//------------------------------------------------- + +mm5445_device::mm5445_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 outpins) : + device_t(mconfig, type, tag, owner, clock), + m_outmask((u64(1) << outpins) - 1), + m_write_output(*this) +{ } + +mm5445_device::mm5445_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + mm5445_device(mconfig, MM5445, tag, owner, clock, 33) +{ } + +mm5446_device::mm5446_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + mm5445_device(mconfig, MM5446, tag, owner, clock, 34) +{ } + +mm5447_device::mm5447_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + mm5445_device(mconfig, MM5447, tag, owner, clock, 34) +{ } + +mm5448_device::mm5448_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + mm5445_device(mconfig, MM5448, tag, owner, clock, 35) +{ } + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mm5445_device::device_start() +{ + // resolve callbacks + m_write_output.resolve_safe(); + + // zerofill + m_clk = 0; + m_enable = 0; + m_data = 0; + m_shiftreg = 0; + m_shiftcount = 0; + + // register for savestates + save_item(NAME(m_clk)); + save_item(NAME(m_enable)); + save_item(NAME(m_data)); + save_item(NAME(m_shiftreg)); + save_item(NAME(m_shiftcount)); +} + + +//------------------------------------------------- +// handlers +//------------------------------------------------- + +WRITE_LINE_MEMBER(mm5445_device::clock_w) +{ + state = (state) ? 1 : 0; + bool rise = state && !m_clk; + m_clk = state; + + // clock on rising edge + if (rise) + { + u64 data_in = u64(m_data & ~m_enable) << 34; + u64 lead_in = ~m_shiftreg & data_in; + m_shiftreg = (m_shiftreg & ((u64(1) << 34) - 1)) | data_in; + + // leading 1 triggers shift start + if (m_shiftcount == 0 && !lead_in) + return; + + // output on 35th clock + if (m_shiftcount == 35) + { + m_shiftcount = 0; + m_write_output(0, m_shiftreg & m_outmask, ~u64(0)); + } + else + { + m_shiftreg >>= 1; + m_shiftcount++; + } + } +} -- cgit v1.2.3-70-g09d2