// CPI Compare Immediate With Accumulator
        // The byte of immediate data is compared to the contents of the accumulator.
        private int CPI(byte b)
        {
            var cmp16 = Accumulator - b;

            Flags = Flags
                    .Set(FlagIndex.Carry, ((cmp16 & 0x00FF) >= Accumulator && b != 0))
                    .Set(FlagIndex.AuxCarry, AuxCarryPredicates.calc_subAC(Accumulator, b))
                    .calc_SZP((byte)cmp16);

            return(7);
        }
        // Compare
        private int CMP(IByteOperandStrategy operand)
        {
            var cmp16 = Accumulator - operand.Read(this);

            Flags = Flags
                    .Set(FlagIndex.Carry, ((cmp16 & 0x00FF) >= Accumulator && operand.Read(this) != 0))
                    .Set(FlagIndex.AuxCarry, AuxCarryPredicates.calc_subAC(Accumulator, operand.Read(this)))
                    .calc_SZP((byte)cmp16);

            return(operand == OpMem ? 7 : 4);
        }
        // INR Increment Register or Memory
        // If register C contains 99H, the instruction: INR C will cause register C to contain 9AH
        private int INR(IByteOperandStrategy op)
        {
            var in8  = op.Read(this);
            var out8 = (byte)(in8 + 1);

            Flags = Flags
                    .Set(FlagIndex.AuxCarry, AuxCarryPredicates.calc_AC(in8, 1))
                    .calc_SZP(out8);

            op.Write(this, out8);
            return(op == OpMem ? 10 : 5);
        }
        //SUI Subtract Immediate From Accumulator
        // The byte of immediate data is subtracted from the contents of the accumulator using two's complement arithmetic.
        private int SUI(byte b)
        {
            var out16 = (ushort)(Accumulator - b);

            Flags = Flags
                    .Set(FlagIndex.Carry, ((out16 & 0x00FF) >= Accumulator && b != 0))
                    .Set(FlagIndex.AuxCarry, AuxCarryPredicates.calc_subAC(Accumulator, b))
                    .calc_SZP((byte)out16);

            Accumulator = (byte)out16;

            return(7);
        }
        // SUB Subtract Register or Memory From Accumulator
        private int SUB(IByteOperandStrategy operand)
        {
            var in8   = operand.Read(this);
            var out16 = Accumulator - in8;

            Flags = Flags
                    .Set(FlagIndex.Carry, ((out16 & 0x00FF) >= Accumulator && in8 != 0))
                    .Set(FlagIndex.AuxCarry, AuxCarryPredicates.calc_subAC(Accumulator, in8))
                    .calc_SZP((byte)out16);

            Accumulator = (byte)out16;
            return(operand == OpMem ? 7 : 4);
        }
        // ADI Add Immediate To Accumulator
        // The byte of immediate data is added to the contents of the accumulator using two's complement arithmetic.
        private int ADI(byte b)
        {
            var out16 = Accumulator + b;

            Flags = Flags
                    .Set(FlagIndex.Carry, ((out16 & 0xFF00) != 0)).Set(FlagIndex.AuxCarry, AuxCarryPredicates.calc_AC(Accumulator, b))
                    .calc_SZP((byte)out16);

            Accumulator = (byte)out16;
            return(7);
        }