From 2e3ccabfc09989aacb8209d990706386cba81fda Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Wed, 5 Sep 2018 09:44:34 +0200 Subject: A better way of doing scanline timers, nw --- src/devices/machine/timer.h | 6 ++++++ src/mame/drivers/apple2e.cpp | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/devices/machine/timer.h b/src/devices/machine/timer.h index 44a7582bec7..c09132afb16 100644 --- a/src/devices/machine/timer.h +++ b/src/devices/machine/timer.h @@ -95,6 +95,12 @@ public: m_first_vpos = first_vpos; m_increment = increment; } + template void configure_scanline(void (FunctionClass::*callback)(timer_device &, void *, s32), + const char *name, const char *screen, int first_vpos, int increment) + { + configure_scanline(expired_delegate(callback, name, nullptr, static_cast(nullptr)), screen, first_vpos, increment); + } + template void set_callback(Object &&cb) { m_callback = std::forward(cb); } void set_start_delay(const attotime &delay) { m_start_delay = delay; } void config_param(int param) { m_param = param; } diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 69c438f3e0b..40f39bd9fd3 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -3975,15 +3975,12 @@ static void apple2eaux_cards(device_slot_interface &device) device.option_add("rw3", A2EAUX_RAMWORKS3); /* Applied Engineering RamWorks III */ } -#define NOMCFG_TIMER_DRIVER_ADD_SCANLINE(_class, _callback, _screen, _first_vpos, _increment) \ - configure_scanline(timer_device::expired_delegate(&_class::_callback, #_class "::" #_callback, nullptr, (_class *)nullptr), _screen, _first_vpos, _increment); - MACHINE_CONFIG_START(apple2e_state::apple2e) /* basic machine hardware */ M6502(config, m_maincpu, 1021800); m_maincpu->set_addrmap(AS_PROGRAM, &apple2e_state::apple2e_map); TIMER(config, m_scantimer, 0); - m_scantimer->NOMCFG_TIMER_DRIVER_ADD_SCANLINE(apple2e_state, apple2_interrupt, "screen", 0, 1) + m_scantimer->configure_scanline(FUNC(apple2e_state::apple2_interrupt), "screen", 0, 1); config.m_minimum_quantum = attotime::from_hz(60); APPLE2_VIDEO(config, m_video, XTAL(14'318'181)); -- cgit v1.2.3