Ejemplo n.º 1
0
        void EmulateCyclesWith1541()
        {
            thread_running = true;

            while (!quit_thyself)
            {
                // The order of calls is important here
                if (TheVIC.EmulateCycle())
                {
                    TheSID.EmulateLine();
                }

                TheCIA1.CheckIRQs();
                TheCIA2.CheckIRQs();
                TheCIA1.EmulateCycle();
                TheCIA2.EmulateCycle();
                TheCPU.EmulateCycle();

                TheCPU1541.CountVIATimers(1);

                if (!TheCPU1541.Idle)
                {
                    TheCPU1541.EmulateCycle();
                }

                CycleCounter++;
            }
        }
Ejemplo n.º 2
0
 public void Reset()
 {
     TheCPU.AsyncReset();
     TheCPU1541.AsyncReset();
     TheSID.Reset();
     TheCIA1.Reset();
     TheCIA2.Reset();
     TheIEC.Reset();
 }
Ejemplo n.º 3
0
        void EmulateCyclesWithout1541()
        {
#if TIMERS
            uint       lc    = CycleCounter;
            HiResTimer timer = new HiResTimer();
            timer.Start();
            const uint cycleCount = 4000000;
#endif

            thread_running = true;
            while (!quit_thyself)
            {
                // The order of calls is important here
                if (TheVIC.EmulateCycle())
                {
                    TheSID.EmulateLine();
                }
                TheCIA1.CheckIRQs();
                TheCIA2.CheckIRQs();
                TheCIA1.EmulateCycle();
                TheCIA2.EmulateCycle();
                TheCPU.EmulateCycle();

                CycleCounter++;

#if TIMERS
                if (CycleCounter - lc == cycleCount)
                {
                    timer.Stop();
                    lc = CycleCounter;
                    double elapsedSec = timer.ElapsedMilliseconds / 1000.0f;

                    Console.WriteLine("------------------------------------");
                    Console.WriteLine("{0} ms elapsed for {1:N} cycles", timer.ElapsedMilliseconds, cycleCount);
                    Console.WriteLine("CIA1: TA Interrupts: {0} -> int/s: {1}", TheCIA1.ta_interrupts, TheCIA1.ta_interrupts / elapsedSec);
                    Console.WriteLine("CPU Instructions: {0} -> ins/s: {1}", TheCPU.ins_counter, TheCPU.ins_counter / elapsedSec);

                    // reset counters
                    TheCIA1.ta_interrupts = 0;
                    TheCIA1.tb_interrupts = 0;
                    TheCIA2.ta_interrupts = 0;
                    TheCIA2.tb_interrupts = 0;
                    TheCPU.ins_counter    = 0;

                    timer.Reset();
                    timer.Start();
                    //TheDisplay.Surface.Update();
                }
#endif
            }
        }
Ejemplo n.º 4
0
        public void Run()
        {
            TheCPU.Reset();
            TheSID.Reset();
            TheCIA1.Reset();
            TheCIA2.Reset();
            TheCPU1541.Reset();

            // Patch kernal IEC routines
            orig_kernal_1d84 = Kernal[0x1d84];
            orig_kernal_1d85 = Kernal[0x1d85];
            patch_kernel(GlobalPrefs.ThePrefs.FastReset, GlobalPrefs.ThePrefs.Emul1541Proc);

            Events.Quit += new QuitEventHandler(Events_Quit);

            // Start the machine main loop
            MainLoop();
        }
Ejemplo n.º 5
0
 public void NMI()
 {
     TheCPU.AsyncNMI();
 }