aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GPU.cpp19
-rw-r--r--GPU.h2
-rw-r--r--NDS.cpp20
-rw-r--r--melonDS.depend8
4 files changed, 41 insertions, 8 deletions
diff --git a/GPU.cpp b/GPU.cpp
index 5d130a0..c1d9de0 100644
--- a/GPU.cpp
+++ b/GPU.cpp
@@ -108,8 +108,8 @@ void Reset()
GPU2D_A->Reset();
GPU2D_B->Reset();
- GPU2D_A->SetFramebuffer(&Framebuffer[256*0]);
- GPU2D_B->SetFramebuffer(&Framebuffer[256*192]);
+ GPU2D_A->SetFramebuffer(&Framebuffer[256*192]);
+ GPU2D_B->SetFramebuffer(&Framebuffer[256*0]);
}
@@ -720,6 +720,21 @@ void MapVRAM_I(u32 bank, u8 cnt)
}
+void DisplaySwap(u32 val)
+{
+ if (val)
+ {
+ GPU2D_A->SetFramebuffer(&Framebuffer[256*0]);
+ GPU2D_B->SetFramebuffer(&Framebuffer[256*192]);
+ }
+ else
+ {
+ GPU2D_A->SetFramebuffer(&Framebuffer[256*192]);
+ GPU2D_B->SetFramebuffer(&Framebuffer[256*0]);
+ }
+}
+
+
void StartFrame()
{
StartScanline(0);
diff --git a/GPU.h b/GPU.h
index dda33e5..c7149e6 100644
--- a/GPU.h
+++ b/GPU.h
@@ -58,6 +58,8 @@ void MapVRAM_FG(u32 bank, u8 cnt);
void MapVRAM_H(u32 bank, u8 cnt);
void MapVRAM_I(u32 bank, u8 cnt);
+void DisplaySwap(u32 val);
+
void StartFrame();
void StartScanline(u32 line);
diff --git a/NDS.cpp b/NDS.cpp
index 2b20471..1e320c8 100644
--- a/NDS.cpp
+++ b/NDS.cpp
@@ -178,6 +178,9 @@ void SetupDirectBoot()
ARM9->JumpTo(bootparams[1]);
ARM7->JumpTo(bootparams[5]);
+
+ PowerControl9 = 0x820F;
+ GPU::DisplaySwap(PowerControl9);
}
void Reset()
@@ -271,7 +274,7 @@ void Reset()
// test
//LoadROM();
//LoadFirmware();
- NDSCart::LoadROM("rom/mkds.nds");
+ NDSCart::LoadROM("rom/sm64ds.nds");
Running = true; // hax
}
@@ -1412,6 +1415,11 @@ u32 ARM9IORead32(u32 addr)
{
return GPU::GPU2D_B->Read32(addr);
}
+ if (addr >= 0x04000320 && addr < 0x040006A4)
+ {
+ // 3D GPU
+ return 0;
+ }
printf("unknown ARM9 IO read32 %08X\n", addr);
return 0;
@@ -1576,7 +1584,10 @@ void ARM9IOWrite16(u32 addr, u16 val)
PostFlag9 = val & 0x03;
return;
- case 0x04000304: PowerControl9 = val; return;
+ case 0x04000304:
+ PowerControl9 = val;
+ GPU::DisplaySwap(PowerControl9>>15);
+ return;
}
if (addr >= 0x04000000 && addr < 0x04000060)
@@ -1589,6 +1600,11 @@ void ARM9IOWrite16(u32 addr, u16 val)
GPU::GPU2D_B->Write16(addr, val);
return;
}
+ if (addr >= 0x04000320 && addr < 0x040006A4)
+ {
+ // 3D GPU
+ return;
+ }
printf("unknown ARM9 IO write16 %08X %04X\n", addr, val);
}
diff --git a/melonDS.depend b/melonDS.depend
index f83cd3e..767e4b7 100644
--- a/melonDS.depend
+++ b/melonDS.depend
@@ -10,7 +10,7 @@
1481161027 c:\documents\sources\melonds\types.h
-1485981206 source:c:\documents\sources\melonds\nds.cpp
+1485982397 source:c:\documents\sources\melonds\nds.cpp
<stdio.h>
<string.h>
"NDS.h"
@@ -24,7 +24,7 @@
"RTC.h"
"Wifi.h"
-1485979545 source:c:\documents\sources\melonds\arm.cpp
+1485981252 source:c:\documents\sources\melonds\arm.cpp
<stdio.h>
"NDS.h"
"ARM.h"
@@ -117,13 +117,13 @@
1484698068 c:\documents\sources\melonds\dma.h
"types.h"
-1485964826 source:c:\documents\sources\melonds\gpu.cpp
+1485982457 source:c:\documents\sources\melonds\gpu.cpp
<stdio.h>
<string.h>
"NDS.h"
"GPU.h"
-1484709419 c:\documents\sources\melonds\gpu.h
+1485982310 c:\documents\sources\melonds\gpu.h
"GPU2D.h"
1484848282 c:\documents\sources\melonds\rtc.h