videopin: output_finder for the leds (nw)

This commit is contained in:
hap 2018-12-24 16:02:39 +01:00
parent 0ed36469ef
commit d75c6a9b3b
2 changed files with 18 additions and 19 deletions

View File

@ -81,7 +81,7 @@ TIMER_CALLBACK_MEMBER(videopin_state::interrupt_callback)
void videopin_state::machine_start() void videopin_state::machine_start()
{ {
m_led.resolve(); m_leds.resolve();
m_interrupt_timer = timer_alloc(TIMER_INTERRUPT); m_interrupt_timer = timer_alloc(TIMER_INTERRUPT);
save_item(NAME(m_time_pushed)); save_item(NAME(m_time_pushed));
@ -138,26 +138,25 @@ READ8_MEMBER(videopin_state::misc_r)
WRITE8_MEMBER(videopin_state::led_w) WRITE8_MEMBER(videopin_state::led_w)
{ {
int i = (m_screen->vpos() >> 5) & 7; // LED matrix as seen in Video Pinball manual, fig. 4-14
static const char *const matrix[8][4] = // output to "LEDxx" where xx = 01 to 32, videopin START = LED30
static const int matrix[8][4] =
{ {
{ "LED26", "LED18", "LED11", "LED13" }, { 26, 18, 11, 13 },
{ "LED25", "LED17", "LED10", "LED08" }, { 25, 17, 10, 8 },
{ "LED24", "LED29", "LED09", "LED07" }, { 24, 29, 9, 7 },
{ "LED23", "LED28", "LED04", "LED06" }, { 23, 28, 4, 6 },
{ "LED22", "LED27", "LED03", "LED05" }, { 22, 27, 3, 5 },
{ "LED21", "LED16", "LED02", "-" }, { 21, 16, 2, 32 },
{ "LED20", "LED15", "LED01", "-" }, { 20, 15, 1, 31 },
{ "LED19", "LED14", "LED12", "-" } { 19, 14, 12, 30 }
}; };
output().set_value(matrix[i][0], (data >> 0) & 1); // anode from 32V,64V,128V
output().set_value(matrix[i][1], (data >> 1) & 1); int a = m_screen->vpos() >> 5 & 7;
output().set_value(matrix[i][2], (data >> 2) & 1);
output().set_value(matrix[i][3], (data >> 3) & 1);
if (i == 7) for (int c = 0; c < 4; c++)
m_led = BIT(data, 3); /* start button */ m_leds[matrix[a][c]] = BIT(data, c);
m_maincpu->set_input_line(0, CLEAR_LINE); m_maincpu->set_input_line(0, CLEAR_LINE);
} }

View File

@ -34,7 +34,7 @@ public:
m_screen(*this, "screen"), m_screen(*this, "screen"),
m_palette(*this, "palette"), m_palette(*this, "palette"),
m_video_ram(*this, "video_ram"), m_video_ram(*this, "video_ram"),
m_led(*this, "led0") m_leds(*this, "LED%02u", 0U)
{ } { }
void videopin(machine_config &config); void videopin(machine_config &config);
@ -75,7 +75,7 @@ private:
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
required_shared_ptr<uint8_t> m_video_ram; required_shared_ptr<uint8_t> m_video_ram;
output_finder<> m_led; output_finder<33> m_leds;
attotime m_time_pushed; attotime m_time_pushed;
attotime m_time_released; attotime m_time_released;