diff options
author | 2019-03-07 21:06:13 +0100 | |
---|---|---|
committer | 2019-03-07 21:06:38 +0100 | |
commit | f86ffd0802af2d0d165e4c626b81c8cc3d7f24f7 (patch) | |
tree | e19774c17335a261d0cbe429cc27766b6a4daa7c /src/devices | |
parent | b090ac4af1f24c9bf5eb1ce33ce36a4b81e29b57 (diff) |
added mm5445_device (nw)
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/video/hlcd0515.cpp | 44 | ||||
-rw-r--r-- | src/devices/video/hlcd0515.h | 8 | ||||
-rw-r--r-- | src/devices/video/hlcd0538.cpp | 29 | ||||
-rw-r--r-- | src/devices/video/hlcd0538.h | 12 | ||||
-rw-r--r-- | src/devices/video/mm5445.cpp | 106 | ||||
-rw-r--r-- | src/devices/video/mm5445.h | 101 |
6 files changed, 249 insertions, 51 deletions
diff --git a/src/devices/video/hlcd0515.cpp b/src/devices/video/hlcd0515.cpp index b7730332bfd..87abf50bc0e 100644 --- a/src/devices/video/hlcd0515.cpp +++ b/src/devices/video/hlcd0515.cpp @@ -26,27 +26,23 @@ DEFINE_DEVICE_TYPE(HLCD0530, hlcd0530_device, "hlcd0530", "Hughes HLCD 0530 LCD // constructor //------------------------------------------------- -hlcd0515_device::hlcd0515_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 colmax) - : device_t(mconfig, type, tag, owner, clock) - , m_colmax(colmax) - , m_write_cols(*this), m_write_data(*this) -{ -} +hlcd0515_device::hlcd0515_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 colmax) : + device_t(mconfig, type, tag, owner, clock), + m_colmax(colmax), + m_write_cols(*this), m_write_data(*this) +{ } -hlcd0515_device::hlcd0515_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : hlcd0515_device(mconfig, HLCD0515, tag, owner, clock, 25) -{ -} +hlcd0515_device::hlcd0515_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + hlcd0515_device(mconfig, HLCD0515, tag, owner, clock, 25) +{ } -hlcd0569_device::hlcd0569_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : hlcd0515_device(mconfig, HLCD0569, tag, owner, clock, 24) -{ -} +hlcd0569_device::hlcd0569_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + hlcd0515_device(mconfig, HLCD0569, tag, owner, clock, 24) +{ } -hlcd0530_device::hlcd0530_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : hlcd0515_device(mconfig, HLCD0530, tag, owner, clock, 24) -{ -} +hlcd0530_device::hlcd0530_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + hlcd0515_device(mconfig, HLCD0530, tag, owner, clock, 24) +{ } @@ -66,7 +62,7 @@ void hlcd0515_device::device_start() // zerofill m_cs = 0; - m_pclock = 0; + m_clk = 0; m_data = 0; m_count = 0; m_control = 0; @@ -79,7 +75,7 @@ void hlcd0515_device::device_start() // register for savestates save_item(NAME(m_cs)); - save_item(NAME(m_pclock)); + save_item(NAME(m_clk)); save_item(NAME(m_data)); save_item(NAME(m_count)); save_item(NAME(m_control)); @@ -157,12 +153,12 @@ void hlcd0515_device::clock_data(int col) } -WRITE_LINE_MEMBER(hlcd0515_device::write_clock) +WRITE_LINE_MEMBER(hlcd0515_device::clock_w) { state = (state) ? 1 : 0; // clock/shift data on falling edge - if (!m_cs && !state && m_pclock) + if (!m_cs && !state && m_clk) { if (m_count < 5) { @@ -179,11 +175,11 @@ WRITE_LINE_MEMBER(hlcd0515_device::write_clock) m_count++; } - m_pclock = state; + m_clk = state; } -WRITE_LINE_MEMBER(hlcd0515_device::write_cs) +WRITE_LINE_MEMBER(hlcd0515_device::cs_w) { state = (state) ? 1 : 0; diff --git a/src/devices/video/hlcd0515.h b/src/devices/video/hlcd0515.h index 5018978226d..1108890a1fb 100644 --- a/src/devices/video/hlcd0515.h +++ b/src/devices/video/hlcd0515.h @@ -50,9 +50,9 @@ public: auto write_cols() { return m_write_cols.bind(); } // COL/ROW pins (offset for ROW) auto write_data() { return m_write_data.bind(); } // DATA OUT pin, don't use on HLCD0569 - DECLARE_WRITE_LINE_MEMBER(write_clock); - DECLARE_WRITE_LINE_MEMBER(write_cs); - DECLARE_WRITE_LINE_MEMBER(write_data) { m_data = (state) ? 1 : 0; } + DECLARE_WRITE_LINE_MEMBER(clock_w); + DECLARE_WRITE_LINE_MEMBER(cs_w); + DECLARE_WRITE_LINE_MEMBER(data_w) { m_data = (state) ? 1 : 0; } protected: hlcd0515_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 colmax); @@ -67,7 +67,7 @@ protected: const u8 m_colmax; // number of column pins int m_cs; // input pin state - int m_pclock; // " + int m_clk; // " int m_data; // " int m_count; u8 m_control; diff --git a/src/devices/video/hlcd0538.cpp b/src/devices/video/hlcd0538.cpp index c409e6be528..12a188d07a0 100644 --- a/src/devices/video/hlcd0538.cpp +++ b/src/devices/video/hlcd0538.cpp @@ -23,22 +23,18 @@ DEFINE_DEVICE_TYPE(HLCD0539, hlcd0539_device, "hlcd0539", "Hughes HLCD 0539 LCD // constructor //------------------------------------------------- -hlcd0538_device::hlcd0538_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) - : device_t(mconfig, type, tag, owner, clock) - , m_write_cols(*this), m_write_interrupt(*this) -{ -} - -hlcd0538_device::hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : hlcd0538_device(mconfig, HLCD0538, tag, owner, clock) -{ -} +hlcd0538_device::hlcd0538_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : + device_t(mconfig, type, tag, owner, clock), + m_write_cols(*this), m_write_interrupt(*this) +{ } -hlcd0539_device::hlcd0539_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : hlcd0538_device(mconfig, HLCD0539, tag, owner, clock) -{ -} +hlcd0538_device::hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + hlcd0538_device(mconfig, HLCD0538, tag, owner, clock) +{ } +hlcd0539_device::hlcd0539_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + hlcd0538_device(mconfig, HLCD0539, tag, owner, clock) +{ } //------------------------------------------------- @@ -65,12 +61,11 @@ void hlcd0538_device::device_start() } - //------------------------------------------------- // handlers //------------------------------------------------- -WRITE_LINE_MEMBER(hlcd0538_device::write_clk) +WRITE_LINE_MEMBER(hlcd0538_device::clk_w) { state = (state) ? 1 : 0; @@ -81,7 +76,7 @@ WRITE_LINE_MEMBER(hlcd0538_device::write_clk) m_clk = state; } -WRITE_LINE_MEMBER(hlcd0538_device::write_lcd) +WRITE_LINE_MEMBER(hlcd0538_device::lcd_w) { state = (state) ? 1 : 0; diff --git a/src/devices/video/hlcd0538.h b/src/devices/video/hlcd0538.h index 187523e1076..bc1a78d16fc 100644 --- a/src/devices/video/hlcd0538.h +++ b/src/devices/video/hlcd0538.h @@ -43,15 +43,15 @@ class hlcd0538_device : public device_t { public: - hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); // configuration helpers - auto write_cols_callback() { return m_write_cols.bind(); } // C/R pins (0538: d0-d7 for rows) - auto write_interrupt_callback() { return m_write_interrupt.bind(); } // INTERRUPT pin + auto write_cols() { return m_write_cols.bind(); } // C/R pins (0538: d0-d7 for rows) + auto write_interrupt() { return m_write_interrupt.bind(); } // INTERRUPT pin - DECLARE_WRITE_LINE_MEMBER(write_clk); - DECLARE_WRITE_LINE_MEMBER(write_lcd); - DECLARE_WRITE_LINE_MEMBER(write_data) { m_data = (state) ? 1 : 0; } + DECLARE_WRITE_LINE_MEMBER(clk_w); + DECLARE_WRITE_LINE_MEMBER(lcd_w); + DECLARE_WRITE_LINE_MEMBER(data_w) { m_data = (state) ? 1 : 0; } protected: hlcd0538_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); 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++; + } + } +} diff --git a/src/devices/video/mm5445.h b/src/devices/video/mm5445.h new file mode 100644 index 00000000000..2ee2b8ed8cb --- /dev/null +++ b/src/devices/video/mm5445.h @@ -0,0 +1,101 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + + National Semiconductor MM5445 series VFD Driver + +*/ + +#ifndef MAME_VIDEO_MM5445_H +#define MAME_VIDEO_MM5445_H + +#pragma once + +// pinout reference + +/* + ____ ____ + VDD 1 |* \_/ | 40 O18 + O17 2 | | 39 O19 + O16 3 | | 38 O20 + O15 4 | | 37 O21 + O14 5 | | 36 O22 + O13 6 | | 35 O23 + O12 7 | | 34 O24 + O11 8 | | 33 O25 + O10 9 | | 32 O26 + O9 10 | MM5445N | 31 O27 + O8 11 | | 30 O28 + O7 12 | | 29 O29 + O6 13 | | 28 O30 + O5 14 | | 27 O31 + O4 15 | | 26 O32 + O3 16 | | 25 O33 + O2 17 | | 24 BRIGHTNESS CONTROL + O1 18 | | 23 _DATA ENABLE + VGG 19 | | 22 DATA IN + VSS 20 |___________| 21 CLOCK IN + + O# = OUTPUT BIT # + MM5446, MM5448 don't have the brightness control pin, an extra output pin instead + MM5447, MM5448 don't have the data enable pin(always enabled), but another extra output pin +*/ + + +class mm5445_device : public device_t +{ +public: + mm5445_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); + + // configuration helpers + auto output_cb() { return m_write_output.bind(); } + + DECLARE_WRITE_LINE_MEMBER(clock_w); + DECLARE_WRITE_LINE_MEMBER(enable_w) { m_enable = (state) ? 1 : 0; } // active low, unused on MM5447 and MM5448 + DECLARE_WRITE_LINE_MEMBER(data_w) { m_data = (state) ? 1 : 0; } + +protected: + mm5445_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 outpins); + + // device-level overrides + virtual void device_start() override; + + const u64 m_outmask; + + int m_clk; // input pin state + int m_enable; // " + int m_data; // " + + u64 m_shiftreg; + int m_shiftcount; + + // callbacks + devcb_write64 m_write_output; +}; + + +class mm5446_device : public mm5445_device +{ +public: + mm5446_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class mm5447_device : public mm5445_device +{ +public: + mm5447_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class mm5448_device : public mm5445_device +{ +public: + mm5448_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + + +DECLARE_DEVICE_TYPE(MM5445, mm5445_device) +DECLARE_DEVICE_TYPE(MM5446, mm5446_device) +DECLARE_DEVICE_TYPE(MM5447, mm5447_device) +DECLARE_DEVICE_TYPE(MM5448, mm5448_device) + +#endif // MAME_VIDEO_MM5445_H |