public virtual void Execute(Clock.Clock clock, MOS6502 cpu, byte pageCrossProlong, byte cycle)
        {
            byte mem = cpu.Target.Read();
            byte a = cpu.State.A.Value;
            int tmp = 0, vCheck = 0;

            if (cpu.State.P.Decimal)
            {
                tmp = (a & 0x0f) + (mem & 0x0f) + cpu.State.P.CarryValue;
                if (tmp > 0x09)
                    tmp += 0x06;

                tmp += (a & 0xf0) + (mem & 0xf0);
                vCheck = tmp;

                if ((tmp & 0x1f0) > 0x90)
                    tmp += 0x60;

                cpu.State.P.Carry = (tmp & 0xff0) > 0xf0;
            }
            else
            {
                vCheck = tmp = a + mem + cpu.State.P.CarryValue;
                cpu.State.P.Carry = (tmp & 0xff00) != 0;
            }

            cpu.State.A.Value = (byte)tmp;

            cpu.State.P.Overflow = ((a ^ mem) & 0x80) == 0 && ((a ^ vCheck) & 0x80) != 0; //(mem & 0x80) == (a & 0x80) && (vCheck  & 0x80) != (a & 0x80);
            cpu.State.P.Zero = cpu.State.A.IsZero;
            cpu.State.P.Negative = cpu.State.A.IsNegative;

            if (cpu.Target.IsPageCrossed(cpu.State.PC.Value))
                clock.Prolong(pageCrossProlong, cpu.Phase);
        }
        public virtual void Execute(Clock.Clock clock, MOS6502 cpu, byte pageCrossProlong, byte cycle)
        {
            cpu.State.A.Value &= cpu.Target.Read();

            cpu.State.P.Zero = cpu.State.A.IsZero;
            cpu.State.P.Negative = cpu.State.A.IsNegative;

            if (cpu.Target.IsPageCrossed(cpu.State.PC.Value))
                clock.Prolong(pageCrossProlong, cpu.Phase);
        }
        public virtual void Execute(Clock.Clock clock, MOS6502 cpu, byte pageCrossProlong, byte cycle)
        {
            uint tmp = (uint)(cpu.State.A.Value - cpu.Target.Read());

            cpu.State.P.Carry = (tmp & 0xff00) == 0;
            cpu.State.P.Zero = (tmp & 0xff) == 0;
            cpu.State.P.Negative = (tmp & 0x80) != 0;

            if (cpu.Target.IsPageCrossed(cpu.State.PC.Value))
                clock.Prolong(pageCrossProlong, cpu.Phase);
        }
        public virtual void Execute(Clock.Clock clock, MOS6502 cpu, byte pageCrossProlong, byte cycle)
        {
            byte prolong = 0;
            if (cpu.State.P.Overflow)
            {
                prolong++;
                ushort newAddress = cpu.Target.Address;
                if ((newAddress & 0xff00) != (cpu.State.PC.Value & 0xff00))
                    prolong++;

                cpu.State.PC.Value = newAddress;
            }

            clock.Prolong(prolong, cpu.Phase);
        }