diff options
author | 2010-09-21 13:26:27 +0000 | |
---|---|---|
committer | 2010-09-21 13:26:27 +0000 | |
commit | 9b7a65c49030832caacc4d521190a07dc443b2d4 (patch) | |
tree | cb3f14e8060fe57b171786afdc9cec44092fc321 | |
parent | 748bbd2b07c6f53ca75d275b95b5bcd64802c2c7 (diff) |
Changed memory width stubs to fill unpopulated regions with the appropriate
portion of the unmap value.
Changed X2212 device to return unmapped bits for the upper 4 bits.
-rw-r--r-- | src/emu/machine/x2212.c | 2 | ||||
-rw-r--r-- | src/emu/memory.c | 16 | ||||
-rw-r--r-- | src/mame/drivers/ccastles.c | 2 | ||||
-rw-r--r-- | src/mame/drivers/firefox.c | 2 |
4 files changed, 13 insertions, 9 deletions
diff --git a/src/emu/machine/x2212.c b/src/emu/machine/x2212.c index 338764786e8..7de91f7812d 100644 --- a/src/emu/machine/x2212.c +++ b/src/emu/machine/x2212.c @@ -215,7 +215,7 @@ WRITE8_MEMBER( x2212_device::write ) READ8_MEMBER( x2212_device::read ) { - return m_addrspace[0]->read_byte(offset) & 0x0f; + return (m_addrspace[0]->read_byte(offset) & 0x0f) | (space.unmap() & 0xf0); } diff --git a/src/emu/memory.c b/src/emu/memory.c index 671b6d11a72..88949890a38 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -480,6 +480,7 @@ protected: UINT8 ** m_rambaseptr; // pointer to the bank base UINT8 m_subunits; // for width stubs, the number of subunits UINT8 m_subshift[8]; // for width stubs, the shift of each subunit + UINT64 m_invsubmask; // inverted mask of the populated subunits }; @@ -4370,6 +4371,9 @@ void handler_entry::configure_subunits(UINT64 handlermask, int handlerbits) { UINT64 unitmask = ((UINT64)1 << handlerbits) - 1; assert(handlermask != 0); + + // set the inverse mask + m_invsubmask = ~handlermask; // compute the maximum possible subunits int maxunits = m_datawidth / handlerbits; @@ -4618,7 +4622,7 @@ void handler_entry_read::set_ioport(const input_port_config &ioport) UINT16 handler_entry_read::read_stub_16_from_8(address_space &space, offs_t offset, UINT16 mask) { - UINT16 result = 0; + UINT16 result = space.unmap() & m_invsubmask; for (int index = 0; index < m_subunits; index++) { int shift = m_subshift[index]; @@ -4637,7 +4641,7 @@ UINT16 handler_entry_read::read_stub_16_from_8(address_space &space, offs_t offs UINT32 handler_entry_read::read_stub_32_from_8(address_space &space, offs_t offset, UINT32 mask) { - UINT32 result = 0; + UINT32 result = space.unmap() & m_invsubmask; for (int index = 0; index < m_subunits; index++) { int shift = m_subshift[index]; @@ -4656,7 +4660,7 @@ UINT32 handler_entry_read::read_stub_32_from_8(address_space &space, offs_t offs UINT64 handler_entry_read::read_stub_64_from_8(address_space &space, offs_t offset, UINT64 mask) { - UINT64 result = 0; + UINT64 result = space.unmap() & m_invsubmask; for (int index = 0; index < m_subunits; index++) { int shift = m_subshift[index]; @@ -4675,7 +4679,7 @@ UINT64 handler_entry_read::read_stub_64_from_8(address_space &space, offs_t offs UINT32 handler_entry_read::read_stub_32_from_16(address_space &space, offs_t offset, UINT32 mask) { - UINT32 result = 0; + UINT32 result = space.unmap() & m_invsubmask; for (int index = 0; index < m_subunits; index++) { int shift = m_subshift[index]; @@ -4694,7 +4698,7 @@ UINT32 handler_entry_read::read_stub_32_from_16(address_space &space, offs_t off UINT64 handler_entry_read::read_stub_64_from_16(address_space &space, offs_t offset, UINT64 mask) { - UINT64 result = 0; + UINT64 result = space.unmap() & m_invsubmask; for (int index = 0; index < m_subunits; index++) { int shift = m_subshift[index]; @@ -4713,7 +4717,7 @@ UINT64 handler_entry_read::read_stub_64_from_16(address_space &space, offs_t off UINT64 handler_entry_read::read_stub_64_from_32(address_space &space, offs_t offset, UINT64 mask) { - UINT64 result = 0; + UINT64 result = space.unmap() & m_invsubmask; for (int index = 0; index < m_subunits; index++) { int shift = m_subshift[index]; diff --git a/src/mame/drivers/ccastles.c b/src/mame/drivers/ccastles.c index 6e66d49fe4a..e6565459f8c 100644 --- a/src/mame/drivers/ccastles.c +++ b/src/mame/drivers/ccastles.c @@ -313,7 +313,7 @@ static WRITE8_HANDLER( nvram_store_w ) static READ8_HANDLER( nvram_r ) { ccastles_state *state = space->machine->driver_data<ccastles_state>(); - return state->nvram_4b->read(*space, offset) | (state->nvram_4a->read(*space, offset) << 4); + return (state->nvram_4b->read(*space, offset) & 0x0f) | (state->nvram_4a->read(*space, offset) << 4); } diff --git a/src/mame/drivers/firefox.c b/src/mame/drivers/firefox.c index 0663fa5337d..bae35aa58a3 100644 --- a/src/mame/drivers/firefox.c +++ b/src/mame/drivers/firefox.c @@ -357,7 +357,7 @@ static WRITE8_HANDLER( nvram_w ) static READ8_HANDLER( nvram_r ) { - return (nvram_1c->read(*space, offset) << 4) | nvram_1d->read(*space, offset); + return (nvram_1c->read(*space, offset) << 4) | (nvram_1d->read(*space, offset) & 0x0f); } static WRITE8_HANDLER( novram_recall_w ) |