/// <summary> /// ApplicationJimulator ctor /// Startup the simulator /// </summary> /// <param name="parsedArgs">command line arguments</param> public ApplicationJimulator(ARMSimArguments parsedArgs) { mParsedArgs = parsedArgs; Breakpoints = new Breakpoints(); mPluginManager = new ARMSim.Simulator.Plugins.PluginManager(this); //this.Stopped = true; //mStandardFiles = new StandardFiles(parsedArgs); }//ApplicationJimulator ctor
static public void Run(ARMSimArguments parsedArgs) { //create a new instance of the simulator engine ApplicationJimulator jm = new ApplicationJimulator(parsedArgs); jm.ARMPreferences = new ARMPreferences(); jm.ARMPreferences.PluginPreferences.EnableSWIExtendedInstructions(); ARMSim.Preferences.PluginPreferences pref = new ARMSim.Preferences.PluginPreferences(); pref.EnableSWIExtendedInstructions(parsedArgs.SWI); jm.InitPlugins(null, null); jm.Load(parsedArgs.Files); if (jm.ErrorReports.Count > 0) { Console.Error.WriteLine(); foreach (string fileName in jm.ErrorReports.ErrorLists.Keys) { foreach (ArmAssembly.ErrorReport er in jm.ErrorReports.GetErrorsList(fileName)) { Console.Error.WriteLine("File:{0} Line:{1} Column:{2} {3}", fileName, er.Line, er.Col, er.ErrorMsg); } } } if (jm.ValidLoadedProgram) { int xlimit = parsedArgs.ExecLimit; jm.StartSimulation(); while (!jm.isCurrentOpCodeSWIExit()) { jm.Execute(); if (--xlimit <= 0) { Console.Error.WriteLine("\n\n** Limit of {0} instructions have been executed\n", parsedArgs.ExecLimit); break; } } printMemory(jm, parsedArgs.PrintMemory); jm.HaltSimulation(); } //close all user and standard file handles jm.Shutdown(); }//Run
static void Main(string[] args) { ARMSimArguments parsedArgs = new ARMSimArguments(); //Batch mode is the simulator running with no UI and standard I/O instead of a console. if (args.Length > 0) { StringBuilder sb = new StringBuilder(); if (!Parser.ParseArgumentsWithUsage(args, parsedArgs, delegate(string str) { sb.Append(str); sb.Append("\n"); })) { MessageBox.Show(sb.ToString(), "Command line parsing Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } parsedArgs.Batch = true; bool attachedOK = false; if (ARMSim.ARMSimUtil.RunningOnWindows) { if (!AttachConsole(ATTACH_PARENT_PROCESS)) { attachedOK = AllocConsole(); } } System.Console.WriteLine("\nARMSim# running in batch mode ..."); // Run with the command-line arguments BatchMode.Run(parsedArgs); // Let the user know we are stopping System.Console.WriteLine("\nARMSim# is exiting"); if (attachedOK) { FreeConsole(); } } else { //Otherwise we run the simulator as a normal GUI application parsedArgs.Batch = false; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //pass in an empty list of arguments Application.Run(new ARMSimForm(parsedArgs)); } } //Main