mirror of https://github.com/mgba-emu/mgba.git
SIO registers can now be read and written properly
This commit is contained in:
parent
3422527d5a
commit
9c8e5fc222
|
@ -259,6 +259,9 @@ void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) {
|
||||||
value &= 0xC1FF;
|
value &= 0xC1FF;
|
||||||
GBASIOWriteRCNT(&gba->sio, value);
|
GBASIOWriteRCNT(&gba->sio, value);
|
||||||
break;
|
break;
|
||||||
|
case REG_SIOMLT_SEND:
|
||||||
|
GBASIOWriteSIOMLT_SEND(&gba->sio, value);
|
||||||
|
break;
|
||||||
|
|
||||||
// Interrupts and misc
|
// Interrupts and misc
|
||||||
case REG_WAITCNT:
|
case REG_WAITCNT:
|
||||||
|
@ -411,6 +414,11 @@ uint16_t GBAIORead(struct GBA* gba, uint32_t address) {
|
||||||
case REG_DMA1CNT_HI:
|
case REG_DMA1CNT_HI:
|
||||||
case REG_DMA2CNT_HI:
|
case REG_DMA2CNT_HI:
|
||||||
case REG_DMA3CNT_HI:
|
case REG_DMA3CNT_HI:
|
||||||
|
case REG_SIOMULTI0:
|
||||||
|
case REG_SIOMULTI1:
|
||||||
|
case REG_SIOMULTI2:
|
||||||
|
case REG_SIOMULTI3:
|
||||||
|
case REG_SIOMLT_SEND:
|
||||||
case REG_IE:
|
case REG_IE:
|
||||||
case REG_IF:
|
case REG_IF:
|
||||||
case REG_WAITCNT:
|
case REG_WAITCNT:
|
||||||
|
|
|
@ -108,11 +108,11 @@ void GBASIOWriteRCNT(struct GBASIO* sio, uint16_t value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBASIOWriteSIOCNT(struct GBASIO* sio, uint16_t value) {
|
void GBASIOWriteSIOCNT(struct GBASIO* sio, uint16_t value) {
|
||||||
|
if (sio->activeDriver && sio->activeDriver->writeRegister) {
|
||||||
|
value = sio->activeDriver->writeRegister(sio->activeDriver, REG_SIOCNT, value);
|
||||||
|
}
|
||||||
sio->siocnt = value;
|
sio->siocnt = value;
|
||||||
_switchMode(sio);
|
_switchMode(sio);
|
||||||
if (sio->activeDriver && sio->activeDriver->writeRegister) {
|
|
||||||
sio->activeDriver->writeRegister(sio->activeDriver, REG_SIOCNT, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBASIOWriteSIOMLT_SEND(struct GBASIO* sio, uint16_t value) {
|
void GBASIOWriteSIOMLT_SEND(struct GBASIO* sio, uint16_t value) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "gba-bios.h"
|
#include "gba-bios.h"
|
||||||
#include "gba-io.h"
|
#include "gba-io.h"
|
||||||
|
#include "gba-sio.h"
|
||||||
#include "gba-thread.h"
|
#include "gba-thread.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
|
@ -198,6 +199,11 @@ static void GBAProcessEvents(struct ARMBoard* board) {
|
||||||
nextEvent = testEvent;
|
nextEvent = testEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testEvent = GBASIOProcessEvents(&gbaBoard->p->sio, cycles);
|
||||||
|
if (testEvent < nextEvent) {
|
||||||
|
nextEvent = testEvent;
|
||||||
|
}
|
||||||
|
|
||||||
board->cpu->cycles -= cycles;
|
board->cpu->cycles -= cycles;
|
||||||
board->cpu->nextEvent = nextEvent;
|
board->cpu->nextEvent = nextEvent;
|
||||||
} while (board->cpu->cycles >= board->cpu->nextEvent);
|
} while (board->cpu->cycles >= board->cpu->nextEvent);
|
||||||
|
@ -447,10 +453,6 @@ void GBATimerWriteTMCNT_HI(struct GBA* gba, int timer, uint16_t control) {
|
||||||
};
|
};
|
||||||
|
|
||||||
void GBAWriteIE(struct GBA* gba, uint16_t value) {
|
void GBAWriteIE(struct GBA* gba, uint16_t value) {
|
||||||
if (value & (1 << IRQ_SIO)) {
|
|
||||||
GBALog(gba, GBA_LOG_STUB, "SIO interrupts not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value & (1 << IRQ_KEYPAD)) {
|
if (value & (1 << IRQ_KEYPAD)) {
|
||||||
GBALog(gba, GBA_LOG_STUB, "Keypad interrupts not implemented");
|
GBALog(gba, GBA_LOG_STUB, "Keypad interrupts not implemented");
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ typedef SOCKET Socket;
|
||||||
#else
|
#else
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -81,4 +82,8 @@ static inline int SocketSetBlocking(Socket socket, int blocking) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int SocketSetTCPPush(Socket socket, int push) {
|
||||||
|
return setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char*) &push, sizeof(int)) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue