mirror of
https://github.com/holub/mame
synced 2025-05-13 01:24:20 +03:00
Apply mirrors and global masks at address map detokenizing time rather
than later. Also added disabled code to detect address maps with overlapping regions for future analysis.
This commit is contained in:
parent
ab171be6cd
commit
8ba04b825a
@ -2293,6 +2293,7 @@ static void memory_exit(running_machine *machine)
|
||||
|
||||
static void map_detokenize(memory_private *memdata, address_map *map, const game_driver *driver, const char *devtag, const addrmap_token *tokens)
|
||||
{
|
||||
address_map_entry **firstentryptr;
|
||||
address_map_entry **entryptr;
|
||||
address_map_entry *entry;
|
||||
address_map tmap = {0};
|
||||
@ -2315,6 +2316,7 @@ static void map_detokenize(memory_private *memdata, address_map *map, const game
|
||||
|
||||
/* find the end of the list */
|
||||
for (entryptr = &map->entrylist; *entryptr != NULL; entryptr = &(*entryptr)->next) ;
|
||||
firstentryptr = entryptr;
|
||||
entry = NULL;
|
||||
|
||||
/* loop over tokens until we hit the end */
|
||||
@ -2367,6 +2369,11 @@ static void map_detokenize(memory_private *memdata, address_map *map, const game
|
||||
check_entry_field(addrmirror);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, entry->addrmirror, 32);
|
||||
if (entry->addrmirror != 0)
|
||||
{
|
||||
entry->addrstart &= ~entry->addrmirror;
|
||||
entry->addrend &= ~entry->addrmirror;
|
||||
}
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_READ:
|
||||
@ -2489,6 +2496,15 @@ static void map_detokenize(memory_private *memdata, address_map *map, const game
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* post-process to apply the global mask */
|
||||
if (map->globalmask != 0)
|
||||
for (entry = map->entrylist; entry != NULL; entry = entry->next)
|
||||
{
|
||||
entry->addrstart &= map->globalmask;
|
||||
entry->addrend &= map->globalmask;
|
||||
entry->addrmask &= map->globalmask;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,7 +23,8 @@
|
||||
DEBUGGING
|
||||
***************************************************************************/
|
||||
|
||||
#define REPORT_TIMES (0)
|
||||
#define REPORT_TIMES (0)
|
||||
#define DETECT_OVERLAPPING_MEMORY (0)
|
||||
|
||||
|
||||
|
||||
@ -1253,6 +1254,7 @@ static int validate_devices(int drivnum, const machine_config *config, const inp
|
||||
for (device = device_list_first(&config->devicelist, DEVICE_TYPE_WILDCARD); device != NULL; device = device_list_next(device, DEVICE_TYPE_WILDCARD))
|
||||
{
|
||||
device_validity_check_func validity_check = (device_validity_check_func) device_get_info_fct(device, DEVINFO_FCT_VALIDITY_CHECK);
|
||||
int detected_overlap = DETECT_OVERLAPPING_MEMORY ? FALSE : TRUE;
|
||||
const device_config *scandevice;
|
||||
int spacenum;
|
||||
|
||||
@ -1309,6 +1311,21 @@ static int validate_devices(int drivnum, const machine_config *config, const inp
|
||||
{
|
||||
UINT32 bytestart = SPACE_SHIFT(entry->addrstart);
|
||||
UINT32 byteend = SPACE_SHIFT_END(entry->addrend);
|
||||
|
||||
/* look for overlapping entries */
|
||||
if (!detected_overlap)
|
||||
{
|
||||
address_map_entry *scan;
|
||||
for (scan = map->entrylist; scan != entry; scan = scan->next)
|
||||
if (entry->addrstart <= scan->addrend && entry->addrend >= scan->addrstart &&
|
||||
((entry->read.type != AMH_NONE && scan->read.type != AMH_NONE) ||
|
||||
(entry->write.type != AMH_NONE && scan->write.type != AMH_NONE)))
|
||||
{
|
||||
mame_printf_warning("%s: %s '%s' %s space has overlapping memory (%X-%X,%d,%d) vs (%X-%X,%d,%d)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->read.type, entry->write.type, scan->addrstart, scan->addrend, scan->read.type, scan->write.type);
|
||||
detected_overlap = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* look for inverted start/end pairs */
|
||||
if (byteend < bytestart)
|
||||
|
@ -340,10 +340,10 @@ static ADDRESS_MAP_START( punchout_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_BASE_SIZE_GENERIC(nvram)
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_RAM
|
||||
AM_RANGE(0xdff0, 0xdff7) AM_RAM AM_BASE(&punchout_spr1_ctrlram)
|
||||
AM_RANGE(0xdff8, 0xdffc) AM_RAM AM_BASE(&punchout_spr2_ctrlram)
|
||||
AM_RANGE(0xdffd, 0xdffd) AM_RAM AM_BASE(&punchout_palettebank)
|
||||
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(punchout_bg_top_videoram_w) AM_BASE(&punchout_bg_top_videoram)
|
||||
AM_RANGE(0xdff0, 0xdff7) AM_BASE(&punchout_spr1_ctrlram)
|
||||
AM_RANGE(0xdff8, 0xdffc) AM_BASE(&punchout_spr2_ctrlram)
|
||||
AM_RANGE(0xdffd, 0xdffd) AM_BASE(&punchout_palettebank)
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(punchout_spr1_videoram_w) AM_BASE(&punchout_spr1_videoram)
|
||||
AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(punchout_spr2_videoram_w) AM_BASE(&punchout_spr2_videoram)
|
||||
AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(punchout_bg_bot_videoram_w) AM_BASE(&punchout_bg_bot_videoram) // also contains scroll RAM
|
||||
@ -354,10 +354,10 @@ static ADDRESS_MAP_START( armwrest_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_BASE_SIZE_GENERIC(nvram)
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_RAM
|
||||
AM_RANGE(0xdff0, 0xdff7) AM_RAM AM_BASE(&punchout_spr1_ctrlram)
|
||||
AM_RANGE(0xdff8, 0xdffc) AM_RAM AM_BASE(&punchout_spr2_ctrlram)
|
||||
AM_RANGE(0xdffd, 0xdffd) AM_RAM AM_BASE(&punchout_palettebank)
|
||||
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(armwrest_fg_videoram_w) AM_BASE(&armwrest_fg_videoram)
|
||||
AM_RANGE(0xdff0, 0xdff7) AM_BASE(&punchout_spr1_ctrlram)
|
||||
AM_RANGE(0xdff8, 0xdffc) AM_BASE(&punchout_spr2_ctrlram)
|
||||
AM_RANGE(0xdffd, 0xdffd) AM_BASE(&punchout_palettebank)
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(punchout_spr1_videoram_w) AM_BASE(&punchout_spr1_videoram)
|
||||
AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(punchout_spr2_videoram_w) AM_BASE(&punchout_spr2_videoram)
|
||||
AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(punchout_bg_bot_videoram_w) AM_BASE(&punchout_bg_bot_videoram)
|
||||
|
Loading…
Reference in New Issue
Block a user