void RunEmulator() { Console.WriteLine("Starting emulator"); while (true) { try { speccy.DoIntructions(69888 * 50); Console.WriteLine("OnCycle"); var screen = speccy.GetScreenInUint(true); Console.WriteLine("Got screen"); //graphics.Clear(); for (int y = 0; y < 128; y++) { for (int x = 0; x < 128; x++) { graphics.DrawPixel(x, y, Color.FromUint(screen[(y * 256 * 2) + x * 2])); } } graphics.Show(); Console.WriteLine("Showing screen"); } catch (Exception ex) { Console.WriteLine(ex.Message); } } }
public static bool TestInstruction(string file) { file = $"{Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName}\\Testfiles\\" + file; ZXSpectrum z80 = new ZXSpectrum(); z80.Reset(); TestState ts = TestfileHandler.ReadINFile(file); z80.AF = ts.af; z80.AFPrim = ts.af_; z80.BC = ts.bc; z80.BCPrim = ts.bc_; z80.DE = ts.de; z80.DEPrim = ts.de_; z80.HL = ts.hl; z80.HLPrim = ts.hl_; z80.I = ts.i; z80.IFF = ts.iff1; z80.IFF2 = ts.iff2; z80.IM = ts.im; z80.IX = ts.ix; z80.IY = ts.iy; //z80.Memory = ts.Memory; for (int m = 0; m < ts.Memory.Length; m++) { z80.WriteByteToMemory(m, ts.Memory[m]); } z80.PC = ts.pc; z80.R = ts.r; z80.SP = ts.sp; z80.DoIntructions(ts.end_tstates2); TestState tsout = TestfileHandler.ReadOUTFile(Path.GetDirectoryName(file) + "\\" + Path.GetFileNameWithoutExtension(file) + ".out", ts.Memory); //Compare bool result = CoreTest.CompareFunction(tsout, ExtractState(z80)); if (!result) { Debug.WriteLine(Path.GetFileNameWithoutExtension(file) + " failed"); } else { Debug.WriteLine(Path.GetFileNameWithoutExtension(file) + " succeeded"); } return(result); }
private async void GameLoop_Elapsed(object sender, ElapsedEventArgs e) { Stopwatch sw = new Stopwatch(); kempston.Gamepads = await GamePadList.GetGamepadsAsync(); Keyboard.KeyBuffer = await JSRuntime.InvokeAsync <List <string> >("getKeyStatus"); //for (int i= 0;i < 1;i++) //{ speccy.DoIntructions(69888); //beeper.GenerateSound(); //} //await BufferSound(); sw.Start(); Paint(); sw.Stop(); Debug.WriteLine(sw.ElapsedMilliseconds); }