SIO registers can now be read and written properly

This commit is contained in:
Jeffrey Pfau 2014-02-10 01:42:40 -08:00
parent 3422527d5a
commit 9c8e5fc222
4 changed files with 22 additions and 7 deletions

View File

@ -259,6 +259,9 @@ void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) {
value &= 0xC1FF;
GBASIOWriteRCNT(&gba->sio, value);
break;
case REG_SIOMLT_SEND:
GBASIOWriteSIOMLT_SEND(&gba->sio, value);
break;
// Interrupts and misc
case REG_WAITCNT:
@ -411,6 +414,11 @@ uint16_t GBAIORead(struct GBA* gba, uint32_t address) {
case REG_DMA1CNT_HI:
case REG_DMA2CNT_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_IF:
case REG_WAITCNT:

View File

@ -108,11 +108,11 @@ void GBASIOWriteRCNT(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;
_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) {

View File

@ -2,6 +2,7 @@
#include "gba-bios.h"
#include "gba-io.h"
#include "gba-sio.h"
#include "gba-thread.h"
#include "memory.h"
@ -198,6 +199,11 @@ static void GBAProcessEvents(struct ARMBoard* board) {
nextEvent = testEvent;
}
testEvent = GBASIOProcessEvents(&gbaBoard->p->sio, cycles);
if (testEvent < nextEvent) {
nextEvent = testEvent;
}
board->cpu->cycles -= cycles;
board->cpu->nextEvent = 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) {
if (value & (1 << IRQ_SIO)) {
GBALog(gba, GBA_LOG_STUB, "SIO interrupts not implemented");
}
if (value & (1 << IRQ_KEYPAD)) {
GBALog(gba, GBA_LOG_STUB, "Keypad interrupts not implemented");
}

View File

@ -8,6 +8,7 @@ typedef SOCKET Socket;
#else
#include <fcntl.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <stdio.h>
#include <sys/socket.h>
#include <unistd.h>
@ -81,4 +82,8 @@ static inline int SocketSetBlocking(Socket socket, int blocking) {
#endif
}
static inline int SocketSetTCPPush(Socket socket, int push) {
return setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char*) &push, sizeof(int)) >= 0;
}
#endif