summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-10-18 15:28:00 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-10-18 15:28:00 +0000
commitc3ec783b3e3ba98e81cf982864d1b6ee9595590b (patch)
tree15003716989745c78cacd9081fab8d06e8512950
parent3c3f26a66ff25f34487261cfa67a79788881af8d (diff)
Added new devcb type DEVCB_TYPE_DRIVER, which implies the driver_device.
Added new macros DEVCB_DRIVER_LINE_MEMBER and DEVCB_DRIVER_MEMBER to specify member functions of the driver device in callbacks.
-rw-r--r--src/emu/devcb.c26
-rw-r--r--src/emu/devcb.h11
2 files changed, 28 insertions, 9 deletions
diff --git a/src/emu/devcb.c b/src/emu/devcb.c
index 4e78b674d4a..49c19dc3e08 100644
--- a/src/emu/devcb.c
+++ b/src/emu/devcb.c
@@ -68,11 +68,13 @@ void devcb_resolve_read_line(devcb_resolved_read_line *resolved, const devcb_rea
}
/* device handlers */
- else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF) && (config->readline != NULL || config->readdevice != NULL))
+ else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF || config->type == DEVCB_TYPE_DRIVER) && (config->readline != NULL || config->readdevice != NULL))
{
/* locate the device */
if (config->type == DEVCB_TYPE_SELF)
resolved->target = device;
+ else if (config->type == DEVCB_TYPE_DRIVER)
+ resolved->target = device->machine->driver_data();
else
resolved->target = device->siblingdevice(config->tag);
@@ -167,11 +169,13 @@ void devcb_resolve_write_line(devcb_resolved_write_line *resolved, const devcb_w
}
/* device handlers */
- else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF) && (config->writeline != NULL || config->writedevice != NULL))
+ else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF || config->type == DEVCB_TYPE_DRIVER) && (config->writeline != NULL || config->writedevice != NULL))
{
/* locate the device */
if (config->type == DEVCB_TYPE_SELF)
resolved->target = device;
+ else if (config->type == DEVCB_TYPE_DRIVER)
+ resolved->target = device->machine->driver_data();
else
resolved->target = device->siblingdevice(config->tag);
@@ -243,9 +247,14 @@ void devcb_resolve_read8(devcb_resolved_read8 *resolved, const devcb_read8 *conf
}
/* device handlers */
- else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF) && (config->readline != NULL || config->readdevice != NULL))
+ else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF || config->type == DEVCB_TYPE_DRIVER) && (config->readline != NULL || config->readdevice != NULL))
{
- resolved->target = (config->type == DEVCB_TYPE_SELF) ? device : device->machine->device(config->tag);
+ if (config->type == DEVCB_TYPE_SELF)
+ resolved->target = device;
+ else if (config->type == DEVCB_TYPE_DRIVER)
+ resolved->target = device->machine->driver_data();
+ else
+ resolved->target = device->siblingdevice(config->tag);
if (resolved->target == NULL)
fatalerror("devcb_resolve_read8: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
@@ -313,9 +322,14 @@ void devcb_resolve_write8(devcb_resolved_write8 *resolved, const devcb_write8 *c
}
/* device handlers */
- else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF) && (config->writeline != NULL || config->writedevice != NULL))
+ else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF || config->type == DEVCB_TYPE_DRIVER) && (config->writeline != NULL || config->writedevice != NULL))
{
- resolved->target = (config->type == DEVCB_TYPE_SELF) ? device : device->machine->device(config->tag);
+ if (config->type == DEVCB_TYPE_SELF)
+ resolved->target = device;
+ else if (config->type == DEVCB_TYPE_DRIVER)
+ resolved->target = device->machine->driver_data();
+ else
+ resolved->target = device->siblingdevice(config->tag);
if (resolved->target == NULL)
fatalerror("devcb_resolve_write8: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
diff --git a/src/emu/devcb.h b/src/emu/devcb.h
index a0c6834e3b8..457ae49f9d6 100644
--- a/src/emu/devcb.h
+++ b/src/emu/devcb.h
@@ -52,8 +52,9 @@
#define DEVCB_TYPE_SELF (1)
#define DEVCB_TYPE_INPUT (2)
#define DEVCB_TYPE_DEVICE (3)
-#define DEVCB_TYPE_MEMORY(space) (4 + (space))
-#define DEVCB_TYPE_CPU_LINE(line) (4 + ADDRESS_SPACES + (line))
+#define DEVCB_TYPE_DRIVER (4)
+#define DEVCB_TYPE_MEMORY(space) (5 + (space))
+#define DEVCB_TYPE_CPU_LINE(line) (5 + ADDRESS_SPACES + (line))
@@ -97,12 +98,16 @@ void devcb_stub(device_t *device, offs_t offset, UINT8 data)
/* standard line or read/write handlers with the calling device passed */
#define DEVCB_LINE(func) { DEVCB_TYPE_SELF, NULL, (func), NULL, NULL }
-#define DEVCB_LINE_MEMBER(func) { DEVCB_TYPE_SELF, NULL, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
+#define DEVCB_LINE_MEMBER(cls,memb) { DEVCB_TYPE_SELF, NULL, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
#define DEVCB_LINE_GND { DEVCB_TYPE_SELF, NULL, devcb_line_gnd_r, NULL, NULL }
#define DEVCB_LINE_VCC { DEVCB_TYPE_SELF, NULL, devcb_line_vcc_r, NULL, NULL }
#define DEVCB_HANDLER(func) { DEVCB_TYPE_SELF, NULL, NULL, (func), NULL }
#define DEVCB_MEMBER(cls,memb) { DEVCB_TYPE_SELF, NULL, NULL, &devcb_stub<cls, &cls::memb>, NULL }
+/* line or read/write handlers for the driver device */
+#define DEVCB_DRIVER_LINE_MEMBER(tag,cls,memb) { DEVCB_TYPE_DRIVER, NULL, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
+#define DEVCB_DRIVER_MEMBER(tag,cls,memb) { DEVCB_TYPE_DRIVER, NULL, NULL, &devcb_stub<cls, &cls::memb>, NULL }
+
/* line or read/write handlers for another device */
#define DEVCB_DEVICE_LINE(tag,func) { DEVCB_TYPE_DEVICE, tag, (func), NULL, NULL }
#define DEVCB_DEVICE_LINE_MEMBER(tag,cls,memb) { DEVCB_TYPE_DEVICE, tag, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }