public static void RunWhilePrintingState(AltCPU cpu, int steps) { for (int i = 0; i < steps; i++) { Console.WriteLine(cpu.Disassemble(cpu.PC)); cpu.Step(); cpu.PrintState(); } }
public static void StepThroughProgram(AltCPU cpu) { while (true) { Console.WriteLine(); Console.WriteLine("Step"); Console.WriteLine(cpu.Disassemble(cpu.PC)); cpu.Step(); cpu.PrintState(); Console.WriteLine(); while (true) { Console.WriteLine("[I]:Inspect [ENTER]:Step"); Console.Write("> "); switch (Console.ReadLine()) { case "": goto exitinputloop; case "i": Console.Write("Location? 0x"); Console.WriteLine("{0:X4}", cpu.Mem[int.Parse(Console.ReadLine(), NumberStyles.HexNumber)]); break; default: Console.WriteLine("Invalid Input"); break; } } exitinputloop: ; } }
public static void Run(AltCPU cpu, int steps) { for (int i = 0; i < steps; i++) cpu.Step(); cpu.PrintState(); }