summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/memory.c')
-rw-r--r--src/emu/memory.c51
1 files changed, 18 insertions, 33 deletions
diff --git a/src/emu/memory.c b/src/emu/memory.c
index 31341deef2b..f6221341374 100644
--- a/src/emu/memory.c
+++ b/src/emu/memory.c
@@ -823,24 +823,6 @@ void memory_init(running_machine *machine)
}
-/*-------------------------------------------------
- memory_find_address_space - find an address
- space in our internal list; for faster access
- use device->space[] after device is started
--------------------------------------------------*/
-
-const address_space *memory_find_address_space(const device_config *device, int spacenum)
-{
- memory_private *memdata = device->machine->memory_data;
- const address_space *space;
-
- for (space = memdata->spacelist; space != NULL; space = space->next)
- if (space->cpu == device && space->spacenum == spacenum)
- return space;
- return NULL;
-}
-
-
/***************************************************************************
ADDRESS MAPS
@@ -851,7 +833,7 @@ const address_space *memory_find_address_space(const device_config *device, int
address map for a device's address space
-------------------------------------------------*/
-address_map *address_map_alloc(const device_config *device, const game_driver *driver, int spacenum, void *memdata)
+address_map *address_map_alloc(const device_config *devconfig, const game_driver *driver, int spacenum, void *memdata)
{
const addrmap_token *internal_map;
const addrmap_token *default_map;
@@ -860,18 +842,18 @@ address_map *address_map_alloc(const device_config *device, const game_driver *d
map = global_alloc_clear(address_map);
/* append the internal device map (first so it takes priority) */
- internal_map = (const addrmap_token *)device_get_info_ptr(device, DEVINFO_PTR_INTERNAL_MEMORY_MAP + spacenum);
+ internal_map = (const addrmap_token *)devconfig->get_config_ptr(DEVINFO_PTR_INTERNAL_MEMORY_MAP + spacenum);
if (internal_map != NULL)
- map_detokenize((memory_private *)memdata, map, driver, device->tag, internal_map);
+ map_detokenize((memory_private *)memdata, map, driver, devconfig->tag, internal_map);
/* construct the standard map */
- if (device->address_map[spacenum] != NULL)
- map_detokenize((memory_private *)memdata, map, driver, device->tag, device->address_map[spacenum]);
+ if (devconfig->address_map[spacenum] != NULL)
+ map_detokenize((memory_private *)memdata, map, driver, devconfig->tag, devconfig->address_map[spacenum]);
/* append the default device map (last so it can be overridden) */
- default_map = (const addrmap_token *)device_get_info_ptr(device, DEVINFO_PTR_DEFAULT_MEMORY_MAP + spacenum);
+ default_map = (const addrmap_token *)devconfig->get_config_ptr(DEVINFO_PTR_DEFAULT_MEMORY_MAP + spacenum);
if (default_map != NULL)
- map_detokenize((memory_private *)memdata, map, driver, device->tag, default_map);
+ map_detokenize((memory_private *)memdata, map, driver, devconfig->tag, default_map);
return map;
}
@@ -1333,7 +1315,7 @@ UINT64 *_memory_install_handler64(const address_space *space, offs_t addrstart,
but explicitly for 8-bit handlers
-------------------------------------------------*/
-UINT8 *_memory_install_device_handler8(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_device_func rhandler, const char *rhandler_name, write8_device_func whandler, const char *whandler_name, int handlerunitmask)
+UINT8 *_memory_install_device_handler8(const address_space *space, running_device *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_device_func rhandler, const char *rhandler_name, write8_device_func whandler, const char *whandler_name, int handlerunitmask)
{
address_space *spacerw = (address_space *)space;
if (rhandler != NULL && (FPTR)rhandler < STATIC_COUNT)
@@ -1354,7 +1336,7 @@ UINT8 *_memory_install_device_handler8(const address_space *space, const device_
above but explicitly for 16-bit handlers
-------------------------------------------------*/
-UINT16 *_memory_install_device_handler16(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_device_func rhandler, const char *rhandler_name, write16_device_func whandler, const char *whandler_name, int handlerunitmask)
+UINT16 *_memory_install_device_handler16(const address_space *space, running_device *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_device_func rhandler, const char *rhandler_name, write16_device_func whandler, const char *whandler_name, int handlerunitmask)
{
address_space *spacerw = (address_space *)space;
if (rhandler != NULL && (FPTR)rhandler < STATIC_COUNT)
@@ -1375,7 +1357,7 @@ UINT16 *_memory_install_device_handler16(const address_space *space, const devic
above but explicitly for 32-bit handlers
-------------------------------------------------*/
-UINT32 *_memory_install_device_handler32(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_device_func rhandler, const char *rhandler_name, write32_device_func whandler, const char *whandler_name, int handlerunitmask)
+UINT32 *_memory_install_device_handler32(const address_space *space, running_device *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_device_func rhandler, const char *rhandler_name, write32_device_func whandler, const char *whandler_name, int handlerunitmask)
{
address_space *spacerw = (address_space *)space;
if (rhandler != NULL && (FPTR)rhandler < STATIC_COUNT)
@@ -1396,7 +1378,7 @@ UINT32 *_memory_install_device_handler32(const address_space *space, const devic
above but explicitly for 64-bit handlers
-------------------------------------------------*/
-UINT64 *_memory_install_device_handler64(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_device_func rhandler, const char *rhandler_name, write64_device_func whandler, const char *whandler_name, int handlerunitmask)
+UINT64 *_memory_install_device_handler64(const address_space *space, running_device *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_device_func rhandler, const char *rhandler_name, write64_device_func whandler, const char *whandler_name, int handlerunitmask)
{
address_space *spacerw = (address_space *)space;
if (rhandler != NULL && (FPTR)rhandler < STATIC_COUNT)
@@ -1703,7 +1685,7 @@ static void memory_init_spaces(running_machine *machine)
{
memory_private *memdata = machine->memory_data;
address_space **nextptr = (address_space **)&memdata->spacelist;
- const device_config *device;
+ running_device *device;
int spacenum;
/* create a global watchpoint-filled table */
@@ -1711,7 +1693,7 @@ static void memory_init_spaces(running_machine *machine)
memset(memdata->wptable, STATIC_WATCHPOINT, 1 << LEVEL1_BITS);
/* loop over devices */
- for (device = machine->config->devicelist.first(); device != NULL; device = device->next)
+ for (device = machine->devicelist.first(); device != NULL; device = device->next)
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
if (device_get_addrbus_width(device, spacenum) > 0)
{
@@ -1799,6 +1781,9 @@ static void memory_init_spaces(running_machine *machine)
/* link us in */
*nextptr = space;
nextptr = (address_space **)&space->next;
+
+ /* notify the deveice */
+ device->set_address_space(spacenum, space);
}
}
@@ -1824,7 +1809,7 @@ static void memory_init_preflight(running_machine *machine)
int entrynum;
/* allocate the address map */
- space->map = address_map_alloc(space->cpu, machine->gamedrv, space->spacenum, memdata);
+ space->map = address_map_alloc(&space->cpu->baseconfig(), machine->gamedrv, space->spacenum, memdata);
/* extract global parameters specified by the map */
space->unmap = (space->map->unmapval == 0) ? 0 : ~0;
@@ -1926,7 +1911,7 @@ static void memory_init_populate(running_machine *machine)
static void memory_init_map_entry(address_space *space, const address_map_entry *entry, read_or_write readorwrite)
{
const map_handler_data *handler = (readorwrite == ROW_READ) ? &entry->read : &entry->write;
- const device_config *device;
+ running_device *device;
/* based on the handler type, alter the bits, name, funcptr, and object */
switch (handler->type)