Skip to content

sega/megadriv.cpp: later Acclaim sport games fails i2c checks during POST #13998

@angelosa

Description

@angelosa

I think what NBA Jam TE and friends are trying to achieve at POST is just an i2c bus check. The device is never driven in a state for reading the actual data inside, it's not using the SCL in a meaningful way while continuously hopping the SDA high then low in idle state. Follows a rough draft:

diff --git a/src/devices/machine/i2cmem.cpp b/src/devices/machine/i2cmem.cpp

index d6fbe779618..75d012226ce 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,10 @@ void i2cmem_device::write_wc(int state)

 int i2cmem_device::read_sda()

 {

 	int res = m_sdar & 1;

+	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;

 }

i2c device operations happens normally when viewing records in options (and I guess when it saves, given I managed to initialize correctly).

Originally posted by @angelosa in 6c9d79d

List of known games affected:
hash/megadriv.xml

  • bighurt
  • blockb
  • collslam
  • nbajam, nbajamj, nbajamp (currently using a i2c own implementation in place thru rom_nbajam_alt)
  • nbajamte, nbajamtef
  • nflqb
  • nflqb96

hash/32x.xml

  • nbajamte
  • nflqb (assumed, currently fails earlier)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions