From dbe222649804644cc61834ede8de840512de6eec Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 17 Jul 2009 05:16:07 +0000 Subject: [PATCH] newemuloop: change main loop to 32bit math for a little speedup and fix a goofup that was costing a small amount of speed --- desmume/src/NDSSystem.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index c94499541..ed17cc52c 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -1376,10 +1376,6 @@ void NDS_SkipNextFrame() { SkipNext2DFrame = true; SkipCur3DFrame = true; } #define INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF)) -//#define LOG_ARM9 -//#define LOG_ARM7 -//static bool dolog = false; - void execHardware_doDma(int procnum, int chan, EDMAMode modeNum) { if(MMU.DMAStartTime[procnum][chan] == modeNum) @@ -1968,9 +1964,9 @@ bool nds_loadstate(std::istream* is, int size) return sequencer.load(is); } -#define LOG_ARM9 -#define LOG_ARM7 -static bool dolog = false; +//#define LOG_ARM9 +//#define LOG_ARM7 +//static bool dolog = false; FORCEINLINE void arm9log() { @@ -2059,30 +2055,39 @@ void NDS_exec(s32 nb) sequencer.reschedule = false; - while(nds_timer(); + arm9 += armcpu_exec(); } } - if(nds_arm7_timer<=nds_timer) + if(arm7<=timer) { if(NDS_ARM7.waitIRQ) - nds_arm7_timer = min(next,nds_arm7_timer + kIrqWait); + arm7 = min(s32next,arm7 + kIrqWait); else { arm7log(); - nds_arm7_timer += (armcpu_exec()<<1); + arm7 += (armcpu_exec()<<1); } } - nds_timer = min(nds_arm7_timer,nds_arm9_timer); + timer = min(arm7,arm9); + nds_timer = nds_timer_base+timer; } + nds_arm7_timer = nds_timer_base+arm7; + nds_arm9_timer = nds_timer_base+arm9; + //what we find here is dependent on the timing constants above if(nds_timer>next && (nds_timer-next)>22) printf("curious. please report: over by %d\n",(int)(nds_timer-next));