aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-03-04 02:37:39 +0100
committerStapleButter <thetotalworm@gmail.com>2017-03-04 02:37:39 +0100
commitff4c1c9cf679ea4658d91ddb0f975c42f5ba76c2 (patch)
tree51e4fa7b8d6466612a1803dd358f527a365fe70a
parenta7e7af4b47e945225da6d891e8cd8e4972bfce0e (diff)
support 16-bit writes to rotscale reference point registers
-rw-r--r--GPU2D.cpp44
-rw-r--r--melonDS.depend2
2 files changed, 41 insertions, 5 deletions
diff --git a/GPU2D.cpp b/GPU2D.cpp
index e819b8f..1398d6b 100644
--- a/GPU2D.cpp
+++ b/GPU2D.cpp
@@ -177,11 +177,47 @@ void GPU2D::Write16(u32 addr, u16 val)
case 0x022: BGRotB[0] = val; return;
case 0x024: BGRotC[0] = val; return;
case 0x026: BGRotD[0] = val; return;
+ case 0x028:
+ BGXRef[0] = (BGXRef[0] & 0xFFFF0000) | val;
+ if (GPU::VCount < 192) BGXRefInternal[0] = BGXRef[0];
+ return;
+ case 0x02A:
+ if (val & 0x0800) val |= 0xF000;
+ BGXRef[0] = (BGXRef[0] & 0xFFFF) | (val << 16);
+ if (GPU::VCount < 192) BGXRefInternal[0] = BGXRef[0];
+ return;
+ case 0x02C:
+ BGYRef[0] = (BGYRef[0] & 0xFFFF0000) | val;
+ if (GPU::VCount < 192) BGYRefInternal[0] = BGYRef[0];
+ return;
+ case 0x02E:
+ if (val & 0x0800) val |= 0xF000;
+ BGYRef[0] = (BGYRef[0] & 0xFFFF) | (val << 16);
+ if (GPU::VCount < 192) BGYRefInternal[0] = BGYRef[0];
+ return;
case 0x030: BGRotA[1] = val; return;
case 0x032: BGRotB[1] = val; return;
case 0x034: BGRotC[1] = val; return;
case 0x036: BGRotD[1] = val; return;
+ case 0x038:
+ BGXRef[1] = (BGXRef[1] & 0xFFFF0000) | val;
+ if (GPU::VCount < 192) BGXRefInternal[1] = BGXRef[1];
+ return;
+ case 0x03A:
+ if (val & 0x0800) val |= 0xF000;
+ BGXRef[1] = (BGXRef[1] & 0xFFFF) | (val << 16);
+ if (GPU::VCount < 192) BGXRefInternal[1] = BGXRef[1];
+ return;
+ case 0x03C:
+ BGYRef[1] = (BGYRef[1] & 0xFFFF0000) | val;
+ if (GPU::VCount < 192) BGYRefInternal[1] = BGYRef[1];
+ return;
+ case 0x03E:
+ if (val & 0x0800) val |= 0xF000;
+ BGYRef[1] = (BGYRef[1] & 0xFFFF) | (val << 16);
+ if (GPU::VCount < 192) BGYRefInternal[1] = BGYRef[1];
+ return;
case 0x050: BlendCnt = val; return;
case 0x052:
@@ -213,23 +249,23 @@ void GPU2D::Write32(u32 addr, u32 val)
case 0x028:
if (val & 0x08000000) val |= 0xF0000000;
BGXRef[0] = val;
- if (GPU::VCount < 192) BGXRefInternal[0] = val;
+ if (GPU::VCount < 192) BGXRefInternal[0] = BGXRef[0];
return;
case 0x02C:
if (val & 0x08000000) val |= 0xF0000000;
BGYRef[0] = val;
- if (GPU::VCount < 192) BGYRefInternal[0] = val;
+ if (GPU::VCount < 192) BGYRefInternal[0] = BGYRef[0];
return;
case 0x038:
if (val & 0x08000000) val |= 0xF0000000;
BGXRef[1] = val;
- if (GPU::VCount < 192) BGXRefInternal[1] = val;
+ if (GPU::VCount < 192) BGXRefInternal[1] = BGXRef[1];
return;
case 0x03C:
if (val & 0x08000000) val |= 0xF0000000;
BGYRef[1] = val;
- if (GPU::VCount < 192) BGYRefInternal[1] = val;
+ if (GPU::VCount < 192) BGYRefInternal[1] = BGYRef[1];
return;
case 0x064:
diff --git a/melonDS.depend b/melonDS.depend
index d1fe971..b158dac 100644
--- a/melonDS.depend
+++ b/melonDS.depend
@@ -87,7 +87,7 @@
"NDS.h"
"SPI.h"
-1488589055 source:c:\documents\sources\melonds\gpu2d.cpp
+1488590400 source:c:\documents\sources\melonds\gpu2d.cpp
<stdio.h>
<string.h>
"NDS.h"