aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CP15.cpp6
-rw-r--r--src/DSi.cpp71
-rw-r--r--src/NDS.cpp5
-rw-r--r--src/NDS.h2
4 files changed, 58 insertions, 26 deletions
diff --git a/src/CP15.cpp b/src/CP15.cpp
index f6476ab..3f9e79d 100644
--- a/src/CP15.cpp
+++ b/src/CP15.cpp
@@ -616,11 +616,11 @@ void ARMv5::CP15Write(u32 id, u32 val)
case 0xF00:
//printf("cache debug index register %08X\n", val);
return;
-
+
case 0xF10:
//printf("cache debug instruction tag %08X\n", val);
return;
-
+
case 0xF20:
//printf("cache debug data tag %08X\n", val);
return;
@@ -632,7 +632,7 @@ void ARMv5::CP15Write(u32 id, u32 val)
case 0xF40:
//printf("cache debug data cache %08X\n", val);
return;
-
+
}
if ((id & 0xF00) == 0xF00) // test/debug shit?
diff --git a/src/DSi.cpp b/src/DSi.cpp
index 42541fe..66b8ed0 100644
--- a/src/DSi.cpp
+++ b/src/DSi.cpp
@@ -699,20 +699,37 @@ void MapNWRAMRange(u32 cpu, u32 num, u32 val)
}
}
+void ApplyNewRAMSize(u32 size)
+{
+ switch (size)
+ {
+ case 0:
+ case 1:
+ NDS::MainRAMMask = 0x3FFFFF;
+ printf("RAM: 4MB\n");
+ break;
+ case 2:
+ case 3: // TODO: debug console w/ 32MB?
+ NDS::MainRAMMask = 0xFFFFFF;
+ printf("RAM: 16MB\n");
+ break;
+ }
+}
+
void Set_SCFG_Clock9(u16 val)
{
- SCFG_Clock9 = val & 0x0187;
- return;
-
NDS::ARM9Timestamp >>= NDS::ARM9ClockShift;
+ NDS::ARM9Target >>= NDS::ARM9ClockShift;
printf("CLOCK9=%04X\n", val);
SCFG_Clock9 = val & 0x0187;
if (SCFG_Clock9 & (1<<0)) NDS::ARM9ClockShift = 2;
else NDS::ARM9ClockShift = 1;
+
NDS::ARM9Timestamp <<= NDS::ARM9ClockShift;
+ NDS::ARM9Target <<= NDS::ARM9ClockShift;
NDS::ARM9->UpdateRegionTimings(0x00000000, 0xFFFFFFFF);
}
@@ -1549,25 +1566,37 @@ void ARM9IOWrite32(u32 addr, u32 val)
switch (addr)
{
case 0x04004008:
- SCFG_EXT[0] &= ~0x8007F19F;
- SCFG_EXT[0] |= (val & 0x8007F19F);
- SCFG_EXT[1] &= ~0x0000F080;
- SCFG_EXT[1] |= (val & 0x0000F080);
- printf("SCFG_EXT = %08X / %08X (val9 %08X)\n", SCFG_EXT[0], SCFG_EXT[1], val);
- /*switch ((SCFG_EXT[0] >> 14) & 0x3)
{
- case 0:
- case 1:
- NDS::MainRAMMask = 0x3FFFFF;
- printf("RAM: 4MB\n");
- break;
- case 2:
- case 3: // TODO: debug console w/ 32MB?
- NDS::MainRAMMask = 0xFFFFFF;
- printf("RAM: 16MB\n");
- break;
- }*/
- printf("from %08X, ARM7 %08X, %08X\n", NDS::GetPC(0), NDS::GetPC(1), NDS::ARM7->R[1]);
+ u32 oldram = (SCFG_EXT[0] >> 14) & 0x3;
+ u32 newram = (val >> 14) & 0x3;
+
+ SCFG_EXT[0] &= ~0x8007F19F;
+ SCFG_EXT[0] |= (val & 0x8007F19F);
+ SCFG_EXT[1] &= ~0x0000F080;
+ SCFG_EXT[1] |= (val & 0x0000F080);
+ printf("SCFG_EXT = %08X / %08X (val9 %08X)\n", SCFG_EXT[0], SCFG_EXT[1], val);
+ /*switch ((SCFG_EXT[0] >> 14) & 0x3)
+ {
+ case 0:
+ case 1:
+ NDS::MainRAMMask = 0x3FFFFF;
+ printf("RAM: 4MB\n");
+ //baziderp=true;
+ break;
+ case 2:
+ case 3: // TODO: debug console w/ 32MB?
+ NDS::MainRAMMask = 0xFFFFFF;
+ printf("RAM: 16MB\n");
+ break;
+ }*/
+ // HAX!!
+ // a change to the RAM size setting is supposed to apply immediately (it does so on hardware)
+ // however, doing so will cause DS-mode app startup to break, because the change happens while the ARM7
+ // is still busy clearing/relocating shit
+ //if (newram != oldram)
+ // NDS::ScheduleEvent(NDS::Event_DSi_RAMSizeChange, false, 512*512*512, ApplyNewRAMSize, newram);
+ printf("from %08X, ARM7 %08X, %08X\n", NDS::GetPC(0), NDS::GetPC(1), NDS::ARM7->R[1]);
+ }
return;
case 0x04004040:
diff --git a/src/NDS.cpp b/src/NDS.cpp
index 823d39a..bb579f6 100644
--- a/src/NDS.cpp
+++ b/src/NDS.cpp
@@ -1817,15 +1817,16 @@ void debug(u32 param)
fwrite(&val, 4, 1, shit);
}
fclose(shit);*/
+
FILE*
- shit = fopen("debug/dump9.bin", "wb");
+ shit = fopen("debug/picto9.bin", "wb");
for (u32 i = 0x02000000; i < 0x04000000; i+=4)
{
u32 val = DSi::ARM9Read32(i);
fwrite(&val, 4, 1, shit);
}
fclose(shit);
- shit = fopen("debug/dump7.bin", "wb");
+ shit = fopen("debug/picto7.bin", "wb");
for (u32 i = 0x02000000; i < 0x04000000; i+=4)
{
u32 val = DSi::ARM7Read32(i);
diff --git a/src/NDS.h b/src/NDS.h
index e0a5045..91bfd1c 100644
--- a/src/NDS.h
+++ b/src/NDS.h
@@ -47,6 +47,8 @@ enum
Event_DSi_SDIOTransfer,
Event_DSi_NWifi,
+ Event_DSi_RAMSizeChange,
+
Event_MAX
};