public void TestCPL(byte a, byte result) { var device = TestUtils.CreateTestDevice(); var cpu = device.CPU; var alu = new ALU(cpu); cpu.Registers.A = a; alu.CPL(); Assert.Equal(result, cpu.Registers.A); Assert.True(cpu.Registers.GetFlag(CpuFlags.SubtractFlag)); Assert.True(cpu.Registers.GetFlag(CpuFlags.HalfCarryFlag)); }