public ConsoleSimulation(string inputFileName, CommandInterpreter interpreter) { m_Terminal = new ConsoleEmulator(interpreter); m_Logger = new ConsoleLogger(); m_TerminationMgr = new TerminationManager(inputFileName); var fileParserFac = new FileReaderFactory(); ICompiledFileReader fileParser = fileParserFac.GetFileParser(inputFileName); DisassembledFileBase file = fileParser.ParseFile(inputFileName, m_Logger); m_Terminal.PrintString("Successfully loaded " + inputFileName + " (source file: " + file.SourceInformation.SourceFilePath + "; " + file.TotalFileSize + " bytes)\n"); m_ExecCtx = new RuntimeProcess(file, m_Terminal); IEnumerable <InstructionData> programInstructions = DisassemblerServices.GenerateInstructionData(file.SymbolTable, file.TextSegment, file.SourceInformation); m_SrcMapping = new Dictionary <int, SourceLineInformation>(); foreach (InstructionData instructionElem in programInstructions) { m_SrcMapping.Add(instructionElem.ProgramCounterLocation, new SourceLineInformation(instructionElem)); } m_CmdTable = new CommandTable(m_SrcMapping, m_ExecCtx, m_Terminal, m_TerminationMgr); m_Terminal.AddAvailableCommands(m_CmdTable.AllCommands); }
static void Main(string[] args) { ConsoleEmulator console = new ConsoleEmulator(); console.Run(); }