Previous 199869 Revisions Next

r18368 Tuesday 9th October, 2012 at 08:36:46 UTC by Miodrag Milanović
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 devcb.h

trunk/src/emu/devcb.c
r18367r18368
208208         m_object.constant = desc.index;
209209         *static_cast<devcb_read_line_delegate *>(this) = devcb_read_line_delegate(&devcb_resolved_read_line::from_constant, "constant", this);
210210         break;
211
212      case DEVCB_TYPE_UNMAP:
213         m_helper.null_indicator = &s_null;
214         m_object.device = &device;
215         *static_cast<devcb_read_line_delegate *>(this) = devcb_read_line_delegate(&devcb_resolved_read_line::from_unmap, "unmap", this);
216         break;
211217   }
212218}
213219
r18367r18368
244250   return (m_object.constant & 1) ? ASSERT_LINE : CLEAR_LINE;
245251}
246252
253//-------------------------------------------------
254//  from_constant - helper to convert from a
255//  unmap value to a line value
256//-------------------------------------------------
247257
258int devcb_resolved_read_line::from_unmap()
259{
260   logerror("%s: unmapped devcb read\n",
261               m_object.device->tag());
262   return CLEAR_LINE;
263}
248264
265
249266//**************************************************************************
250267//  DEVCB RESOLVED WRITE LINE
251268//**************************************************************************
r18367r18368
303320         m_helper.input_line = desc.index;
304321         *static_cast<devcb_write_line_delegate *>(this) = devcb_write_line_delegate(&devcb_resolved_write_line::to_input, desc.tag, this);
305322         break;
323
324      case DEVCB_TYPE_UNMAP:
325         m_helper.null_indicator = &s_null;
326         m_object.device = &device;
327         *static_cast<devcb_write_line_delegate *>(this) = devcb_write_line_delegate(&devcb_resolved_write_line::to_unmap, "unmap", this);
328         break;
306329   }
307330}
308331
r18367r18368
315338{
316339}
317340
341//-------------------------------------------------
342//  to_unmap - helper to handle a unmap write
343//-------------------------------------------------
318344
345void devcb_resolved_write_line::to_unmap(int state)
346{
347   logerror("%s: unmapped devcb write %s\n",
348               m_object.device->tag(),
349               core_i64_format(state, 2 * sizeof(UINT8),false));
350}
351
319352//-------------------------------------------------
320353//  to_port - helper to convert to an I/O port
321354//  value from a line value
r18367r18368
410443         m_object.constant = desc.index;
411444         *static_cast<devcb_read8_delegate *>(this) = devcb_read8_delegate(&devcb_resolved_read8::from_constant, "constant", this);
412445         break;
446
447      case DEVCB_TYPE_UNMAP:
448         m_helper.null_indicator = &s_null;
449         m_object.device = &device;
450         *static_cast<devcb_read8_delegate *>(this) = devcb_read8_delegate(&devcb_resolved_read8::from_unmap, "unmap", this);
451         break;
413452   }
414453}
415454
r18367r18368
468507   return m_object.constant;
469508}
470509
510//-------------------------------------------------
511//  from_constant - helper to convert from a
512//  unmap value to an 8-bit value
513//-------------------------------------------------
471514
515UINT8 devcb_resolved_read8::from_unmap(offs_t offset, UINT8 mem_mask)
516{
517   logerror("%s: unmapped devcb read\n",
518               m_object.device->tag());
519   return 0;
520}
472521
473522//**************************************************************************
474523//  DEVCB RESOLVED WRITE8
r18367r18368
530579         m_helper.input_line = desc.index;
531580         *static_cast<devcb_write8_delegate *>(this) = devcb_write8_delegate(&devcb_resolved_write8::to_input, desc.tag, this);
532581         break;
582
583      case DEVCB_TYPE_UNMAP:
584         m_helper.null_indicator = &s_null;
585         m_object.device = &device;
586         *static_cast<devcb_write8_delegate *>(this) = devcb_write8_delegate(&devcb_resolved_write8::to_unmap, "unmap", this);
587         break;
533588   }
534589}
535590
r18367r18368
542597{
543598}
544599
600//-------------------------------------------------
601//  to_unmap - helper to handle a unmap write
602//-------------------------------------------------
545603
604void devcb_resolved_write8::to_unmap(offs_t offset, UINT8 data, UINT8 mem_mask)
605{
606   logerror("%s: unmapped devcb write %s & %s\n",
607            m_object.device->tag(),
608            core_i64_format(data, 2 * sizeof(UINT8),false),
609            core_i64_format(mem_mask, 2 * sizeof(UINT8),false));
610}
611
546612//-------------------------------------------------
547613//  to_port - helper to convert to an I/O port
548614//  value from a line value
r18367r18368
658724         m_object.constant = desc.index;
659725         *static_cast<devcb_read16_delegate *>(this) = devcb_read16_delegate(&devcb_resolved_read16::from_constant, "constant", this);
660726         break;
727
728      case DEVCB_TYPE_UNMAP:
729         m_helper.null_indicator = &s_null;
730         m_object.device = &device;
731         *static_cast<devcb_read16_delegate *>(this) = devcb_read16_delegate(&devcb_resolved_read16::from_unmap, "unmap", this);
732         break;
661733   }
662734}
663735
r18367r18368
705777   return m_object.constant;
706778}
707779
780//-------------------------------------------------
781//  from_constant - helper to convert from a
782//  unmap value to a 16-bit value
783//-------------------------------------------------
708784
785UINT16 devcb_resolved_read16::from_unmap(offs_t offset, UINT16 mem_mask)
786{
787   logerror("%s: unmapped devcb read\n",
788               m_object.device->tag());
789   return 0;
790}
709791
710792//**************************************************************************
711793//  DEVCB RESOLVED WRITE16
r18367r18368
766848         m_helper.input_line = desc.index;
767849         *static_cast<devcb_write16_delegate *>(this) = devcb_write16_delegate(&devcb_resolved_write16::to_input, desc.tag, this);
768850         break;
851
852      case DEVCB_TYPE_UNMAP:
853         m_helper.null_indicator = &s_null;
854         m_object.device = &device;
855         *static_cast<devcb_write16_delegate *>(this) = devcb_write16_delegate(&devcb_resolved_write16::to_unmap, "unmap", this);
856         break;
769857   }
770858}
771859
r18367r18368
780868
781869
782870//-------------------------------------------------
871//  to_unmap - helper to handle a unmap write
872//-------------------------------------------------
873
874void devcb_resolved_write16::to_unmap(offs_t offset, UINT16 data, UINT16 mask)
875{
876   logerror("%s: unmapped devcb write %s & %s\n",
877            m_object.device->tag(),
878            core_i64_format(data, 2 * sizeof(UINT16),false),
879            core_i64_format(mask, 2 * sizeof(UINT16),false));
880}
881
882//-------------------------------------------------
783883//  to_port - helper to convert to an I/O port
784884//  value from a line value
785885//-------------------------------------------------
trunk/src/emu/devcb.h
r18367r18368
9090   DEVCB_TYPE_DEVICE,            // device read/write
9191   DEVCB_TYPE_LEGACY_SPACE,      // legacy address space read/write
9292   DEVCB_TYPE_INPUT_LINE,         // device input line write
93   DEVCB_TYPE_CONSTANT            // constant value read
93   DEVCB_TYPE_CONSTANT,         // constant value read
94   DEVCB_TYPE_UNMAP            // unmapped line
9495};
9596
9697
r18367r18368
176177#define DEVCB_LINE_GND                     DEVCB_CONSTANT(0)
177178#define DEVCB_LINE_VCC                     DEVCB_CONSTANT(1)
178179
180#define DEVCB_UNMAPPED                     { DEVCB_TYPE_UNMAP, 0, NULL, NULL, NULL, NULL }
181
179182// read/write handlers for a given CPU's address space
180183#define DEVCB_MEMORY_HANDLER(cpu,space,func)   { DEVCB_TYPE_LEGACY_SPACE, AS_##space, (cpu), #func, NULL, NULL, func }
181184
r18367r18368
280283   int from_port();
281284   int from_read8();
282285   int from_constant();
286   int from_unmap();
283287
284288   // internal state
285289   devcb_resolved_objects         m_object;
r18367r18368
330334   void to_port(int state);
331335   void to_write8(int state);
332336   void to_input(int state);
337   void to_unmap(int state);
333338
334339   // internal state
335340   devcb_resolved_objects         m_object;
r18367r18368
384389   UINT8 from_read8device(offs_t offset, UINT8 mem_mask);
385390   UINT8 from_readline(offs_t offset, UINT8 mem_mask);
386391   UINT8 from_constant(offs_t offset, UINT8 mem_mask);
392   UINT8 from_unmap(offs_t offset, UINT8 mem_mask);
387393
388394   // internal state
389395   devcb_resolved_objects         m_object;
r18367r18368
439445   void to_write8device(offs_t offset, UINT8 data, UINT8 mem_mask);
440446   void to_writeline(offs_t offset, UINT8 data, UINT8 mem_mask);
441447   void to_input(offs_t offset, UINT8 data, UINT8 mem_mask);
448   void to_unmap(offs_t offset, UINT8 data, UINT8 mem_mask);
442449
443450   // internal state
444451   devcb_resolved_objects         m_object;
r18367r18368
492499   UINT16 from_read16(offs_t offset, UINT16 mask);
493500   UINT16 from_readline(offs_t offset, UINT16 mask);
494501   UINT16 from_constant(offs_t offset, UINT16 mask);
502   UINT16 from_unmap(offs_t offset, UINT16 mask);
495503
496504   // internal state
497505   devcb_resolved_objects         m_object;
r18367r18368
546554   void to_write16(offs_t offset, UINT16 data, UINT16 mask);
547555   void to_writeline(offs_t offset, UINT16 data, UINT16 mask);
548556   void to_input(offs_t offset, UINT16 data, UINT16 mask);
557   void to_unmap(offs_t offset, UINT16 data, UINT16 mask);
549558
550559   // internal state
551560   devcb_resolved_objects         m_object;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team