summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video/hlcd0438.cpp
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2020-07-29 20:16:59 +0200
committer hap <happppp@users.noreply.github.com>2020-07-29 20:17:25 +0200
commit23b6a0c6cce63c8bfc4377cbf793f395243732dc (patch)
treeea23be7a2cafaf3294d5e2973261f6a9e66bde7d /src/devices/video/hlcd0438.cpp
parentfac0622f072a844405517bdbd5fdcc37b19ab5f5 (diff)
ssystem3: added chess unit lcd svg screen [hap, Berger, Achim]
Diffstat (limited to 'src/devices/video/hlcd0438.cpp')
-rw-r--r--src/devices/video/hlcd0438.cpp41
1 files changed, 30 insertions, 11 deletions
diff --git a/src/devices/video/hlcd0438.cpp b/src/devices/video/hlcd0438.cpp
index e349654e592..42317ddb087 100644
--- a/src/devices/video/hlcd0438.cpp
+++ b/src/devices/video/hlcd0438.cpp
@@ -5,8 +5,7 @@
Hughes HLCD 0438 LCD Driver
32 segment outputs, may also be used as a column driver
-TODO:
-- OSC (LCD phi pin)
+LCD pin can be driven manually, or oscillating.
*/
@@ -32,15 +31,23 @@ hlcd0438_device::hlcd0438_device(const machine_config &mconfig, const char *tag,
void hlcd0438_device::device_start()
{
+ // resolve callbacks
m_write_segs.resolve_safe();
m_write_data.resolve_safe();
+ // timer (when LCD pin is oscillator)
+ m_lcd_timer = timer_alloc();
+ attotime period = (clock() != 0) ? attotime::from_hz(2 * clock()) : attotime::never;
+ m_lcd_timer->adjust(period, 0, period);
+
// 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_lcd));
save_item(NAME(m_shift));
+ save_item(NAME(m_latch));
}
@@ -48,13 +55,6 @@ void hlcd0438_device::device_start()
// 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;
@@ -67,10 +67,29 @@ void hlcd0438_device::clock_w(int state)
m_shift = m_shift << 1 | m_data_in;
- // output
m_write_data(m_data_out);
- update_output();
+ load_w(m_load);
}
m_clk = state;
}
+
+void hlcd0438_device::load_w(int state)
+{
+ m_load = state ? 1 : 0;
+
+ // load to output latches while LOAD pin is high
+ if (m_load)
+ m_latch = m_shift;
+}
+
+void hlcd0438_device::lcd_w(int state)
+{
+ state = state ? 1 : 0;
+
+ // LCD pin drives backplate
+ if (state != m_lcd)
+ m_write_segs(m_lcd, m_latch);
+
+ m_lcd = state;
+}