aboutsummaryrefslogtreecommitdiff
path: root/src/NDS.cpp
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-05-10 02:21:02 +0200
committerStapleButter <thetotalworm@gmail.com>2017-05-10 02:21:02 +0200
commitf54f54fb7e640a339433e72fb7406ba8cd2d91bc (patch)
tree5fc581fccf68dad31449497180628c2a211f141b /src/NDS.cpp
parent63e15d248088d861dbde8a8ee152385c0dd80669 (diff)
add support for writing to VCount. incl. fucked-up display and altering framerate accordingly.
Diffstat (limited to 'src/NDS.cpp')
-rw-r--r--src/NDS.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/NDS.cpp b/src/NDS.cpp
index 4ad325b..ddd6c03 100644
--- a/src/NDS.cpp
+++ b/src/NDS.cpp
@@ -380,16 +380,16 @@ void RunSystem(s32 cycles)
}
}
-void RunFrame()
+u32 RunFrame()
{
s32 framecycles = 560190;
- if (!Running) return; // dorp
+ if (!Running) return 263; // dorp
GPU::StartFrame();
- while (Running && framecycles>0)
+ while (Running && GPU::TotalScanlines==0)
{
s32 ndscyclestorun;
s32 ndscycles = 0;
@@ -430,21 +430,9 @@ void RunFrame()
RunSystem(ndscyclestorun);
//GPU3D::Run(ndscyclestorun);
-
- /*while (ndscycles < ndscyclestorun)
- {
- ARM7->CyclesToRun = ndscyclestorun - ndscycles - ARM7Offset;
- ARM7->Execute();
- ARM7Offset = 0;
-
- RunEvents(ARM7->Cycles);
- ndscycles += ARM7->Cycles;
- }
-
- ARM7Offset = ndscycles - ndscyclestorun;*/
-
- framecycles -= ndscyclestorun;
}
+
+ return GPU::TotalScanlines;
}
void Reschedule()
@@ -1657,6 +1645,7 @@ void ARM9IOWrite16(u32 addr, u16 val)
switch (addr)
{
case 0x04000004: GPU::SetDispStat(0, val); return;
+ case 0x04000006: GPU::SetVCount(val); return;
case 0x04000060: GPU3D::Write16(addr, val); return;
@@ -2198,6 +2187,7 @@ void ARM7IOWrite16(u32 addr, u16 val)
switch (addr)
{
case 0x04000004: GPU::SetDispStat(1, val); return;
+ case 0x04000006: GPU::SetVCount(val); return;
case 0x040000B8: DMAs[4]->WriteCnt((DMAs[4]->Cnt & 0xFFFF0000) | val); return;
case 0x040000BA: DMAs[4]->WriteCnt((DMAs[4]->Cnt & 0x0000FFFF) | (val << 16)); return;