mirror of
https://github.com/libretro/mgba.git
synced 2024-11-24 08:30:30 +00:00
GBA SIO: Add bits for JOY connections
This commit is contained in:
parent
f0f12fec1a
commit
5c9d5d9ddf
@ -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);
|
||||
|
17
src/gba/io.c
17
src/gba/io.c
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user