mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
hh*: added output finder (nw)
This commit is contained in:
parent
70115f6f25
commit
c8c3f073f9
@ -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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// output to digity
|
||||
if (m_display_segmask[y] != 0)
|
||||
m_out_digit[y] = active_state & m_display_segmask[y];
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(hh_cop400_state::display_decay_tick)
|
||||
|
@ -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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// output to digity
|
||||
if (m_display_segmask[y] != 0)
|
||||
m_out_digit[y] = active_state & m_display_segmask[y];
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(hh_hmcs40_state::display_decay_tick)
|
||||
|
@ -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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// output to digity
|
||||
if (m_display_segmask[y] != 0)
|
||||
m_out_digit[y] = active_state & m_display_segmask[y];
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(hh_melps4_state::display_decay_tick)
|
||||
|
@ -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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// output to digity
|
||||
if (m_display_segmask[y] != 0)
|
||||
m_out_digit[y] = active_state & m_display_segmask[y];
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(hh_pic16_state::display_decay_tick)
|
||||
|
@ -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,42 +287,20 @@ 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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// output to digity
|
||||
if (m_display_segmask[y] != 0)
|
||||
m_out_digit[y] = active_state & m_display_segmask[y];
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
|
||||
|
||||
// output optional power led
|
||||
if (m_power_led != m_power_on)
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// output to digity
|
||||
if (m_display_segmask[y] != 0)
|
||||
m_out_digit[y] = active_state & m_display_segmask[y];
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(hh_ucom4_state::display_decay_tick)
|
||||
|
@ -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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// output to digity
|
||||
if (m_display_segmask[y] != 0)
|
||||
m_out_digit[y] = active_state & m_display_segmask[y];
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(m_display_cache, active_state, sizeof(m_display_cache));
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(k28_state::display_decay_tick)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user