GBA SIO: Add bits for JOY connections
Jeffrey Pfau jeffrey@endrift.com
Sun, 01 Mar 2015 21:54:22 -0800
5 files changed,
23 insertions(+),
11 deletions(-)
M
src/gba/bios.c
→
src/gba/bios.c
@@ -70,8 +70,8 @@ cpu->memory.store16(cpu, BASE_IO | REG_SIOCNT, 0x0000, 0);
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);
M
src/gba/io.c
→
src/gba/io.c
@@ -515,7 +515,13 @@ value &= 0xC1FF;
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 @@ mLOG(GBA_IO, GAME_ERROR, "Read from write-only I/O register: %03X", 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 @@ case REG_SIOMULTI1:
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:
M
src/gba/io.h
→
src/gba/io.h
@@ -131,8 +131,10 @@ REG_SIOMLT_SEND = 0x12A,
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
M
src/gba/sio.c
→
src/gba/sio.c
@@ -167,10 +167,11 @@ }
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) {
M
src/gba/sio.h
→
src/gba/sio.h
@@ -76,7 +76,7 @@ void GBASIOSetDriver(struct GBASIO* sio, struct GBASIODriver* driver, enum GBASIOMode mode);
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);