aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-07-23 15:31:09 +0200
committerStapleButter <thetotalworm@gmail.com>2017-07-23 15:31:09 +0200
commite6f5507c9e73ee2bdb7089cb9588c769c170b57c (patch)
treea995ee68e1763d0b5cba0ed755e48236de8c50cd /src
parentf869975a51c4338b926322f627c9e083d6103a4b (diff)
add some more GPU IO
Diffstat (limited to 'src')
-rw-r--r--src/GPU2D.cpp23
-rw-r--r--src/GPU2D.h3
-rw-r--r--src/NDS.cpp15
3 files changed, 38 insertions, 3 deletions
diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp
index c270bf7..72f7409 100644
--- a/src/GPU2D.cpp
+++ b/src/GPU2D.cpp
@@ -105,6 +105,11 @@ void GPU2D::Reset()
memset(Win1Coords, 0, 4);
memset(WinCnt, 0, 4);
+ BGMosaicSize[0] = 0;
+ BGMosaicSize[1] = 0;
+ OBJMosaicSize[0] = 0;
+ OBJMosaicSize[1] = 0;
+
BlendCnt = 0;
EVA = 16;
EVB = 0;
@@ -238,6 +243,15 @@ void GPU2D::Write8(u32 addr, u8 val)
case 0x04A: WinCnt[2] = val; return;
case 0x04B: WinCnt[3] = val; return;
+ case 0x04C:
+ BGMosaicSize[0] = val & 0xF;
+ BGMosaicSize[1] = val >> 4;
+ return;
+ case 0x04D:
+ OBJMosaicSize[0] = val & 0xF;
+ OBJMosaicSize[1] = val >> 4;
+ return;
+
case 0x050: BlendCnt = (BlendCnt & 0x3F00) | val; return;
case 0x051: BlendCnt = (BlendCnt & 0x00FF) | (val << 8); return;
case 0x052:
@@ -245,7 +259,7 @@ void GPU2D::Write8(u32 addr, u8 val)
EVA = val & 0x1F;
if (EVA > 16) EVA = 16;
return;
- case 0x53:
+ case 0x053:
BlendAlpha = (BlendAlpha & 0x001F) | ((val & 0x1F) << 8);
EVB = val & 0x1F;
if (EVB > 16) EVB = 16;
@@ -353,6 +367,13 @@ void GPU2D::Write16(u32 addr, u16 val)
WinCnt[3] = val >> 8;
return;
+ case 0x04C:
+ BGMosaicSize[0] = val & 0xF;
+ BGMosaicSize[1] = (val >> 4) & 0xF;
+ OBJMosaicSize[0] = (val >> 8) & 0xF;
+ OBJMosaicSize[1] = val >> 12;
+ return;
+
case 0x050: BlendCnt = val & 0x3FFF; return;
case 0x052:
BlendAlpha = val & 0x1F1F;
diff --git a/src/GPU2D.h b/src/GPU2D.h
index affcc75..3e9dc36 100644
--- a/src/GPU2D.h
+++ b/src/GPU2D.h
@@ -91,6 +91,9 @@ private:
bool Win0Active;
bool Win1Active;
+ u8 BGMosaicSize[2];
+ u8 OBJMosaicSize[2];
+
u16 BlendCnt;
u16 BlendAlpha;
u8 EVA, EVB;
diff --git a/src/NDS.cpp b/src/NDS.cpp
index 271b618..04a1a26 100644
--- a/src/NDS.cpp
+++ b/src/NDS.cpp
@@ -1638,6 +1638,11 @@ void ARM9IOWrite8(u32 addr, u8 val)
{
switch (addr)
{
+ case 0x0400006C:
+ case 0x0400006D: GPU::GPU2D_A->Write8(addr, val); return;
+ case 0x0400106C:
+ case 0x0400106D: GPU::GPU2D_B->Write8(addr, val); return;
+
case 0x04000132:
KeyCnt = (KeyCnt & 0xFF00) | val;
return;
@@ -1720,6 +1725,9 @@ void ARM9IOWrite16(u32 addr, u16 val)
case 0x04000068:
case 0x0400006A: GPU::GPU2D_A->Write16(addr, val); return;
+ case 0x0400006C: GPU::GPU2D_A->Write16(addr, val); return;
+ case 0x0400106C: GPU::GPU2D_B->Write16(addr, val); return;
+
case 0x040000B8: DMAs[0]->WriteCnt((DMAs[0]->Cnt & 0xFFFF0000) | val); return;
case 0x040000BA: DMAs[0]->WriteCnt((DMAs[0]->Cnt & 0x0000FFFF) | (val << 16)); return;
case 0x040000C4: DMAs[1]->WriteCnt((DMAs[1]->Cnt & 0xFFFF0000) | val); return;
@@ -1847,12 +1855,12 @@ void ARM9IOWrite16(u32 addr, u16 val)
return;
}
- if ((addr >= 0x04000000 && addr < 0x04000060) || (addr == 0x0400006C))
+ if (addr >= 0x04000000 && addr < 0x04000060)
{
GPU::GPU2D_A->Write16(addr, val);
return;
}
- if ((addr >= 0x04001000 && addr < 0x04001060) || (addr == 0x0400106C))
+ if (addr >= 0x04001000 && addr < 0x04001060)
{
GPU::GPU2D_B->Write16(addr, val);
return;
@@ -1874,6 +1882,9 @@ void ARM9IOWrite32(u32 addr, u32 val)
case 0x04000064:
case 0x04000068: GPU::GPU2D_A->Write32(addr, val); return;
+ case 0x0400006C: GPU::GPU2D_A->Write16(addr, val&0xFFFF); return;
+ case 0x0400106C: GPU::GPU2D_B->Write16(addr, val&0xFFFF); return;
+
case 0x040000B0: DMAs[0]->SrcAddr = val; return;
case 0x040000B4: DMAs[0]->DstAddr = val; return;
case 0x040000B8: DMAs[0]->WriteCnt(val); return;