Exemplo n.º 1
0
        private void Setter(string destination, string to_move)
        {
            var dest = DestinationSelecter.IsCommand(destination);

            if (dest == SelfLanguageDestination.Ram)
            {
                var dst   = destination.Split(':');
                var name  = dst.ElementAtOrDefault(1);
                var value = dst.ElementAtOrDefault(2);
                var type  = dst.ElementAtOrDefault(3);
                HandleToRam(string.Concat(name, ":", to_move, ":", type));
            }
            else if (dest == SelfLanguageDestination.Stack)
            {
                CommandStackCarry.Push(Convert.ToInt32(to_move));
            }
            else if (dest == SelfLanguageDestination.StackMultiChar)
            {
                to_move.ToList().ForEach((s) => CommandStackCarry.Push(Convert.ToInt32(s)));
            }
            else if (dest == SelfLanguageDestination.Number)
            {
                LoadInMemory(to_move, Convert.ToInt32(destination));
            }
            else if (dest == SelfLanguageDestination.None)
            {
                throw new InvalidMoveException(string.Format("The destination {0} is not well formed", destination));
            }
            else
            {
                throw new NotImplementedException(); //HTF
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Set the CommandValueCarry
 /// </summary>
 /// <param name="i">Pointer</param>
 private void SetCarry(int i)
 {
     CommandStackCarry.Push(GetNFrom(i + 2));
 }