Exemple #1
0
        private static long InitializeMemory(string[] input, bool includeXMask)
        {
            var memoryInitializer = new MemoryInitializer(input.First(), includeXMask);
            var instructions      = input.Skip(1)
                                    .Select(ParseInstruction);

            return(memoryInitializer.Execute(instructions));
        }
Exemple #2
0
        // Constructor will read in the filepath and store the text in the file to a list.
        public Parser(string filepath)
        {
            filepath = filepath.Replace("\n", "");             // get rid of illegal character from file path

            var temp = System.IO.File.ReadAllLines(filepath);

            lines = new List <string>(temp);

            instRead = new InstructionReader();
            foreach (string line in lines)
            {
                if (line.Contains("DATA SEGMENT"))                 // stop printing at data section
                {
                    break;
                }

                instRead.ParseAndPrintInstruction(line);
            }
            MemoryInitializer.InitStaticData(lines);
            MemoryInitializer.InitStack();
            MemoryInitializer.InitTextData(lines);
        }