DSi: make ARM9-clock-selector actually work
This commit is contained in:
parent
e27d55505f
commit
ba373ca72a
35
src/DSi.cpp
35
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,6 +1566,10 @@ void ARM9IOWrite32(u32 addr, u32 val)
|
|||
switch (addr)
|
||||
{
|
||||
case 0x04004008:
|
||||
{
|
||||
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;
|
||||
|
@ -1560,6 +1581,7 @@ void ARM9IOWrite32(u32 addr, u32 val)
|
|||
case 1:
|
||||
NDS::MainRAMMask = 0x3FFFFF;
|
||||
printf("RAM: 4MB\n");
|
||||
//baziderp=true;
|
||||
break;
|
||||
case 2:
|
||||
case 3: // TODO: debug console w/ 32MB?
|
||||
|
@ -1567,7 +1589,14 @@ void ARM9IOWrite32(u32 addr, u32 val)
|
|||
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:
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue