summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <lordkale4@gmail.com>2025-08-30 12:08:53 +0200
committer angelosa <lordkale4@gmail.com>2025-08-30 12:09:03 +0200
commit60e46e250b631a49c9ea0a1a70a1db4eeeb5df50 (patch)
treea9347c378a87bb54d1f9ade9b325b42b96f0de35
parentae14e0a30830e8aba81e1cb26ac0d72d5cddaa3c (diff)
machine/i2cmem: fix #13998
-rw-r--r--src/devices/machine/i2cmem.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/devices/machine/i2cmem.cpp b/src/devices/machine/i2cmem.cpp
index d6fbe779618..12e8cb88d80 100644
--- a/src/devices/machine/i2cmem.cpp
+++ b/src/devices/machine/i2cmem.cpp
@@ -316,7 +316,7 @@ void i2cmem_device::write_sda(int state)
state &= 1;
if( m_sdaw != state )
{
- LOGMASKED( LOG_WRITELINE, "%s: SDA = %d @ %s\n", machine().describe_context(), state, machine().time().to_string() );
+ LOGMASKED( LOG_WRITELINE, "%s: SDA = %d @ %s (%d)\n", machine().describe_context(), state, machine().time().to_string(), state );
m_sdaw = state;
// Ignore transitions on SDA while device is driving it low
@@ -352,7 +352,7 @@ void i2cmem_device::write_scl(int state)
if( m_scl != state )
{
m_scl = state;
- LOGMASKED( LOG_WRITELINE, "%s: SCL = %d @ %s\n", machine().describe_context(), m_scl, machine().time().to_string() );
+ LOGMASKED( LOG_WRITELINE, "%s: SCL = %d @ %s (%d)\n", machine().describe_context(), m_scl, machine().time().to_string(), m_state );
switch( m_state )
{
@@ -567,8 +567,12 @@ void i2cmem_device::write_wc(int state)
int i2cmem_device::read_sda()
{
int res = m_sdar & 1;
+ // https://github.com/mamedev/mame/issues/13998
+ // pullup write value if reading doesn't belong to this device
+ if (m_state == STATE_IDLE)
+ res = m_sdaw & 1;
if( !machine().side_effects_disabled() )
- LOGMASKED( LOG_READLINE, "%s: SDA = %d\n", machine().describe_context(), res );
+ LOGMASKED( LOG_READLINE, "%s: SDA = %d (%d)\n", machine().describe_context(), res, m_state );
return res;
}