summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/memory.c
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2013-06-12 16:40:31 +0000
committer Olivier Galibert <galibert@pobox.com>2013-06-12 16:40:31 +0000
commit3bf927f944f1a597550dd191026d31e055d7bac3 (patch)
tree99dcd6dbd8f1e09f269c4947ca9ad229248468a2 /src/emu/memory.c
parent6a4fdb6a337b16a9b86671d4b2225e61e9203fcf (diff)
memory: Fix subunit reconfiguration [O. Galibert]
To hit this bug you need to have two subsized handlers on the same address with a different starting address. Something like, in a 64-bits address map: AM_RANGE(0x00, 0x1f) AM_READ32(r1_r, 0xffffffff00000000) AM_RANGE(0x10, 0x1f) AM_READ32(r2_r, 0x00000000ffffffff) Then r2_r (last entry) was called with an incorrect offset. To say that this configuration does not happen often is an understatement.
Diffstat (limited to 'src/emu/memory.c')
-rw-r--r--src/emu/memory.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/emu/memory.c b/src/emu/memory.c
index bba8f2617f4..b3c28020714 100644
--- a/src/emu/memory.c
+++ b/src/emu/memory.c
@@ -304,7 +304,7 @@ protected:
struct subunit_info
{
UINT32 m_mask; // mask (ff, ffff or ffffffff)
- UINT32 m_offset; // offset to add to the address
+ INT32 m_offset; // offset to add to the address
UINT32 m_multiplier; // multiplier to the pre-split address
UINT8 m_size; // size (8, 16 or 32)
UINT8 m_shift; // shift of the subunit
@@ -4341,9 +4341,9 @@ void handler_entry::copy(handler_entry *entry)
//-------------------------------------------------
void handler_entry::reconfigure_subunits(offs_t bytestart)
{
- offs_t delta = bytestart - m_bytestart;
+ INT32 delta = bytestart - m_bytestart;
for (int i=0; i != m_subunits; i++)
- m_subunit_infos[i].m_offset -= delta;
+ m_subunit_infos[i].m_offset += delta / (m_subunit_infos[i].m_size / 8);
}