diff options
author | 2008-07-30 02:57:19 +0000 | |
---|---|---|
committer | 2008-07-30 02:57:19 +0000 | |
commit | 53491603bb05d412b70b2fb4fe3e29c41abdecc3 (patch) | |
tree | c4f7652d5a9c6a1338194605b917272fabd70807 /src/emu | |
parent | 3b3cd0ffb263c2958425201996ecac585435dcbd (diff) |
Added region and regionbytes fields to the deviceconfig, which are
auto-filled by the device manager before starting the device. This
simplifies the auto-binding process for devices.
Added new selector for device-specific ROM regions. Not yet wired
up in the ROM loader.
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/devintrf.c | 10 | ||||
-rw-r--r-- | src/emu/devintrf.h | 38 | ||||
-rw-r--r-- | src/emu/romload.h | 1 |
3 files changed, 30 insertions, 19 deletions
diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c index 5c03ab93e6f..bbd215e632f 100644 --- a/src/emu/devintrf.c +++ b/src/emu/devintrf.c @@ -471,8 +471,12 @@ void device_list_start(running_machine *machine) device->token = malloc_or_die(tokenlen); memset(device->token, 0, tokenlen); - /* call the start function */ + /* fill in the remaining runtime fields */ device->machine = machine; + device->region = memory_region(machine, device->tag); + device->regionbytes = memory_region_length(machine, device->tag); + + /* call the start function */ (*device->start)(device); } } @@ -502,8 +506,12 @@ static void device_list_stop(running_machine *machine) /* free allocated memory for the token */ if (device->token != NULL) free(device->token); + + /* reset all runtime fields */ device->token = NULL; device->machine = NULL; + device->region = NULL; + device->regionbytes = 0; } } diff --git a/src/emu/devintrf.h b/src/emu/devintrf.h index bdeb3052878..f744fc088bb 100644 --- a/src/emu/devintrf.h +++ b/src/emu/devintrf.h @@ -15,6 +15,7 @@ #define __DEVINTRF_H__ #include "mamecore.h" +#include "romload.h" /*************************************************************************** @@ -46,45 +47,43 @@ enum /* --- the following bits of info are returned as 64-bit signed integers --- */ DEVINFO_INT_FIRST = 0x00000, - DEVINFO_INT_TOKEN_BYTES = DEVINFO_INT_FIRST, /* R/O: bytes to allocate for the token */ - DEVINFO_INT_INLINE_CONFIG_BYTES, /* R/O: bytes to allocate for the inline configuration */ - DEVINFO_INT_CLASS, /* R/O: the device's class */ + DEVINFO_INT_TOKEN_BYTES = DEVINFO_INT_FIRST, /* R/O: bytes to allocate for the token */ + DEVINFO_INT_INLINE_CONFIG_BYTES, /* R/O: bytes to allocate for the inline configuration */ + DEVINFO_INT_CLASS, /* R/O: the device's class */ DEVINFO_INT_DEVICE_SPECIFIC = 0x08000, /* R/W: device-specific values start here */ - DEVINFO_INT_LAST = 0x0ffff, /* --- the following bits of info are returned as pointers --- */ DEVINFO_PTR_FIRST = 0x10000, + + DEVINFO_PTR_ROM_REGION = DEVINFO_PTR_FIRST, /* R/O: pointer to device-specific ROM region */ DEVINFO_PTR_DEVICE_SPECIFIC = 0x18000, /* R/W: device-specific values start here */ - DEVINFO_PTR_LAST = 0x1ffff, /* --- the following bits of info are returned as pointers to functions --- */ DEVINFO_FCT_FIRST = 0x20000, - DEVINFO_FCT_SET_INFO = DEVINFO_FCT_FIRST, /* R/O: device_set_info_func */ - DEVINFO_FCT_START, /* R/O: device_start_func */ - DEVINFO_FCT_STOP, /* R/O: device_stop_func */ - DEVINFO_FCT_RESET, /* R/O: device_reset_func */ - DEVINFO_FCT_VALIDITY_CHECK, /* R/O: device_validity_check_func */ + DEVINFO_FCT_SET_INFO = DEVINFO_FCT_FIRST, /* R/O: device_set_info_func */ + DEVINFO_FCT_START, /* R/O: device_start_func */ + DEVINFO_FCT_STOP, /* R/O: device_stop_func */ + DEVINFO_FCT_RESET, /* R/O: device_reset_func */ + DEVINFO_FCT_VALIDITY_CHECK, /* R/O: device_validity_check_func */ DEVINFO_FCT_DEVICE_SPECIFIC = 0x28000, /* R/W: device-specific values start here */ - DEVINFO_FCT_LAST = 0x2ffff, /* --- the following bits of info are returned as NULL-terminated strings --- */ DEVINFO_STR_FIRST = 0x30000, - DEVINFO_STR_NAME = DEVINFO_STR_FIRST, /* R/O: name of the device */ - DEVINFO_STR_FAMILY, /* R/O: family of the device */ - DEVINFO_STR_VERSION, /* R/O: version of the device */ - DEVINFO_STR_SOURCE_FILE, /* R/O: file containing the device implementation */ - DEVINFO_STR_CREDITS, /* R/O: credits for the device implementation */ + DEVINFO_STR_NAME = DEVINFO_STR_FIRST, /* R/O: name of the device */ + DEVINFO_STR_FAMILY, /* R/O: family of the device */ + DEVINFO_STR_VERSION, /* R/O: version of the device */ + DEVINFO_STR_SOURCE_FILE, /* R/O: file containing the device implementation */ + DEVINFO_STR_CREDITS, /* R/O: credits for the device implementation */ DEVINFO_STR_DEVICE_SPECIFIC = 0x38000, /* R/W: device-specific values start here */ - DEVINFO_STR_LAST = 0x3ffff }; @@ -155,6 +154,7 @@ union _deviceinfo device_stop_func stop; /* DEVINFO_FCT_STOP */ device_reset_func reset; /* DEVINFO_FCT_RESET */ device_validity_check_func validity_check; /* DEVINFO_FCT_VALIDITY_CHECK */ + const rom_entry * romregion; /* DEVINFO_PTR_ROM_REGION */ }; @@ -171,9 +171,11 @@ struct _device_config const void * static_config; /* static device configuration */ void * inline_config; /* inline device configuration */ - /* these two fields are only valid if the device is live */ + /* these four fields are only valid if the device is live */ void * token; /* token if device is live */ running_machine * machine; /* machine if device is live */ + UINT8 * region; /* pointer to region with the device's tag, or NULL */ + UINT32 regionbytes; /* size of the region, in bytes */ char tag[1]; /* tag for this instance */ }; diff --git a/src/emu/romload.h b/src/emu/romload.h index d8e6ab1ae35..00ebf6e9418 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -16,6 +16,7 @@ #include "mamecore.h" #include "chd.h" +#include "options.h" |