summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author mooglyguy <therealmogminer@gmail.com>2018-09-05 09:44:34 +0200
committer mooglyguy <therealmogminer@gmail.com>2018-09-05 09:44:45 +0200
commit2e3ccabfc09989aacb8209d990706386cba81fda (patch)
tree436f30436c39592a8e4bf3443cbc79cb195a462e
parent1e41f12ad2f7cb7e0055fe9643ffb3e363e81850 (diff)
A better way of doing scanline timers, nw
-rw-r--r--src/devices/machine/timer.h6
-rw-r--r--src/mame/drivers/apple2e.cpp5
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 <class FunctionClass> 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<FunctionClass *>(nullptr)), screen, first_vpos, increment);
+ }
+
template <typename Object> void set_callback(Object &&cb) { m_callback = std::forward<Object>(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));