public void Execute(Instruction instruction, ICpu cpu, IMmu mmu) { var n = cpu.ReadImmediateN(); cpu.Registers.F.ZeroFlag = cpu.Registers.A.Value == n; cpu.Registers.F.CarryFlag = cpu.Registers.A.Value < n; cpu.Registers.F.SubtractFlag = true; // TODO: ??? cpu.Registers.F.HalfCarryFlag = (((cpu.Registers.A.Value & 0xF) - (n & 0xF)) & 0x10) == 0x10; }
public void Execute(Instruction instruction, ICpu cpu, IMmu mmu) { if (cpu.Registers.F.ZeroFlag) { IncrementProgramCounter = true; return; } var b = (sbyte)cpu.ReadImmediateN(); cpu.Registers.PC.Value += (ushort)b; IncrementProgramCounter = true; }
public void Execute(Instruction instruction, ICpu cpu, IMmu mmu) { var n = cpu.ReadImmediateN(); var originalValue = cpu.Registers.A.Value; cpu.Registers.A.Value = (byte)(cpu.Registers.A.Value + n); // Flags cpu.Registers.F.SubtractFlag = false; cpu.Registers.F.CarryFlag = originalValue + n > byte.MaxValue; cpu.Registers.F.ZeroFlag = cpu.Registers.A.Value == 0; cpu.Registers.F.HalfCarryFlag = (((originalValue & 0xF) + (n & 0xF)) & 0x10) == 0x10; }
public void Execute(Instruction instruction, ICpu cpu, IMmu mmu) { var b = (sbyte)cpu.ReadImmediateN(); cpu.Registers.PC.Value += (ushort)b; }
public void Execute(Instruction instruction, ICpu cpu, IMmu mmu) { cpu.Registers.L.Value = cpu.ReadImmediateN(); }
public void Execute(Instruction instruction, ICpu cpu, IMmu mmu) { var n = cpu.ReadImmediateN(); cpu.Registers.A.Value = mmu.ReadByte((ushort)(0xFF00 + n)); }