Ejemplo n.º 1
0
        private void LoadBaitCodes(string path = "einstructiondefs.arc")
        {
            BaitCodeList = new Dictionary <string, byte>();
            StreamReader reader = new StreamReader(path);
            int          i      = 0;
            string       instruction;

            while (!reader.EndOfStream)
            {
                instruction = reader.ReadLine();
                VMCommands.ClearCommand(ref instruction);
                BaitCodeList.Add(instruction, Convert.ToByte(i));
                i++;
            }
        }
Ejemplo n.º 2
0
        private void LoadFlags(string path = "eflags.arc")
        {
            Flags = new Dictionary <string, string>();
            StreamReader reader = new StreamReader(path);
            string       line, command;

            string[] args;
            while (!reader.EndOfStream)
            {
                line    = reader.ReadLine();
                command = line.Substring(0, line.IndexOf(' '));
                args    = VMCommands.GetArguments(line);
                switch (command)
                {
                case "bit_depth": Flags[command] = args[0]; break;

                case "RAM_SIZE": Flags[command] = args[0]; break;
                }
            }
        }
Ejemplo n.º 3
0
        private void LoadRegisterDefs(string path = "eregisterdefs.arc")
        {
            RegisterCodes = new Dictionary <string, int>();
            RegisterSizes = new Dictionary <int, int>();
            StreamReader reader  = new StreamReader(path);
            int          maxaddr = 0;
            int          maxsize = 0;

            while (!reader.EndOfStream)
            {
                string   command = reader.ReadLine();
                string[] args    = VMCommands.GetArguments(command);
                if (Convert.ToInt32(args[0], 16) > maxaddr)
                {
                    maxaddr = Convert.ToInt32(args[0], 16);
                    maxsize = Convert.ToInt32(args[1], 10);
                }
                RegisterCodes.Add(command.Substring(0, command.IndexOf(' ')), Convert.ToInt32(args[0], 16));
                RegisterSizes.Add(Convert.ToInt32(args[0], 16), Convert.ToInt32(args[1], 10));
            }
            Registers_.Capacity = maxaddr + maxsize;
        }