Skip to content

Commit

Permalink
Merge pull request #63 from retro-wertz/fix_gba_siocnt
Browse files Browse the repository at this point in the history
libretro: add SIO Control, normal mode reg
  • Loading branch information
inactive123 committed Jul 23, 2019
2 parents 7df7b19 + 53ce6fb commit d1fcffc
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/libretro/libretro.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -90,14 +90,19 @@ bool EmuReseted;
int winGbPrinterEnabled; int winGbPrinterEnabled;
bool gba_joybus_active = false; bool gba_joybus_active = false;


#define UPDATE_REG(address, value) WRITE16LE(((uint16_t*)&ioMem[address]), value)

LinkMode GetLinkMode() LinkMode GetLinkMode()
{ {
return LINK_DISCONNECTED; return LINK_DISCONNECTED;
} }


void StartGPLink(uint16_t value) void StartGPLink(uint16_t value)
{ {
WRITE16LE(((uint16_t*)&ioMem[COMM_RCNT]), value); if (!ioMem)
return;

UPDATE_REG(COMM_RCNT, value);
} }


void LinkUpdate(int ticks) void LinkUpdate(int ticks)
Expand All @@ -106,6 +111,23 @@ void LinkUpdate(int ticks)


void StartLink(uint16_t siocnt) void StartLink(uint16_t siocnt)
{ {
/* log("'s' siocnt = %04x\n", siocnt); */

if (!ioMem)
return;

if(siocnt & 0x80)
{
siocnt &= 0xff7f;
if(siocnt & 1 && (siocnt & 0x4000))
{
UPDATE_REG(COMM_SIOCNT, 0xFF);
IF |= 0x80;
UPDATE_REG(0x202, IF);
siocnt &= 0x7f7f;
}
}
UPDATE_REG(COMM_SIOCNT, siocnt);
} }


void CheckLinkConnection() void CheckLinkConnection()
Expand Down

0 comments on commit d1fcffc

Please sign in to comment.