Ejemplo n.º 1
0
        public override void Execute(CPU cpu)
        {
            bool   argument2 = Convert.ToBoolean(cpu.PopValue());
            bool   argument1 = Convert.ToBoolean(cpu.PopValue());
            object result    = argument1 | argument2;

            cpu.PushStack(result);
        }
Ejemplo n.º 2
0
        public override void Execute(CPU cpu)
        {
            argument2 = cpu.PopValue();
            argument1 = cpu.PopValue();

            Calculator calc   = GetCalculator();
            object     result = ExecuteCalculation(calc);

            cpu.PushStack(result);
        }
Ejemplo n.º 3
0
        public override void Execute(CPU cpu)
        {
            object value  = cpu.PopValue();
            bool   result = Convert.ToBoolean(value);

            cpu.PushStack(result);
        }
Ejemplo n.º 4
0
        public override void Execute(CPU cpu)
        {
            object value      = cpu.PopValue();
            string identifier = (string)cpu.PopStack();

            cpu.SetValue(identifier, value);
        }
Ejemplo n.º 5
0
        public override void Execute(CPU cpu)
        {
            cpu.MoveStackPointer(1);
            int destinationPointer = (int)cpu.PopValue();
            int currentPointer     = cpu.InstructionPointer;

            DeltaInstructionPointer = destinationPointer - currentPointer;
        }
Ejemplo n.º 6
0
        public override void Execute(CPU cpu)
        {
            int functionPointer = (int)cpu.PopValue();

            cpu.AddTrigger(functionPointer);
            if (shouldWait)
            {
                cpu.StartWait(0);
            }
        }
Ejemplo n.º 7
0
        public override void Execute(CPU cpu)
        {
            object waitTime = cpu.PopValue();

            if (waitTime is double)
            {
                cpu.StartWait((double)waitTime);
            }
            else if (waitTime is int)
            {
                cpu.StartWait((int)waitTime);
            }
        }
Ejemplo n.º 8
0
        public override void Execute(CPU cpu)
        {
            bool condition = Convert.ToBoolean(cpu.PopValue());

            if (!condition)
            {
                DeltaInstructionPointer = distance;
            }
            else
            {
                DeltaInstructionPointer = 1;
            }
        }
Ejemplo n.º 9
0
        public override void Execute(CPU cpu)
        {
            object value = cpu.PopValue();
            object result;

            if (value is bool)
            {
                result = !((bool)value);
            }
            else if (value is int)
            {
                result = -((int)value);
            }
            else if (value is double)
            {
                result = -((double)value);
            }
            else
            {
                throw new ArgumentException(string.Format("Can't negate object {0} of type {1}", value, value.GetType()));
            }

            cpu.PushStack(result);
        }
Ejemplo n.º 10
0
        public override void Execute(CPU cpu)
        {
            int functionPointer = (int)cpu.PopValue();

            cpu.RemoveTrigger(functionPointer);
        }