Example #1
0
        private void EXECUTE()
        {
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
            Thread.CurrentThread.Priority = ThreadPriority.Highest;

            var timer = new System.Timers.Timer(1000);

            timer.Elapsed += OnTimedEvent;
            timer.Enabled  = true;

            try {
                while (true)
                {
                    for (int j = 0; j < 100; j++)
                    {
                        cpu.Run();
                        //cpu.handleInterrupts();
                        counter++;
                    }
                    bus.tick(200);
                    cpu.handleInterrupts();
                }
            } catch (Exception e) {
                Console.WriteLine(e.ToString());
            }
        }
Example #2
0
 public void RunFrame()
 {
     //A lame mainloop with a workaround to be able to underclock.
     for (int i = 0; i < SYNC_LOOPS; i++)
     {
         for (int j = 0; j < SYNC_CYCLES; j++)
         {
             cpu.Run();
             //cpu.handleInterrupts();
         }
         bus.tick(SYNC_CYCLES * MIPS_UNDERCLOCK);
         cpu.handleInterrupts();
     }
 }
Example #3
0
        private void EXECUTE()
        {
            //Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
            //Thread.CurrentThread.Priority = ThreadPriority.Highest;
            watch.Start();
            //try {
            while (true)
            {
                //for (int i = 0; i < 100; i++) {
                //    cpu.Run();
                //    counter++;
                //}
                //
                //bus.tick(200); //2 ticks per opcode
                //cpu.handleInterrupts();
                for (int i = 0; i < 2822; i++)
                {
                    for (int j = 0; j < 100; j++)
                    {
                        cpu.Run();
                        counter++;
                    }
                    bus.tick(200);
                    cpu.handleInterrupts();
                }


                if (watch.ElapsedMilliseconds > 1000)
                {
                    window.Text = " ProjectPSX | Speed % " + (((float)counter / (PSX_MHZ / 2)) * 100);
                    watch.Restart();
                    counter = 0;
                }
                if (framewatch.ElapsedMilliseconds > (1000 / 60))
                {
                    framewatch.Restart();
                    Globals.frameCounter++;
                }
                //if (counter >= PSX_MHZ/2) {
                //    counter = 0;
                //    window.Text = "ProjectPSX | Fps: " + (60 / ((float)watch.ElapsedMilliseconds / 1000)).ToString();
                //    watch.Restart();
                //}
            }
            //} catch (Exception e) {
            //    Console.WriteLine(e.ToString());
            //}
        }
Example #4
0
        public void RunFrame()
        {
            //A lame mainloop with a workaround to be able to underclock.
            int cyclesPerFrame = PSX_MHZ / 60;
            int syncLoops      = (cyclesPerFrame / (SYNC_CYCLES * MIPS_UNDERCLOCK)) + 1;

            for (int i = 0; i < syncLoops; i++)
            {
                for (int j = 0; j < SYNC_CYCLES; j++)
                {
                    cpu.Run();
                    //cpu.handleInterrupts();
                }
                bus.tick(SYNC_CYCLES * MIPS_UNDERCLOCK);
                cpu.handleInterrupts();
            }
        }
Example #5
0
        public void RunFrame()
        {
            //A lame mainloop with a workaround to be able to underclock.
            int cyclesPerFrame = PSX_MHZ / 60;
            int syncLoops      = (cyclesPerFrame / (SYNC_CYCLES * MIPS_UNDERCLOCK)) + 1;

            for (int i = 0; i < syncLoops; i++)
            {
                for (int j = 0; j < SYNC_CYCLES; j++)
                {
                    cpu.Run();
                    //cpu.handleInterrupts();
                }
                bus.tick(SYNC_CYCLES * MIPS_UNDERCLOCK);
                cpu.handleInterrupts();
            }
            Globals.frameCounter++;  // this is where to figure out frame numbers for tools that need it
            if (Globals.GTEprecapture)
            {
                Globals.frameCounter  = 0;
                Globals.capturingGTE  = true;
                Globals.GTEprecapture = false;
            }
            if (Globals.GPUprecapture)
            {
                Globals.frameCounter  = 0;
                Globals.capturingGPU  = true;
                Globals.GPUprecapture = false;
            }
            if (Globals.frameCounter == Globals.capframes)
            {
                if (Globals.capturingGTE)
                {
                    Globals.capturingGTE = false;
                }
                if (Globals.capturingGPU)
                {
                    Globals.capturingGPU = false;
                }
            }
        }