From d73d7c09fe2dd2f96bace50ef63d4110831aa858 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 9 Oct 2012 08:36:46 +0000 Subject: [PATCH] Added support for DEVCB_UNMAPPED, that will do the logging on read/write of device callback, preventing a need for making dummy log line handlers [Miodrag Milanovic] --- src/emu/devcb.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++ src/emu/devcb.h | 11 +++++- 2 files changed, 110 insertions(+), 1 deletion(-) diff --git a/src/emu/devcb.c b/src/emu/devcb.c index b1f3c5b0dbe..1a27454d59c 100644 --- a/src/emu/devcb.c +++ b/src/emu/devcb.c @@ -208,6 +208,12 @@ void devcb_resolved_read_line::resolve(const devcb_read_line &desc, device_t &de m_object.constant = desc.index; *static_cast(this) = devcb_read_line_delegate(&devcb_resolved_read_line::from_constant, "constant", this); break; + + case DEVCB_TYPE_UNMAP: + m_helper.null_indicator = &s_null; + m_object.device = &device; + *static_cast(this) = devcb_read_line_delegate(&devcb_resolved_read_line::from_unmap, "unmap", this); + break; } } @@ -244,6 +250,17 @@ int devcb_resolved_read_line::from_constant() return (m_object.constant & 1) ? ASSERT_LINE : CLEAR_LINE; } +//------------------------------------------------- +// from_constant - helper to convert from a +// unmap value to a line value +//------------------------------------------------- + +int devcb_resolved_read_line::from_unmap() +{ + logerror("%s: unmapped devcb read\n", + m_object.device->tag()); + return CLEAR_LINE; +} //************************************************************************** @@ -303,6 +320,12 @@ void devcb_resolved_write_line::resolve(const devcb_write_line &desc, device_t & m_helper.input_line = desc.index; *static_cast(this) = devcb_write_line_delegate(&devcb_resolved_write_line::to_input, desc.tag, this); break; + + case DEVCB_TYPE_UNMAP: + m_helper.null_indicator = &s_null; + m_object.device = &device; + *static_cast(this) = devcb_write_line_delegate(&devcb_resolved_write_line::to_unmap, "unmap", this); + break; } } @@ -315,6 +338,16 @@ void devcb_resolved_write_line::to_null(int state) { } +//------------------------------------------------- +// to_unmap - helper to handle a unmap write +//------------------------------------------------- + +void devcb_resolved_write_line::to_unmap(int state) +{ + logerror("%s: unmapped devcb write %s\n", + m_object.device->tag(), + core_i64_format(state, 2 * sizeof(UINT8),false)); +} //------------------------------------------------- // to_port - helper to convert to an I/O port @@ -410,6 +443,12 @@ void devcb_resolved_read8::resolve(const devcb_read8 &desc, device_t &device) m_object.constant = desc.index; *static_cast(this) = devcb_read8_delegate(&devcb_resolved_read8::from_constant, "constant", this); break; + + case DEVCB_TYPE_UNMAP: + m_helper.null_indicator = &s_null; + m_object.device = &device; + *static_cast(this) = devcb_read8_delegate(&devcb_resolved_read8::from_unmap, "unmap", this); + break; } } @@ -468,7 +507,17 @@ UINT8 devcb_resolved_read8::from_constant(offs_t offset, UINT8 mem_mask) return m_object.constant; } +//------------------------------------------------- +// from_constant - helper to convert from a +// unmap value to an 8-bit value +//------------------------------------------------- +UINT8 devcb_resolved_read8::from_unmap(offs_t offset, UINT8 mem_mask) +{ + logerror("%s: unmapped devcb read\n", + m_object.device->tag()); + return 0; +} //************************************************************************** // DEVCB RESOLVED WRITE8 @@ -530,6 +579,12 @@ void devcb_resolved_write8::resolve(const devcb_write8 &desc, device_t &device) m_helper.input_line = desc.index; *static_cast(this) = devcb_write8_delegate(&devcb_resolved_write8::to_input, desc.tag, this); break; + + case DEVCB_TYPE_UNMAP: + m_helper.null_indicator = &s_null; + m_object.device = &device; + *static_cast(this) = devcb_write8_delegate(&devcb_resolved_write8::to_unmap, "unmap", this); + break; } } @@ -542,6 +597,17 @@ void devcb_resolved_write8::to_null(offs_t offset, UINT8 data, UINT8 mem_mask) { } +//------------------------------------------------- +// to_unmap - helper to handle a unmap write +//------------------------------------------------- + +void devcb_resolved_write8::to_unmap(offs_t offset, UINT8 data, UINT8 mem_mask) +{ + logerror("%s: unmapped devcb write %s & %s\n", + m_object.device->tag(), + core_i64_format(data, 2 * sizeof(UINT8),false), + core_i64_format(mem_mask, 2 * sizeof(UINT8),false)); +} //------------------------------------------------- // to_port - helper to convert to an I/O port @@ -658,6 +724,12 @@ void devcb_resolved_read16::resolve(const devcb_read16 &desc, device_t &device) m_object.constant = desc.index; *static_cast(this) = devcb_read16_delegate(&devcb_resolved_read16::from_constant, "constant", this); break; + + case DEVCB_TYPE_UNMAP: + m_helper.null_indicator = &s_null; + m_object.device = &device; + *static_cast(this) = devcb_read16_delegate(&devcb_resolved_read16::from_unmap, "unmap", this); + break; } } @@ -705,7 +777,17 @@ UINT16 devcb_resolved_read16::from_constant(offs_t offset, UINT16 mask) return m_object.constant; } +//------------------------------------------------- +// from_constant - helper to convert from a +// unmap value to a 16-bit value +//------------------------------------------------- +UINT16 devcb_resolved_read16::from_unmap(offs_t offset, UINT16 mem_mask) +{ + logerror("%s: unmapped devcb read\n", + m_object.device->tag()); + return 0; +} //************************************************************************** // DEVCB RESOLVED WRITE16 @@ -766,6 +848,12 @@ void devcb_resolved_write16::resolve(const devcb_write16 &desc, device_t &device m_helper.input_line = desc.index; *static_cast(this) = devcb_write16_delegate(&devcb_resolved_write16::to_input, desc.tag, this); break; + + case DEVCB_TYPE_UNMAP: + m_helper.null_indicator = &s_null; + m_object.device = &device; + *static_cast(this) = devcb_write16_delegate(&devcb_resolved_write16::to_unmap, "unmap", this); + break; } } @@ -779,6 +867,18 @@ void devcb_resolved_write16::to_null(offs_t offset, UINT16 data, UINT16 mask) } +//------------------------------------------------- +// to_unmap - helper to handle a unmap write +//------------------------------------------------- + +void devcb_resolved_write16::to_unmap(offs_t offset, UINT16 data, UINT16 mask) +{ + logerror("%s: unmapped devcb write %s & %s\n", + m_object.device->tag(), + core_i64_format(data, 2 * sizeof(UINT16),false), + core_i64_format(mask, 2 * sizeof(UINT16),false)); +} + //------------------------------------------------- // to_port - helper to convert to an I/O port // value from a line value diff --git a/src/emu/devcb.h b/src/emu/devcb.h index a440083cf42..03d4f33a256 100644 --- a/src/emu/devcb.h +++ b/src/emu/devcb.h @@ -90,7 +90,8 @@ enum DEVCB_TYPE_DEVICE, // device read/write DEVCB_TYPE_LEGACY_SPACE, // legacy address space read/write DEVCB_TYPE_INPUT_LINE, // device input line write - DEVCB_TYPE_CONSTANT // constant value read + DEVCB_TYPE_CONSTANT, // constant value read + DEVCB_TYPE_UNMAP // unmapped line }; @@ -176,6 +177,8 @@ void devcb_stub16(device_t *device, address_space &space, offs_t offset, UINT16 #define DEVCB_LINE_GND DEVCB_CONSTANT(0) #define DEVCB_LINE_VCC DEVCB_CONSTANT(1) +#define DEVCB_UNMAPPED { DEVCB_TYPE_UNMAP, 0, NULL, NULL, NULL, NULL } + // read/write handlers for a given CPU's address space #define DEVCB_MEMORY_HANDLER(cpu,space,func) { DEVCB_TYPE_LEGACY_SPACE, AS_##space, (cpu), #func, NULL, NULL, func } @@ -280,6 +283,7 @@ private: int from_port(); int from_read8(); int from_constant(); + int from_unmap(); // internal state devcb_resolved_objects m_object; @@ -330,6 +334,7 @@ private: void to_port(int state); void to_write8(int state); void to_input(int state); + void to_unmap(int state); // internal state devcb_resolved_objects m_object; @@ -384,6 +389,7 @@ private: UINT8 from_read8device(offs_t offset, UINT8 mem_mask); UINT8 from_readline(offs_t offset, UINT8 mem_mask); UINT8 from_constant(offs_t offset, UINT8 mem_mask); + UINT8 from_unmap(offs_t offset, UINT8 mem_mask); // internal state devcb_resolved_objects m_object; @@ -439,6 +445,7 @@ private: void to_write8device(offs_t offset, UINT8 data, UINT8 mem_mask); void to_writeline(offs_t offset, UINT8 data, UINT8 mem_mask); void to_input(offs_t offset, UINT8 data, UINT8 mem_mask); + void to_unmap(offs_t offset, UINT8 data, UINT8 mem_mask); // internal state devcb_resolved_objects m_object; @@ -492,6 +499,7 @@ private: UINT16 from_read16(offs_t offset, UINT16 mask); UINT16 from_readline(offs_t offset, UINT16 mask); UINT16 from_constant(offs_t offset, UINT16 mask); + UINT16 from_unmap(offs_t offset, UINT16 mask); // internal state devcb_resolved_objects m_object; @@ -546,6 +554,7 @@ private: void to_write16(offs_t offset, UINT16 data, UINT16 mask); void to_writeline(offs_t offset, UINT16 data, UINT16 mask); void to_input(offs_t offset, UINT16 data, UINT16 mask); + void to_unmap(offs_t offset, UINT16 data, UINT16 mask); // internal state devcb_resolved_objects m_object;