// license:BSD-3-Clause // copyright-holders:Olivier Galibert // handler_entry_read_tap/handler_entry_write_tap // handler which tap on a bus access and possibly change the data value through a std::function template class handler_entry_read_tap : public handler_entry_read_passthrough { public: using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_read_passthrough; handler_entry_read_tap(address_space *space, memory_passthrough_handler &mph, std::string name, std::function tap) : handler_entry_read_passthrough(space, mph), m_name(name), m_tap(std::move(tap)) {} ~handler_entry_read_tap() = default; uX read(offs_t offset, uX mem_mask) override; std::string name() const override; handler_entry_read_tap *instantiate(handler_entry_read *next) const override; protected: std::string m_name; std::function m_tap; handler_entry_read_tap(address_space *space, memory_passthrough_handler &mph, handler_entry_read *next, std::string name, std::function tap) : handler_entry_read_passthrough(space, mph, next), m_name(name), m_tap(tap) {} }; template class handler_entry_write_tap : public handler_entry_write_passthrough { public: using uX = typename emu::detail::handler_entry_size::uX; using inh = handler_entry_write_passthrough; handler_entry_write_tap(address_space *space, memory_passthrough_handler &mph, std::string name, std::function tap) : handler_entry_write_passthrough(space, mph), m_name(name), m_tap(std::move(tap)) {} ~handler_entry_write_tap() = default; void write(offs_t offset, uX data, uX mem_mask) override; std::string name() const override; handler_entry_write_tap *instantiate(handler_entry_write *next) const override; protected: std::string m_name; std::function m_tap; handler_entry_write_tap(address_space *space, memory_passthrough_handler &mph, handler_entry_write *next, std::string name, std::function tap) : handler_entry_write_passthrough(space, mph, next), m_name(name), m_tap(tap) {} };