/// <summary> /// /// </summary> /// <param name="machine"></param> public static void Run(i8080 machine) { Stopwatch sw = new Stopwatch(); sw.Start(); Stopwatch sw2 = new Stopwatch(); sw2.Start(); int ticks = (int)(1000.0 / 60.0 / 2.0) * 10000; bool top = true; int c = 0; long t = 0; double s1; double s2; double clockRate = 0; machine.MemoryProtection = true; while (machine.On) { if (c % 100 == 0) { s1 = (double)(machine.Cycles + 1); s2 = (double)(sw.ElapsedMilliseconds + 1); clockRate = s1 / s2; } if (clockRate < 2000) { machine.RunNext(); } if (t > ticks) { if (machine.Interupt((byte)(top ? 0xcf : 0xd7))) { top = !top; } sw2.Restart(); } if (c % 100 == 0) { t = sw2.ElapsedTicks; } //if (c % 250 == 0) //{ // Thread.Sleep(1); //} if (c % 25 == 0) { if (machine.controller != null) { if (machine.controller.IsConnected) { Input.Check(machine); } } } c++; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { m_machine.RunNext(); RefreshDebugInformation(); }