Beispiel #1
0
 public static void ShiftLeft(IRegister <byte> target, IFlags flags)
 {
     flags.Carry    = target.GetBit(7);
     target.Value   = (byte)(target.Value << 1);
     flags.Subtract = flags.HalfCarry = false;
     flags.Zero     = target.Value == 0;
 }
Beispiel #2
0
 public static void ShiftRightLogical(IRegister <byte> target, IFlags flags)
 {
     flags.Carry    = target.GetBit(0);
     target.Value   = (byte)(target.Value >> 1);
     flags.Subtract = flags.HalfCarry = false;
     flags.Zero     = target.Value == 0;
 }
Beispiel #3
0
 public static void RotateRight(IRegister <byte> target, IFlags flags)
 {
     flags.Carry    = target.GetBit(0);
     target.Value   = (byte)(target.Value >> 1 | target.Value << 7);
     flags.Subtract = flags.HalfCarry = false;
     flags.Zero     = target.Value == 0;
 }
Beispiel #4
0
 public static void RotateLeft(IRegister <byte> target, IFlags flags)
 {
     target.Value   = (byte)((target.Value << 1) | (target.Value >> 7));
     flags.Zero     = target.Value == 0;
     flags.Subtract = flags.HalfCarry = false;
     flags.Carry    = target.GetBit(0);
 }
Beispiel #5
0
        public static void ShiftRightArithmetic(IRegister <byte> target, IFlags flags)
        {
            flags.Carry = target.GetBit(0);
            var msbMask = target.Value & 0x80;

            target.Value   = (byte)((target.Value >> 1) | msbMask);
            flags.Subtract = flags.HalfCarry = false;
            flags.Zero     = target.Value == 0;
        }
Beispiel #6
0
        public static void RotateRightThroughCarry(IRegister <byte> target, IFlags flags)
        {
            var carry = flags.Carry ? 1 : 0;

            flags.Carry    = target.GetBit(0);
            target.Value   = (byte)(carry << 7 | target.Value >> 1);
            flags.Subtract = flags.HalfCarry = false;
            flags.Zero     = target.Value == 0;
        }
Beispiel #7
0
        public static void RotateLeftThroughCarry(IRegister <byte> target, IFlags flags)
        {
            var carry = flags.Carry ? 1 : 0;

            flags.Carry    = target.GetBit(7);
            target.Value   = (byte)((target.Value << 1) | carry);
            flags.Subtract = flags.HalfCarry = false;
            flags.Zero     = target.Value == 0;
        }