mame/src/emu/emumem_heun.h
Olivier Galibert 639c9b85fc memory: Allow simplified versions of handlers [O. Galibert]
A standard memory handler has as a prototype (where uX = u8, u16, u32 or u64):
  uX device::read(address_space &space, offs_t offset, uX mem_mask);
  void device::write(address_space &space, offs_t offset, uX data, uX mem_mask);

We now allow simplified versions which are:
  uX device::read(offs_t offset, uX mem_mask);
  void device::write(offs_t offset, uX data, uX mem_mask);

  uX device::read(offs_t offset);
  void device::write(offs_t offset, uX data);

  uX device::read();
  void device::write(uX data);

Use them at will.  Also consider
(DECLARE_)(READ|WRITE)(8|16|32|64)_MEMBER on the way out, use the
explicit prototypes.

Same for lambdas in the memory map, the parameters are now optional
following the same combinations.
2018-08-02 21:08:47 +02:00

69 lines
2.2 KiB
C++

// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
// handler_entry_read_unmapped/handler_entry_write_unmapped
// Logs an unmapped access
template<int Width, int AddrShift, int Endian> class handler_entry_read_unmapped : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read<Width, AddrShift, Endian>;
handler_entry_read_unmapped(address_space *space) : handler_entry_read<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_read_unmapped() = default;
uX read(offs_t offset, uX mem_mask) override;
std::string name() const override;
};
template<int Width, int AddrShift, int Endian> class handler_entry_write_unmapped : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write<Width, AddrShift, Endian>;
handler_entry_write_unmapped(address_space *space) : handler_entry_write<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_write_unmapped() = default;
void write(offs_t offset, uX data, uX mem_mask) override;
std::string name() const override;
};
// handler_entry_read_nop/handler_entry_write_nop
// Drops an unmapped access silently
template<int Width, int AddrShift, int Endian> class handler_entry_read_nop : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_read<Width, AddrShift, Endian>;
handler_entry_read_nop(address_space *space) : handler_entry_read<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_read_nop() = default;
uX read(offs_t offset, uX mem_mask) override;
std::string name() const override;
};
template<int Width, int AddrShift, int Endian> class handler_entry_write_nop : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using inh = handler_entry_write<Width, AddrShift, Endian>;
handler_entry_write_nop(address_space *space) : handler_entry_write<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_write_nop() = default;
void write(offs_t offset, uX data, uX mem_mask) override;
std::string name() const override;
};