Пример #1
0
        public SpectrumMemoryMap() : base(65536)
        {
            // Load ROM assembly source code
            string sourcePath     = "zxspectrum.asm";
            string romProgramText = LoadROMAssemblySource(sourcePath);

            // Parse ROM program
            using (Stream romProgramStream = new MemoryStream(Encoding.UTF8.GetBytes(romProgramText)))
            {
                ROM = Assembler.ParseProgram(sourcePath, romProgramStream, Encoding.UTF8, false);
            }

            // Compile ROM program and store it in memeory
            Assembler.CompileProgram(ROM, 0, this);

            // Analyze ROM ProgramFlow
            Assembler.AnalyzeProgramFlow(ROM, this);

            // Register system variables descriptions
            foreach (SpectrumSystemVariable variable in SystemVariables.Values)
            {
                for (int i = variable.Address; i < (variable.Address + variable.Length); i++)
                {
                    MemoryCellDescriptions[i] = new MemoryCellDescription(MemoryDescriptionType.SystemVariable, variable);
                }
            }
        }