summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2017-07-29 21:58:06 +0200
committer hap <happppp@users.noreply.github.com>2017-07-29 21:58:31 +0200
commitc8c3f073f9f02ad2d99f6b46d9b3c784327a5be2 (patch)
treea28e386bf9dae2c1c7922b9ef93fb7c3dd56fee0
parent70115f6f2541919b596e75f191a499cf12bbb8cf (diff)
hh*: added output finder (nw)
-rw-r--r--src/mame/drivers/hh_cop400.cpp60
-rw-r--r--src/mame/drivers/hh_hmcs40.cpp60
-rw-r--r--src/mame/drivers/hh_melps4.cpp60
-rw-r--r--src/mame/drivers/hh_pic16.cpp60
-rw-r--r--src/mame/drivers/hh_tms1k.cpp53
-rw-r--r--src/mame/drivers/hh_ucom4.cpp53
-rw-r--r--src/mame/drivers/k28.cpp60
-rw-r--r--src/mame/includes/hh_tms1k.h7
-rw-r--r--src/mame/includes/hh_ucom4.h7
9 files changed, 154 insertions, 266 deletions
diff --git a/src/mame/drivers/hh_cop400.cpp b/src/mame/drivers/hh_cop400.cpp
index b6eef107568..9b156b5593a 100644
--- a/src/mame/drivers/hh_cop400.cpp
+++ b/src/mame/drivers/hh_cop400.cpp
@@ -43,6 +43,9 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_inp_matrix(*this, "IN.%u", 0),
+ m_out_x(*this, "%u.%u", 0U, 0U),
+ m_out_a(*this, "%u.a", 0U),
+ m_out_digit(*this, "digit%u", 0U),
m_speaker(*this, "speaker"),
m_display_wait(33),
m_display_maxy(1),
@@ -52,6 +55,9 @@ public:
// devices
required_device<cpu_device> m_maincpu;
optional_ioport_array<6> m_inp_matrix; // max 6
+ output_finder<0x20, 0x20> m_out_x;
+ output_finder<0x20> m_out_a;
+ output_finder<0x20> m_out_digit;
optional_device<speaker_sound_device> m_speaker;
// misc common
@@ -71,7 +77,6 @@ public:
u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on)
u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments
- u32 m_display_cache[0x20]; // (internal use)
u8 m_display_decay[0x20][0x20]; // (internal use)
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
@@ -90,9 +95,13 @@ protected:
void hh_cop400_state::machine_start()
{
+ // resolve handlers
+ m_out_x.resolve();
+ m_out_a.resolve();
+ m_out_digit.resolve();
+
// zerofill
memset(m_display_state, 0, sizeof(m_display_state));
- memset(m_display_cache, ~0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
memset(m_display_segmask, 0, sizeof(m_display_segmask));
@@ -109,7 +118,6 @@ void hh_cop400_state::machine_start()
save_item(NAME(m_display_wait));
save_item(NAME(m_display_state));
- /* save_item(NAME(m_display_cache)); */ // don't save!
save_item(NAME(m_display_decay));
save_item(NAME(m_display_segmask));
@@ -138,11 +146,9 @@ void hh_cop400_state::machine_reset()
void hh_cop400_state::display_update()
{
- u32 active_state[0x20];
-
for (int y = 0; y < m_display_maxy; y++)
{
- active_state[y] = 0;
+ u32 active_state = 0;
for (int x = 0; x <= m_display_maxx; x++)
{
@@ -152,41 +158,19 @@ void hh_cop400_state::display_update()
// determine active state
u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0;
- active_state[y] |= (ds << x);
- }
- }
+ active_state |= (ds << x);
- // on difference, send to output
- for (int y = 0; y < m_display_maxy; y++)
- if (m_display_cache[y] != active_state[y])
- {
- if (m_display_segmask[y] != 0)
- output().set_digit_value(y, active_state[y] & m_display_segmask[y]);
-
- const int mul = (m_display_maxx <= 10) ? 10 : 100;
- for (int x = 0; x <= m_display_maxx; x++)
- {
- int state = active_state[y] >> x & 1;
- char buf1[0x10]; // lampyx
- char buf2[0x10]; // y.x
-
- if (x == m_display_maxx)
- {
- // always-on if selected
- sprintf(buf1, "lamp%da", y);
- sprintf(buf2, "%d.a", y);
- }
- else
- {
- sprintf(buf1, "lamp%d", y * mul + x);
- sprintf(buf2, "%d.%d", y, x);
- }
- output().set_value(buf1, state);
- output().set_value(buf2, state);
- }
+ // output to y.x, or y.a when always-on
+ if (x != m_display_maxx)
+ m_out_x[y][x] = ds;
+ else
+ m_out_a[y] = ds;
}
- memcpy(m_display_cache, active_state, sizeof(m_display_cache));
+ // output to digity
+ if (m_display_segmask[y] != 0)
+ m_out_digit[y] = active_state & m_display_segmask[y];
+ }
}
TIMER_DEVICE_CALLBACK_MEMBER(hh_cop400_state::display_decay_tick)
diff --git a/src/mame/drivers/hh_hmcs40.cpp b/src/mame/drivers/hh_hmcs40.cpp
index 9e50d198312..4376441337c 100644
--- a/src/mame/drivers/hh_hmcs40.cpp
+++ b/src/mame/drivers/hh_hmcs40.cpp
@@ -115,6 +115,9 @@ public:
m_soundlatch(*this, "soundlatch"),
m_soundlatch2(*this, "soundlatch2"),
m_inp_matrix(*this, "IN.%u", 0),
+ m_out_x(*this, "%u.%u", 0U, 0U),
+ m_out_a(*this, "%u.a", 0U),
+ m_out_digit(*this, "digit%u", 0U),
m_speaker(*this, "speaker"),
m_display_wait(33),
m_display_maxy(1),
@@ -127,6 +130,9 @@ public:
optional_device<generic_latch_8_device> m_soundlatch;
optional_device<generic_latch_8_device> m_soundlatch2;
optional_ioport_array<7> m_inp_matrix; // max 7
+ output_finder<0x20, 0x40> m_out_x;
+ output_finder<0x20> m_out_a;
+ output_finder<0x20> m_out_digit;
optional_device<speaker_sound_device> m_speaker;
// misc common
@@ -150,7 +156,6 @@ public:
u64 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on)
u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments
- u64 m_display_cache[0x20]; // (internal use)
u8 m_display_decay[0x20][0x40]; // (internal use)
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
@@ -169,9 +174,13 @@ protected:
void hh_hmcs40_state::machine_start()
{
+ // resolve handlers
+ m_out_x.resolve();
+ m_out_a.resolve();
+ m_out_digit.resolve();
+
// zerofill
memset(m_display_state, 0, sizeof(m_display_state));
- memset(m_display_cache, ~0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
memset(m_display_segmask, 0, sizeof(m_display_segmask));
@@ -188,7 +197,6 @@ void hh_hmcs40_state::machine_start()
save_item(NAME(m_display_wait));
save_item(NAME(m_display_state));
- /* save_item(NAME(m_display_cache)); */ // don't save!
save_item(NAME(m_display_decay));
save_item(NAME(m_display_segmask));
@@ -218,11 +226,9 @@ void hh_hmcs40_state::machine_reset()
void hh_hmcs40_state::display_update()
{
- u64 active_state[0x20];
-
for (int y = 0; y < m_display_maxy; y++)
{
- active_state[y] = 0;
+ u64 active_state = 0;
for (int x = 0; x <= m_display_maxx; x++)
{
@@ -232,41 +238,19 @@ void hh_hmcs40_state::display_update()
// determine active state
u64 ds = (m_display_decay[y][x] != 0) ? 1 : 0;
- active_state[y] |= (ds << x);
- }
- }
+ active_state |= (ds << x);
- // on difference, send to output
- for (int y = 0; y < m_display_maxy; y++)
- if (m_display_cache[y] != active_state[y])
- {
- if (m_display_segmask[y] != 0)
- output().set_digit_value(y, active_state[y] & m_display_segmask[y]);
-
- const int mul = (m_display_maxx <= 10) ? 10 : 100;
- for (int x = 0; x <= m_display_maxx; x++)
- {
- int state = active_state[y] >> x & 1;
- char buf1[0x10]; // lampyx
- char buf2[0x10]; // y.x
-
- if (x == m_display_maxx)
- {
- // always-on if selected
- sprintf(buf1, "lamp%da", y);
- sprintf(buf2, "%d.a", y);
- }
- else
- {
- sprintf(buf1, "lamp%d", y * mul + x);
- sprintf(buf2, "%d.%d", y, x);
- }
- output().set_value(buf1, state);
- output().set_value(buf2, state);
- }
+ // output to y.x, or y.a when always-on
+ if (x != m_display_maxx)
+ m_out_x[y][x] = ds;
+ else
+ m_out_a[y] = ds;
}
- memcpy(m_display_cache, active_state, sizeof(m_display_cache));
+ // output to digity
+ if (m_display_segmask[y] != 0)
+ m_out_digit[y] = active_state & m_display_segmask[y];
+ }
}
TIMER_DEVICE_CALLBACK_MEMBER(hh_hmcs40_state::display_decay_tick)
diff --git a/src/mame/drivers/hh_melps4.cpp b/src/mame/drivers/hh_melps4.cpp
index 57f6437ed6f..389c95a92b9 100644
--- a/src/mame/drivers/hh_melps4.cpp
+++ b/src/mame/drivers/hh_melps4.cpp
@@ -26,6 +26,9 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_inp_matrix(*this, "IN.%u", 0),
+ m_out_x(*this, "%u.%u", 0U, 0U),
+ m_out_a(*this, "%u.a", 0U),
+ m_out_digit(*this, "digit%u", 0U),
m_speaker(*this, "speaker"),
m_display_wait(33),
m_display_maxy(1),
@@ -35,6 +38,9 @@ public:
// devices
required_device<cpu_device> m_maincpu;
optional_ioport_array<4> m_inp_matrix; // max 4
+ output_finder<0x20, 0x20> m_out_x;
+ output_finder<0x20> m_out_a;
+ output_finder<0x20> m_out_digit;
optional_device<speaker_sound_device> m_speaker;
// misc common
@@ -53,7 +59,6 @@ public:
u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on)
u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments
- u32 m_display_cache[0x20]; // (internal use)
u8 m_display_decay[0x20][0x20]; // (internal use)
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
@@ -71,9 +76,13 @@ protected:
void hh_melps4_state::machine_start()
{
+ // resolve handlers
+ m_out_x.resolve();
+ m_out_a.resolve();
+ m_out_digit.resolve();
+
// zerofill
memset(m_display_state, 0, sizeof(m_display_state));
- memset(m_display_cache, ~0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
memset(m_display_segmask, 0, sizeof(m_display_segmask));
@@ -87,7 +96,6 @@ void hh_melps4_state::machine_start()
save_item(NAME(m_display_wait));
save_item(NAME(m_display_state));
- /* save_item(NAME(m_display_cache)); */ // don't save!
save_item(NAME(m_display_decay));
save_item(NAME(m_display_segmask));
@@ -113,11 +121,9 @@ void hh_melps4_state::machine_reset()
void hh_melps4_state::display_update()
{
- u32 active_state[0x20];
-
for (int y = 0; y < m_display_maxy; y++)
{
- active_state[y] = 0;
+ u32 active_state = 0;
for (int x = 0; x <= m_display_maxx; x++)
{
@@ -127,41 +133,19 @@ void hh_melps4_state::display_update()
// determine active state
u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0;
- active_state[y] |= (ds << x);
- }
- }
+ active_state |= (ds << x);
- // on difference, send to output
- for (int y = 0; y < m_display_maxy; y++)
- if (m_display_cache[y] != active_state[y])
- {
- if (m_display_segmask[y] != 0)
- output().set_digit_value(y, active_state[y] & m_display_segmask[y]);
-
- const int mul = (m_display_maxx <= 10) ? 10 : 100;
- for (int x = 0; x <= m_display_maxx; x++)
- {
- int state = active_state[y] >> x & 1;
- char buf1[0x10]; // lampyx
- char buf2[0x10]; // y.x
-
- if (x == m_display_maxx)
- {
- // always-on if selected
- sprintf(buf1, "lamp%da", y);
- sprintf(buf2, "%d.a", y);
- }
- else
- {
- sprintf(buf1, "lamp%d", y * mul + x);
- sprintf(buf2, "%d.%d", y, x);
- }
- output().set_value(buf1, state);
- output().set_value(buf2, state);
- }
+ // output to y.x, or y.a when always-on
+ if (x != m_display_maxx)
+ m_out_x[y][x] = ds;
+ else
+ m_out_a[y] = ds;
}
- memcpy(m_display_cache, active_state, sizeof(m_display_cache));
+ // output to digity
+ if (m_display_segmask[y] != 0)
+ m_out_digit[y] = active_state & m_display_segmask[y];
+ }
}
TIMER_DEVICE_CALLBACK_MEMBER(hh_melps4_state::display_decay_tick)
diff --git a/src/mame/drivers/hh_pic16.cpp b/src/mame/drivers/hh_pic16.cpp
index 2f087a0a402..5d1b3197638 100644
--- a/src/mame/drivers/hh_pic16.cpp
+++ b/src/mame/drivers/hh_pic16.cpp
@@ -70,6 +70,9 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_inp_matrix(*this, "IN.%u", 0),
+ m_out_x(*this, "%u.%u", 0U, 0U),
+ m_out_a(*this, "%u.a", 0U),
+ m_out_digit(*this, "digit%u", 0U),
m_speaker(*this, "speaker"),
m_display_wait(33),
m_display_maxy(1),
@@ -79,6 +82,9 @@ public:
// devices
required_device<cpu_device> m_maincpu;
optional_ioport_array<6> m_inp_matrix; // max 6
+ output_finder<0x20, 0x20> m_out_x;
+ output_finder<0x20> m_out_a;
+ output_finder<0x20> m_out_digit;
optional_device<speaker_sound_device> m_speaker;
// misc common
@@ -97,7 +103,6 @@ public:
u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on)
u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments
- u32 m_display_cache[0x20]; // (internal use)
u8 m_display_decay[0x20][0x20]; // (internal use)
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
@@ -116,9 +121,13 @@ protected:
void hh_pic16_state::machine_start()
{
+ // resolve handlers
+ m_out_x.resolve();
+ m_out_a.resolve();
+ m_out_digit.resolve();
+
// zerofill
memset(m_display_state, 0, sizeof(m_display_state));
- memset(m_display_cache, ~0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
memset(m_display_segmask, 0, sizeof(m_display_segmask));
@@ -134,7 +143,6 @@ void hh_pic16_state::machine_start()
save_item(NAME(m_display_wait));
save_item(NAME(m_display_state));
- /* save_item(NAME(m_display_cache)); */ // don't save!
save_item(NAME(m_display_decay));
save_item(NAME(m_display_segmask));
@@ -162,11 +170,9 @@ void hh_pic16_state::machine_reset()
void hh_pic16_state::display_update()
{
- u32 active_state[0x20];
-
for (int y = 0; y < m_display_maxy; y++)
{
- active_state[y] = 0;
+ u32 active_state = 0;
for (int x = 0; x <= m_display_maxx; x++)
{
@@ -176,41 +182,19 @@ void hh_pic16_state::display_update()
// determine active state
u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0;
- active_state[y] |= (ds << x);
- }
- }
+ active_state |= (ds << x);
- // on difference, send to output
- for (int y = 0; y < m_display_maxy; y++)
- if (m_display_cache[y] != active_state[y])
- {
- if (m_display_segmask[y] != 0)
- output().set_digit_value(y, active_state[y] & m_display_segmask[y]);
-
- const int mul = (m_display_maxx <= 10) ? 10 : 100;
- for (int x = 0; x <= m_display_maxx; x++)
- {
- int state = active_state[y] >> x & 1;
- char buf1[0x10]; // lampyx
- char buf2[0x10]; // y.x
-
- if (x == m_display_maxx)
- {
- // always-on if selected
- sprintf(buf1, "lamp%da", y);
- sprintf(buf2, "%d.a", y);
- }
- else
- {
- sprintf(buf1, "lamp%d", y * mul + x);
- sprintf(buf2, "%d.%d", y, x);
- }
- output().set_value(buf1, state);
- output().set_value(buf2, state);
- }
+ // output to y.x, or y.a when always-on
+ if (x != m_display_maxx)
+ m_out_x[y][x] = ds;
+ else
+ m_out_a[y] = ds;
}
- memcpy(m_display_cache, active_state, sizeof(m_display_cache));
+ // output to digity
+ if (m_display_segmask[y] != 0)
+ m_out_digit[y] = active_state & m_display_segmask[y];
+ }
}
TIMER_DEVICE_CALLBACK_MEMBER(hh_pic16_state::display_decay_tick)
diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp
index ab05a4c0d52..ded2c6b7513 100644
--- a/src/mame/drivers/hh_tms1k.cpp
+++ b/src/mame/drivers/hh_tms1k.cpp
@@ -221,9 +221,13 @@
void hh_tms1k_state::machine_start()
{
+ // resolve handlers
+ m_out_x.resolve();
+ m_out_a.resolve();
+ m_out_digit.resolve();
+
// zerofill
memset(m_display_state, 0, sizeof(m_display_state));
- memset(m_display_cache, ~0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
memset(m_display_segmask, 0, sizeof(m_display_segmask));
@@ -241,7 +245,6 @@ void hh_tms1k_state::machine_start()
save_item(NAME(m_display_wait));
save_item(NAME(m_display_state));
- /* save_item(NAME(m_display_cache)); */ // don't save!
/* save_item(NAME(m_power_led)); */ // don't save!
save_item(NAME(m_display_decay));
save_item(NAME(m_display_segmask));
@@ -272,11 +275,9 @@ void hh_tms1k_state::machine_reset()
void hh_tms1k_state::display_update()
{
- u32 active_state[0x20];
-
for (int y = 0; y < m_display_maxy; y++)
{
- active_state[y] = 0;
+ u32 active_state = 0;
for (int x = 0; x <= m_display_maxx; x++)
{
@@ -286,41 +287,19 @@ void hh_tms1k_state::display_update()
// determine active state
u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0;
- active_state[y] |= (ds << x);
- }
- }
+ active_state |= (ds << x);
- // on difference, send to output
- for (int y = 0; y < m_display_maxy; y++)
- if (m_display_cache[y] != active_state[y])
- {
- if (m_display_segmask[y] != 0)
- output().set_digit_value(y, active_state[y] & m_display_segmask[y]);
-
- const int mul = (m_display_maxx <= 10) ? 10 : 100;
- for (int x = 0; x <= m_display_maxx; x++)
- {
- int state = active_state[y] >> x & 1;
- char buf1[0x10]; // lampyx
- char buf2[0x10]; // y.x
-
- if (x == m_display_maxx)
- {
- // always-on if selected
- sprintf(buf1, "lamp%da", y);
- sprintf(buf2, "%d.a", y);
- }
- else
- {
- sprintf(buf1, "lamp%d", y * mul + x);
- sprintf(buf2, "%d.%d", y, x);
- }
- output().set_value(buf1, state);
- output().set_value(buf2, state);
- }
+ // output to y.x, or y.a when always-on
+ if (x != m_display_maxx)
+ m_out_x[y][x] = ds;
+ else
+ m_out_a[y] = ds;
}
- memcpy(m_display_cache, active_state, sizeof(m_display_cache));
+ // output to digity
+ if (m_display_segmask[y] != 0)
+ m_out_digit[y] = active_state & m_display_segmask[y];
+ }
// output optional power led
if (m_power_led != m_power_on)
diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp
index a68c6586b59..ac40c94aec4 100644
--- a/src/mame/drivers/hh_ucom4.cpp
+++ b/src/mame/drivers/hh_ucom4.cpp
@@ -89,9 +89,13 @@ TODO:
void hh_ucom4_state::machine_start()
{
+ // resolve handlers
+ m_out_x.resolve();
+ m_out_a.resolve();
+ m_out_digit.resolve();
+
// zerofill
memset(m_display_state, 0, sizeof(m_display_state));
- memset(m_display_cache, ~0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
memset(m_display_segmask, 0, sizeof(m_display_segmask));
@@ -107,7 +111,6 @@ void hh_ucom4_state::machine_start()
save_item(NAME(m_display_wait));
save_item(NAME(m_display_state));
- /* save_item(NAME(m_display_cache)); */ // don't save!
save_item(NAME(m_display_decay));
save_item(NAME(m_display_segmask));
@@ -136,11 +139,9 @@ void hh_ucom4_state::machine_reset()
void hh_ucom4_state::display_update()
{
- u32 active_state[0x20];
-
for (int y = 0; y < m_display_maxy; y++)
{
- active_state[y] = 0;
+ u32 active_state = 0;
for (int x = 0; x <= m_display_maxx; x++)
{
@@ -150,41 +151,19 @@ void hh_ucom4_state::display_update()
// determine active state
u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0;
- active_state[y] |= (ds << x);
- }
- }
+ active_state |= (ds << x);
- // on difference, send to output
- for (int y = 0; y < m_display_maxy; y++)
- if (m_display_cache[y] != active_state[y])
- {
- if (m_display_segmask[y] != 0)
- output().set_digit_value(y, active_state[y] & m_display_segmask[y]);
-
- const int mul = (m_display_maxx <= 10) ? 10 : 100;
- for (int x = 0; x <= m_display_maxx; x++)
- {
- int state = active_state[y] >> x & 1;
- char buf1[0x10]; // lampyx
- char buf2[0x10]; // y.x
-
- if (x == m_display_maxx)
- {
- // always-on if selected
- sprintf(buf1, "lamp%da", y);
- sprintf(buf2, "%d.a", y);
- }
- else
- {
- sprintf(buf1, "lamp%d", y * mul + x);
- sprintf(buf2, "%d.%d", y, x);
- }
- output().set_value(buf1, state);
- output().set_value(buf2, state);
- }
+ // output to y.x, or y.a when always-on
+ if (x != m_display_maxx)
+ m_out_x[y][x] = ds;
+ else
+ m_out_a[y] = ds;
}
- memcpy(m_display_cache, active_state, sizeof(m_display_cache));
+ // output to digity
+ if (m_display_segmask[y] != 0)
+ m_out_digit[y] = active_state & m_display_segmask[y];
+ }
}
TIMER_DEVICE_CALLBACK_MEMBER(hh_ucom4_state::display_decay_tick)
diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp
index 1debe2a5faf..5e4cf519161 100644
--- a/src/mame/drivers/k28.cpp
+++ b/src/mame/drivers/k28.cpp
@@ -38,6 +38,9 @@ public:
m_speech(*this, "speech"),
m_onbutton_timer(*this, "on_button"),
m_inp_matrix(*this, "IN.%u", 0),
+ m_out_x(*this, "%u.%u", 0U, 0U),
+ m_out_a(*this, "%u.a", 0U),
+ m_out_digit(*this, "digit%u", 0U),
m_display_wait(33),
m_display_maxy(1),
m_display_maxx(0)
@@ -49,6 +52,9 @@ public:
required_device<votrax_sc01_device> m_speech;
required_device<timer_device> m_onbutton_timer;
required_ioport_array<7> m_inp_matrix;
+ output_finder<0x20, 0x20> m_out_x;
+ output_finder<0x20> m_out_a;
+ output_finder<0x20> m_out_digit;
// display common
int m_display_wait; // led/lamp off-delay in milliseconds (default 33ms)
@@ -57,7 +63,6 @@ public:
u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on)
u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments
- u32 m_display_cache[0x20]; // (internal use)
u8 m_display_decay[0x20][0x20]; // (internal use)
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
@@ -96,9 +101,13 @@ protected:
void k28_state::machine_start()
{
+ // resolve handlers
+ m_out_x.resolve();
+ m_out_a.resolve();
+ m_out_digit.resolve();
+
// zerofill
memset(m_display_state, 0, sizeof(m_display_state));
- memset(m_display_cache, ~0, sizeof(m_display_cache));
memset(m_display_decay, 0, sizeof(m_display_decay));
memset(m_display_segmask, 0, sizeof(m_display_segmask));
@@ -119,7 +128,6 @@ void k28_state::machine_start()
save_item(NAME(m_display_wait));
save_item(NAME(m_display_state));
- /* save_item(NAME(m_display_cache)); */ // don't save!
save_item(NAME(m_display_decay));
save_item(NAME(m_display_segmask));
@@ -168,11 +176,9 @@ void k28_state::power_off()
void k28_state::display_update()
{
- u32 active_state[0x20];
-
for (int y = 0; y < m_display_maxy; y++)
{
- active_state[y] = 0;
+ u32 active_state = 0;
for (int x = 0; x <= m_display_maxx; x++)
{
@@ -182,41 +188,19 @@ void k28_state::display_update()
// determine active state
u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0;
- active_state[y] |= (ds << x);
- }
- }
+ active_state |= (ds << x);
- // on difference, send to output
- for (int y = 0; y < m_display_maxy; y++)
- if (m_display_cache[y] != active_state[y])
- {
- if (m_display_segmask[y] != 0)
- output().set_digit_value(y, active_state[y] & m_display_segmask[y]);
-
- const int mul = (m_display_maxx <= 10) ? 10 : 100;
- for (int x = 0; x <= m_display_maxx; x++)
- {
- int state = active_state[y] >> x & 1;
- char buf1[0x10]; // lampyx
- char buf2[0x10]; // y.x
-
- if (x == m_display_maxx)
- {
- // always-on if selected
- sprintf(buf1, "lamp%da", y);
- sprintf(buf2, "%d.a", y);
- }
- else
- {
- sprintf(buf1, "lamp%d", y * mul + x);
- sprintf(buf2, "%d.%d", y, x);
- }
- output().set_value(buf1, state);
- output().set_value(buf2, state);
- }
+ // output to y.x, or y.a when always-on
+ if (x != m_display_maxx)
+ m_out_x[y][x] = ds;
+ else
+ m_out_a[y] = ds;
}
- memcpy(m_display_cache, active_state, sizeof(m_display_cache));
+ // output to digity
+ if (m_display_segmask[y] != 0)
+ m_out_digit[y] = active_state & m_display_segmask[y];
+ }
}
TIMER_DEVICE_CALLBACK_MEMBER(k28_state::display_decay_tick)
diff --git a/src/mame/includes/hh_tms1k.h b/src/mame/includes/hh_tms1k.h
index ff932352bd6..1d3fcf1034c 100644
--- a/src/mame/includes/hh_tms1k.h
+++ b/src/mame/includes/hh_tms1k.h
@@ -28,6 +28,9 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_inp_matrix(*this, "IN.%u", 0),
+ m_out_x(*this, "%u.%u", 0U, 0U),
+ m_out_a(*this, "%u.a", 0U),
+ m_out_digit(*this, "digit%u", 0U),
m_speaker(*this, "speaker"),
m_display_wait(33),
m_display_maxy(1),
@@ -37,6 +40,9 @@ public:
// devices
required_device<tms1k_base_device> m_maincpu;
optional_ioport_array<18> m_inp_matrix; // max 18
+ output_finder<0x20, 0x20> m_out_x;
+ output_finder<0x20> m_out_a;
+ output_finder<0x20> m_out_digit;
optional_device<speaker_sound_device> m_speaker;
// misc common
@@ -62,7 +68,6 @@ public:
u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on)
u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments
- u32 m_display_cache[0x20]; // (internal use)
u8 m_display_decay[0x20][0x20]; // (internal use)
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
diff --git a/src/mame/includes/hh_ucom4.h b/src/mame/includes/hh_ucom4.h
index 83fcaf0228c..eddb55cc31d 100644
--- a/src/mame/includes/hh_ucom4.h
+++ b/src/mame/includes/hh_ucom4.h
@@ -22,6 +22,9 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_inp_matrix(*this, "IN.%u", 0),
+ m_out_x(*this, "%u.%u", 0U, 0U),
+ m_out_a(*this, "%u.a", 0U),
+ m_out_digit(*this, "digit%u", 0U),
m_speaker(*this, "speaker"),
m_display_wait(33),
m_display_maxy(1),
@@ -31,6 +34,9 @@ public:
// devices
required_device<cpu_device> m_maincpu;
optional_ioport_array<5> m_inp_matrix; // max 5
+ output_finder<0x20, 0x20> m_out_x;
+ output_finder<0x20> m_out_a;
+ output_finder<0x20> m_out_digit;
optional_device<speaker_sound_device> m_speaker;
// misc common
@@ -53,7 +59,6 @@ public:
u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on)
u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments
- u32 m_display_cache[0x20]; // (internal use)
u8 m_display_decay[0x20][0x20]; // (internal use)
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);