From d75c6a9b3b5a6a9e97245ee60c79771776040adc Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 24 Dec 2018 16:02:39 +0100 Subject: videopin: output_finder for the leds (nw) --- src/mame/drivers/videopin.cpp | 33 ++++++++++++++++----------------- src/mame/includes/videopin.h | 4 ++-- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/mame/drivers/videopin.cpp b/src/mame/drivers/videopin.cpp index 7ccb4393727..740f6e029dd 100644 --- a/src/mame/drivers/videopin.cpp +++ b/src/mame/drivers/videopin.cpp @@ -81,7 +81,7 @@ TIMER_CALLBACK_MEMBER(videopin_state::interrupt_callback) void videopin_state::machine_start() { - m_led.resolve(); + m_leds.resolve(); m_interrupt_timer = timer_alloc(TIMER_INTERRUPT); save_item(NAME(m_time_pushed)); @@ -138,26 +138,25 @@ READ8_MEMBER(videopin_state::misc_r) WRITE8_MEMBER(videopin_state::led_w) { - int i = (m_screen->vpos() >> 5) & 7; - static const char *const matrix[8][4] = + // LED matrix as seen in Video Pinball manual, fig. 4-14 + // output to "LEDxx" where xx = 01 to 32, videopin START = LED30 + static const int matrix[8][4] = { - { "LED26", "LED18", "LED11", "LED13" }, - { "LED25", "LED17", "LED10", "LED08" }, - { "LED24", "LED29", "LED09", "LED07" }, - { "LED23", "LED28", "LED04", "LED06" }, - { "LED22", "LED27", "LED03", "LED05" }, - { "LED21", "LED16", "LED02", "-" }, - { "LED20", "LED15", "LED01", "-" }, - { "LED19", "LED14", "LED12", "-" } + { 26, 18, 11, 13 }, + { 25, 17, 10, 8 }, + { 24, 29, 9, 7 }, + { 23, 28, 4, 6 }, + { 22, 27, 3, 5 }, + { 21, 16, 2, 32 }, + { 20, 15, 1, 31 }, + { 19, 14, 12, 30 } }; - output().set_value(matrix[i][0], (data >> 0) & 1); - output().set_value(matrix[i][1], (data >> 1) & 1); - output().set_value(matrix[i][2], (data >> 2) & 1); - output().set_value(matrix[i][3], (data >> 3) & 1); + // anode from 32V,64V,128V + int a = m_screen->vpos() >> 5 & 7; - if (i == 7) - m_led = BIT(data, 3); /* start button */ + for (int c = 0; c < 4; c++) + m_leds[matrix[a][c]] = BIT(data, c); m_maincpu->set_input_line(0, CLEAR_LINE); } diff --git a/src/mame/includes/videopin.h b/src/mame/includes/videopin.h index c03f1c25450..86a665aeb52 100644 --- a/src/mame/includes/videopin.h +++ b/src/mame/includes/videopin.h @@ -34,7 +34,7 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_video_ram(*this, "video_ram"), - m_led(*this, "led0") + m_leds(*this, "LED%02u", 0U) { } void videopin(machine_config &config); @@ -75,7 +75,7 @@ private: required_device m_palette; required_shared_ptr m_video_ram; - output_finder<> m_led; + output_finder<33> m_leds; attotime m_time_pushed; attotime m_time_released; -- cgit v1.2.3