mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
Move address_map array from cpu_config to device_config. Added
MDRV macros in the device for specifying address maps. Changed the memory system to fetch the maps from the new location. This is just a small step toward the end goal of getting address maps into arbitrary devices.
This commit is contained in:
parent
54ca1938bc
commit
7b28233e47
@ -63,7 +63,6 @@ struct _cpu_config
|
||||
{
|
||||
cpu_type type; /* index for the CPU type */
|
||||
UINT32 flags; /* flags; see #defines below */
|
||||
const addrmap_token *address_map[ADDRESS_SPACES]; /* 1 memory map per address space */
|
||||
cpu_interrupt_func vblank_interrupt; /* for interrupts tied to VBLANK */
|
||||
int vblank_interrupts_per_frame;/* usually 1 */
|
||||
const char * vblank_interrupt_screen; /* the screen that causes the VBLANK interrupt */
|
||||
@ -111,14 +110,14 @@ struct _cpu_class_header
|
||||
#define MDRV_CPU_CONFIG(_config) \
|
||||
MDRV_DEVICE_CONFIG(_config)
|
||||
|
||||
#define MDRV_CPU_PROGRAM_MAP(_map1) \
|
||||
MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map, ADDRESS_SPACE_PROGRAM, ADDRESS_MAP_NAME(_map1)) \
|
||||
#define MDRV_CPU_PROGRAM_MAP(_map) \
|
||||
MDRV_DEVICE_PROGRAM_MAP(_map)
|
||||
|
||||
#define MDRV_CPU_DATA_MAP(_map1) \
|
||||
MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map, ADDRESS_SPACE_DATA, ADDRESS_MAP_NAME(_map1)) \
|
||||
#define MDRV_CPU_DATA_MAP(_map) \
|
||||
MDRV_DEVICE_DATA_MAP(_map)
|
||||
|
||||
#define MDRV_CPU_IO_MAP(_map1) \
|
||||
MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map, ADDRESS_SPACE_IO, ADDRESS_MAP_NAME(_map1)) \
|
||||
#define MDRV_CPU_IO_MAP(_map) \
|
||||
MDRV_DEVICE_IO_MAP(_map)
|
||||
|
||||
#define MDRV_CPU_VBLANK_INT(_tag, _func) \
|
||||
MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, vblank_interrupt, _func) \
|
||||
|
@ -126,6 +126,7 @@ device_config *device_list_add(device_config **listheadptr, const device_config
|
||||
|
||||
/* populate device configuration */
|
||||
device->clock = clock;
|
||||
memset(device->address_map, 0, sizeof(device->address_map));
|
||||
if ((device->clock & 0xff000000) == 0xff000000)
|
||||
{
|
||||
assert(device->owner != NULL);
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "mamecore.h"
|
||||
#include "romload.h"
|
||||
#include "memory.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -188,7 +189,6 @@ enum
|
||||
|
||||
/* forward-declare these types */
|
||||
typedef union _deviceinfo deviceinfo;
|
||||
typedef struct _device_config device_config;
|
||||
|
||||
|
||||
/* a device contract */
|
||||
@ -252,6 +252,7 @@ struct _device_config
|
||||
|
||||
/* device configuration (always valid) */
|
||||
UINT32 clock; /* device clock */
|
||||
const addrmap_token * address_map[ADDRESS_SPACES]; /* address maps for each address space */
|
||||
const void * static_config; /* static device configuration */
|
||||
void * inline_config; /* inline device configuration */
|
||||
|
||||
|
@ -64,6 +64,7 @@ typedef struct _game_driver game_driver;
|
||||
typedef struct _machine_config machine_config;
|
||||
typedef struct _gfx_element gfx_element;
|
||||
typedef struct _mame_file mame_file;
|
||||
typedef struct _device_config device_config;
|
||||
|
||||
|
||||
/* pen_t is used to represent pixel values in bitmaps */
|
||||
|
@ -155,6 +155,13 @@ static void machine_config_detokenize(machine_config *config, const machine_conf
|
||||
TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, device->clock, 32);
|
||||
break;
|
||||
|
||||
case MCONFIG_TOKEN_DEVICE_MAP:
|
||||
assert(device != NULL);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, data32, 8);
|
||||
device->address_map[data32] = TOKEN_GET_PTR(tokens, addrmap);
|
||||
break;
|
||||
|
||||
case MCONFIG_TOKEN_DEVICE_CONFIG:
|
||||
assert(device != NULL);
|
||||
device->static_config = TOKEN_GET_PTR(tokens, voidptr);
|
||||
|
@ -39,6 +39,7 @@ enum
|
||||
MCONFIG_TOKEN_DEVICE_REMOVE,
|
||||
MCONFIG_TOKEN_DEVICE_MODIFY,
|
||||
MCONFIG_TOKEN_DEVICE_CLOCK,
|
||||
MCONFIG_TOKEN_DEVICE_MAP,
|
||||
MCONFIG_TOKEN_DEVICE_CONFIG,
|
||||
MCONFIG_TOKEN_DEVICE_CONFIG_DATA32,
|
||||
MCONFIG_TOKEN_DEVICE_CONFIG_DATA64,
|
||||
@ -312,6 +313,20 @@ union _machine_config_token
|
||||
#define MDRV_DEVICE_CLOCK(_clock) \
|
||||
TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_CLOCK, 8, _clock, 32),
|
||||
|
||||
#define MDRV_DEVICE_ADDRESS_MAP(_space, _map) \
|
||||
TOKEN_UINT32_PACK2(MCONFIG_TOKEN_DEVICE_MAP, 8, _space, 8), \
|
||||
TOKEN_PTR(addrmap, (const addrmap_token *)ADDRESS_MAP_NAME(_map)),
|
||||
|
||||
#define MDRV_DEVICE_PROGRAM_MAP(_map) \
|
||||
MDRV_DEVICE_ADDRESS_MAP(ADDRESS_SPACE_PROGRAM, _map)
|
||||
|
||||
#define MDRV_DEVICE_DATA_MAP(_map) \
|
||||
MDRV_DEVICE_ADDRESS_MAP(ADDRESS_SPACE_DATA, _map)
|
||||
|
||||
#define MDRV_DEVICE_IO_MAP(_map) \
|
||||
MDRV_DEVICE_ADDRESS_MAP(ADDRESS_SPACE_IO, _map)
|
||||
|
||||
|
||||
|
||||
/* inline device configurations that require 32 bits of storage in the token */
|
||||
#define MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(_size, _offset, _val) \
|
||||
|
@ -764,7 +764,6 @@ const address_space *memory_find_address_space(const device_config *cpu, int spa
|
||||
|
||||
address_map *address_map_alloc(const device_config *device, const game_driver *driver, int spacenum)
|
||||
{
|
||||
const cpu_config *cpuconfig = (const cpu_config *)device->inline_config;
|
||||
const addrmap_token *internal_map;
|
||||
address_map *map;
|
||||
|
||||
@ -776,8 +775,8 @@ address_map *address_map_alloc(const device_config *device, const game_driver *d
|
||||
map_detokenize(map, driver, device->tag, internal_map);
|
||||
|
||||
/* construct the standard map */
|
||||
if (cpuconfig->address_map[spacenum] != NULL)
|
||||
map_detokenize(map, driver, device->tag, cpuconfig->address_map[spacenum]);
|
||||
if (device->address_map[spacenum] != NULL)
|
||||
map_detokenize(map, driver, device->tag, device->address_map[spacenum]);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
@ -15,8 +15,9 @@
|
||||
#define __MEMORY_H__
|
||||
|
||||
#include "mamecore.h"
|
||||
#include "devintrf.h"
|
||||
#include "tokenize.h"
|
||||
#include "astring.h"
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user