GBA SIO: Add bits for JOY connections

This commit is contained in:
Jeffrey Pfau 2015-03-01 21:54:22 -08:00
parent f0f12fec1a
commit 5c9d5d9ddf
5 changed files with 23 additions and 11 deletions

View File

@ -70,8 +70,8 @@ static void _RegisterRamReset(struct GBA* gba) {
cpu->memory.store16(cpu, BASE_IO | REG_RCNT, RCNT_INITIAL, 0);
cpu->memory.store16(cpu, BASE_IO | REG_SIOMLT_SEND, 0, 0);
cpu->memory.store16(cpu, BASE_IO | REG_JOYCNT, 0, 0);
cpu->memory.store32(cpu, BASE_IO | REG_JOY_RECV, 0, 0);
cpu->memory.store32(cpu, BASE_IO | REG_JOY_TRANS, 0, 0);
cpu->memory.store32(cpu, BASE_IO | REG_JOY_RECV_LO, 0, 0);
cpu->memory.store32(cpu, BASE_IO | REG_JOY_TRANS_LO, 0, 0);
}
if (registers & 0x40) {
cpu->memory.store16(cpu, BASE_IO | REG_SOUND1CNT_LO, 0, 0);

View File

@ -515,7 +515,13 @@ void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) {
GBASIOWriteRCNT(&gba->sio, value);
break;
case REG_SIOMLT_SEND:
GBASIOWriteSIOMLT_SEND(&gba->sio, value);
case REG_JOYCNT:
case REG_JOYSTAT:
case REG_JOY_RECV_LO:
case REG_JOY_RECV_HI:
case REG_JOY_TRANS_LO:
case REG_JOY_TRANS_HI:
value = GBASIOWriteRegister(&gba->sio, address, value);
break;
// Interrupts and misc
@ -757,9 +763,6 @@ uint16_t GBAIORead(struct GBA* gba, uint32_t address) {
return GBALoadBad(gba->cpu);
case REG_SOUNDBIAS:
case REG_JOYCNT:
case REG_JOY_RECV:
case REG_JOY_TRANS:
case REG_KEYCNT:
case REG_POSTFLG:
mLOG(GBA_IO, STUB, "Stub I/O register read: %03x", address);
@ -814,6 +817,12 @@ uint16_t GBAIORead(struct GBA* gba, uint32_t address) {
case REG_SIOMULTI2:
case REG_SIOMULTI3:
case REG_SIOMLT_SEND:
case REG_JOYCNT:
case REG_JOY_RECV_LO:
case REG_JOY_RECV_HI:
case REG_JOY_TRANS_LO:
case REG_JOY_TRANS_HI:
case REG_JOYSTAT:
case REG_IE:
case REG_IF:
case REG_WAITCNT:

View File

@ -131,8 +131,10 @@ enum GBAIORegisters {
REG_SIODATA8 = 0x12A,
REG_RCNT = 0x134,
REG_JOYCNT = 0x140,
REG_JOY_RECV = 0x150,
REG_JOY_TRANS = 0x154,
REG_JOY_RECV_LO = 0x150,
REG_JOY_RECV_HI = 0x152,
REG_JOY_TRANS_LO = 0x154,
REG_JOY_TRANS_HI = 0x156,
REG_JOYSTAT = 0x158,
// Keypad

View File

@ -167,10 +167,11 @@ void GBASIOWriteSIOCNT(struct GBASIO* sio, uint16_t value) {
sio->siocnt = value;
}
void GBASIOWriteSIOMLT_SEND(struct GBASIO* sio, uint16_t value) {
uint16_t GBASIOWriteRegister(struct GBASIO* sio, uint32_t address, uint16_t value) {
if (sio->activeDriver && sio->activeDriver->writeRegister) {
sio->activeDriver->writeRegister(sio->activeDriver, REG_SIOMLT_SEND, value);
return sio->activeDriver->writeRegister(sio->activeDriver, address, value);
}
return value;
}
int32_t GBASIOProcessEvents(struct GBASIO* sio, int32_t cycles) {

View File

@ -76,7 +76,7 @@ void GBASIOSetDriver(struct GBASIO* sio, struct GBASIODriver* driver, enum GBASI
void GBASIOWriteRCNT(struct GBASIO* sio, uint16_t value);
void GBASIOWriteSIOCNT(struct GBASIO* sio, uint16_t value);
void GBASIOWriteSIOMLT_SEND(struct GBASIO* sio, uint16_t value);
uint16_t GBASIOWriteRegister(struct GBASIO* sio, uint32_t address, uint16_t value);
int32_t GBASIOProcessEvents(struct GBASIO* sio, int32_t cycles);