GBA:Fix serial emulation if compiled with NO_LINK

This commit is contained in:
negativeExponent 2021-05-22 08:26:19 +08:00
parent 15bcad1351
commit 70477dcd9b
1 changed files with 26 additions and 2 deletions

View File

@ -3038,11 +3038,27 @@ void CPUUpdateRegister(uint32_t address, uint16_t value)
cpuNextEvent = cpuTotalTicks; cpuNextEvent = cpuTotalTicks;
break; break;
#ifndef NO_LINK
case COMM_SIOCNT: case COMM_SIOCNT:
#ifndef NO_LINK
StartLink(value); StartLink(value);
#else
if (!ioMem)
return;
if (value & 0x80) {
value &= 0xff7f;
if (value & 1 && (value & 0x4000)) {
UPDATE_REG(COMM_SIOCNT, 0xFF);
IF |= 0x80;
UPDATE_REG(0x202, IF);
value &= 0x7f7f;
}
}
UPDATE_REG(COMM_SIOCNT, value);
#endif
break; break;
#ifndef NO_LINK
case COMM_SIODATA8: case COMM_SIODATA8:
UPDATE_REG(COMM_SIODATA8, value); UPDATE_REG(COMM_SIODATA8, value);
break; break;
@ -3057,11 +3073,19 @@ void CPUUpdateRegister(uint32_t address, uint16_t value)
UPDATE_REG(0x132, value & 0xC3FF); UPDATE_REG(0x132, value & 0xC3FF);
break; break;
#ifndef NO_LINK
case COMM_RCNT: case COMM_RCNT:
#ifndef NO_LINK
StartGPLink(value); StartGPLink(value);
#else
if (!ioMem)
return;
UPDATE_REG(COMM_RCNT, value);
#endif
break; break;
#ifndef NO_LINK
case COMM_JOYCNT: { case COMM_JOYCNT: {
uint16_t cur = READ16LE(&ioMem[COMM_JOYCNT]); uint16_t cur = READ16LE(&ioMem[COMM_JOYCNT]);