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 | |
parent | c9afe852360bacea3c4cba2d95ad28c658fa0783 (diff) |
added Hughes HLCD 0438 LCD Driver device
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/machine/tms1024.h | 2 | ||||
-rw-r--r-- | src/devices/video/hlcd0438.cpp | 76 | ||||
-rw-r--r-- | src/devices/video/hlcd0438.h | 79 | ||||
-rw-r--r-- | src/devices/video/hlcd0488.cpp | 2 | ||||
-rw-r--r-- | src/devices/video/hlcd0488.h | 2 | ||||
-rw-r--r-- | src/devices/video/md4330b.cpp | 4 | ||||
-rw-r--r-- | src/devices/video/md4330b.h | 4 |
7 files changed, 162 insertions, 7 deletions
diff --git a/src/devices/machine/tms1024.h b/src/devices/machine/tms1024.h index 1920c5efb42..49193191bfa 100644 --- a/src/devices/machine/tms1024.h +++ b/src/devices/machine/tms1024.h @@ -68,7 +68,7 @@ public: auto write_port5_callback() { return m_write_port[4].bind(); } auto write_port6_callback() { return m_write_port[5].bind(); } auto write_port7_callback() { return m_write_port[6].bind(); } - tms1024_device &set_ms(u8 i) { m_ms = i & 1; return *this; } // if hardwired, can just set MS pin state here + tms1024_device &set_ms(int state) { m_ms = state ? 1 : 0; return *this; } // if hardwired, can just set MS pin state here void write_h(u8 data); u8 read_h(); 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; +} diff --git a/src/devices/video/hlcd0438.h b/src/devices/video/hlcd0438.h new file mode 100644 index 00000000000..a8a1b68d465 --- /dev/null +++ b/src/devices/video/hlcd0438.h @@ -0,0 +1,79 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + + Hughes HLCD 0438 LCD Driver + +*/ + +#ifndef MAME_VIDEO_HLCD0438_H +#define MAME_VIDEO_HLCD0438_H + +#pragma once + +// pinout reference + +/* + ____ ____ + VDD 1 |* \_/ | 40 CLOCK + LOAD 2 | | 39 SEG 1 + SEG 32 3 | | 38 SEG 2 + SEG 31 4 | | 37 SEG 3 + SEG 30 5 | | 36 GND + SEG 29 6 | | 35 DATA OUT + SEG 28 7 | | 34 DATA IN + SEG 27 8 | | 33 SEG 4 + SEG 26 9 | | 32 SEG 5 + SEG 25 10 | HLCD 0438 | 31 LCD phi + SEG 24 11 | | 30 BP + SEG 23 12 | | 29 SEG 6 + SEG 22 13 | | 28 SEG 7 + SEG 21 14 | | 27 SEG 8 + SEG 20 15 | | 26 SEG 9 + SEG 19 16 | | 25 SEG 10 + SEG 18 17 | | 24 SEG 11 + SEG 17 18 | | 23 SEG 12 + SEG 16 19 | | 22 SEG 13 + SEG 15 20 |___________| 21 SEG 14 + +*/ + + +class hlcd0438_device : public device_t +{ +public: + hlcd0438_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + // configuration helpers + auto write_segs() { return m_write_segs.bind(); } // SEG pins + auto write_data() { return m_write_data.bind(); } // DATA OUT pin + hlcd0438_device &set_load(int state) { m_load = state ? 1 : 0; return *this; } // if hardwired, can just set LOAD pin state here + + void data_w(int state) { m_data_in = state ? 1 : 0; } + int data_r() { return m_data_out; } + void load_w(int state) { m_load = state ? 1 : 0; update_output(); } + void clock_w(int state); + +protected: + // device-level overrides + virtual void device_start() override; + +private: + // pin state + int m_data_in = 0; + int m_data_out = 0; + int m_clk = 0; + int m_load = 0; + + u32 m_shift = 0; + + void update_output(); + + devcb_write32 m_write_segs; + devcb_write_line m_write_data; +}; + + +DECLARE_DEVICE_TYPE(HLCD0438, hlcd0438_device) + +#endif // MAME_VIDEO_HLCD0438_H diff --git a/src/devices/video/hlcd0488.cpp b/src/devices/video/hlcd0488.cpp index d48bde277fe..beed0221a3f 100644 --- a/src/devices/video/hlcd0488.cpp +++ b/src/devices/video/hlcd0488.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Wilbert Pol +// copyright-holders:Wilbert Pol, hap /* Hughes HLCD 0488 LCD Driver diff --git a/src/devices/video/hlcd0488.h b/src/devices/video/hlcd0488.h index 0ab76640580..ed71ed09bc5 100644 --- a/src/devices/video/hlcd0488.h +++ b/src/devices/video/hlcd0488.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Wilbert Pol +// copyright-holders:Wilbert Pol, hap /* Hughes HLCD 0488 LCD Driver diff --git a/src/devices/video/md4330b.cpp b/src/devices/video/md4330b.cpp index 6889cc2e3b6..f8f9ca2323a 100644 --- a/src/devices/video/md4330b.cpp +++ b/src/devices/video/md4330b.cpp @@ -70,7 +70,7 @@ void md4330b_device::device_start() // handlers //------------------------------------------------- -void md4330b_device::update_q() +void md4330b_device::update_output() { u32 out = m_shift; if (m_tc) @@ -96,8 +96,8 @@ WRITE_LINE_MEMBER(md4330b_device::clk_w) m_shift = (m_shift << 1) | m_di; // output - update_q(); m_write_do(m_do); + update_output(); } m_clk = state; diff --git a/src/devices/video/md4330b.h b/src/devices/video/md4330b.h index d372f2b88de..906c032424a 100644 --- a/src/devices/video/md4330b.h +++ b/src/devices/video/md4330b.h @@ -49,7 +49,7 @@ public: auto write_do() { return m_write_do.bind(); } DECLARE_WRITE_LINE_MEMBER(clk_w); - DECLARE_WRITE_LINE_MEMBER(tc_w) { m_tc = (state) ? 1 : 0; update_q(); } + DECLARE_WRITE_LINE_MEMBER(tc_w) { m_tc = (state) ? 1 : 0; update_output(); } DECLARE_WRITE_LINE_MEMBER(di_w) { m_di = (state) ? 1 : 0; } DECLARE_WRITE_LINE_MEMBER(rst_w) { m_rst = (state) ? 1 : 0; } DECLARE_READ_LINE_MEMBER(do_r) { return m_do; } @@ -60,7 +60,7 @@ protected: // device-level overrides virtual void device_start() override; - void update_q(); + void update_output(); const u8 m_qmax; // number of Q pins u32 m_shift; |