From 71ca9ecec226cad90f15c9244fe59d49af27bb9f Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Tue, 15 Apr 2008 06:39:34 +0000 Subject: [PATCH] Switched subhandlers to using masks instead of shifts. Reduced the number of stub handlers required as a result. Updated all drivers accordingly. --- src/emu/memory.c | 946 ++++++++++-------------------------- src/emu/memory.h | 87 ++-- src/mame/audio/mcr.c | 2 +- src/mame/drivers/gaelco3d.c | 38 +- src/mame/drivers/itech8.c | 8 +- src/mame/drivers/mcr68.c | 6 +- 6 files changed, 342 insertions(+), 745 deletions(-) diff --git a/src/emu/memory.c b/src/emu/memory.c index f9ff5f61da3..48dd1736883 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -245,7 +245,8 @@ struct _handler_data const char * name; /* name of the handler */ memory_handler subhandler; /* function pointer for subhandler */ void * subobject; /* object associated with the subhandler */ - UINT32 subshift; /* shift for the subhandler */ + UINT8 subunits; /* number of subunits to access */ + UINT8 subshift[8]; /* shift amounts for up to 8 subunits */ offs_t bytestart; /* byte-adjusted start address for handler */ offs_t byteend; /* byte-adjusted end address for handler */ offs_t bytemask; /* byte-adjusted mask against the final address */ @@ -417,11 +418,12 @@ static void address_map_detokenize(address_map *map, const addrmap_token *tokens static void memory_init_cpudata(const machine_config *config); static void memory_init_preflight(const machine_config *config); static void memory_init_populate(running_machine *machine); -static void space_map_range_private(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlershift, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name); -static void space_map_range(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlershift, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name); +static void space_map_range_private(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name); +static void space_map_range(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name); static void bank_assign_static(int banknum, int cpunum, int spacenum, read_or_write readorwrite, offs_t bytestart, offs_t byteend); static genf *bank_assign_dynamic(int cpunum, int spacenum, read_or_write readorwrite, offs_t bytestart, offs_t byteend); static UINT8 table_assign_handler(handler_data *table, void *object, genf *handler, const char *handler_name, offs_t bytestart, offs_t byteend, offs_t bytemask); +static void table_compute_subhandler(handler_data *table, UINT8 entry, read_or_write readorwrite, int spacebits, int spaceendian, int handlerbits, int handlerunitmask); static void table_populate_range(table_data *tabledata, offs_t bytestart, offs_t byteend, UINT8 handler); static void table_populate_range_mirrored(table_data *tabledata, offs_t bytestart, offs_t byteend, offs_t bytemirror, UINT8 handler); static UINT8 subtable_alloc(table_data *tabledata); @@ -436,7 +438,7 @@ static void register_for_save(int cpunum, int spacenum, offs_t bytestart, void * static address_map_entry *assign_intersecting_blocks(addrspace_data *space, offs_t bytestart, offs_t byteend, UINT8 *base); static void memory_init_locate(running_machine *machine); static void *memory_find_base(int cpunum, int spacenum, offs_t byteaddress); -static memory_handler get_stub_handler(read_or_write readorwrite, int spacedbits, int spaceendian, int handlerdbits, int handlershift); +static memory_handler get_stub_handler(read_or_write readorwrite, int spacedbits, int handlerdbits); static genf *get_static_handler(int handlerbits, int readorwrite, int spacenum, int which); static void memory_exit(running_machine *machine); static void mem_dump(void); @@ -790,19 +792,21 @@ static void address_map_detokenize(address_map *map, const addrmap_token *tokens case ADDRMAP_TOKEN_READ: TOKEN_UNGET_UINT32(tokens); - TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->read_bits, 2, entry->read_shift, 6); + TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->read_bits, 8, entry->read_mask, 8); entry->read = TOKEN_GET_PTR(tokens, read); entry->read_name = TOKEN_GET_STRING(tokens); break; case ADDRMAP_TOKEN_WRITE: TOKEN_UNGET_UINT32(tokens); - TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->write_bits, 2, entry->write_shift, 6); + TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->write_bits, 8, entry->write_mask, 8); entry->write = TOKEN_GET_PTR(tokens, write); entry->write_name = TOKEN_GET_STRING(tokens); break; case ADDRMAP_TOKEN_DEVICE_READ: + TOKEN_UNGET_UINT32(tokens); + TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->read_bits, 8, entry->read_mask, 8); entry->read = TOKEN_GET_PTR(tokens, read); entry->read_name = TOKEN_GET_STRING(tokens); entry->read_devtype = TOKEN_GET_PTR(tokens, devtype); @@ -810,6 +814,8 @@ static void address_map_detokenize(address_map *map, const addrmap_token *tokens break; case ADDRMAP_TOKEN_DEVICE_WRITE: + TOKEN_UNGET_UINT32(tokens); + TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->write_bits, 8, entry->write_mask, 8); entry->write = TOKEN_GET_PTR(tokens, write); entry->write_name = TOKEN_GET_STRING(tokens); entry->write_devtype = TOKEN_GET_PTR(tokens, devtype); @@ -1626,7 +1632,7 @@ static void memory_init_populate(running_machine *machine) if (entry->read.generic != NULL) { - int bits = (entry->read_bits == 0) ? space->dbits : (4 << entry->read_bits); + int bits = (entry->read_bits == 0) ? space->dbits : entry->read_bits; void *object = machine; if (entry->read_devtype != NULL) { @@ -1634,11 +1640,11 @@ static void memory_init_populate(running_machine *machine) if (object == NULL) fatalerror("Unidentified object in memory map: type=%s tag=%s\n", devtype_name(entry->read_devtype), entry->read_devtag); } - space_map_range_private(space, ROW_READ, bits, entry->read_shift, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, entry->read.generic, object, entry->read_name); + space_map_range_private(space, ROW_READ, bits, entry->read_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, entry->read.generic, object, entry->read_name); } if (entry->write.generic != NULL) { - int bits = (entry->write_bits == 0) ? space->dbits : (4 << entry->write_bits); + int bits = (entry->write_bits == 0) ? space->dbits : entry->write_bits; void *object = machine; if (entry->write_devtype != NULL) { @@ -1646,7 +1652,7 @@ static void memory_init_populate(running_machine *machine) if (object == NULL) fatalerror("Unidentified object in memory map: type=%s tag=%s\n", devtype_name(entry->write_devtype), entry->write_devtag); } - space_map_range_private(space, ROW_WRITE, bits, entry->write_shift, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, entry->write.generic, object, entry->write_name); + space_map_range_private(space, ROW_WRITE, bits, entry->write_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, entry->write.generic, object, entry->write_name); } } } @@ -1661,7 +1667,7 @@ static void memory_init_populate(running_machine *machine) banks to dynamically assigned banks -------------------------------------------------*/ -static void space_map_range_private(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlershift, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) +static void space_map_range_private(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) { /* translate ROM to RAM/UNMAP here */ if (HANDLER_IS_ROM(handler)) @@ -1685,7 +1691,7 @@ static void space_map_range_private(addrspace_data *space, read_or_write readorw } /* then do a normal installation */ - space_map_range(space, readorwrite, handlerbits, handlershift, addrstart, addrend, addrmask, addrmirror, handler, object, handler_name); + space_map_range(space, readorwrite, handlerbits, handlerunitmask, addrstart, addrend, addrmask, addrmirror, handler, object, handler_name); } @@ -1695,7 +1701,7 @@ static void space_map_range_private(addrspace_data *space, read_or_write readorw space -------------------------------------------------*/ -static void space_map_range(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlershift, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) +static void space_map_range(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) { table_data *tabledata = (readorwrite == ROW_WRITE) ? &space->write : &space->read; offs_t bytestart, byteend, bytemask, bytemirror; @@ -1717,7 +1723,6 @@ static void space_map_range(addrspace_data *space, read_or_write readorwrite, in assert_always(!HANDLER_IS_RAM(handler), "space_map_range called with RAM after initialization"); assert_always(addrstart <= addrend, "space_map_range called with start greater than end"); assert_always(handlerbits <= space->dbits, "space_map_range called with handlers larger than the address space"); - assert_always(handlershift == SHIFT_PACKED || handlerbits + handlershift <= space->dbits, "space_map_range called with out-of-range handlershift"); assert_always((bytestart & (space->dbits / 8 - 1)) == 0, "space_map_range called with misaligned start address"); assert_always((byteend & (space->dbits / 8 - 1)) == (space->dbits / 8 - 1), "space_map_range called with misaligned end address"); @@ -1730,20 +1735,7 @@ static void space_map_range(addrspace_data *space, read_or_write readorwrite, in /* fix up the handler if a stub is required */ if (handlerbits != space->dbits) - { - handler_data *hdata = &tabledata->handlers[entry]; - - assert_always(!HANDLER_IS_STATIC(entry), "space_map_range called with static handlers and mismatched data bus widths"); - - /* copy raw data to the subhandler data */ - hdata->subobject = hdata->object; - hdata->subhandler = hdata->handler; - hdata->subshift = handlershift; - - /* fill in a stub as the real handler */ - hdata->object = hdata; - hdata->handler = get_stub_handler(readorwrite, space->dbits, space->endianness, handlerbits, handlershift); - } + table_compute_subhandler(tabledata->handlers, entry, readorwrite, space->dbits, space->endianness, handlerbits, handlerunitmask); /* populate it */ table_populate_range_mirrored(tabledata, bytestart, byteend, bytemirror, entry); @@ -1871,6 +1863,52 @@ static UINT8 table_assign_handler(handler_data *table, void *object, genf *handl } +/*------------------------------------------------- + table_compute_subhandler - compute data for + a subhandler +-------------------------------------------------*/ + +static void table_compute_subhandler(handler_data *table, UINT8 entry, read_or_write readorwrite, int spacebits, int spaceendian, int handlerbits, int handlerunitmask) +{ + int maxunits = spacebits / handlerbits; + handler_data *hdata = &table[entry]; + int unitnum; + + assert_always(!HANDLER_IS_STATIC(entry), "table_compute_subhandler called with static handlers and mismatched data bus widths"); + + /* copy raw data to the subhandler data */ + hdata->subobject = hdata->object; + hdata->subhandler = hdata->handler; + + /* fill in a stub as the real handler */ + hdata->object = hdata; + hdata->handler = get_stub_handler(readorwrite, spacebits, handlerbits); + + /* compute the number of subunits */ + hdata->subunits = 0; + for (unitnum = 0; unitnum < maxunits; unitnum++) + if (handlerunitmask & (1 << unitnum)) + hdata->subunits++; + assert_always(hdata->subunits > 0, "table_compute_subhandler called with no bytes specified in mask"); + + /* then fill in the shifts based on the endianness */ + if (spaceendian == CPU_IS_LE) + { + UINT8 *unitshift = &hdata->subshift[0]; + for (unitnum = 0; unitnum < maxunits; unitnum++) + if (handlerunitmask & (1 << unitnum)) + *unitshift++ = unitnum * handlerbits; + } + else + { + UINT8 *unitshift = &hdata->subshift[hdata->subunits]; + for (unitnum = 0; unitnum < maxunits; unitnum++) + if (handlerunitmask & (1 << unitnum)) + *--unitshift = unitnum * handlerbits; + } +} + + /*------------------------------------------------- table_populate_range - assign a memory handler to a range of addresses @@ -3000,183 +3038,145 @@ static void mem_dump(void) ***************************************************************************/ /*------------------------------------------------- - stub_read8_from_16_shifted - return a 16-bit - value from a single byte access in a - particular lane --------------------------------------------------*/ - -static READ16_HANDLER( stub_read8_from_16_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT8)(mem_mask >> handler->subshift) != 0xff) - return (*handler->subhandler.read.mhandler8)(handler->subobject, offset) << handler->subshift; - else - return 0; -} - - -/*------------------------------------------------- - stub_read8_from_16le_packed - return a 16-bit + stub_read8_from_16 - return a 16-bit value combined from one or more byte accesses -------------------------------------------------*/ -static READ16_HANDLER( stub_read8_from_16le_packed ) +static READ16_HANDLER( stub_read8_from_16 ) { - handler_data *handler = (handler_data *)machine; + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; UINT16 result = 0; - if (ACCESSING_BITS_0_7) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 2 + 0) << 0; - if (ACCESSING_BITS_8_15) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 2 + 1) << 8; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT8)(mem_mask >> shift) != 0xff) + result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset) << shift; + offset++; + } return result; } /*------------------------------------------------- - stub_read8_from_16be_packed - return a 16-bit + stub_read8_from_32 - return a 32-bit value combined from one or more byte accesses -------------------------------------------------*/ -static READ16_HANDLER( stub_read8_from_16be_packed ) +static READ32_HANDLER( stub_read8_from_32 ) { - handler_data *handler = (handler_data *)machine; - UINT16 result = 0; - if (ACCESSING_BITS_8_15) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 2 + 0) << 8; - if (ACCESSING_BITS_0_7) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 2 + 1) << 0; - return result; -} - - -/*------------------------------------------------- - stub_read8_from_32_shifted - return a 32-bit - value from a single byte access in a - particular lane --------------------------------------------------*/ - -static READ32_HANDLER( stub_read8_from_32_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT8)(mem_mask >> handler->subshift) != 0xff) - return (*handler->subhandler.read.mhandler8)(handler->subobject, offset) << handler->subshift; - else - return 0; -} - - -/*------------------------------------------------- - stub_read8_from_32le_packed - return a 32-bit - value combined from one or more byte accesses --------------------------------------------------*/ - -static READ32_HANDLER( stub_read8_from_32le_packed ) -{ - handler_data *handler = (handler_data *)machine; + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; UINT32 result = 0; - if (ACCESSING_BITS_0_7) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 4 + 0) << 0; - if (ACCESSING_BITS_8_15) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 4 + 1) << 8; - if (ACCESSING_BITS_16_23) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 4 + 2) << 16; - if (ACCESSING_BITS_24_31) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 4 + 3) << 24; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT8)(mem_mask >> shift) != 0xff) + result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset) << shift; + offset++; + } return result; } /*------------------------------------------------- - stub_read8_from_32be_packed - return a 32-bit + stub_read8_from_64 - return a 64-bit value combined from one or more byte accesses -------------------------------------------------*/ -static READ32_HANDLER( stub_read8_from_32be_packed ) +static READ64_HANDLER( stub_read8_from_64 ) { - handler_data *handler = (handler_data *)machine; + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; + UINT64 result = 0; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT8)(mem_mask >> shift) != 0xff) + result |= (UINT64)(*handler->subhandler.read.mhandler8)(handler->subobject, offset) << shift; + offset++; + } + return result; +} + + +/*------------------------------------------------- + stub_read16_from_32 - return a 32-bit + value combined from one or more word accesses +-------------------------------------------------*/ + +static READ32_HANDLER( stub_read16_from_32 ) +{ + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; UINT32 result = 0; - if (ACCESSING_BITS_24_31) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 4 + 0) << 24; - if (ACCESSING_BITS_16_23) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 4 + 1) << 16; - if (ACCESSING_BITS_8_15) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 4 + 2) << 8; - if (ACCESSING_BITS_0_7) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 4 + 3) << 0; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT16)(mem_mask >> shift) != 0xffff) + result |= (*handler->subhandler.read.mhandler16)(handler->subobject, offset, mem_mask >> shift) << shift; + offset++; + } return result; } /*------------------------------------------------- - stub_read8_from_64_shifted - return a 64-bit - value from a single byte access in a - particular lane + stub_read16_from_64 - return a 64-bit + value combined from one or more word accesses -------------------------------------------------*/ -static READ64_HANDLER( stub_read8_from_64_shifted ) +static READ64_HANDLER( stub_read16_from_64 ) { - handler_data *handler = (handler_data *)machine; - if ((UINT8)(mem_mask >> handler->subshift) != 0xff) - return (UINT64)(*handler->subhandler.read.mhandler8)(handler->subobject, offset) << handler->subshift; - else - return 0; -} - - -/*------------------------------------------------- - stub_read8_from_64le_packed - return a 64-bit - value combined from one or more byte accesses --------------------------------------------------*/ - -static READ64_HANDLER( stub_read8_from_64le_packed ) -{ - handler_data *handler = (handler_data *)machine; + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; UINT64 result = 0; - if (ACCESSING_BITS_0_7) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 0) << 0; - if (ACCESSING_BITS_8_15) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 1) << 8; - if (ACCESSING_BITS_16_23) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 2) << 16; - if (ACCESSING_BITS_24_31) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 3) << 24; - if (ACCESSING_BITS_32_39) - result |= (UINT64)(*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 4) << 32; - if (ACCESSING_BITS_40_47) - result |= (UINT64)(*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 5) << 40; - if (ACCESSING_BITS_48_55) - result |= (UINT64)(*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 6) << 48; - if (ACCESSING_BITS_56_63) - result |= (UINT64)(*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 7) << 56; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT16)(mem_mask >> shift) != 0xffff) + result |= (UINT64)(*handler->subhandler.read.mhandler16)(handler->subobject, offset, mem_mask >> shift) << shift; + offset++; + } return result; } /*------------------------------------------------- - stub_read8_from_64be_packed - return a 64-bit - value combined from one or more byte accesses + stub_read32_from_64 - return a 64-bit + value combined from one or more dword accesses -------------------------------------------------*/ -static READ64_HANDLER( stub_read8_from_64be_packed ) +static READ64_HANDLER( stub_read32_from_64 ) { - handler_data *handler = (handler_data *)machine; + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; UINT64 result = 0; - if (ACCESSING_BITS_56_63) - result |= (UINT64)(*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 0) << 56; - if (ACCESSING_BITS_48_55) - result |= (UINT64)(*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 1) << 48; - if (ACCESSING_BITS_40_47) - result |= (UINT64)(*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 2) << 40; - if (ACCESSING_BITS_32_39) - result |= (UINT64)(*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 3) << 32; - if (ACCESSING_BITS_24_31) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 4) << 24; - if (ACCESSING_BITS_16_23) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 5) << 16; - if (ACCESSING_BITS_8_15) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 6) << 8; - if (ACCESSING_BITS_0_7) - result |= (*handler->subhandler.read.mhandler8)(handler->subobject, offset * 8 + 7) << 0; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT32)(mem_mask >> shift) != 0xffffffff) + result |= (UINT64)(*handler->subhandler.read.mhandler32)(handler->subobject, offset, mem_mask >> shift) << shift; + offset++; + } return result; } @@ -3187,478 +3187,134 @@ static READ64_HANDLER( stub_read8_from_64be_packed ) ***************************************************************************/ /*------------------------------------------------- - stub_write8_from_16_shifted - write a 16-bit - value to a single byte lane --------------------------------------------------*/ - -static WRITE16_HANDLER( stub_write8_from_16_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT8)(mem_mask >> handler->subshift) != 0xff) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset, data >> handler->subshift); -} - - -/*------------------------------------------------- - stub_write8_from_16le_packed - convert a 16-bit + stub_write8_from_16 - convert a 16-bit write to one or more byte accesses -------------------------------------------------*/ -static WRITE16_HANDLER( stub_write8_from_16le_packed ) +static WRITE16_HANDLER( stub_write8_from_16 ) { - handler_data *handler = (handler_data *)machine; - if (ACCESSING_BITS_0_7) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 2 + 0, data >> 0); - if (ACCESSING_BITS_8_15) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 2 + 1, data >> 8); + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT8)(mem_mask >> shift) != 0xff) + (*handler->subhandler.write.mhandler8)(handler->subobject, offset, data >> shift); + offset++; + } } /*------------------------------------------------- - stub_write8_from_16be_packed - convert a 16-bit + stub_write8_from_32 - convert a 32-bit write to one or more byte accesses -------------------------------------------------*/ -static WRITE16_HANDLER( stub_write8_from_16be_packed ) +static WRITE32_HANDLER( stub_write8_from_32 ) { - handler_data *handler = (handler_data *)machine; - if (ACCESSING_BITS_8_15) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 2 + 0, data >> 8); - if (ACCESSING_BITS_0_7) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 2 + 1, data >> 0); + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT8)(mem_mask >> shift) != 0xff) + (*handler->subhandler.write.mhandler8)(handler->subobject, offset, data >> shift); + offset++; + } } /*------------------------------------------------- - stub_write8_from_32_shifted - write a 32-bit - value to a single byte lane --------------------------------------------------*/ - -static WRITE32_HANDLER( stub_write8_from_32_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT8)(mem_mask >> handler->subshift) != 0xff) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset, data >> handler->subshift); -} - - -/*------------------------------------------------- - stub_write8_from_32le_packed - convert a 32-bit + stub_write8_from_64 - convert a 64-bit write to one or more byte accesses -------------------------------------------------*/ -static WRITE32_HANDLER( stub_write8_from_32le_packed ) +static WRITE64_HANDLER( stub_write8_from_64 ) { - handler_data *handler = (handler_data *)machine; - if (ACCESSING_BITS_0_7) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 4 + 0, data >> 0); - if (ACCESSING_BITS_8_15) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 4 + 1, data >> 8); - if (ACCESSING_BITS_16_23) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 4 + 2, data >> 16); - if (ACCESSING_BITS_24_31) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 4 + 3, data >> 24); + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT8)(mem_mask >> shift) != 0xff) + (*handler->subhandler.write.mhandler8)(handler->subobject, offset, data >> shift); + offset++; + } } /*------------------------------------------------- - stub_write8_from_32be_packed - convert a 32-bit - write to one or more byte accesses --------------------------------------------------*/ - -static WRITE32_HANDLER( stub_write8_from_32be_packed ) -{ - handler_data *handler = (handler_data *)machine; - if (ACCESSING_BITS_24_31) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 4 + 0, data >> 24); - if (ACCESSING_BITS_16_23) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 4 + 1, data >> 16); - if (ACCESSING_BITS_8_15) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 4 + 2, data >> 8); - if (ACCESSING_BITS_0_7) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 4 + 3, data >> 0); -} - - -/*------------------------------------------------- - stub_write8_from_64_shifted - write a 64-bit - value to a single byte lane --------------------------------------------------*/ - -static WRITE64_HANDLER( stub_write8_from_64_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT8)(mem_mask >> handler->subshift) != 0xff) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset, data >> handler->subshift); -} - - -/*------------------------------------------------- - stub_write8_from_64le_packed - convert a 64-bit - write to one or more byte accesses --------------------------------------------------*/ - -static WRITE64_HANDLER( stub_write8_from_64le_packed ) -{ - handler_data *handler = (handler_data *)machine; - if (ACCESSING_BITS_0_7) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 0, data >> 0); - if (ACCESSING_BITS_8_15) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 1, data >> 8); - if (ACCESSING_BITS_16_23) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 2, data >> 16); - if (ACCESSING_BITS_24_31) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 3, data >> 24); - if (ACCESSING_BITS_32_39) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 4, data >> 32); - if (ACCESSING_BITS_40_47) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 5, data >> 40); - if (ACCESSING_BITS_48_55) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 6, data >> 48); - if (ACCESSING_BITS_56_63) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 7, data >> 56); -} - - -/*------------------------------------------------- - stub_write8_from_64be_packed - convert a 64-bit - write to one or more byte accesses --------------------------------------------------*/ - -static WRITE64_HANDLER( stub_write8_from_64be_packed ) -{ - handler_data *handler = (handler_data *)machine; - if (ACCESSING_BITS_56_63) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 0, data >> 56); - if (ACCESSING_BITS_48_55) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 1, data >> 48); - if (ACCESSING_BITS_40_47) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 2, data >> 40); - if (ACCESSING_BITS_32_39) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 3, data >> 32); - if (ACCESSING_BITS_24_31) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 4, data >> 24); - if (ACCESSING_BITS_16_23) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 5, data >> 16); - if (ACCESSING_BITS_8_15) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 6, data >> 8); - if (ACCESSING_BITS_0_7) - (*handler->subhandler.write.mhandler8)(handler->subobject, offset * 8 + 7, data >> 0); -} - - - -/*************************************************************************** - STUB HANDLERS THAT MAP TO WORD READS -***************************************************************************/ - -/*------------------------------------------------- - stub_read16_from_32_shifted - return a 32-bit - value from a single word access in a - particular lane --------------------------------------------------*/ - -static READ32_HANDLER( stub_read16_from_32_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT16)(mem_mask >> handler->subshift) != 0xffff) - return (*handler->subhandler.read.mhandler16)(handler->subobject, offset, mem_mask >> handler->subshift) << handler->subshift; - else - return 0; -} - - -/*------------------------------------------------- - stub_read16_from_32le_packed - return a 32-bit - value combined from one or more word accesses --------------------------------------------------*/ - -static READ32_HANDLER( stub_read16_from_32le_packed ) -{ - handler_data *handler = (handler_data *)machine; - UINT32 result = 0; - if ((mem_mask & 0x0000ffff) != 0x0000ffff) - result |= (*handler->subhandler.read.mhandler16)(handler->subobject, offset * 2 + 0, mem_mask >> 0) << 0; - if ((mem_mask & 0xffff0000) != 0xffff0000) - result |= (*handler->subhandler.read.mhandler16)(handler->subobject, offset * 2 + 1, mem_mask >> 16) << 16; - return result; -} - - -/*------------------------------------------------- - stub_read16_from_32be_packed - return a 32-bit - value combined from one or more word accesses --------------------------------------------------*/ - -static READ32_HANDLER( stub_read16_from_32be_packed ) -{ - handler_data *handler = (handler_data *)machine; - UINT32 result = 0; - if ((mem_mask & 0xffff0000) != 0xffff0000) - result |= (*handler->subhandler.read.mhandler16)(handler->subobject, offset * 2 + 0, mem_mask >> 16) << 16; - if ((mem_mask & 0x0000ffff) != 0x0000ffff) - result |= (*handler->subhandler.read.mhandler16)(handler->subobject, offset * 2 + 1, mem_mask >> 0) << 0; - return result; -} - - -/*------------------------------------------------- - stub_read16_from_64_shifted - return a 64-bit - value from a single word access in a - particular lane --------------------------------------------------*/ - -static READ64_HANDLER( stub_read16_from_64_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT16)(mem_mask >> handler->subshift) != 0xffff) - return (UINT64)(*handler->subhandler.read.mhandler16)(handler->subobject, offset, mem_mask >> handler->subshift) << handler->subshift; - else - return 0; -} - - -/*------------------------------------------------- - stub_read16_from_64le_packed - return a 64-bit - value combined from one or more word accesses --------------------------------------------------*/ - -static READ64_HANDLER( stub_read16_from_64le_packed ) -{ - handler_data *handler = (handler_data *)machine; - UINT32 result = 0; - if ((mem_mask & U64(0x000000000000ffff)) != U64(0x000000000000ffff)) - result |= (*handler->subhandler.read.mhandler16)(handler->subobject, offset * 4 + 0, mem_mask >> 0) << 0; - if ((mem_mask & U64(0x00000000ffff0000)) != U64(0x00000000ffff0000)) - result |= (*handler->subhandler.read.mhandler16)(handler->subobject, offset * 4 + 1, mem_mask >> 16) << 16; - if ((mem_mask & U64(0x0000ffff00000000)) != U64(0x0000ffff00000000)) - result |= (UINT64)(*handler->subhandler.read.mhandler16)(handler->subobject, offset * 4 + 2, mem_mask >> 32) << 32; - if ((mem_mask & U64(0xffff000000000000)) != U64(0xffff000000000000)) - result |= (UINT64)(*handler->subhandler.read.mhandler16)(handler->subobject, offset * 4 + 3, mem_mask >> 48) << 48; - return result; -} - - -/*------------------------------------------------- - stub_read16_from_64be_packed - return a 64-bit - value combined from one or more word accesses --------------------------------------------------*/ - -static READ64_HANDLER( stub_read16_from_64be_packed ) -{ - handler_data *handler = (handler_data *)machine; - UINT32 result = 0; - if ((mem_mask & U64(0xffff000000000000)) != U64(0xffff000000000000)) - result |= (UINT64)(*handler->subhandler.read.mhandler16)(handler->subobject, offset * 4 + 0, mem_mask >> 48) << 48; - if ((mem_mask & U64(0x0000ffff00000000)) != U64(0x0000ffff00000000)) - result |= (UINT64)(*handler->subhandler.read.mhandler16)(handler->subobject, offset * 4 + 1, mem_mask >> 32) << 32; - if ((mem_mask & U64(0x00000000ffff0000)) != U64(0x00000000ffff0000)) - result |= (*handler->subhandler.read.mhandler16)(handler->subobject, offset * 4 + 2, mem_mask >> 16) << 16; - if ((mem_mask & U64(0x000000000000ffff)) != U64(0x000000000000ffff)) - result |= (*handler->subhandler.read.mhandler16)(handler->subobject, offset * 4 + 3, mem_mask >> 0) << 0; - return result; -} - - - -/*************************************************************************** - STUB HANDLERS THAT MAP TO WORD WRITES -***************************************************************************/ - -/*------------------------------------------------- - stub_write16_from_32_shifted - write a 32-bit - value to a single word lane --------------------------------------------------*/ - -static WRITE32_HANDLER( stub_write16_from_32_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT16)(mem_mask >> handler->subshift) != 0xffff) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset, data >> handler->subshift, mem_mask >> handler->subshift); -} - - -/*------------------------------------------------- - stub_write16_from_32le_packed - convert a 32-bit + stub_write16_from_32 - convert a 32-bit write to one or more word accesses -------------------------------------------------*/ -static WRITE32_HANDLER( stub_write16_from_32le_packed ) +static WRITE32_HANDLER( stub_write16_from_32 ) { - handler_data *handler = (handler_data *)machine; - if ((mem_mask & 0x0000ffff) != 0x0000ffff) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 2 + 0, data >> 0, mem_mask >> 0); - if ((mem_mask & 0xffff0000) != 0xffff0000) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 2 + 1, data >> 16, mem_mask >> 16); + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT16)(mem_mask >> shift) != 0xffff) + (*handler->subhandler.write.mhandler16)(handler->subobject, offset, data >> shift, mem_mask >> shift); + offset++; + } } /*------------------------------------------------- - stub_write16_from_32be_packed - convert a 32-bit + stub_write16_from_64 - convert a 64-bit write to one or more word accesses -------------------------------------------------*/ -static WRITE32_HANDLER( stub_write16_from_32be_packed ) +static WRITE64_HANDLER( stub_write16_from_64 ) { - handler_data *handler = (handler_data *)machine; - if ((mem_mask & 0xffff0000) != 0xffff0000) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 2 + 0, data >> 16, mem_mask >> 16); - if ((mem_mask & 0x0000ffff) != 0x0000ffff) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 2 + 1, data >> 0, mem_mask >> 0); + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT16)(mem_mask >> shift) != 0xffff) + (*handler->subhandler.write.mhandler16)(handler->subobject, offset, data >> shift, mem_mask >> shift); + offset++; + } } /*------------------------------------------------- - stub_write16_from_64_shifted - write a 64-bit - value to a single word lane --------------------------------------------------*/ - -static WRITE64_HANDLER( stub_write16_from_64_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT16)(mem_mask >> handler->subshift) != 0xffff) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset, data >> handler->subshift, mem_mask >> handler->subshift); -} - - -/*------------------------------------------------- - stub_write16_from_64le_packed - convert a 64-bit + stub_write32_from_64 - convert a 64-bit write to one or more word accesses -------------------------------------------------*/ -static WRITE64_HANDLER( stub_write16_from_64le_packed ) +static WRITE64_HANDLER( stub_write32_from_64 ) { - handler_data *handler = (handler_data *)machine; - if ((mem_mask & U64(0x000000000000ffff)) != U64(0x000000000000ffff)) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 4 + 0, data >> 0, mem_mask >> 0); - if ((mem_mask & U64(0x00000000ffff0000)) != U64(0x00000000ffff0000)) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 4 + 1, data >> 16, mem_mask >> 16); - if ((mem_mask & U64(0x0000ffff00000000)) != U64(0x0000ffff00000000)) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 4 + 2, data >> 32, mem_mask >> 32); - if ((mem_mask & U64(0xffff000000000000)) != U64(0xffff000000000000)) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 4 + 3, data >> 48, mem_mask >> 48); -} - - -/*------------------------------------------------- - stub_write16_from_64be_packed - convert a 64-bit - write to one or more word accesses --------------------------------------------------*/ - -static WRITE64_HANDLER( stub_write16_from_64be_packed ) -{ - handler_data *handler = (handler_data *)machine; - if ((mem_mask & U64(0xffff000000000000)) != U64(0xffff000000000000)) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 4 + 0, data >> 48, mem_mask >> 48); - if ((mem_mask & U64(0x0000ffff00000000)) != U64(0x0000ffff00000000)) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 4 + 1, data >> 32, mem_mask >> 32); - if ((mem_mask & U64(0x00000000ffff0000)) != U64(0x00000000ffff0000)) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 4 + 2, data >> 16, mem_mask >> 16); - if ((mem_mask & U64(0x000000000000ffff)) != U64(0x000000000000ffff)) - (*handler->subhandler.write.mhandler16)(handler->subobject, offset * 4 + 3, data >> 0, mem_mask >> 0); -} - - - -/*************************************************************************** - STUB HANDLERS THAT MAP TO DWORD READS -***************************************************************************/ - -/*------------------------------------------------- - stub_read32_from_64_shifted - return a 64-bit - value from a single dword access in a - particular lane --------------------------------------------------*/ - -static READ64_HANDLER( stub_read32_from_64_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT32)(mem_mask >> handler->subshift) != 0xffffffff) - return (UINT64)(*handler->subhandler.read.mhandler32)(handler->subobject, offset, mem_mask >> handler->subshift) << handler->subshift; - else - return 0; -} - - -/*------------------------------------------------- - stub_read32_from_64le_packed - return a 64-bit - value combined from one or more dword accesses --------------------------------------------------*/ - -static READ64_HANDLER( stub_read32_from_64le_packed ) -{ - handler_data *handler = (handler_data *)machine; - UINT32 result = 0; - if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff)) - result |= (*handler->subhandler.read.mhandler32)(handler->subobject, offset * 2 + 0, mem_mask >> 0) << 0; - if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000)) - result |= (UINT64)(*handler->subhandler.read.mhandler32)(handler->subobject, offset * 2 + 1, mem_mask >> 32) << 32; - return result; -} - - -/*------------------------------------------------- - stub_read32_from_64be_packed - return a 64-bit - value combined from one or more dword accesses --------------------------------------------------*/ - -static READ64_HANDLER( stub_read32_from_64be_packed ) -{ - handler_data *handler = (handler_data *)machine; - UINT32 result = 0; - if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000)) - result |= (UINT64)(*handler->subhandler.read.mhandler32)(handler->subobject, offset * 2 + 0, mem_mask >> 32) << 32; - if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff)) - result |= (*handler->subhandler.read.mhandler32)(handler->subobject, offset * 2 + 1, mem_mask >> 0) << 0; - return result; -} - - - -/*************************************************************************** - STUB HANDLERS THAT MAP TO DWORD WRITES -***************************************************************************/ - -/*------------------------------------------------- - stub_write32_from_64_shifted - write a 64-bit - value to a single word lane --------------------------------------------------*/ - -static WRITE64_HANDLER( stub_write32_from_64_shifted ) -{ - handler_data *handler = (handler_data *)machine; - if ((UINT32)(mem_mask >> handler->subshift) != 0xffffffff) - (*handler->subhandler.write.mhandler32)(handler->subobject, offset, data >> handler->subshift, mem_mask >> handler->subshift); -} - - -/*------------------------------------------------- - stub_write32_from_64le_packed - convert a 64-bit - write to one or more word accesses --------------------------------------------------*/ - -static WRITE64_HANDLER( stub_write32_from_64le_packed ) -{ - handler_data *handler = (handler_data *)machine; - if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff)) - (*handler->subhandler.write.mhandler32)(handler->subobject, offset * 2 + 0, data >> 0, mem_mask >> 0); - if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000)) - (*handler->subhandler.write.mhandler32)(handler->subobject, offset * 2 + 1, data >> 32, mem_mask >> 32); -} - - -/*------------------------------------------------- - stub_write32_from_64be_packed - convert a 64-bit - write to one or more word accesses --------------------------------------------------*/ - -static WRITE64_HANDLER( stub_write32_from_64be_packed ) -{ - handler_data *handler = (handler_data *)machine; - if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000)) - (*handler->subhandler.write.mhandler32)(handler->subobject, offset * 2 + 0, data >> 32, mem_mask >> 32); - if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff)) - (*handler->subhandler.write.mhandler32)(handler->subobject, offset * 2 + 1, data >> 0, mem_mask >> 0); + const handler_data *handler = (const handler_data *)machine; + const UINT8 *subshift = handler->subshift; + int subunits = handler->subunits; + + offset *= subunits; + while (subunits-- != 0) + { + int shift = *subshift++; + if ((UINT32)(mem_mask >> shift) != 0xffffffff) + (*handler->subhandler.write.mhandler32)(handler->subobject, offset, data >> shift, mem_mask >> shift); + offset++; + } } @@ -3672,7 +3328,7 @@ static WRITE64_HANDLER( stub_write32_from_64be_packed ) stub handler -------------------------------------------------*/ -static memory_handler get_stub_handler(read_or_write readorwrite, int spacedbits, int spaceendian, int handlerdbits, int handlershift) +static memory_handler get_stub_handler(read_or_write readorwrite, int spacedbits, int handlerdbits) { memory_handler result = { 0 }; @@ -3683,69 +3339,27 @@ static memory_handler get_stub_handler(read_or_write readorwrite, int spacedbits if (spacedbits == 16) { if (handlerdbits == 8) - { - if (handlershift != SHIFT_PACKED) - result.read.mhandler16 = stub_read8_from_16_shifted; - else if (spaceendian == CPU_IS_LE) - result.read.mhandler16 = stub_read8_from_16le_packed; - else if (spaceendian == CPU_IS_BE) - result.read.mhandler16 = stub_read8_from_16be_packed; - } + result.read.mhandler16 = stub_read8_from_16; } /* 32-bit read stubs */ else if (spacedbits == 32) { if (handlerdbits == 8) - { - if (handlershift != SHIFT_PACKED) - result.read.mhandler32 = stub_read8_from_32_shifted; - else if (spaceendian == CPU_IS_LE) - result.read.mhandler32 = stub_read8_from_32le_packed; - else if (spaceendian == CPU_IS_BE) - result.read.mhandler32 = stub_read8_from_32be_packed; - } + result.read.mhandler32 = stub_read8_from_32; else if (handlerdbits == 16) - { - if (handlershift != SHIFT_PACKED) - result.read.mhandler32 = stub_read16_from_32_shifted; - else if (spaceendian == CPU_IS_LE) - result.read.mhandler32 = stub_read16_from_32le_packed; - else if (spaceendian == CPU_IS_BE) - result.read.mhandler32 = stub_read16_from_32be_packed; - } + result.read.mhandler32 = stub_read16_from_32; } /* 64-bit read stubs */ else if (spacedbits == 64) { if (handlerdbits == 8) - { - if (handlershift != SHIFT_PACKED) - result.read.mhandler64 = stub_read8_from_64_shifted; - else if (spaceendian == CPU_IS_LE) - result.read.mhandler64 = stub_read8_from_64le_packed; - else if (spaceendian == CPU_IS_BE) - result.read.mhandler64 = stub_read8_from_64be_packed; - } + result.read.mhandler64 = stub_read8_from_64; else if (handlerdbits == 16) - { - if (handlershift != SHIFT_PACKED) - result.read.mhandler64 = stub_read16_from_64_shifted; - else if (spaceendian == CPU_IS_LE) - result.read.mhandler64 = stub_read16_from_64le_packed; - else if (spaceendian == CPU_IS_BE) - result.read.mhandler64 = stub_read16_from_64be_packed; - } + result.read.mhandler64 = stub_read16_from_64; else if (handlerdbits == 32) - { - if (handlershift != SHIFT_PACKED) - result.read.mhandler64 = stub_read32_from_64_shifted; - else if (spaceendian == CPU_IS_LE) - result.read.mhandler64 = stub_read32_from_64le_packed; - else if (spaceendian == CPU_IS_BE) - result.read.mhandler64 = stub_read32_from_64be_packed; - } + result.read.mhandler64 = stub_read32_from_64; } } @@ -3756,69 +3370,27 @@ static memory_handler get_stub_handler(read_or_write readorwrite, int spacedbits if (spacedbits == 16) { if (handlerdbits == 8) - { - if (handlershift != SHIFT_PACKED) - result.write.mhandler16 = stub_write8_from_16_shifted; - else if (spaceendian == CPU_IS_LE) - result.write.mhandler16 = stub_write8_from_16le_packed; - else if (spaceendian == CPU_IS_BE) - result.write.mhandler16 = stub_write8_from_16be_packed; - } + result.write.mhandler16 = stub_write8_from_16; } /* 32-bit write stubs */ else if (spacedbits == 32) { if (handlerdbits == 8) - { - if (handlershift != SHIFT_PACKED) - result.write.mhandler32 = stub_write8_from_32_shifted; - else if (spaceendian == CPU_IS_LE) - result.write.mhandler32 = stub_write8_from_32le_packed; - else if (spaceendian == CPU_IS_BE) - result.write.mhandler32 = stub_write8_from_32be_packed; - } + result.write.mhandler32 = stub_write8_from_32; else if (handlerdbits == 16) - { - if (handlershift != SHIFT_PACKED) - result.write.mhandler32 = stub_write16_from_32_shifted; - else if (spaceendian == CPU_IS_LE) - result.write.mhandler32 = stub_write16_from_32le_packed; - else if (spaceendian == CPU_IS_BE) - result.write.mhandler32 = stub_write16_from_32be_packed; - } + result.write.mhandler32 = stub_write16_from_32; } /* 64-bit write stubs */ else if (spacedbits == 64) { if (handlerdbits == 8) - { - if (handlershift != SHIFT_PACKED) - result.write.mhandler64 = stub_write8_from_64_shifted; - else if (spaceendian == CPU_IS_LE) - result.write.mhandler64 = stub_write8_from_64le_packed; - else if (spaceendian == CPU_IS_BE) - result.write.mhandler64 = stub_write8_from_64be_packed; - } + result.write.mhandler64 = stub_write8_from_64; else if (handlerdbits == 16) - { - if (handlershift != SHIFT_PACKED) - result.write.mhandler64 = stub_write16_from_64_shifted; - else if (spaceendian == CPU_IS_LE) - result.write.mhandler64 = stub_write16_from_64le_packed; - else if (spaceendian == CPU_IS_BE) - result.write.mhandler64 = stub_write16_from_64be_packed; - } + result.write.mhandler64 = stub_write16_from_64; else if (handlerdbits == 32) - { - if (handlershift != SHIFT_PACKED) - result.write.mhandler64 = stub_write32_from_64_shifted; - else if (spaceendian == CPU_IS_LE) - result.write.mhandler64 = stub_write32_from_64le_packed; - else if (spaceendian == CPU_IS_BE) - result.write.mhandler64 = stub_write32_from_64be_packed; - } + result.write.mhandler64 = stub_write32_from_64; } } diff --git a/src/emu/memory.h b/src/emu/memory.h index 43634b77b65..59cc9bfd336 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -198,13 +198,13 @@ struct _address_map_entry offs_t addrmask; /* mask bits */ read_handler read; /* read handler callback */ UINT8 read_bits; /* bits for the read handler callback (0=default, 1=8, 2=16, 3=32) */ - UINT8 read_shift; /* shift value for the read handler */ + UINT8 read_mask; /* mask bits indicating which subunits to process */ const char * read_name; /* read handler callback name */ device_type read_devtype; /* read device type for device references */ const char * read_devtag; /* read tag for the relevant device */ write_handler write; /* write handler callback */ UINT8 write_bits; /* bits for the write handler callback (0=default, 1=8, 2=16, 3=32) */ - UINT8 write_shift; /* shift value for the write handler */ + UINT8 write_mask; /* mask bits indicating which subunits to process */ const char * write_name; /* write handler callback name */ device_type write_devtype; /* read device type for device references */ const char * write_devtag; /* read tag for the relevant device */ @@ -553,6 +553,31 @@ union _addrmap64_token #define address_map_0 NULL +/* maps a full 64-bit mask down to an 8-bit byte mask */ +#define UNITMASK8(x) \ + ((((UINT64)(x) >> (63-7)) & 0x80) | \ + (((UINT64)(x) >> (55-6)) & 0x40) | \ + (((UINT64)(x) >> (47-5)) & 0x20) | \ + (((UINT64)(x) >> (39-4)) & 0x10) | \ + (((UINT64)(x) >> (31-3)) & 0x08) | \ + (((UINT64)(x) >> (23-2)) & 0x04) | \ + (((UINT64)(x) >> (15-1)) & 0x02) | \ + (((UINT64)(x) >> ( 7-0)) & 0x01)) + +/* maps a full 64-bit mask down to a 4-bit word mask */ +#define UNITMASK16(x) \ + ((((UINT64)(x) >> (63-3)) & 0x08) | \ + (((UINT64)(x) >> (47-2)) & 0x04) | \ + (((UINT64)(x) >> (31-1)) & 0x02) | \ + (((UINT64)(x) >> (15-0)) & 0x01)) + +/* maps a full 64-bit mask down to a 2-bit dword mask */ +#define UNITMASK32(x) \ + ((((UINT64)(x) >> (63-1)) & 0x02) | \ + (((UINT64)(x) >> (31-0)) & 0x01)) + + + /* start/end tags for the address map */ #define ADDRESS_MAP_START(_name, _space, _bits) \ const addrmap##_bits##_token address_map_##_name[] = { \ @@ -595,103 +620,103 @@ union _addrmap64_token TOKEN_UINT64_PACK2(ADDRMAP_TOKEN_MIRROR, 8, _mirror, 32), #define AM_READ(_handler) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_READ, 8, 0, 2, 0, 6), \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_READ, 8, 0, 8, 0, 8), \ TOKEN_PTR(mread, _handler), \ TOKEN_STRING(#_handler), -#define AM_READ8(_handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_READ, 8, 1, 2, (_shift), 6), \ +#define AM_READ8(_handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_READ, 8, 8, 8, UNITMASK8(_unitmask), 8), \ TOKEN_PTR(mread8, _handler), \ TOKEN_STRING(#_handler), -#define AM_READ16(_handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_READ, 8, 2, 2, (_shift), 6), \ +#define AM_READ16(_handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_READ, 8, 16, 8, UNITMASK16(_unitmask), 8), \ TOKEN_PTR(mread16, _handler), \ TOKEN_STRING(#_handler), -#define AM_READ32(_handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_READ, 8, 3, 2, (_shift), 6), \ +#define AM_READ32(_handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_READ, 8, 32, 8, UNITMASK32(_unitmask), 8), \ TOKEN_PTR(mread32, _handler), \ TOKEN_STRING(#_handler), #define AM_WRITE(_handler) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_WRITE, 8, 0, 2, 0, 6), \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_WRITE, 8, 0, 8, 0, 8), \ TOKEN_PTR(mwrite, _handler), \ TOKEN_STRING(#_handler), -#define AM_WRITE8(_handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_WRITE, 8, 1, 2, (_shift), 6), \ +#define AM_WRITE8(_handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_WRITE, 8, 8, 8, UNITMASK8(_unitmask), 8), \ TOKEN_PTR(mwrite8, _handler), \ TOKEN_STRING(#_handler), -#define AM_WRITE16(_handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_WRITE, 8, 2, 2, (_shift), 6), \ +#define AM_WRITE16(_handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_WRITE, 8, 16, 8, UNITMASK16(_unitmask), 8), \ TOKEN_PTR(mwrite16, _handler), \ TOKEN_STRING(#_handler), -#define AM_WRITE32(_handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_WRITE, 8, 3, 2, (_shift), 6), \ +#define AM_WRITE32(_handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_WRITE, 8, 32, 8, UNITMASK32(_unitmask), 8), \ TOKEN_PTR(mwrite32, _handler), \ TOKEN_STRING(#_handler), #define AM_DEVREAD(_type, _tag, _handler) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_READ, 8, 0, 2, 0, 6), \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_READ, 8, 0, 8, 0, 8), \ TOKEN_PTR(dread, _handler), \ TOKEN_STRING(#_handler), \ TOKEN_PTR(devtype, _type), \ TOKEN_STRING(_tag), -#define AM_DEVREAD8(_type, _tag, _handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_READ, 8, 1, 2, (_shift), 6), \ +#define AM_DEVREAD8(_type, _tag, _handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_READ, 8, 8, 8, UNITMASK8(_unitmask), 8), \ TOKEN_PTR(dread8, _handler), \ TOKEN_STRING(#_handler), \ TOKEN_PTR(devtype, _type), \ TOKEN_STRING(_tag), -#define AM_DEVREAD16(_type, _tag, _handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_READ, 8, 2, 2, (_shift), 6), \ +#define AM_DEVREAD16(_type, _tag, _handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_READ, 8, 16, 8, UNITMASK16(_unitmask), 8), \ TOKEN_PTR(dread16, _handler), \ TOKEN_STRING(#_handler), \ TOKEN_PTR(devtype, _type), \ TOKEN_STRING(_tag), -#define AM_DEVREAD32(_type, _tag, _handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_READ, 8, 3, 2, (_shift), 6), \ +#define AM_DEVREAD32(_type, _tag, _handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_READ, 8, 32, 8, UNITMASK32(_unitmask), 8), \ TOKEN_PTR(dread32, _handler), \ TOKEN_STRING(#_handler), \ TOKEN_PTR(devtype, _type), \ TOKEN_STRING(_tag), #define AM_DEVWRITE(_type, _tag, _handler) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_WRITE, 8, 0, 2, 0, 6), \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_WRITE, 8, 0, 8, 0, 8), \ TOKEN_PTR(dwrite, _handler), \ TOKEN_STRING(#_handler), \ TOKEN_PTR(devtype, _type), \ TOKEN_STRING(_tag), -#define AM_DEVWRITE8(_type, _tag, _handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_WRITE, 8, 1, 2, (_shift), 6), \ +#define AM_DEVWRITE8(_type, _tag, _handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_WRITE, 8, 8, 8, UNITMASK8(_unitmask), 8), \ TOKEN_PTR(dwrite8, _handler), \ TOKEN_STRING(#_handler), \ TOKEN_PTR(devtype, _type), \ TOKEN_STRING(_tag), -#define AM_DEVWRITE16(_type, _tag, _handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_WRITE, 8, 2, 2, (_shift), 6), \ +#define AM_DEVWRITE16(_type, _tag, _handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_WRITE, 8, 16, 8, UNITMASK16(_unitmask), 8), \ TOKEN_PTR(dwrite16, _handler), \ TOKEN_STRING(#_handler), \ TOKEN_PTR(devtype, _type), \ TOKEN_STRING(_tag), -#define AM_DEVWRITE32(_type, _tag, _handler, _shift) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_WRITE, 8, 3, 2, (_shift), 6), \ +#define AM_DEVWRITE32(_type, _tag, _handler, _unitmask) \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_DEVICE_WRITE, 8, 32, 8, UNITMASK32(_unitmask), 8), \ TOKEN_PTR(dwrite32, _handler), \ TOKEN_STRING(#_handler), \ TOKEN_PTR(devtype, _type), \ TOKEN_STRING(_tag), #define AM_READ_PORT(_tag) \ - TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_READ_PORT, 8, 0, 2, 0, 6), \ + TOKEN_UINT32_PACK3(ADDRMAP_TOKEN_READ_PORT, 8, 0, 8, 0, 8), \ TOKEN_STRING(_tag), #define AM_REGION(_region, _offs) \ diff --git a/src/mame/audio/mcr.c b/src/mame/audio/mcr.c index 8b1fcfa11ff..21d65b9c9f3 100644 --- a/src/mame/audio/mcr.c +++ b/src/mame/audio/mcr.c @@ -692,7 +692,7 @@ static ADDRESS_MAP_START( soundsgood_map, ADDRESS_SPACE_PROGRAM, 16 ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0x7ffff) AM_RANGE(0x000000, 0x03ffff) AM_ROM - AM_RANGE(0x060000, 0x060007) AM_READWRITE8(pia_1_alt_r, pia_1_alt_w, 8) + AM_RANGE(0x060000, 0x060007) AM_READWRITE8(pia_1_alt_r, pia_1_alt_w, 0xff00) AM_RANGE(0x070000, 0x070fff) AM_RAM ADDRESS_MAP_END diff --git a/src/mame/drivers/gaelco3d.c b/src/mame/drivers/gaelco3d.c index 38e5c217382..ea0a5862067 100644 --- a/src/mame/drivers/gaelco3d.c +++ b/src/mame/drivers/gaelco3d.c @@ -736,29 +736,29 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( main020_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x000000, 0x1fffff) AM_ROM AM_RANGE(0x400000, 0x40ffff) AM_READWRITE(SMH_RAM, gaelco3d_paletteram_020_w) AM_BASE(&paletteram32) - AM_RANGE(0x51000c, 0x51000f) AM_READ16(input_port_0_word_r, 16) - AM_RANGE(0x51001c, 0x51001f) AM_READ16(input_port_1_word_r, 16) - AM_RANGE(0x51002c, 0x51002f) AM_READ16(input_port_2_word_r, 16) - AM_RANGE(0x51003c, 0x51003f) AM_READ16(input_port_3_word_r, 16) - AM_RANGE(0x510040, 0x510043) AM_READ16(sound_status_r, 0) - AM_RANGE(0x510040, 0x510043) AM_WRITE16(sound_data_w, 16) - AM_RANGE(0x510100, 0x510103) AM_READ16(eeprom_data_r, 16) - AM_RANGE(0x510100, 0x510103) AM_WRITE16(irq_ack_w, 16) + AM_RANGE(0x51000c, 0x51000f) AM_READ16(input_port_0_word_r, 0xffff0000) + AM_RANGE(0x51001c, 0x51001f) AM_READ16(input_port_1_word_r, 0xffff0000) + AM_RANGE(0x51002c, 0x51002f) AM_READ16(input_port_2_word_r, 0xffff0000) + AM_RANGE(0x51003c, 0x51003f) AM_READ16(input_port_3_word_r, 0xffff0000) + AM_RANGE(0x510040, 0x510043) AM_READ16(sound_status_r, 0x0000ffff) + AM_RANGE(0x510040, 0x510043) AM_WRITE16(sound_data_w, 0xffff0000) + AM_RANGE(0x510100, 0x510103) AM_READ16(eeprom_data_r, 0xffff0000) + AM_RANGE(0x510100, 0x510103) AM_WRITE16(irq_ack_w, 0xffff0000) AM_RANGE(0x510104, 0x510107) AM_WRITE(unknown_107_w) - AM_RANGE(0x510110, 0x510113) AM_WRITE16(eeprom_data_w, 0) - AM_RANGE(0x510114, 0x510117) AM_WRITE16(tms_control3_w, 0) - AM_RANGE(0x510118, 0x51011b) AM_WRITE16(eeprom_clock_w, 0) - AM_RANGE(0x510120, 0x510123) AM_WRITE16(eeprom_cs_w, 0) + AM_RANGE(0x510110, 0x510113) AM_WRITE16(eeprom_data_w, 0x0000ffff) + AM_RANGE(0x510114, 0x510117) AM_WRITE16(tms_control3_w, 0x0000ffff) + AM_RANGE(0x510118, 0x51011b) AM_WRITE16(eeprom_clock_w, 0x0000ffff) + AM_RANGE(0x510120, 0x510123) AM_WRITE16(eeprom_cs_w, 0x0000ffff) AM_RANGE(0x510124, 0x510127) AM_WRITE(unknown_127_w) - AM_RANGE(0x510128, 0x51012b) AM_WRITE16(tms_reset_w, 0) - AM_RANGE(0x510130, 0x510133) AM_WRITE16(tms_irq_w, 0) + AM_RANGE(0x510128, 0x51012b) AM_WRITE16(tms_reset_w, 0x0000ffff) + AM_RANGE(0x510130, 0x510133) AM_WRITE16(tms_irq_w, 0x0000ffff) AM_RANGE(0x510134, 0x510137) AM_WRITE(unknown_137_w) AM_RANGE(0x510138, 0x51013b) AM_WRITE(unknown_13a_w) - AM_RANGE(0x510144, 0x510147) AM_WRITE16(led_0_w, 0) - AM_RANGE(0x510154, 0x510157) AM_WRITE16(analog_port_clock_w, 0) - AM_RANGE(0x510164, 0x510167) AM_WRITE16(analog_port_latch_w, 0) - AM_RANGE(0x510174, 0x510177) AM_WRITE16(led_1_w, 0) - AM_RANGE(0xfe7f80, 0xfe7fff) AM_WRITE16(tms_comm_w, SHIFT_PACKED) AM_BASE((UINT32 **)&tms_comm_base) + AM_RANGE(0x510144, 0x510147) AM_WRITE16(led_0_w, 0x0000ffff) + AM_RANGE(0x510154, 0x510157) AM_WRITE16(analog_port_clock_w, 0x0000ffff) + AM_RANGE(0x510164, 0x510167) AM_WRITE16(analog_port_latch_w, 0x0000ffff) + AM_RANGE(0x510174, 0x510177) AM_WRITE16(led_1_w, 0x0000ffff) + AM_RANGE(0xfe7f80, 0xfe7fff) AM_WRITE16(tms_comm_w, 0xffffffff) AM_BASE((UINT32 **)&tms_comm_base) AM_RANGE(0xfe0000, 0xfeffff) AM_RAM AM_BASE((UINT32 **)&m68k_ram_base) ADDRESS_MAP_END diff --git a/src/mame/drivers/itech8.c b/src/mame/drivers/itech8.c index 92889957a43..8426c0074c2 100644 --- a/src/mame/drivers/itech8.c +++ b/src/mame/drivers/itech8.c @@ -933,14 +933,14 @@ static ADDRESS_MAP_START( ninclown_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x000000, 0x00007f) AM_RAM AM_REGION(REGION_CPU1, 0) AM_RANGE(0x000080, 0x003fff) AM_RAM AM_BASE((void *)&main_ram) AM_SIZE(&main_ram_size) AM_RANGE(0x004000, 0x07ffff) AM_ROM - AM_RANGE(0x100080, 0x100081) AM_WRITE8(sound_data_w, 8) + AM_RANGE(0x100080, 0x100081) AM_WRITE8(sound_data_w, 0xff00) AM_RANGE(0x100100, 0x100101) AM_READWRITE(input_port_0_word_r, grom_bank16_w) AM_BASE((void *)&itech8_grom_bank) AM_RANGE(0x100180, 0x100181) AM_READWRITE(input_port_1_word_r, display_page16_w) - AM_RANGE(0x100240, 0x100241) AM_WRITE8(tms34061_latch_w, 8) + AM_RANGE(0x100240, 0x100241) AM_WRITE8(tms34061_latch_w, 0xff00) AM_RANGE(0x100280, 0x100281) AM_READWRITE(input_port_2_word_r, SMH_NOP) - AM_RANGE(0x100300, 0x10031f) AM_READWRITE8(itech8_blitter_r, itech8_blitter_w, SHIFT_PACKED) + AM_RANGE(0x100300, 0x10031f) AM_READWRITE8(itech8_blitter_r, itech8_blitter_w, 0xffff) AM_RANGE(0x100380, 0x1003ff) AM_WRITE(palette16_w) - AM_RANGE(0x110000, 0x110fff) AM_READWRITE8(itech8_tms34061_r, itech8_tms34061_w, SHIFT_PACKED) + AM_RANGE(0x110000, 0x110fff) AM_READWRITE8(itech8_tms34061_r, itech8_tms34061_w, 0xffff) ADDRESS_MAP_END diff --git a/src/mame/drivers/mcr68.c b/src/mame/drivers/mcr68.c index a1818f02fd1..db168b354f5 100644 --- a/src/mame/drivers/mcr68.c +++ b/src/mame/drivers/mcr68.c @@ -331,9 +331,9 @@ static ADDRESS_MAP_START( zwackery_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x080000, 0x080fff) AM_RAM AM_RANGE(0x084000, 0x084fff) AM_RAM AM_RANGE(0x100000, 0x10000f) AM_READWRITE(zwackery_6840_r, mcr68_6840_upper_w) - AM_RANGE(0x104000, 0x104007) AM_READWRITE8(pia_2_r, pia_2_w, 8) - AM_RANGE(0x108000, 0x108007) AM_READWRITE8(pia_3_r, pia_3_w, 0) - AM_RANGE(0x10c000, 0x10c007) AM_READWRITE8(pia_4_r, pia_4_w, 0) + AM_RANGE(0x104000, 0x104007) AM_READWRITE8(pia_2_r, pia_2_w, 0xff00) + AM_RANGE(0x108000, 0x108007) AM_READWRITE8(pia_3_r, pia_3_w, 0x00ff) + AM_RANGE(0x10c000, 0x10c007) AM_READWRITE8(pia_4_r, pia_4_w, 0x00ff) AM_RANGE(0x800000, 0x800fff) AM_READWRITE(SMH_RAM, zwackery_videoram_w) AM_BASE(&videoram16) AM_SIZE(&videoram_size) AM_RANGE(0x802000, 0x803fff) AM_READWRITE(SMH_RAM, zwackery_paletteram_w) AM_BASE(&paletteram16) AM_RANGE(0xc00000, 0xc00fff) AM_READWRITE(SMH_RAM, zwackery_spriteram_w) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)