From df821c674d47b9202add6573962c60cb0b8245fd Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Sun, 3 Jun 2018 19:54:49 +0200 Subject: No. --- src/emu/diexec.cpp | 23 ++++++++--------------- src/emu/diexec.h | 8 ++++---- src/mame/drivers/svision.cpp | 9 +++------ src/mame/includes/svision.h | 2 +- 4 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp index f77f58fa83f..c7f4752bd6d 100644 --- a/src/emu/diexec.cpp +++ b/src/emu/diexec.cpp @@ -46,7 +46,7 @@ device_execute_interface::device_execute_interface(const machine_config &mconfig : device_interface(device, "execute") , m_scheduler(nullptr) , m_disabled(false) - , m_vblank_interrupt_screen(nullptr) + , m_vblank_interrupt_screen(*this, finder_base::DUMMY_TAG) , m_timed_interrupt_period(attotime::zero) , m_nextexec(nullptr) , m_timedint_timer(nullptr) @@ -345,13 +345,12 @@ void device_execute_interface::execute_set_input(int linenum, int state) void device_execute_interface::interface_validity_check(validity_checker &valid) const { // validate the interrupts - if (!m_vblank_interrupt.isnull()) + if (!m_vblank_interrupt_screen) { - screen_device_iterator iter(device().mconfig().root_device()); - if (iter.first() == nullptr) - osd_printf_error("VBLANK interrupt specified, but the driver is screenless\n"); - else if (m_vblank_interrupt_screen != nullptr && device().siblingdevice(m_vblank_interrupt_screen) == nullptr) - osd_printf_error("VBLANK interrupt references a non-existant screen tag '%s'\n", m_vblank_interrupt_screen); + if (m_vblank_interrupt_screen.finder_tag() != finder_base::DUMMY_TAG) + osd_printf_error("VBLANK interrupt references non-existent screen tag %s\n", m_vblank_interrupt_screen.finder_tag()); + else if (!m_vblank_interrupt.isnull()) + osd_printf_error("VBLANK interrupt specified, but no screen configured\n"); } if (!m_timed_interrupt.isnull() && m_timed_interrupt_period == attotime::zero) @@ -443,14 +442,8 @@ void device_execute_interface::interface_post_reset() elem.reset(); // reconfingure VBLANK interrupts - if (m_vblank_interrupt_screen != nullptr) - { - // get the screen that will trigger the VBLANK - screen_device *screen = device().siblingdevice(m_vblank_interrupt_screen); - - assert(screen != nullptr); - screen->register_vblank_callback(vblank_state_delegate(&device_execute_interface::on_vblank, this)); - } + if (m_vblank_interrupt_screen) + m_vblank_interrupt_screen->register_vblank_callback(vblank_state_delegate(&device_execute_interface::on_vblank, this)); // reconfigure periodic interrupts if (m_timed_interrupt_period != attotime::zero) diff --git a/src/emu/diexec.h b/src/emu/diexec.h index 3c9d754434e..597f3186174 100644 --- a/src/emu/diexec.h +++ b/src/emu/diexec.h @@ -86,7 +86,7 @@ enum #define MCFG_DEVICE_VBLANK_INT_DEVICE(_tag, _devtag, _class, _func) \ dynamic_cast(*device).set_vblank_int(device_interrupt_delegate(&_class::_func, #_class "::" #_func, _devtag, (_class *)nullptr), _tag); #define MCFG_DEVICE_VBLANK_INT_REMOVE() \ - dynamic_cast(*device).set_vblank_int(device_interrupt_delegate(), nullptr); + dynamic_cast(*device).set_vblank_int(device_interrupt_delegate(), finder_base::DUMMY_TAG); #define MCFG_DEVICE_PERIODIC_INT_DRIVER(_class, _func, _rate) \ dynamic_cast(*device).set_periodic_int(device_interrupt_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr), attotime::from_hz(_rate)); #define MCFG_DEVICE_PERIODIC_INT_DEVICE(_devtag, _class, _func, _rate) \ @@ -140,10 +140,10 @@ public: // inline configuration helpers void set_disable() { m_disabled = true; } - template void set_vblank_int(Object &&cb, const char *tag, int rate = 0) + template void set_vblank_int(Object &&cb, T &&tag, int rate = 0) { m_vblank_interrupt = std::forward(cb); - m_vblank_interrupt_screen = tag; + m_vblank_interrupt_screen.set_tag(std::forward(tag)); } template void set_periodic_int(Object &&cb, const attotime &rate) { @@ -290,7 +290,7 @@ private: // configuration bool m_disabled; // disabled from executing? device_interrupt_delegate m_vblank_interrupt; // for interrupts tied to VBLANK - const char * m_vblank_interrupt_screen; // the screen that causes the VBLANK interrupt + optional_device m_vblank_interrupt_screen; // the screen that causes the VBLANK interrupt device_interrupt_delegate m_timed_interrupt; // for interrupts not tied to VBLANK attotime m_timed_interrupt_period; // period for periodic interrupts diff --git a/src/mame/drivers/svision.cpp b/src/mame/drivers/svision.cpp index 2aa5122d22d..a8b15a0a3f5 100644 --- a/src/mame/drivers/svision.cpp +++ b/src/mame/drivers/svision.cpp @@ -422,13 +422,10 @@ uint32_t svision_state::screen_update_tvlink(screen_device &screen, bitmap_rgb32 return 0; } -WRITE_LINE_MEMBER(svision_state::frame_int_w) +INTERRUPT_GEN_MEMBER(svision_state::svision_frame_int) { - if (!state) - return; - if (BIT(m_reg[BANK], 0)) - m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); + device.execute().pulse_input_line(INPUT_LINE_NMI, attotime::zero); m_sound->sound_decrement(); } @@ -522,6 +519,7 @@ MACHINE_CONFIG_START(svision_state::svision) MCFG_DEVICE_ADD(m_maincpu, M65C02, 4000000) MCFG_DEVICE_PROGRAM_MAP(svision_mem) + MCFG_DEVICE_VBLANK_INT_DRIVER(m_screen, svision_state, svision_frame_int) MCFG_SCREEN_ADD(m_screen, LCD) MCFG_SCREEN_REFRESH_RATE(61) @@ -529,7 +527,6 @@ MACHINE_CONFIG_START(svision_state::svision) MCFG_SCREEN_VISIBLE_AREA(3+0, 3+160-1, 0, 160-1) MCFG_SCREEN_UPDATE_DRIVER(svision_state, screen_update_svision) MCFG_SCREEN_PALETTE(m_palette) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, svision_state, frame_int_w)) MCFG_PALETTE_ADD(m_palette, ARRAY_LENGTH(svision_palette) * 3) MCFG_PALETTE_INIT_OWNER(svision_state, svision ) diff --git a/src/mame/includes/svision.h b/src/mame/includes/svision.h index 22f61f4d243..386ac2ff71d 100644 --- a/src/mame/includes/svision.h +++ b/src/mame/includes/svision.h @@ -62,7 +62,7 @@ public: void init_svision(); uint32_t screen_update_svision(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_tvlink(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(frame_int_w); + INTERRUPT_GEN_MEMBER(svision_frame_int); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(svision_cart); void svisionp(machine_config &config); -- cgit v1.2.3