mirror of
https://github.com/holub/mame
synced 2025-05-21 21:29:15 +03:00
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.
This commit is contained in:
parent
3c3f26a66f
commit
c3ec783b3e
@ -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());
|
||||
|
||||
|
@ -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 }
|
||||
|
Loading…
Reference in New Issue
Block a user