added output finder to some chess drivers (nw)

This commit is contained in:
hap 2017-07-29 17:05:25 +02:00
parent b925d33f6a
commit 593d402d55
6 changed files with 52 additions and 49 deletions

View File

@ -42,6 +42,9 @@ public:
m_dac(*this, "dac"),
m_speaker_off_timer(*this, "speaker_off"),
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)
@ -52,6 +55,9 @@ public:
required_device<dac_bit_interface> m_dac;
required_device<timer_device> m_speaker_off_timer;
optional_ioport_array<10> m_inp_matrix; // max 10
output_finder<0x20, 0x20> m_out_x;
output_finder<0x20> m_out_a;
output_finder<0x20> m_out_digit;
TIMER_DEVICE_CALLBACK_MEMBER(irq_on) { m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); }
TIMER_DEVICE_CALLBACK_MEMBER(irq_off) { m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); }
@ -94,6 +100,11 @@ protected:
void cxgz80_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));
@ -158,29 +169,19 @@ void cxgz80_state::display_update()
for (int y = 0; y < m_display_maxy; y++)
if (m_display_cache[y] != active_state[y])
{
// output to digity
if (m_display_segmask[y] != 0)
output().set_digit_value(y, active_state[y] & m_display_segmask[y]);
m_out_digit[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);
}
// output to y.x, or y.a when always-on
if (x != m_display_maxx)
m_out_x[y][x] = state;
else
{
sprintf(buf1, "lamp%d", y * mul + x);
sprintf(buf2, "%d.%d", y, x);
}
output().set_value(buf1, state);
output().set_value(buf2, state);
m_out_a[y] = state;
}
}

View File

@ -588,6 +588,11 @@ public:
void fidelbase_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));
@ -658,29 +663,19 @@ void fidelbase_state::display_update()
for (int y = 0; y < m_display_maxy; y++)
if (m_display_cache[y] != active_state[y])
{
// output to digity
if (m_display_segmask[y] != 0)
output().set_digit_value(y, active_state[y] & m_display_segmask[y]);
m_out_digit[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);
}
// output to y.x, or y.a when always-on
if (x != m_display_maxx)
m_out_x[y][x] = state;
else
{
sprintf(buf1, "lamp%d", y * mul + x);
sprintf(buf2, "%d.%d", y, x);
}
output().set_value(buf1, state);
output().set_value(buf2, state);
m_out_a[y] = state;
}
}

View File

@ -88,7 +88,7 @@ protected:
void hh_sm510_state::machine_start()
{
// resolve output handlers
// resolve handlers
m_out_x.resolve();
// zerofill

View File

@ -121,6 +121,11 @@ public:
void novagbase_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));
@ -187,29 +192,19 @@ void novagbase_state::display_update()
for (int y = 0; y < m_display_maxy; y++)
if (m_display_cache[y] != active_state[y])
{
// output to digity
if (m_display_segmask[y] != 0)
output().set_digit_value(y, active_state[y] & m_display_segmask[y]);
m_out_digit[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);
}
// output to y.x, or y.a when always-on
if (x != m_display_maxx)
m_out_x[y][x] = state;
else
{
sprintf(buf1, "lamp%d", y * mul + x);
sprintf(buf2, "%d.%d", y, x);
}
output().set_value(buf1, state);
output().set_value(buf2, state);
m_out_a[y] = state;
}
}

View File

@ -25,6 +25,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_speech(*this, "speech"),
m_speech_rom(*this, "speech"),
m_dac(*this, "dac"),
@ -37,6 +40,9 @@ public:
// devices/pointers
required_device<cpu_device> m_maincpu;
optional_ioport_array<11> m_inp_matrix; // max 11
output_finder<0x20, 0x20> m_out_x;
output_finder<0x20> m_out_a;
output_finder<0x20> m_out_digit;
optional_device<s14001a_device> m_speech;
optional_region_ptr<u8> m_speech_rom;
optional_device<dac_bit_interface> m_dac;

View File

@ -26,6 +26,9 @@ public:
m_beeper(*this, "beeper"),
m_lcd(*this, "hd44780"),
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)
@ -37,6 +40,9 @@ public:
optional_device<beep_device> m_beeper;
optional_device<hd44780_device> m_lcd;
optional_ioport_array<9> m_inp_matrix; // max 9
output_finder<0x20, 0x20> m_out_x;
output_finder<0x20> m_out_a;
output_finder<0x20> m_out_digit;
// misc common
u16 m_inp_mux; // multiplexed keypad mask