public FlagSet(byte[] input) { // A constructor that can set ZF, SF, PF to what they are defined as in most cases Carry = FlagState.UNDEFINED; Auxiliary = FlagState.UNDEFINED; Overflow = FlagState.UNDEFINED; Direction = FlagState.UNDEFINED; Interrupt = FlagState.UNDEFINED; // ZF is set if $input is equal to zero. Zero = input.IsZero() ? FlagState.ON : FlagState.OFF; // SF is set if $input has a negative sign in twos compliment form. Sign = input.IsNegative() ? FlagState.ON : FlagState.OFF; // PF is set if the number of bits on in the first byte of $input is even. // e,g // input[0] == 0b0000 ; PF // input[0] == 0b1000 ; NO PF // input[0] == 0b1010 ; PF Parity = Bitwise.GetParity(input[0]) ? FlagState.ON : FlagState.OFF; }