From 1c3684787c304e67c5b6f8ea36137403cd11e31e Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 25 Mar 2018 04:31:07 +1100 Subject: [PATCH] get rid of dioutput - it's only used in one place, and it upset GCC on Linux debug builds for some reason --- scripts/src/emu.lua | 2 - src/devices/video/dm9368.cpp | 83 +++++++++---------- src/devices/video/dm9368.h | 29 ++++--- src/emu/dioutput.cpp | 68 ---------------- src/emu/dioutput.h | 56 ------------- src/mame/drivers/didact.cpp | 145 ++++++++++++++-------------------- src/mame/drivers/elf.cpp | 5 +- src/mame/drivers/seabattl.cpp | 46 +++++------ src/mame/includes/elf.h | 25 +++--- 9 files changed, 152 insertions(+), 307 deletions(-) delete mode 100644 src/emu/dioutput.cpp delete mode 100644 src/emu/dioutput.h diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index 88ad0f5e499..88af75653c8 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -82,8 +82,6 @@ files { MAME_DIR .. "src/emu/dinetwork.h", MAME_DIR .. "src/emu/dinvram.cpp", MAME_DIR .. "src/emu/dinvram.h", - MAME_DIR .. "src/emu/dioutput.cpp", - MAME_DIR .. "src/emu/dioutput.h", MAME_DIR .. "src/emu/dipalette.cpp", MAME_DIR .. "src/emu/dipalette.h", MAME_DIR .. "src/emu/dipty.cpp", diff --git a/src/devices/video/dm9368.cpp b/src/devices/video/dm9368.cpp index c7f8e3379a3..3585e039843 100644 --- a/src/devices/video/dm9368.cpp +++ b/src/devices/video/dm9368.cpp @@ -25,7 +25,7 @@ DEFINE_DEVICE_TYPE(DM9368, dm9368_device, "dm9368", "Fairchild DM9368 7-Segment // MACROS / CONSTANTS //************************************************************************** -const uint8_t dm9368_device::s_segment_data[16] = +const u8 dm9368_device::s_segment_data[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x67, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71 }; @@ -36,61 +36,54 @@ const uint8_t dm9368_device::s_segment_data[16] = // LIVE DEVICE //************************************************************************** -//------------------------------------------------- -// dm9368_device - constructor -//------------------------------------------------- - -dm9368_device::dm9368_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +dm9368_device::dm9368_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, DM9368, tag, owner, clock), - device_output_interface(mconfig, *this), - m_write_rbo(*this), + m_update_cb(*this), + m_rbo_cb(*this), m_rbi(1), m_rbo(1) { } -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- +void dm9368_device::a_w(u8 data) +{ + int const a(data & 0x0f); + int const rbo((m_rbi || a) ? 1 : 0); + u8 const value(rbo ? s_segment_data[a] : 0); + + if (!rbo) + LOG("DM9368 Blanked Rippling Zero\n"); + else + LOG("DM9368 Output Data: %u = %02x\n", a, value); + + m_update_cb(0, value); + if (rbo != m_rbo) + m_rbo_cb(m_rbo = rbo); +} + + +WRITE_LINE_MEMBER( dm9368_device::rbi_w ) +{ + if (state != m_rbi) + { + m_rbi = state; + update(); + } +} + + +void dm9368_device::device_resolve_objects() +{ + // resolve callbacks + m_update_cb.resolve_safe(); + m_rbo_cb.resolve_safe(); +} + void dm9368_device::device_start() { - // resolve callbacks - m_write_rbo.resolve_safe(); - // state saving save_item(NAME(m_rbi)); save_item(NAME(m_rbo)); } - - -//------------------------------------------------- -// a_w - -//------------------------------------------------- - -void dm9368_device::a_w(uint8_t data) -{ - int const a = data & 0x0f; - uint8_t value = 0; - - if (!m_rbi && !a) - { - LOG("DM9368 Blanked Rippling Zero\n"); - - // blank rippling 0 - m_rbo = 0; - } - else - { - LOG("DM9368 Output Data: %u = %02x\n", a, s_segment_data[a]); - - value = s_segment_data[a]; - - m_rbo = 1; - } - - set_digit_value(value); - - m_write_rbo(m_rbo); -} diff --git a/src/devices/video/dm9368.h b/src/devices/video/dm9368.h index ba628da64fc..05e7fbb170f 100644 --- a/src/devices/video/dm9368.h +++ b/src/devices/video/dm9368.h @@ -22,16 +22,17 @@ #pragma once -#include "dioutput.h" - //************************************************************************** // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_DM9368_RBO_CALLBACK(_write) \ - devcb = &dm9368_device::set_rbo_wr_callback(*device, DEVCB_##_read); +#define MCFG_DM9368_UPDATE_CALLBACK(cb) \ + devcb = &downcast(*device).set_update_callback(DEVCB_##cb); + +#define MCFG_DM9368_RBO_CALLBACK(cb) \ + devcb = &downcast(*device).set_rbo_callback(DEVCB_##cb); @@ -41,29 +42,35 @@ // ======================> dm9368_device -class dm9368_device : public device_t, - public device_output_interface +class dm9368_device : public device_t { public: - // construction/destruction - dm9368_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template devcb_base &set_update_callback(Obj &&cb) { return m_update_cb.set_callback(std::forward(cb)); } + template devcb_base &set_rbo_callback(Obj &&cb) { return m_rbo_cb.set_callback(std::forward(cb)); } - void a_w(uint8_t data); + // construction/destruction + dm9368_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + void a_w(u8 data); DECLARE_WRITE_LINE_MEMBER( rbi_w ) { m_rbi = state; } DECLARE_READ_LINE_MEMBER( rbo_r ) { return m_rbo; } protected: // device-level overrides + virtual void device_resolve_objects() override; virtual void device_start() override; + void update(); + private: - devcb_write_line m_write_rbo; + devcb_write8 m_update_cb; + devcb_write_line m_rbo_cb; int m_rbi; int m_rbo; - static const uint8_t s_segment_data[16]; + static const u8 s_segment_data[16]; }; diff --git a/src/emu/dioutput.cpp b/src/emu/dioutput.cpp deleted file mode 100644 index bde41b2a7e1..00000000000 --- a/src/emu/dioutput.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - dirtc.c - - Device Output interfaces. - -***************************************************************************/ - -#include "emu.h" -#include "dioutput.h" - - -//************************************************************************** -// DEVICE OUTPUT INTERFACE -//************************************************************************** - -//------------------------------------------------- -// device_output_interface - constructor -//------------------------------------------------- - -device_output_interface::device_output_interface(const machine_config &mconfig, device_t &device) : - device_interface(device, "output"), - m_output_index(0), - m_output_name(nullptr) -{ -} - -//------------------------------------------------- -// device_output_interface - destructor -//------------------------------------------------- - -device_output_interface::~device_output_interface() -{ -} - -void device_output_interface::set_output_value(int value) const -{ - if (m_output_name) - device().machine().output().set_value(m_output_name, value); - else - fatalerror("Output name not set!"); -} - -void device_output_interface::set_led_value(int value) const -{ - if (m_output_name) - device().machine().output().set_value(m_output_name, value); - else - device().machine().output().set_led_value(m_output_index, value); -} - -void device_output_interface::set_lamp_value(int value) const -{ - if (m_output_name) - device().machine().output().set_value(m_output_name, value); - else - device().machine().output().set_lamp_value(m_output_index, value); -} - -void device_output_interface::set_digit_value(int value) const -{ - if (m_output_name) - device().machine().output().set_value(m_output_name, value); - else - device().machine().output().set_digit_value(m_output_index, value); -} diff --git a/src/emu/dioutput.h b/src/emu/dioutput.h deleted file mode 100644 index 840ae9add23..00000000000 --- a/src/emu/dioutput.h +++ /dev/null @@ -1,56 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - dioutput.h - - Device Output interfaces. - -***************************************************************************/ - -#ifndef MAME_EMU_DIOUTPUT_H -#define MAME_EMU_DIOUTPUT_H - -#pragma once - - -//************************************************************************** -// MACROS -//************************************************************************** - -#define MCFG_OUTPUT_INDEX(_index) \ - dynamic_cast(*device).set_output_index(_index); - -#define MCFG_OUTPUT_NAME(_name) \ - dynamic_cast(*device).set_output_name(_name); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> device_output_interface - -class device_output_interface : public device_interface -{ -public: - // construction/destruction - device_output_interface(const machine_config &mconfig, device_t &device); - virtual ~device_output_interface(); - - void set_output_index(int index) { m_output_index = index; } - void set_output_name(const char *name) { m_output_name = name; } - - void set_output_value(int value) const; - void set_led_value(int value) const; - void set_lamp_value(int value) const; - void set_digit_value(int value) const; - -protected: - int m_output_index; - const char *m_output_name; -}; - - -#endif // MAME_EMU_DIOUTPUT_H diff --git a/src/mame/drivers/didact.cpp b/src/mame/drivers/didact.cpp index c4910adfa0e..2c37b348450 100644 --- a/src/mame/drivers/didact.cpp +++ b/src/mame/drivers/didact.cpp @@ -96,29 +96,13 @@ class didact_state : public driver_device public: didact_state(const machine_config &mconfig, device_type type, const char * tag) : driver_device(mconfig, type, tag) - ,m_io_line0(*this, "LINE0") - ,m_io_line1(*this, "LINE1") - ,m_io_line2(*this, "LINE2") - ,m_io_line3(*this, "LINE3") - ,m_io_line4(*this, "LINE4") - ,m_line0(0) - ,m_line1(0) - ,m_line2(0) - ,m_line3(0) - ,m_reset(0) - ,m_shift(0) - ,m_led(0) - ,m_rs232(*this, "rs232") - { } - required_ioport m_io_line0; - required_ioport m_io_line1; - required_ioport m_io_line2; - required_ioport m_io_line3; - required_ioport m_io_line4; - uint8_t m_line0; - uint8_t m_line1; - uint8_t m_line2; - uint8_t m_line3; + , m_io_lines(*this, "LINE%u", 0U) + , m_lines{ 0, 0, 0, 0 } + , m_led(0) + , m_rs232(*this, "rs232") + { } + required_ioport_array<5> m_io_lines; + uint8_t m_lines[4]; uint8_t m_reset; uint8_t m_shift; uint8_t m_led; @@ -166,15 +150,15 @@ class didact_state : public driver_device /* Mikrodator 6802 driver class */ class md6802_state : public didact_state { - public: +public: md6802_state(const machine_config &mconfig, device_type type, const char * tag) : didact_state(mconfig, type, tag) - ,m_maincpu(*this, "maincpu") - ,m_tb16_74145(*this, "tb16_74145") - ,m_segments(0) - ,m_pia1(*this, PIA1_TAG) - ,m_pia2(*this, PIA2_TAG) - { } + , m_maincpu(*this, "maincpu") + , m_tb16_74145(*this, "tb16_74145") + , m_segments(0) + , m_pia1(*this, PIA1_TAG) + , m_pia2(*this, PIA2_TAG) + { } required_device m_maincpu; required_device m_tb16_74145; uint8_t m_segments; @@ -203,16 +187,13 @@ READ8_MEMBER( md6802_state::pia2_kbA_r ) ls145 = m_tb16_74145->read() & 0x0f; // read out the artwork, line04 is handled by the timer - m_line0 = m_io_line0->read(); - m_line1 = m_io_line1->read(); - m_line2 = m_io_line2->read(); - m_line3 = m_io_line3->read(); + for (unsigned i = 0U; 4U > i; ++i) + { + m_lines[i] = m_io_lines[i]->read(); - // Mask out those rows that has a button pressed - pa &= ~(((~m_line0 & ls145 ) != 0) ? 1 : 0); - pa &= ~(((~m_line1 & ls145 ) != 0) ? 2 : 0); - pa &= ~(((~m_line2 & ls145 ) != 0) ? 4 : 0); - pa &= ~(((~m_line3 & ls145 ) != 0) ? 8 : 0); + // Mask out those rows that has a button pressed + pa &= ~(((~m_lines[i] & ls145) != 0) ? (1 << i) : 0); + } if (m_shift) { @@ -341,32 +322,25 @@ class mp68a_state : public didact_state public: mp68a_state(const machine_config &mconfig, device_type type, const char * tag) : didact_state(mconfig, type, tag) - ,m_maincpu(*this, "maincpu") - ,m_digit0(*this, "digit0") - ,m_digit1(*this, "digit1") - ,m_digit2(*this, "digit2") - ,m_digit3(*this, "digit3") - ,m_digit4(*this, "digit4") - ,m_digit5(*this, "digit5") - ,m_pia1(*this, PIA1_TAG) - ,m_pia2(*this, PIA2_TAG) - { } + , m_maincpu(*this, "maincpu") + , m_digits(*this, "digit%u", 0U) + , m_7segs(*this, "digit%u", 0U) + , m_pia1(*this, PIA1_TAG) + , m_pia2(*this, PIA2_TAG) + { } required_device m_maincpu; // The display segment driver device (there is actually just one, needs rewrite to be correct) - required_device m_digit0; - required_device m_digit1; - required_device m_digit2; - required_device m_digit3; - required_device m_digit4; - required_device m_digit5; + required_device_array m_digits; + output_finder<6> m_7segs; DECLARE_READ8_MEMBER( pia2_kbA_r ); DECLARE_WRITE8_MEMBER( pia2_kbA_w ); DECLARE_READ8_MEMBER( pia2_kbB_r ); DECLARE_WRITE8_MEMBER( pia2_kbB_w ); DECLARE_READ_LINE_MEMBER( pia2_cb1_r ); + template DECLARE_WRITE8_MEMBER( digit_w ) { m_7segs[N] = data; } virtual void machine_reset() override; virtual void machine_start() override; @@ -386,24 +360,26 @@ READ8_MEMBER( mp68a_state::pia2_kbA_r ) WRITE8_MEMBER( mp68a_state::pia2_kbA_w ) { - uint8_t digit_nbr; - /* Display memory is at $702 to $708 in AAAADD format (A=address digit, D=Data digit) but we are using data read from the port. */ - digit_nbr = (data >> 4) & 0x07; + uint8_t const digit_nbr = (data >> 4) & 0x07; /* There is actually only one 9368 and a 74145 to drive the cathode of the right digit low */ /* This can be emulated by prentending there are one 9368 per digit, at least for now */ switch (digit_nbr) { - case 0: m_digit0->a_w(data & 0x0f); break; - case 1: m_digit1->a_w(data & 0x0f); break; - case 2: m_digit2->a_w(data & 0x0f); break; - case 3: m_digit3->a_w(data & 0x0f); break; - case 4: m_digit4->a_w(data & 0x0f); break; - case 5: m_digit5->a_w(data & 0x0f); break; - case 7: break; // used as an 'unselect' by the ROM between digit accesses. - default: logerror("Invalid digit index %d\n", digit_nbr); + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + m_digits[digit_nbr]->a_w(data & 0x0f); + break; + case 7: // used as an 'unselect' by the ROM between digit accesses. + break; + default: + logerror("Invalid digit index %d\n", digit_nbr); } } @@ -411,16 +387,16 @@ READ8_MEMBER( mp68a_state::pia2_kbB_r ) { uint8_t a012, line, pb; - LOG("--->%s %02x %02x %02x %02x %02x => ", FUNCNAME, m_line0, m_line1, m_line2, m_line3, m_shift); + LOG("--->%s %02x %02x %02x %02x %02x => ", FUNCNAME, m_lines[0], m_lines[1], m_lines[2], m_lines[3], m_shift); a012 = 0; - if ((line = (m_line0 | m_line1)) != 0) + if ((line = (m_lines[0] | m_lines[1])) != 0) { a012 = 8; while (a012 > 0 && !(line & (1 << --a012))); a012 += 8; } - if ( a012 == 0 && (line = ((m_line2) | m_line3)) != 0) + if ( a012 == 0 && (line = ((m_lines[2]) | m_lines[3])) != 0) { a012 = 8; while (a012 > 0 && !(line & (1 << --a012))); @@ -448,17 +424,15 @@ WRITE8_MEMBER( mp68a_state::pia2_kbB_w ) READ_LINE_MEMBER( mp68a_state::pia2_cb1_r ) { - m_line0 = m_io_line0->read(); - m_line1 = m_io_line1->read(); - m_line2 = m_io_line2->read(); - m_line3 = m_io_line3->read(); + for (unsigned i = 0U; 4U > i; ++i) + m_lines[i] = m_io_lines[i]->read(); #if VERBOSE - if ((m_line0 | m_line1 | m_line2 | m_line3) != 0) - LOG("%s()-->%02x %02x %02x %02x\n", FUNCNAME, m_line0, m_line1, m_line2, m_line3); + if (m_lines[0] | m_lines[1] | m_lines[2] | m_lines[3]) + LOG("%s()-->%02x %02x %02x %02x\n", FUNCNAME, m_lines[0], m_lines[1], m_lines[2], m_lines[3]); #endif - return (m_line0 | m_line1 | m_line2 | m_line3) != 0 ? 0 : 1; + return (m_lines[0] | m_lines[1] | m_lines[2] | m_lines[3]) ? 0 : 1; } void mp68a_state::machine_reset() @@ -563,7 +537,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(didact_state::scan_artwork) // LOG("--->%s()\n", FUNCNAME); // Poll the artwork Reset key - if ( (m_io_line4->read() & 0x04) ) + if (m_io_lines[4]->read() & 0x04) { LOG("RESET is pressed, resetting the CPU\n"); m_shift = 0; @@ -574,10 +548,9 @@ TIMER_DEVICE_CALLBACK_MEMBER(didact_state::scan_artwork) } m_reset = 1; // Inhibit multiple resets } - - // Poll the artwork SHIFT/* key - else if ( (m_io_line4->read() & 0x08) ) + else if (m_io_lines[4]->read() & 0x08) { + // Poll the artwork SHIFT/* key LOG("%s", !m_shift ? "SHIFT is set\n" : ""); m_shift = 1; output().set_led_value(m_led, m_shift); // For mp68a only @@ -670,17 +643,17 @@ MACHINE_CONFIG_START(mp68a_state::mp68a) /* 0x086B 0x600 (Port A) = 0x50 */ /* 0x086B 0x600 (Port A) = 0x70 */ MCFG_DEVICE_ADD("digit0", DM9368, 0) - MCFG_OUTPUT_INDEX(0) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(mp68a_state, digit_w<0>)) MCFG_DEVICE_ADD("digit1", DM9368, 0) - MCFG_OUTPUT_INDEX(1) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(mp68a_state, digit_w<1>)) MCFG_DEVICE_ADD("digit2", DM9368, 0) - MCFG_OUTPUT_INDEX(2) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(mp68a_state, digit_w<2>)) MCFG_DEVICE_ADD("digit3", DM9368, 0) - MCFG_OUTPUT_INDEX(3) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(mp68a_state, digit_w<3>)) MCFG_DEVICE_ADD("digit4", DM9368, 0) - MCFG_OUTPUT_INDEX(4) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(mp68a_state, digit_w<4>)) MCFG_DEVICE_ADD("digit5", DM9368, 0) - MCFG_OUTPUT_INDEX(5) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(mp68a_state, digit_w<5>)) MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", mp68a_state, scan_artwork, attotime::from_hz(10)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/elf.cpp b/src/mame/drivers/elf.cpp index 0f0fc2422b1..dee2c473c66 100644 --- a/src/mame/drivers/elf.cpp +++ b/src/mame/drivers/elf.cpp @@ -203,6 +203,7 @@ void elf2_state::machine_start() address_space &program = m_maincpu->space(AS_PROGRAM); /* initialize LED displays */ + m_7segs.resolve(); m_led_l->rbi_w(1); m_led_h->rbi_w(1); @@ -265,9 +266,9 @@ MACHINE_CONFIG_START(elf2_state::elf2) MCFG_MM74C922_X4_CALLBACK(IOPORT("X4")) MCFG_DEVICE_ADD(DM9368_H_TAG, DM9368, 0) - MCFG_OUTPUT_NAME("digit0") + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(elf2_state, digit_w<0>)) MCFG_DEVICE_ADD(DM9368_L_TAG, DM9368, 0) - MCFG_OUTPUT_NAME("digit1") + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(elf2_state, digit_w<1>)) MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) diff --git a/src/mame/drivers/seabattl.cpp b/src/mame/drivers/seabattl.cpp index 03e1e4eed2a..d8fa5bb530e 100644 --- a/src/mame/drivers/seabattl.cpp +++ b/src/mame/drivers/seabattl.cpp @@ -44,19 +44,15 @@ the sound board should be fully discrete. class seabattl_state : public driver_device { public: - seabattl_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + seabattl_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_objram(*this, "objram"), - m_digit0(*this, "sc_thousand"), - m_digit1(*this, "sc_hundred"), - m_digit2(*this, "sc_half"), - m_digit3(*this, "sc_unity"), - m_digit4(*this, "tm_half"), - m_digit5(*this, "tm_unity"), + m_digits(*this, { "sc_thousand", "sc_hundred", "sc_half", "sc_unity", "tm_half", "tm_unity" }), m_s2636(*this, "s2636"), + m_7segs(*this, "digit%u", 0U), m_waveenable(false), m_collision(0), m_gfxdecode(*this, "gfxdecode"), @@ -69,13 +65,9 @@ public: required_shared_ptr m_videoram; required_shared_ptr m_colorram; required_shared_ptr m_objram; - required_device m_digit0; - required_device m_digit1; - required_device m_digit2; - required_device m_digit3; - required_device m_digit4; - required_device m_digit5; + required_device_array m_digits; required_device m_s2636; + output_finder<6> m_7segs; tilemap_t *m_bg_tilemap; bitmap_ind16 m_collision_bg; @@ -92,6 +84,7 @@ public: DECLARE_WRITE8_MEMBER(time_display_w); DECLARE_WRITE8_MEMBER(score_display_w); DECLARE_WRITE8_MEMBER(score2_display_w); + template DECLARE_WRITE8_MEMBER( digit_w ) { m_7segs[N] = data; } INTERRUPT_GEN_MEMBER(seabattl_interrupt); @@ -239,6 +232,7 @@ uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_in void seabattl_state::video_start() { + m_7segs.resolve(); m_screen->register_screen_bitmap(m_collision_bg); m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(seabattl_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); m_bg_tilemap->set_transparent_pen(0); @@ -339,20 +333,20 @@ WRITE8_MEMBER(seabattl_state::sound2_w ) WRITE8_MEMBER(seabattl_state::time_display_w ) { - m_digit5->a_w(data & 0x0f); - m_digit4->a_w((data >> 4) & 0x0f); + m_digits[5]->a_w(data & 0x0f); + m_digits[4]->a_w((data >> 4) & 0x0f); } WRITE8_MEMBER(seabattl_state::score_display_w ) { - m_digit3->a_w(data & 0x0f); - m_digit2->a_w((data >> 4) & 0x0f); + m_digits[3]->a_w(data & 0x0f); + m_digits[2]->a_w((data >> 4) & 0x0f); } WRITE8_MEMBER(seabattl_state::score2_display_w ) { - m_digit1->a_w(data & 0x0f); - m_digit0->a_w((data >> 4) & 0x0f); + m_digits[1]->a_w(data & 0x0f); + m_digits[0]->a_w((data >> 4) & 0x0f); } @@ -492,17 +486,17 @@ MACHINE_CONFIG_START(seabattl_state::seabattl) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) MCFG_DEVICE_ADD("sc_thousand", DM9368, 0) - MCFG_OUTPUT_INDEX(0) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(seabattl_state, digit_w<0>)) MCFG_DEVICE_ADD("sc_hundred", DM9368, 0) - MCFG_OUTPUT_INDEX(1) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(seabattl_state, digit_w<1>)) MCFG_DEVICE_ADD("sc_half", DM9368, 0) - MCFG_OUTPUT_INDEX(2) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(seabattl_state, digit_w<2>)) MCFG_DEVICE_ADD("sc_unity", DM9368, 0) - MCFG_OUTPUT_INDEX(3) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(seabattl_state, digit_w<3>)) MCFG_DEVICE_ADD("tm_half", DM9368, 0) - MCFG_OUTPUT_INDEX(4) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(seabattl_state, digit_w<4>)) MCFG_DEVICE_ADD("tm_unity", DM9368, 0) - MCFG_OUTPUT_INDEX(5) + MCFG_DM9368_UPDATE_CALLBACK(WRITE8(seabattl_state, digit_w<5>)) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/includes/elf.h b/src/mame/includes/elf.h index aaf0d798e97..7d0f089651e 100644 --- a/src/mame/includes/elf.h +++ b/src/mame/includes/elf.h @@ -1,10 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Curt Coder -#pragma once - #ifndef MAME_INCLUDES_ELF_H #define MAME_INCLUDES_ELF_H +#pragma once + #include "cpu/cosmac/cosmac.h" #include "imagedev/cassette.h" @@ -26,15 +26,16 @@ class elf2_state : public driver_device { public: elf2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_vdc(*this, CDP1861_TAG), - m_kb(*this, MM74C923_TAG), - m_led_l(*this, DM9368_L_TAG), - m_led_h(*this, DM9368_H_TAG), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_special(*this, "SPECIAL") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, CDP1802_TAG) + , m_vdc(*this, CDP1861_TAG) + , m_kb(*this, MM74C923_TAG) + , m_led_l(*this, DM9368_L_TAG) + , m_led_h(*this, DM9368_H_TAG) + , m_cassette(*this, "cassette") + , m_ram(*this, RAM_TAG) + , m_special(*this, "SPECIAL") + , m_7segs(*this, "digit%u", 0U) { } required_device m_maincpu; @@ -45,6 +46,7 @@ public: required_device m_cassette; required_device m_ram; required_ioport m_special; + output_finder<2> m_7segs; virtual void machine_start() override; @@ -60,6 +62,7 @@ public: DECLARE_WRITE8_MEMBER( sc_w ); DECLARE_WRITE_LINE_MEMBER( da_w ); DECLARE_INPUT_CHANGED_MEMBER( input_w ); + template DECLARE_WRITE8_MEMBER( digit_w ) { m_7segs[N] = data; } DECLARE_QUICKLOAD_LOAD_MEMBER( elf ); // display state