Create address_space_debug_wrapper to deal with pedantic but common issue (nw)

This commit is contained in:
AJR 2016-08-18 17:36:29 -04:00
parent 4cc2a6b599
commit cb8d322890
2 changed files with 29 additions and 1 deletions

View File

@ -475,6 +475,33 @@ private:
};
// ======================> address_space_debug_wrapper
// wrapper for temporarily setting the debug flag on a memory space (especially one being accessed through another space)
class address_space_debug_wrapper
{
public:
// construction
address_space_debug_wrapper(address_space &space, bool debugger_access)
: m_target(space)
, m_prev_debugger_access(space.debugger_access())
{
space.set_debugger_access(debugger_access);
}
// destruction
~address_space_debug_wrapper() { m_target.set_debugger_access(m_prev_debugger_access); }
// getter
address_space &space() const { return m_target; }
private:
// internal state
address_space &m_target;
const bool m_prev_debugger_access;
};
// ======================> memory_block
// a memory block is a chunk of RAM associated with a range of memory in a device's address space

View File

@ -488,7 +488,8 @@ READ_LINE_MEMBER(skylncr_state::mbutrfly_prot_r)
READ8_MEMBER(skylncr_state::bdream97_opcode_r)
{
return m_maincpu->space(AS_PROGRAM).read_byte(offset) ^ 0x80;
address_space_debug_wrapper program(m_maincpu->space(AS_PROGRAM), space.debugger_access());
return program.space().read_byte(offset) ^ 0x80;
}