public override string ToString()
 {
     return(TextFormat.addZeros(Convert.ToString(command[0], 16).ToUpper(), 2)
            + ' ' + TextFormat.addZeros(Convert.ToString(command[1], 16).ToUpper(), 4)
            + ' ' + TextFormat.addZeros(Convert.ToString(command[2], 16).ToUpper(), 4)
            + ' ' + TextFormat.addZeros(Convert.ToString(command[3], 16).ToUpper(), 4));
 }
Esempio n. 2
0
        public string GetName(int position)
        {
            Check(position);

            if (_names.ContainsKey(position))
            {
                return(_names[position]);
            }
            else
            {
                return(TextFormat.addZeros(Convert.ToString(position, 16).ToUpper(), 4));
            }
        }
Esempio n. 3
0
        public List <string> GetCmdInfo()
        {
            List <string> cmdInfo = new List <string>();

            for (int i = 0; i < _memory.Length; i++)
            {
                if (_memory[i] != null && _memory[i] is Command)
                {
                    cmdInfo.Add(string.Format("{0} := {1}", TextFormat.addZeros(Convert.ToString(i, 16).ToUpper(), 4), _memory[i].ToString()));
                }
            }

            return(cmdInfo);
        }
Esempio n. 4
0
        private List <string> CreateVarInfo(Func <string, string, int, string> stringFormat)
        {
            List <string> varInfo = new List <string>();

            for (int i = 0; i < _memory.Length; i++)
            {
                if (_memory[i] != null && _memory[i] is Variable)
                {
                    varInfo.Add(stringFormat(TextFormat.addZeros(Convert.ToString(i, 16).ToUpper(), 4), GetName(i), _memory[i].GetValue()));
                }
            }

            return(varInfo);
        }
Esempio n. 5
0
 protected override void InitialiseCommand(List <int> command)
 {
     try
     {
         if (CommandIsLong(command[1]))
         {
             InitialiseLongCommand(command);
         }
         else
         {
             InitialiseShortCommand(command);
         }
     }
     catch (Exception exp)
     {
         throw new System.Exception(exp.Message + ' ' +
                                    TextFormat.addZeros(Convert.ToString(command[0], 16), 4));
     }
 }
Esempio n. 6
0
        protected override void InitialiseCommand(List <int> command)
        {
            try
            {
                CheckCommandFormat(command);

                if (currentAddress == -1)
                {
                    currentAddress = command[0];
                }

                ramMemory.SetCell(command[0], new LM3Command(command[1], command[2], command[3], command[4]));
            }
            catch (Exception exp)
            {
                throw new System.Exception("At address \"" + TextFormat.addZeros(
                                               Convert.ToString(command[0], 16), 4) + "\" " + exp.Message);
            }
        }
Esempio n. 7
0
        protected override void InitialiseCommand(List <int> command)
        {
            try
            {
                CheckCommandFormat(command);

                if (currentAddress == UNINITIALIZED_ADDRESS)
                {
                    currentAddress = command[0];
                }

                ramMemory.SetCell(command[0],
                                  new LM2Command(command[1], command[2], command[3]));
            }
            catch (Exception exp)
            {
                throw new System.Exception(exp.Message + ' ' +
                                           TextFormat.addZeros(Convert.ToString(command[0], 16), 4));
            }
        }
Esempio n. 8
0
        public virtual void DoOneStep(RichTextBox output)
        {
            if (inputFlag)
            {
                return;
            }

            if (uInputFlag)
            {
                return;
            }

            try
            {
                MasterSwitch(output);
            }
            catch (System.Exception exp)
            {
                throw new System.Exception("at address \"" + TextFormat.addZeros(
                                               Convert.ToString(currentAddress, 16), 4) + "\" " + exp.Message);
            }
        }
Esempio n. 9
0
 public string GetCurrentCommand()
 {
     return(string.Format("{0} {1}", TextFormat.addZeros(Convert.ToString(currentAddress, 16).ToUpper(), 4), ramMemory.GetCell(this.currentAddress).ToString()));
 }
Esempio n. 10
0
 public override string ToString()
 {
     return(TextFormat.addZeros(Convert.ToString(variableItem, 16), 4));
 }
Esempio n. 11
0
 public override string ToString()
 {
     return(TextFormat.addZeros(Convert.ToString(command[0], 16), 2)
            + ' ' + TextFormat.addZeros(Convert.ToString(command[0], 16), 2)
            + ' ' + TextFormat.addZeros(Convert.ToString(command[0], 16), 2));
 }