diff options
author | 2020-07-24 13:31:04 +0200 | |
---|---|---|
committer | 2020-07-24 13:31:36 +0200 | |
commit | b44810404e8548c64337a1e0bd86f47603120b4c (patch) | |
tree | 637abf31370b940d670d2fb8342d421c6d4a07e5 /src/devices/video/hlcd0438.cpp | |
parent | c9afe852360bacea3c4cba2d95ad28c658fa0783 (diff) |
added Hughes HLCD 0438 LCD Driver device
Diffstat (limited to 'src/devices/video/hlcd0438.cpp')
-rw-r--r-- | src/devices/video/hlcd0438.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/devices/video/hlcd0438.cpp b/src/devices/video/hlcd0438.cpp new file mode 100644 index 00000000000..e349654e592 --- /dev/null +++ b/src/devices/video/hlcd0438.cpp @@ -0,0 +1,76 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + +Hughes HLCD 0438 LCD Driver +32 segment outputs, may also be used as a column driver + +TODO: +- OSC (LCD phi pin) + +*/ + +#include "emu.h" +#include "video/hlcd0438.h" + + +DEFINE_DEVICE_TYPE(HLCD0438, hlcd0438_device, "hlcd0438", "Hughes HLCD 0438 LCD Driver") + +//------------------------------------------------- +// constructor +//------------------------------------------------- + +hlcd0438_device::hlcd0438_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + device_t(mconfig, HLCD0438, tag, owner, clock), + m_write_segs(*this), m_write_data(*this) +{ } + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void hlcd0438_device::device_start() +{ + m_write_segs.resolve_safe(); + m_write_data.resolve_safe(); + + // register for savestates + save_item(NAME(m_data_in)); + save_item(NAME(m_data_out)); + save_item(NAME(m_clk)); + save_item(NAME(m_load)); + save_item(NAME(m_shift)); +} + + +//------------------------------------------------- +// handlers +//------------------------------------------------- + +void hlcd0438_device::update_output() +{ + // load output latches while LOAD pin is high + if (m_load) + m_write_segs(0, m_shift); +} + +void hlcd0438_device::clock_w(int state) +{ + state = state ? 1 : 0; + + // shift on falling edge + if (m_clk && !state) + { + // DATA OUT pin follows carry out + m_data_out = BIT(m_shift, 31); + + m_shift = m_shift << 1 | m_data_in; + + // output + m_write_data(m_data_out); + update_output(); + } + + m_clk = state; +} |