mirror of
https://github.com/holub/mame
synced 2025-06-29 07:34:45 +03:00
Delegatize dasm overrides (nw)
This commit is contained in:
parent
38c4b762f0
commit
7870e6d539
@ -21,7 +21,6 @@
|
||||
|
||||
device_disasm_interface::device_disasm_interface(const machine_config &mconfig, device_t &device)
|
||||
: device_interface(device, "disasm")
|
||||
, m_dasm_override(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -35,12 +34,24 @@ device_disasm_interface::~device_disasm_interface()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// interface_pre_start - work to be done prior to
|
||||
// actually starting a device
|
||||
//-------------------------------------------------
|
||||
|
||||
void device_disasm_interface::interface_pre_start()
|
||||
{
|
||||
// bind delegate
|
||||
m_dasm_override.bind_relative_to(*device().owner());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// static_set_dasm_override - configuration
|
||||
// helper to override disassemble function
|
||||
//-------------------------------------------------
|
||||
|
||||
void device_disasm_interface::static_set_dasm_override(device_t &device, dasm_override_func dasm_override)
|
||||
void device_disasm_interface::static_set_dasm_override(device_t &device, dasm_override_delegate dasm_override)
|
||||
{
|
||||
device_disasm_interface *dasm;
|
||||
if (!device.interface(dasm))
|
||||
@ -58,8 +69,8 @@ offs_t device_disasm_interface::disassemble(char *buffer, offs_t pc, const UINT8
|
||||
offs_t result = 0;
|
||||
|
||||
// check for disassembler override
|
||||
if (m_dasm_override != nullptr)
|
||||
result = (*m_dasm_override)(device(), buffer, pc, oprom, opram, options);
|
||||
if (!m_dasm_override.isnull())
|
||||
result = m_dasm_override(device(), buffer, pc, oprom, opram, options);
|
||||
if (result == 0)
|
||||
result = disasm_disassemble(buffer, pc, oprom, opram, options);
|
||||
|
||||
|
@ -45,7 +45,7 @@ const UINT32 DASMFLAG_LENGTHMASK = 0x0000ffff; // the low 16-bits contain t
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_DEVICE_DISASSEMBLE_OVERRIDE(_class, _func) \
|
||||
device_disasm_interface::static_set_dasm_override(*device, &_class::_func);
|
||||
device_disasm_interface::static_set_dasm_override(*device, dasm_override_delegate(&_class::_func, #_class "::" #_func, nullptr, (_class *)nullptr));
|
||||
|
||||
|
||||
|
||||
@ -53,13 +53,13 @@ const UINT32 DASMFLAG_LENGTHMASK = 0x0000ffff; // the low 16-bits contain t
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
typedef device_delegate<offs_t (device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options)> dasm_override_delegate;
|
||||
|
||||
// ======================> device_disasm_interface
|
||||
|
||||
// class representing interface-specific live disasm
|
||||
class device_disasm_interface : public device_interface
|
||||
{
|
||||
typedef offs_t (*dasm_override_func)(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
@ -71,7 +71,7 @@ public:
|
||||
UINT32 max_opcode_bytes() const { return disasm_max_opcode_bytes(); }
|
||||
|
||||
// static inline configuration helpers
|
||||
static void static_set_dasm_override(device_t &device, dasm_override_func dasm_override);
|
||||
static void static_set_dasm_override(device_t &device, dasm_override_delegate dasm_override);
|
||||
|
||||
// interface for disassembly
|
||||
offs_t disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options = 0);
|
||||
@ -82,8 +82,11 @@ protected:
|
||||
virtual UINT32 disasm_max_opcode_bytes() const = 0;
|
||||
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) = 0;
|
||||
|
||||
// interface-level overrides
|
||||
virtual void interface_pre_start();
|
||||
|
||||
private:
|
||||
dasm_override_func m_dasm_override; // pointer to provided override function
|
||||
dasm_override_delegate m_dasm_override; // provided override function
|
||||
};
|
||||
|
||||
// iterator
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
required_ioport m_io_penb;
|
||||
required_ioport m_io_portd;
|
||||
|
||||
static offs_t palm_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
|
||||
offs_t palm_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
|
||||
};
|
||||
|
||||
|
||||
|
@ -142,7 +142,7 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( cart_w ) { cart_w((bool) state); }
|
||||
|
||||
// disassembly override
|
||||
static offs_t dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
|
||||
offs_t dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
|
@ -557,7 +557,7 @@ public:
|
||||
void mac_driver_init(model_t model);
|
||||
void mac_install_memory(offs_t memory_begin, offs_t memory_end,
|
||||
offs_t memory_size, void *memory_data, int is_rom, const char *bank);
|
||||
static offs_t mac_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
|
||||
offs_t mac_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
|
||||
};
|
||||
|
||||
#endif /* MAC_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user