From 45e6a9ec060531044ca63d1464ad2b23268c96d3 Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Thu, 20 Jul 2017 10:12:04 +0200 Subject: [PATCH 1/3] sda5708: Added layout with generated bezels + program snippet to redo it as a comment, to be able to generate with new offsets, scale and/or dotmatrix later --- src/mame/layout/sda5708.lay | 365 ++++++++++++++++++++++++++++++++++++ 1 file changed, 365 insertions(+) create mode 100644 src/mame/layout/sda5708.lay diff --git a/src/mame/layout/sda5708.lay b/src/mame/layout/sda5708.lay new file mode 100644 index 00000000000..8ed68750e5e --- /dev/null +++ b/src/mame/layout/sda5708.lay @@ -0,0 +1,365 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 233c8efa3c8498f9c71ac0d214faba47140369ff Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Thu, 20 Jul 2017 10:14:58 +0200 Subject: [PATCH 2/3] dbox: added sda5708 matrix diplay layout, it works and displays version number on start but dbox driver hangs shortly thereafter --- src/mame/drivers/dbox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/dbox.cpp b/src/mame/drivers/dbox.cpp index 20ce322ee43..c611b4fd984 100644 --- a/src/mame/drivers/dbox.cpp +++ b/src/mame/drivers/dbox.cpp @@ -340,6 +340,8 @@ #include "video/sda5708.h" #include "machine/latch8.h" // IP16 +#include "sda5708.lh" + //************************************************************************** // MACROS / CONSTANTS //************************************************************************** @@ -427,7 +429,7 @@ static MACHINE_CONFIG_START( dbox ) /* LED Matrix Display */ MCFG_SDA5708_ADD("display") - + MCFG_DEFAULT_LAYOUT(layout_sda5708) /* IP16 74256 8 bit latch */ MCFG_LATCH8_ADD("hct259.ip16") MCFG_LATCH8_WRITE_4(DEVWRITELINE("display", sda5708_device, reset_w)) From 883f12fa2fa6b65021b99e3e2895eb9de4145f20 Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Thu, 20 Jul 2017 10:18:02 +0200 Subject: [PATCH 3/3] sda5708: added layout support, state saving and a credits section --- src/devices/video/sda5708.cpp | 89 +++++++++++++++++++++++++++++++---- src/devices/video/sda5708.h | 5 ++ 2 files changed, 84 insertions(+), 10 deletions(-) diff --git a/src/devices/video/sda5708.cpp b/src/devices/video/sda5708.cpp index 842591331b8..99f097da593 100644 --- a/src/devices/video/sda5708.cpp +++ b/src/devices/video/sda5708.cpp @@ -4,8 +4,12 @@ Siemens SDA5708 8 character 7x5 dot matrix LED display -**********************************************************************/ +********************************************************************** + Main source of information about the SDA5708 came from San Bergmans: + http://www.sbprojects.com/knowledge/footprints/sda5708/index.php + +**********************************************************************/ #include "emu.h" #include "sda5708.h" @@ -17,9 +21,10 @@ #define LOG_SETUP (1U << 1) #define LOG_CMD (1U << 2) #define LOG_DATA (1U << 3) +#define LOG_CNTR (1U << 4) -//#define VERBOSE (LOG_DATA|LOG_SETUP|LOG_CMD|LOG_GENERAL) -//#define LOG_OUTPUT_FUNC printf +//#define VERBOSE (LOG_DATA|LOG_SETUP|LOG_CMD|LOG_CNTR|LOG_GENERAL) +#define LOG_OUTPUT_FUNC printf // must always be enabled as logerror is not available here #include "logmacro.h" @@ -27,6 +32,7 @@ #define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__) #define LOGCMD(...) LOGMASKED(LOG_CMD, __VA_ARGS__) #define LOGDATA(...) LOGMASKED(LOG_DATA, __VA_ARGS__) +#define LOGCNTR(...) LOGMASKED(LOG_CNTR, __VA_ARGS__) #ifdef _MSC_VER #define FUNCNAME __func__ @@ -56,6 +62,16 @@ DEFINE_DEVICE_TYPE(SDA5708, sda5708_device, "sda5708", "SDA570 sda5708_device::sda5708_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SDA5708, tag, owner, clock) + , m_serial(0) + , m_load(0) + , m_reset(0) + , m_data(0) + , m_sdclk(0) + , m_cdp(0) + , m_digit(0) + , m_bright(0) + , m_clear(0) + , m_ip(0) { } @@ -68,6 +84,16 @@ void sda5708_device::device_start() { LOG("%s\n", FUNCNAME); // register for state saving + save_item(NAME(m_serial)); + save_item(NAME(m_load)); + save_item(NAME(m_reset)); + save_item(NAME(m_data)); + save_item(NAME(m_sdclk)); + save_item(NAME(m_cdp)); + save_item(NAME(m_digit)); + save_item(NAME(m_bright)); + save_item(NAME(m_clear)); + save_item(NAME(m_ip)); } @@ -78,6 +104,12 @@ void sda5708_device::device_start() void sda5708_device::device_reset() { LOG("%s\n", FUNCNAME); + m_ip = 0; + m_clear = 0; + m_bright = 0; + m_digit = 0; + memset(m_dispmem, 0x00, sizeof(m_dispmem)); + update_display(); } //------------------------------------------------- @@ -90,6 +122,25 @@ void sda5708_device::device_reset() // on the same bus. //------------------------------------------------- +void sda5708_device::update_display() +{ + LOG("%s\n", FUNCNAME); + for (int d = 1; d <= 8; d++) + { + for (int y = 1; y <= 7; y++) + { + LOGDATA("- SDA5708 data: "); + for (int x = 1; x <= 5; x++) + { + machine().output().set_indexed_value("Dot_", d * 100 + y * 10 + x, (m_dispmem[(d - 1) * 7 + y] & (1 << (4 - (x - 1)))) == 0 ? 7 : m_bright ); + LOGDATA("%c", (m_dispmem[(d - 1) * 7 + (y - 1)] & (1 << (4 - (x - 1)))) == 0 ? '-' : 'x'); + } + LOGDATA("\n"); + } + LOGDATA("\n"); + } +} + WRITE_LINE_MEMBER( sda5708_device::load_w ) { LOG("%s - line %s\n", FUNCNAME, state == ASSERT_LINE ? "asserted" : "cleared"); @@ -98,11 +149,20 @@ WRITE_LINE_MEMBER( sda5708_device::load_w ) switch (m_serial & SDA5708_REG_MASK) { case SDA5708_CNTR_COMMAND: - LOGCMD("- Control command: %0x02\n", m_serial & 0x1f); + LOGCMD("- Control command: %02x\n", m_serial); + m_bright = m_serial & 0x07; + m_clear = m_serial & 0x20; + m_ip = m_serial & 0x80; + LOGCNTR("- SDA5708 control command - Clear:%d IP:%d Bright:%d\n", m_clear, m_ip, m_bright); break; case SDA5708_CLEAR_COMMAND: LOGCMD("- Display cleared\n"); memset(m_dispmem, 0x00, sizeof(m_dispmem)); + update_display(); + m_bright = m_serial & 0x07; + m_clear = m_serial & 0x20; + m_ip = m_serial & 0x80; + LOGCNTR("- SDA5708 clear command - Clear:%d IP:%d Bright:%d\n", m_clear, m_ip, m_bright); break; case SDA5708_ADDR_COMMAND: LOGCMD("- Address command: %02x\n", m_serial & 0x1f); @@ -112,12 +172,20 @@ WRITE_LINE_MEMBER( sda5708_device::load_w ) case SDA5708_DATA_COMMAND: LOGCMD("- Data command: %02x\n", m_serial & 0x1f); LOGDATA("- SDA5708 data: %c%c%c%c%c\n", - (m_serial & 0x10) ? 'x' : ' ', - (m_serial & 0x08) ? 'x' : ' ', - (m_serial & 0x04) ? 'x' : ' ', - (m_serial & 0x02) ? 'x' : ' ', - (m_serial & 0x01) ? 'x' : ' ' ); + (m_serial & 0x10) ? (m_clear == 0 ? 'o' : 'x') : ' ', + (m_serial & 0x08) ? (m_clear == 0 ? 'o' : 'x') : ' ', + (m_serial & 0x04) ? (m_clear == 0 ? 'o' : 'x') : ' ', + (m_serial & 0x02) ? (m_clear == 0 ? 'o' : 'x') : ' ', + (m_serial & 0x01) ? (m_clear == 0 ? 'o' : 'x') : ' ' ); m_dispmem[m_digit * 7 + m_cdp] = m_serial; + if (m_clear != 0) + { + machine().output().set_indexed_value("Dot_", (m_digit + 1) * 100 + (m_cdp + 1) * 10 + 1, (m_serial & 0x10) ? m_bright : 7 ); + machine().output().set_indexed_value("Dot_", (m_digit + 1) * 100 + (m_cdp + 1) * 10 + 2, (m_serial & 0x08) ? m_bright : 7 ); + machine().output().set_indexed_value("Dot_", (m_digit + 1) * 100 + (m_cdp + 1) * 10 + 3, (m_serial & 0x04) ? m_bright : 7 ); + machine().output().set_indexed_value("Dot_", (m_digit + 1) * 100 + (m_cdp + 1) * 10 + 4, (m_serial & 0x02) ? m_bright : 7 ); + machine().output().set_indexed_value("Dot_", (m_digit + 1) * 100 + (m_cdp + 1) * 10 + 5, (m_serial & 0x01) ? m_bright : 7 ); + } m_cdp = (m_cdp + 1) % 7; break; default: @@ -128,7 +196,6 @@ WRITE_LINE_MEMBER( sda5708_device::load_w ) m_load = state; } - //------------------------------------------------- // data_w - data line // @@ -177,4 +244,6 @@ WRITE_LINE_MEMBER( sda5708_device::reset_w ) { LOG("%s - line %s\n", FUNCNAME, state == ASSERT_LINE ? "asserted" : "cleared"); m_reset = state; + if (state == ASSERT_LINE) + device_reset(); } diff --git a/src/devices/video/sda5708.h b/src/devices/video/sda5708.h index 4d39c685f0c..30769c04bb4 100644 --- a/src/devices/video/sda5708.h +++ b/src/devices/video/sda5708.h @@ -71,6 +71,8 @@ protected: virtual void device_start() override; virtual void device_reset() override; + void update_display(); + private: enum { SDA5708_REG_MASK = 0xE0, @@ -111,6 +113,9 @@ private: uint8_t m_dispmem[7 * 8]; uint8_t m_cdp; uint8_t m_digit; + uint8_t m_bright; + uint8_t m_clear; + uint8_t m_ip; };