Esempio n. 1
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand1);
            uint b    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Operand1.Size;

            int shift = ((int)b) & 0x1F;

            if (shift == 0)
            {
                return;                 // no changes
            }
            // TODO: for sizes other than 32
            Debug.Assert(size == 32);

            uint u = (a >> 1);

            shift--;

            if (cpu.EFLAGS.Carry)
            {
                u = u | ((uint)1 << (size - 1));
            }

            if (shift != 0)
            {
                u = u >> shift;
                u = u | (a << (size - shift));
            }

            StoreValue(cpu, instruction.Operand1, (uint)u, size);

            cpu.EFLAGS.Overflow = cpu.EFLAGS.Carry ^ IsSign(a, size);
            cpu.EFLAGS.Carry    = ((a >> (shift - 1)) & 0x1) == 1;
        }
Esempio n. 2
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a    = LoadFloatValue(cpu, instruction.Operand2, instruction.Size);
            int size = instruction.Size;

            StoreFloatValue(cpu, instruction.Operand1, a, size);
        }
Esempio n. 3
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var  a    = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
            uint p    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Size;

            float r;

            if ((p & 0x3) == 0x3)
            {
                r = (float)Math.Truncate(a.LowF);
            }
            else if ((p & 0x2) == 0x2)
            {
                r = (float)Math.Ceiling(a.LowF);
            }
            else if ((p & 0x1) == 0x1)
            {
                r = (float)Math.Floor(a.LowF);
            }
            else
            {
                r = (float)Math.Round(a.LowF);
            }

            StoreFloatValue(cpu, instruction.Operand1, r, size);
        }
Esempio n. 4
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
            uint p = LoadValue(cpu, instruction.Operand2);
            int size = instruction.Size;

            float r;
            if ((p & 0x3) == 0x3)
            {
                r = (float)Math.Truncate(a.LowF);
            }
            else if ((p & 0x2) == 0x2)
            {
                r = (float)Math.Ceiling(a.LowF);
            }
            else if ((p & 0x1) == 0x1)
            {
                r = (float)Math.Floor(a.LowF);
            }
            else
            {
                r = (float)Math.Round(a.LowF);
            }

            StoreFloatValue(cpu, instruction.Operand1, r, size);
        }
Esempio n. 5
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (cpu.EFLAGS.Sign != cpu.EFLAGS.Overflow)
     {
         StoreValue(cpu, instruction.Operand1, 1, 8);
     }
 }
Esempio n. 6
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (cpu.EFLAGS.Parity)
     {
         cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
     }
 }
Esempio n. 7
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var r    = LoadFloatValue(cpu, instruction.Operand1, instruction.Operand1.Size);
            int size = instruction.Operand1.Size;

            cpu.ST0.Value = r;
        }
Esempio n. 8
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (!cpu.EFLAGS.Carry && !cpu.EFLAGS.Zero)
     {
         cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
     }
 }
Esempio n. 9
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (cpu.EFLAGS.Sign != cpu.EFLAGS.Overflow)
     {
         cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
     }
 }
Esempio n. 10
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint address = GetAddress(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            StoreValue(cpu, instruction.Operand1, address, size);
        }
Esempio n. 11
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a = LoadValue(cpu, instruction.Operand1);
            uint b = LoadValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            int shift = ((int)b) & 0x1F;

            if (shift == 0)
                return; // no changes

            bool sign = IsSign(a, size);
            uint u = a >> shift;

            if (sign)
            {
                uint m = (uint.MaxValue << (int)(32 - shift));
                u = u | m;
            }

            StoreValue(cpu, instruction.Operand1, (uint)u, size);

            UpdateFlags(cpu, size, (long)u, u, true, true, false, false, false);

            cpu.EFLAGS.Overflow = (shift != 1);
            cpu.EFLAGS.Carry = ((a >> (shift - 1)) & 0x1) == 1;
            cpu.EFLAGS.Sign = sign;
        }
Esempio n. 12
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (!cpu.EFLAGS.Carry && !cpu.EFLAGS.Zero)
     {
         base.Execute(cpu, instruction);
     }
 }
Esempio n. 13
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand1);
            uint b    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Operand1.Size;

            int shift = ((int)b) & 0x1F;

            if (shift == 0)
            {
                return;                 // no changes
            }
            bool sign = IsSign(a, size);
            uint u    = a >> shift;

            if (sign)
            {
                uint m = (uint.MaxValue << 32 - shift);
                u = u | m;
            }

            StoreValue(cpu, instruction.Operand1, u, size);

            UpdateFlags(cpu, size, u, u, true, true, false, false, false);

            cpu.EFLAGS.Overflow = (shift != 1);
            cpu.EFLAGS.Carry    = ((a >> (shift - 1)) & 0x1) == 1;
            cpu.EFLAGS.Sign     = sign;
        }
Esempio n. 14
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			if (!cpu.EFLAGS.Parity)
			{
				cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
			}
		}
Esempio n. 15
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a    = LoadFloatValue(cpu, instruction.Operand1, instruction.Size).LowF;
            var b    = LoadFloatValue(cpu, instruction.Operand2, instruction.Size).LowF;
            int size = instruction.Size;

            if (float.IsNaN(a) || float.IsNaN(b))
            {
                cpu.EFLAGS.Zero   = true;
                cpu.EFLAGS.Parity = true;
                cpu.EFLAGS.Carry  = true;
            }
            else if (a == b)
            {
                cpu.EFLAGS.Zero   = true;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry  = false;
            }
            else if (a > b)
            {
                cpu.EFLAGS.Zero   = false;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry  = false;
            }
            else
            {
                cpu.EFLAGS.Zero   = false;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry  = true;
            }

            cpu.EFLAGS.Overflow = false;
            cpu.EFLAGS.Adjust   = false;
            cpu.EFLAGS.Sign     = false;
        }
Esempio n. 16
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (!cpu.EFLAGS.Zero)
     {
         StoreValue(cpu, instruction.Operand1, 1, 8);
     }
 }
Esempio n. 17
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			var a = LoadFloatValue(cpu, instruction.Operand2, instruction.Operand1.Size);
			int size = instruction.Operand1.Size;

			StoreFloatValue(cpu, instruction.Operand1, a, size);
		}
Esempio n. 18
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			if (IsSign(cpu.EAX.Value))
				cpu.EDX.Value = ~(uint)0;
			else
				cpu.EDX.Value = 0;
		}
Esempio n. 19
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Operand1.Size;

            StoreValue(cpu, instruction.Operand1, a, size);
        }
Esempio n. 20
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			uint a = LoadValue(cpu, instruction.Operand1);
			uint b = LoadValue(cpu, instruction.Operand2);
			int size = instruction.Operand1.Size;

			int shift = ((int)b) & 0x1F;

			if (shift == 0)
				return; // no changes

			// TODO: for sizes other than 32
			Debug.Assert(size == 32);

			uint u = (a << 1);

			if (cpu.EFLAGS.Carry)
				u = u | 0x1;

			shift--;

			u = u << shift;

			u = u | (a >> (size - shift));

			StoreValue(cpu, instruction.Operand1, (uint)u, size);

			cpu.EFLAGS.Overflow = cpu.EFLAGS.Carry ^ IsSign(a, size);
			cpu.EFLAGS.Carry = ((a >> (size - shift)) & 0x1) == 1;
		}
Esempio n. 21
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint address = GetAddress(cpu, instruction.Operand2);
            int  size    = instruction.Operand1.Size;

            StoreValue(cpu, instruction.Operand1, address, size);
        }
Esempio n. 22
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			uint a = LoadValue(cpu, instruction.Operand2);
			int size = instruction.Operand1.Size;

			StoreValue(cpu, instruction.Operand1, a, size);
		}
Esempio n. 23
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (cpu.EFLAGS.Sign)
     {
         base.Execute(cpu, instruction);
     }
 }
Esempio n. 24
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			if (cpu.EFLAGS.Carry || cpu.EFLAGS.Zero)
			{
				cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
			}
		}
Esempio n. 25
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand1);
            uint b    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Operand1.Size;

            int shift = ((int)b) & 0x1F;

            if (shift == 0)
            {
                return;                 // no changes
            }
            uint u    = a << shift;
            bool sign = IsSign(a, size);

            //if (cpu.FLAGS.Carry)
            //{
            //	u = u | 0x1;
            //}

            StoreValue(cpu, instruction.Operand1, u, size);

            UpdateFlags(cpu, size, u, u, true, true, true, false, false);

            cpu.EFLAGS.Overflow = sign ^ IsSign(u, size);
            cpu.EFLAGS.Carry    = sign;
        }
Esempio n. 26
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            int a    = (int)LoadValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            StoreFloatValue(cpu, instruction.Operand1, (float)a, size);
        }
Esempio n. 27
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (cpu.EFLAGS.Zero || cpu.EFLAGS.Sign != cpu.EFLAGS.Overflow)
     {
         cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
     }
 }
Esempio n. 28
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (!cpu.EFLAGS.Zero && cpu.EFLAGS.Sign != cpu.EFLAGS.Overflow)
     {
         base.Execute(cpu, instruction);
     }
 }
Esempio n. 29
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			var r = LoadFloatValue(cpu, instruction.Operand1, instruction.Operand1.Size);
			int size = instruction.Operand1.Size;

			cpu.ST0.Value = r;
		}
Esempio n. 30
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            double a = LoadFloatValue(cpu, instruction.Operand1);
            double b = LoadFloatValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            if (double.IsNaN(a) || double.IsNaN(b))
            {
                cpu.EFLAGS.Zero = true;
                cpu.EFLAGS.Parity = true;
                cpu.EFLAGS.Carry = true;
            }
            else if (a == b)
            {
                cpu.EFLAGS.Zero = true;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry = false;
            }
            else if (a > b)
            {
                cpu.EFLAGS.Zero = false;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry = false;
            }
            else
            {
                cpu.EFLAGS.Zero = false;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry = true;
            }
        }
Esempio n. 31
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a = LoadValue(cpu, instruction.Operand1);
            uint b = LoadValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            int shift = ((int)b) & 0x1F;

            if (shift == 0)
                return; // no changes

            uint u = a << shift;
            bool sign = IsSign(a, size);

            //if (cpu.FLAGS.Carry)
            //{
            //	u = u | 0x1;
            //}

            StoreValue(cpu, instruction.Operand1, u, size);

            UpdateFlags(cpu, size, u, u, true, true, true, false, false);

            cpu.EFLAGS.Overflow = sign ^ IsSign(u, size);
            cpu.EFLAGS.Carry = sign;
        }
Esempio n. 32
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			var a = LoadFloatValue(cpu, instruction.Operand1, instruction.Size).Low;
			var b = LoadFloatValue(cpu, instruction.Operand2, instruction.Size).Low;
			int size = instruction.Size;

			if (double.IsNaN(a) || double.IsNaN(b))
			{
				cpu.EFLAGS.Zero = true;
				cpu.EFLAGS.Parity = true;
				cpu.EFLAGS.Carry = true;
			}
			else if (a == b)
			{
				cpu.EFLAGS.Zero = true;
				cpu.EFLAGS.Parity = false;
				cpu.EFLAGS.Carry = false;
			}
			else if (a > b)
			{
				cpu.EFLAGS.Zero = false;
				cpu.EFLAGS.Parity = false;
				cpu.EFLAGS.Carry = false;
			}
			else
			{
				cpu.EFLAGS.Zero = false;
				cpu.EFLAGS.Parity = false;
				cpu.EFLAGS.Carry = true;
			}

			cpu.EFLAGS.Overflow = false;
			cpu.EFLAGS.Adjust = false;
			cpu.EFLAGS.Sign = false;
		}
Esempio n. 33
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			int a = (int)LoadValue(cpu, instruction.Operand2);
			int size = instruction.Operand1.Size;

			StoreFloatValue(cpu, instruction.Operand1, (double)a, size);
		}
Esempio n. 34
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            int size = 32;

            cpu.EFLAGS.Value = Read(cpu, cpu.ESP.Value, size);

            cpu.ESP.Value = (uint)(cpu.ESP.Value + (size / 8));
        }
Esempio n. 35
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			int size = 32;
			uint value = Read(cpu, cpu.ESP.Value, size);

			cpu.ESP.Value = (uint)(cpu.ESP.Value + (size / 8));
			cpu.EIP.Value = value;
		}
Esempio n. 36
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a = LoadFloatValue(cpu, instruction.Operand2, instruction.Operand2.Size);
            int size = instruction.Operand1.Size;

            uint r = (uint)a.LowF;
            StoreValue(cpu, instruction.Operand1, r, size);
        }
Esempio n. 37
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Operand1.Size;

            int s = SignExtend(a, instruction.Operand2.Size, size);

            StoreValue(cpu, instruction.Operand1, (uint)s, size);
        }
Esempio n. 38
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a = LoadValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            int s = SignExtend(a, instruction.Operand2.Size, size);

            StoreValue(cpu, instruction.Operand1, (uint)s, size);
        }
Esempio n. 39
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            int  size  = instruction.Operand1.Size;
            uint value = Read(cpu, cpu.ESP.Value, size);

            (instruction.Operand1.Register as GeneralPurposeRegister).Value = value;

            cpu.ESP.Value = (uint)(cpu.ESP.Value + (size / 8));
        }
Esempio n. 40
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a    = LoadFloatValue(cpu, instruction.Operand2, instruction.Operand2.Size);
            int size = instruction.Operand1.Size;

            uint r = (uint)a.Low;

            StoreValue(cpu, instruction.Operand1, r, size);
        }
Esempio n. 41
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a = LoadValue(cpu, instruction.Operand1);
            int size = instruction.Operand1.Size;

            Write(cpu, (uint)(cpu.ESP.Value - (size / 8)), a, size);

            cpu.ESP.Value = (uint)(cpu.ESP.Value - (size / 8));
        }
Esempio n. 42
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand1);
            int  size = instruction.Operand1.Size;

            Write(cpu, (uint)(cpu.ESP.Value - (size / 8)), a, size);

            cpu.ESP.Value = (uint)(cpu.ESP.Value - (size / 8));
        }
Esempio n. 43
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            if (instruction.Operand1 == null)
                return;

            uint v1 = LoadValue(cpu, instruction.Operand1);

            cpu.EIP.Value = (uint)(cpu.EIP.Value + (int)v1);
        }
Esempio n. 44
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            int size = instruction.Operand1.Size;
            uint value = Read(cpu, cpu.ESP.Value, size);

            (instruction.Operand1.Register as GeneralPurposeRegister).Value = value;

            cpu.ESP.Value = (uint)(cpu.ESP.Value + (size / 8));
        }
Esempio n. 45
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            double a = LoadFloatValue(cpu, instruction.Operand1);
            double b = LoadFloatValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            double r = a - b;

            StoreFloatValue(cpu, instruction.Operand1, r, size);
        }
Esempio n. 46
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			var a = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
			var b = LoadFloatValue(cpu, instruction.Operand2, instruction.Size);
			int size = instruction.Size;

			double r = a.Low + b.Low;

			StoreFloatValue(cpu, instruction.Operand1, r, size);
		}
Esempio n. 47
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            int size = instruction.Operand1.Size;

            uint r = cpu.EFLAGS.Value & 0x00FCFFFF;

            Write(cpu, cpu.ESP.Value, r, size);

            cpu.ESP.Value = (uint)(cpu.ESP.Value - (size / 8));
        }
Esempio n. 48
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a    = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
            var b    = LoadFloatValue(cpu, instruction.Operand2, instruction.Size);
            int size = instruction.Size;

            float r = a.LowF + b.LowF;

            StoreFloatValue(cpu, instruction.Operand1, r, size);
        }
Esempio n. 49
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			int size = instruction.Operand1.Size;

			uint r = cpu.EFLAGS.Value & 0x00FCFFFF;

			Write(cpu, cpu.ESP.Value, r, size);

			cpu.ESP.Value = (uint)(cpu.ESP.Value - (size / 8));
		}
Esempio n. 50
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a    = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
            var b    = LoadFloatValue(cpu, instruction.Operand2, instruction.Size);
            int size = instruction.Size;

            a.ULow  = a.ULow ^ b.ULow;
            a.UHigh = a.UHigh ^ b.UHigh;

            StoreFloatValue(cpu, instruction.Operand1, a, size);
        }
Esempio n. 51
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            // Pop Order: EIP, CS, FLAGS
            int size = 32;

            cpu.EIP.Value = Read(cpu, cpu.ESP.Value - (8 * 1), size);
            // Skip CS
            cpu.EFLAGS.Value = Read(cpu, cpu.ESP.Value - (8 * 3), size);

            cpu.ESP.Value = (uint)(cpu.ESP.Value + (size * 3 / 8));
        }
Esempio n. 52
0
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			// Pop Order: EIP, CS, FLAGS
			int size = 32;

			cpu.EIP.Value = Read(cpu, cpu.ESP.Value - (8 * 1), size);
			// Skip CS
			cpu.EFLAGS.Value = Read(cpu, cpu.ESP.Value - (8 * 3), size);

			cpu.ESP.Value = (uint)(cpu.ESP.Value + (size * 3 / 8));
		}
Esempio n. 53
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
            var b = LoadFloatValue(cpu, instruction.Operand2, instruction.Size);
            int size = instruction.Size;

            a.ULow = a.ULow ^ b.ULow;
            a.UHigh = a.UHigh ^ b.UHigh;

            StoreFloatValue(cpu, instruction.Operand1, a, size);
        }
Esempio n. 54
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            if (instruction.Operand1 == null)
            {
                return;
            }

            uint v1 = LoadValue(cpu, instruction.Operand1);

            cpu.EIP.Value = (uint)(cpu.EIP.Value + (int)v1);
        }
Esempio n. 55
0
 /// <summary>
 /// Sets the Operand value to 1 if the condition is met, otherwise set to 0.
 /// </summary>
 /// <param name="cpu"></param>
 /// <param name="instruction"></param>
 /// <param name="conditionMet">Boolean indicating if the condition was met</param>
 public void SetValue(CPUx86 cpu, SimInstruction instruction, bool conditionMet)
 {
     if (conditionMet)
     {
         StoreValue(cpu, instruction.Operand1, 1, 8);
     }
     else
     {
         StoreValue(cpu, instruction.Operand1, 0, 8);
     }
 }
Esempio n. 56
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (IsSign(cpu.EAX.Value))
     {
         cpu.EDX.Value = ~(uint)0;
     }
     else
     {
         cpu.EDX.Value = 0;
     }
 }
Esempio n. 57
0
 /// <summary>
 /// Sets the Operand value to 1 if the condition is met, otherwise set to 0.
 /// </summary>
 /// <param name="cpu"></param>
 /// <param name="instruction"></param>
 /// <param name="conditionMet">Boolean indicating if the condition was met</param>
 public void SetValue(CPUx86 cpu, SimInstruction instruction, bool conditionMet)
 {
     if (conditionMet)
     {
         StoreValue(cpu, instruction.Operand1, 1, 8);
     }
     else
     {
         StoreValue(cpu, instruction.Operand1, 0, 8);
     }
 }
Esempio n. 58
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand1);
            int  size = instruction.Operand1.Size;

            uint u = (uint)(0 - a);

            StoreValue(cpu, instruction.Operand1, (uint)u, size);

            UpdateFlags(cpu, size, (long)u, u, true, true, true, false, false);

            cpu.EFLAGS.Carry = !cpu.EFLAGS.Zero;
        }
Esempio n. 59
0
        protected void Execute3(CPUx86 cpu, SimInstruction instruction)
        {
            long v1   = LoadValue(cpu, instruction.Operand2);
            long v2   = LoadValue(cpu, instruction.Operand3);
            int  size = instruction.Operand1.Size;

            long r = v1 * v2;

            StoreValue(cpu, instruction.Operand1, (uint)r, size);

            cpu.EFLAGS.Overflow = (((ulong)r) >> 32) != 0;
            cpu.EFLAGS.Carry    = cpu.EFLAGS.Overflow;
        }
Esempio n. 60
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a = LoadValue(cpu, instruction.Operand1);
            uint b = LoadValue(cpu, instruction.Operand2);
            int size = instruction.Operand2.Size;

            if (size == 8)
                cpu.Write8Port(a, (byte)b);
            else if (size == 16)
                cpu.Write16Port(a, (ushort)b);
            else if (size == 32)
                cpu.Write32Port(a, b);
        }