From e9c1f4a42a6758a6fb75403e28c7dc6cf869081c Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 17 Jun 2023 01:10:05 +1000 Subject: emu/devcb.h: Eliminated the need to call resolve() on callbacks. (#11333) Read callbacks now need a default return value supplied at construction. Replaced isnull() with isunset() which tells you if the callback wasn't configured rather than whether it isn't safe to call. Enabled validation of device callbacks (it seems it was disabled at some point, probably accidentally). Device callbacks and object finders now implement the same interface for resolution. --- src/devices/sound/tms5110.cpp | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'src/devices/sound/tms5110.cpp') diff --git a/src/devices/sound/tms5110.cpp b/src/devices/sound/tms5110.cpp index 62b43b42173..42899a0ac4d 100644 --- a/src/devices/sound/tms5110.cpp +++ b/src/devices/sound/tms5110.cpp @@ -149,13 +149,10 @@ static int16_t clip_analog(int16_t cliptemp); void tms5110_device::new_int_write(uint8_t rc, uint8_t m0, uint8_t m1, uint8_t addr) { - if (!m_m0_cb.isnull()) - m_m0_cb(m0); - if (!m_m1_cb.isnull()) - m_m1_cb(m1); - if (!m_addr_cb.isnull()) - m_addr_cb((offs_t)0, addr); - if (!m_romclk_cb.isnull()) + m_m0_cb(m0); + m_m1_cb(m1); + m_addr_cb(offs_t(0), addr); + if (!m_romclk_cb.isunset()) { //printf("rc %d\n", rc); m_romclk_cb(rc); @@ -176,7 +173,7 @@ uint8_t tms5110_device::new_int_read() new_int_write(0, 1, 0, 0); // romclk 0, m0 1, m1 0, addr bus nybble = 0/open bus new_int_write(1, 0, 0, 0); // romclk 1, m0 0, m1 0, addr bus nybble = 0/open bus new_int_write(0, 0, 0, 0); // romclk 0, m0 0, m1 0, addr bus nybble = 0/open bus - if (!m_data_cb.isnull()) + if (!m_data_cb.isunset()) return m_data_cb(); if (DEBUG_5110) logerror("WARNING: CALLBACK MISSING, RETURNING 0!\n"); return 0; @@ -1040,13 +1037,6 @@ void tms5110_device::device_start() fatalerror("Unknown variant in tms5110_create\n"); } - /* resolve lines */ - m_m0_cb.resolve(); - m_m1_cb.resolve(); - m_romclk_cb.resolve(); - m_addr_cb.resolve(); - m_data_cb.resolve(); - /* initialize a stream */ m_stream = stream_alloc(0, 1, clock() / 80); @@ -1355,10 +1345,6 @@ TIMER_CALLBACK_MEMBER(tmsprom_device::update_romclk) void tmsprom_device::device_start() { - /* resolve lines */ - m_pdc_cb.resolve_safe(); - m_ctl_cb.resolve_safe(); - m_romclk_timer = timer_alloc(FUNC(tmsprom_device::update_romclk), this); m_romclk_timer->adjust(attotime::zero, 0, attotime::from_hz(clock())); @@ -1450,7 +1436,7 @@ tms5110_device::tms5110_device(const machine_config &mconfig, device_type type, , m_m0_cb(*this) , m_m1_cb(*this) , m_addr_cb(*this) - , m_data_cb(*this) + , m_data_cb(*this, 0) , m_romclk_cb(*this) { } -- cgit v1.2.3-70-g09d2