gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Multi-Player Packet transfers

#81327 - bitswiper - Fri Apr 28, 2006 12:31 pm

Hi!

I managed to setup a connection between GBAs, but I have some problems in packet exchange between them. This is the code I use to try send data and confirm that the connection have been done. But for some reason, the data is wrong. Could anyone help me please?

Code:

#define REG_SIOCNT    *(vu16*) 0x04000128
#define REG_SIODATA   *(vu16*) 0x0400012A
#define REG_SIOMULTI  ((vu16*) 0x04000120)

// Multiplayer sets
#define SIO_SI          0x0004
#define SIO_SD          0x0008
#define SIO_START       0x0080

#define TEST_PACKET     0xDEAD


Code:

  REG_SIODATA = TEST_PACKET;

  if( REG_SIOCNT & SIO_SI )
    REG_SIOCNT |= SIO_START;

  while( !( REG_SIOCNT & SIO_SD ) ) ;

  if( REG_SIOMULTI[ 1 ] == TEST_PACKET ) // <- This doesn't work
    g_nNbrPlayers = 2;

  g_nPlayerID = ( REG_SIOCNT >> 4 ) & 3;


I followed the gbatek document, but the code doesn't work for some reason. What have I forgotten?