static void Main(string[] args) { Greet(); if (args.Length == 0 || args.Length > 2) { Usage(); return; } bool hex = false; int fileIndex = 0; if (args[0].StartsWith("/") || args[0].StartsWith("-")) { fileIndex = 1; string ar = args[0].ToLower(); if (ar == "/hex" || ar == "-hex") { hex = true; } else { Usage(); return; } } VirtualMachine vm = new VirtualMachine(); try { if (hex) { vm.LoadFromHexFile(args[fileIndex]); } else { vm.LoadFromBinaryFile(args[fileIndex]); } } catch (Exception) { Console.WriteLine(string.Format("Could not load file '{0}'", args[fileIndex])); return; } RuntimeException e = vm.Run(); Console.WriteLine(e.ToString()); Console.WriteLine(); Console.WriteLine("Press Enter to exit..."); Console.ReadLine(); }
/// <summary> /// Initializes the object with the specified Virtual Machine. /// </summary> /// <param name="virtualMachine">A picoComputer Virtual Machine</param> public PicoTarget(VirtualMachine virtualMachine) { VirtualMachine = virtualMachine; Memory = new PicoMemory(this); Registers = new PicoRegisters(this); BreakpointChecker = new PicoBreakpointChecker(this); }
/// <summary> /// Creates a debugger for picoComputer and initializes the virtual machine. /// </summary> public override void CreateDebugger() { var vm = new VirtualMachine(new Data(), new NullIODevice()); var target = new MessyLab.Debugger.Target.Pico.PicoTarget(vm); Debugger = new MessyLab.Debugger.Debugger(target); Debugger.ExecutionInterrupt += new ExecutionInterruptHandler(HandleExecutionInterrupt); }