void devcb_write_base::resolve() { // first resolve any address spaces if (m_space_tag != nullptr) resolve_space(); else m_space = &downcast<driver_device &>(m_device.machine().root_device()).generic_space(); // then handle the various types const char *name = "unknown"; try { switch (m_type) { case CALLBACK_NONE: break; case CALLBACK_LINE: name = m_writeline.name(); m_writeline.bind_relative_to(*m_device.owner()); m_adapter = m_writeline.isnull() ? &devcb_write_base::write_noop_adapter : &devcb_write_base::write_line_adapter; break; case CALLBACK_8: name = m_write8.name(); m_write8.bind_relative_to(*m_device.owner()); m_adapter = m_write8.isnull() ? &devcb_write_base::write_noop_adapter : &devcb_write_base::write8_adapter; break; case CALLBACK_16: name = m_write16.name(); m_write16.bind_relative_to(*m_device.owner()); m_adapter = m_write16.isnull() ? &devcb_write_base::write_noop_adapter : &devcb_write_base::write16_adapter; break; case CALLBACK_32: name = m_write32.name(); m_write32.bind_relative_to(*m_device.owner()); m_adapter = m_write32.isnull() ? &devcb_write_base::write_noop_adapter : &devcb_write_base::write32_adapter; break; case CALLBACK_64: name = m_write64.name(); m_write64.bind_relative_to(*m_device.owner()); m_adapter = m_write64.isnull() ? &devcb_write_base::write_noop_adapter : &devcb_write_base::write64_adapter; break; case CALLBACK_IOPORT: resolve_ioport(); m_adapter = (m_target.ioport == nullptr) ? &devcb_write_base::write_noop_adapter : &devcb_write_base::write_ioport_adapter; break; case CALLBACK_LOG: m_adapter = &devcb_write_base::write_logged_adapter; break; case CALLBACK_CONSTANT: m_adapter = &devcb_write_base::write_noop_adapter; break; case CALLBACK_INPUTLINE: resolve_inputline(); m_adapter = &devcb_write_base::write_inputline_adapter; break; } } catch (binding_type_exception &binderr) { throw emu_fatalerror("devcb_write: Error performing a late bind of type %s to %s (name=%s)\n", binderr.m_actual_type.name(), binderr.m_target_type.name(), name); } }
void devcb2_read_base::resolve() { // first resolve any address spaces if (m_space_tag != NULL) resolve_space(); else m_space = &downcast<driver_device &>(m_device.machine().root_device()).generic_space(); // then handle the various types const char *name = "unknown"; try { switch (m_type) { case CALLBACK_NONE: break; case CALLBACK_LINE: name = m_readline.name(); m_readline.bind_relative_to(*m_device.owner()); m_target_int = 0; m_adapter = m_readline.isnull() ? &devcb2_read_base::read_constant_adapter : &devcb2_read_base::read_line_adapter; break; case CALLBACK_8: name = m_read8.name(); m_read8.bind_relative_to(*m_device.owner()); m_target_int = 0; m_adapter = m_read8.isnull() ? &devcb2_read_base::read_constant_adapter : &devcb2_read_base::read8_adapter; break; case CALLBACK_16: name = m_read16.name(); m_read16.bind_relative_to(*m_device.owner()); m_target_int = 0; m_adapter = m_read16.isnull() ? &devcb2_read_base::read_constant_adapter : &devcb2_read_base::read16_adapter; break; case CALLBACK_32: name = m_read32.name(); m_read32.bind_relative_to(*m_device.owner()); m_target_int = 0; m_adapter = m_read32.isnull() ? &devcb2_read_base::read_constant_adapter : &devcb2_read_base::read32_adapter; break; case CALLBACK_64: name = m_read64.name(); m_read64.bind_relative_to(*m_device.owner()); m_target_int = 0; m_adapter = m_read64.isnull() ? &devcb2_read_base::read_constant_adapter : &devcb2_read_base::read64_adapter; break; case CALLBACK_IOPORT: resolve_ioport(); m_target_int = 0; m_adapter = (m_target.ioport == NULL) ? &devcb2_read_base::read_constant_adapter : &devcb2_read_base::read_ioport_adapter; break; case CALLBACK_LOG: m_adapter = &devcb2_read_base::read_logged_adapter; break; case CALLBACK_CONSTANT: m_adapter = &devcb2_read_base::read_constant_adapter; break; case CALLBACK_INPUTLINE: throw emu_fatalerror("Device read callbacks can't be connected to input lines\n"); } } catch (binding_type_exception &binderr) { throw emu_fatalerror("devcb2_read: Error performing a late bind of type %s to %s (name=%s)\n", binderr.m_actual_type.name(), binderr.m_target_type.name(), name); } }