コード例 #1
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
 public static void ConditionalReturn(IWriteonlyRegister <ushort> pc, IStack stack, JumpCondition condition, IFlags flags)
 {
     if (ShouldJump(condition, flags))
     {
         Return(pc, stack);
     }
 }
コード例 #2
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
        public static void Return(IWriteonlyRegister <ushort> pc, IStack stack)
        {
            var low  = stack.Pop();
            var high = stack.Pop();

            Load(pc, BitUtils.Combine(low, high));
        }
コード例 #3
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
 public static void ConditionalJump(IWriteonlyRegister <ushort> target, ushort address, JumpCondition condition, IFlags flags)
 {
     if (ShouldJump(condition, flags))
     {
         Load(target, address);
     }
 }
コード例 #4
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
        public static void Pop(IWriteonlyRegister <ushort> target, IStack stack)
        {
            var low  = stack.Pop();
            var high = stack.Pop();

            target.Value = BitUtils.Combine(low, high);
        }
コード例 #5
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
        // Used for LDHL SP, e and ADD SP, e
        public static void LoadWithSignedOffset(IWriteonlyRegister <ushort> target, IReadonlyRegister <ushort> source, sbyte offset, IFlags flags)
        {
            var old = source.Value;

            target.Value    = (ushort)(source.Value + offset);
            flags.Zero      = false;
            flags.Subtract  = false;
            flags.Carry     = (old & 0xFF) + (offset & 0xFF) >= 0x100;
            flags.HalfCarry = (old & 0xF) + (offset & 0xF) >= 0x10;
        }
コード例 #6
0
ファイル: Instructions.cs プロジェクト: a10r/GameboyEmulator
 public static void Load <T>(IWriteonlyRegister <T> target, T value)
 {
     target.Value = value;
 }