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.
This commit is contained in:
Aaron Giles 2010-09-21 13:26:27 +00:00
parent 748bbd2b07
commit 9b7a65c490
4 changed files with 13 additions and 9 deletions

View File

@ -215,7 +215,7 @@ WRITE8_MEMBER( x2212_device::write )
READ8_MEMBER( x2212_device::read ) READ8_MEMBER( x2212_device::read )
{ {
return m_addrspace[0]->read_byte(offset) & 0x0f; return (m_addrspace[0]->read_byte(offset) & 0x0f) | (space.unmap() & 0xf0);
} }

View File

@ -480,6 +480,7 @@ protected:
UINT8 ** m_rambaseptr; // pointer to the bank base UINT8 ** m_rambaseptr; // pointer to the bank base
UINT8 m_subunits; // for width stubs, the number of subunits UINT8 m_subunits; // for width stubs, the number of subunits
UINT8 m_subshift[8]; // for width stubs, the shift of each subunit UINT8 m_subshift[8]; // for width stubs, the shift of each subunit
UINT64 m_invsubmask; // inverted mask of the populated subunits
}; };
@ -4371,6 +4372,9 @@ void handler_entry::configure_subunits(UINT64 handlermask, int handlerbits)
UINT64 unitmask = ((UINT64)1 << handlerbits) - 1; UINT64 unitmask = ((UINT64)1 << handlerbits) - 1;
assert(handlermask != 0); assert(handlermask != 0);
// set the inverse mask
m_invsubmask = ~handlermask;
// compute the maximum possible subunits // compute the maximum possible subunits
int maxunits = m_datawidth / handlerbits; int maxunits = m_datawidth / handlerbits;
assert(maxunits > 1); assert(maxunits > 1);
@ -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 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++) for (int index = 0; index < m_subunits; index++)
{ {
int shift = m_subshift[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 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++) for (int index = 0; index < m_subunits; index++)
{ {
int shift = m_subshift[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 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++) for (int index = 0; index < m_subunits; index++)
{ {
int shift = m_subshift[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 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++) for (int index = 0; index < m_subunits; index++)
{ {
int shift = m_subshift[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 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++) for (int index = 0; index < m_subunits; index++)
{ {
int shift = m_subshift[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 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++) for (int index = 0; index < m_subunits; index++)
{ {
int shift = m_subshift[index]; int shift = m_subshift[index];

View File

@ -313,7 +313,7 @@ static WRITE8_HANDLER( nvram_store_w )
static READ8_HANDLER( nvram_r ) static READ8_HANDLER( nvram_r )
{ {
ccastles_state *state = space->machine->driver_data<ccastles_state>(); 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);
} }

View File

@ -357,7 +357,7 @@ static WRITE8_HANDLER( nvram_w )
static READ8_HANDLER( nvram_r ) 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 ) static WRITE8_HANDLER( novram_recall_w )