diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/NDS.cpp | 55 | ||||
-rw-r--r-- | src/Wifi.cpp | 2 | ||||
-rw-r--r-- | src/version.h | 2 |
3 files changed, 55 insertions, 4 deletions
diff --git a/src/NDS.cpp b/src/NDS.cpp index 8a3d13e..a93e581 100644 --- a/src/NDS.cpp +++ b/src/NDS.cpp @@ -104,6 +104,8 @@ u32 SqrtVal[2]; u32 SqrtRes; u32 KeyInput; +u16 KeyCnt; +u16 RCnt; bool Running; @@ -326,6 +328,8 @@ void Reset() ARM7Offset = 0; KeyInput = 0x007F03FF; + KeyCnt = 0; + RCnt = 0; NDSCart::Reset(); GPU::Reset(); @@ -1321,6 +1325,8 @@ u8 ARM9IORead8(u32 addr) { case 0x04000130: return KeyInput & 0xFF; case 0x04000131: return (KeyInput >> 8) & 0xFF; + case 0x04000132: return KeyCnt & 0xFF; + case 0x04000133: return KeyCnt >> 8; case 0x040001A2: return NDSCart::ReadSPIData(); @@ -1405,6 +1411,7 @@ u16 ARM9IORead16(u32 addr) case 0x0400010E: return Timers[3].Cnt; case 0x04000130: return KeyInput & 0xFFFF; + case 0x04000132: return KeyCnt; case 0x04000180: return IPCSync9; case 0x04000184: @@ -1495,6 +1502,8 @@ u32 ARM9IORead32(u32 addr) case 0x04000108: return TimerGetCounter(2) | (Timers[2].Cnt << 16); case 0x0400010C: return TimerGetCounter(3) | (Timers[3].Cnt << 16); + case 0x04000130: return (KeyInput & 0xFFFF) | (KeyCnt << 16); + case 0x040001A0: return NDSCart::SPICnt | (NDSCart::ReadSPIData() << 16); case 0x040001A4: return NDSCart::ROMCnt; @@ -1577,6 +1586,13 @@ void ARM9IOWrite8(u32 addr, u8 val) { switch (addr) { + case 0x04000132: + KeyCnt = (KeyCnt & 0xFF00) | val; + return; + case 0x04000133: + KeyCnt = (KeyCnt & 0x00FF) | (val << 8); + return; + case 0x040001A0: if (!(ExMemCnt[0] & (1<<11))) { @@ -1676,6 +1692,10 @@ void ARM9IOWrite16(u32 addr, u16 val) case 0x0400010C: Timers[3].Reload = val; return; case 0x0400010E: TimerStart(3, val); return; + case 0x04000132: + KeyCnt = val; + return; + case 0x04000180: IPCSync7 &= 0xFFF0; IPCSync7 |= ((val & 0x0F00) >> 8); @@ -1830,6 +1850,10 @@ void ARM9IOWrite32(u32 addr, u32 val) TimerStart(3, val>>16); return; + case 0x04000130: + KeyCnt = val >> 16; + return; + case 0x04000188: if (IPCFIFOCnt9 & 0x8000) { @@ -1937,6 +1961,10 @@ u8 ARM7IORead8(u32 addr) { case 0x04000130: return KeyInput & 0xFF; case 0x04000131: return (KeyInput >> 8) & 0xFF; + case 0x04000132: return KeyCnt & 0xFF; + case 0x04000133: return KeyCnt >> 8; + case 0x04000134: return RCnt & 0xFF; + case 0x04000135: return RCnt >> 8; case 0x04000136: return (KeyInput >> 16) & 0xFF; case 0x04000137: return KeyInput >> 24; @@ -1998,9 +2026,10 @@ u16 ARM7IORead16(u32 addr) case 0x0400010E: return Timers[7].Cnt; case 0x04000130: return KeyInput & 0xFFFF; + case 0x04000132: return KeyCnt; + case 0x04000134: return RCnt; case 0x04000136: return KeyInput >> 16; - case 0x04000134: return 0x8000; case 0x04000138: return RTC::Read(); case 0x04000180: return IPCSync7; @@ -2070,6 +2099,10 @@ u32 ARM7IORead32(u32 addr) case 0x04000108: return TimerGetCounter(6) | (Timers[6].Cnt << 16); case 0x0400010C: return TimerGetCounter(7) | (Timers[7].Cnt << 16); + case 0x04000130: return (KeyInput & 0xFFFF) | (KeyCnt << 16); + case 0x04000134: return RCnt | (KeyCnt & 0xFFFF0000); + case 0x04000138: return RTC::Read(); + case 0x040001A0: return NDSCart::SPICnt | (NDSCart::ReadSPIData() << 16); case 0x040001A4: return NDSCart::ROMCnt; @@ -2128,6 +2161,19 @@ void ARM7IOWrite8(u32 addr, u8 val) { switch (addr) { + case 0x04000132: + KeyCnt = (KeyCnt & 0xFF00) | val; + return; + case 0x04000133: + KeyCnt = (KeyCnt & 0x00FF) | (val << 8); + return; + case 0x04000134: + RCnt = (RCnt & 0xFF00) | val; + return; + case 0x04000135: + RCnt = (RCnt & 0x00FF) | (val << 8); + return; + case 0x04000138: RTC::Write(val, true); return; case 0x040001A0: @@ -2207,7 +2253,8 @@ void ARM7IOWrite16(u32 addr, u16 val) case 0x0400010C: Timers[7].Reload = val; return; case 0x0400010E: TimerStart(7, val); return; - case 0x04000134: /* TODO? */ return; + case 0x04000132: KeyCnt = val; return; + case 0x04000134: RCnt = val; return; case 0x04000138: RTC::Write(val, false); return; @@ -2333,6 +2380,10 @@ void ARM7IOWrite32(u32 addr, u32 val) TimerStart(7, val>>16); return; + case 0x04000130: KeyCnt = val >> 16; return; + case 0x04000134: RCnt = val & 0xFFFF; return; + case 0x04000138: RTC::Write(val & 0xFFFF, false); return; + case 0x04000188: if (IPCFIFOCnt7 & 0x8000) { diff --git a/src/Wifi.cpp b/src/Wifi.cpp index 2a60a6a..77be4d8 100644 --- a/src/Wifi.cpp +++ b/src/Wifi.cpp @@ -941,7 +941,7 @@ void Write(u32 addr, u16 val) case 0x0A4: case 0x0A8: case 0x094: - printf("wifi: trying to send packet. %08X=%04X\n", addr, val); + printf("wifi: trying to send packet. %08X=%04X. TXREQ=%04X\n", addr, val, IOPORT(W_TXReqRead)); break; // read-only ports diff --git a/src/version.h b/src/version.h index d8a26d2..7d6b68c 100644 --- a/src/version.h +++ b/src/version.h @@ -19,7 +19,7 @@ #ifndef VERSION_H #define VERSION_H -#define MELONDS_VERSION "0.3" +#define MELONDS_VERSION "0.4" #define MELONDS_URL "http://melonds.kuribo64.net/" |