コード例 #1
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
 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;
 }
コード例 #2
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
 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;
 }
コード例 #3
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
 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;
 }
コード例 #4
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
 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);
 }
コード例 #5
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
        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;
        }
コード例 #6
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
        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;
        }
コード例 #7
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
        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;
        }