Logical (SETB) expressions

You can use a logical expression to assign a binary value to a SETB symbol. You can also use a logical expression to represent the condition test in an AIF instruction. This use lets you code a logical expression whose value (0 or 1) varies according to the values substituted into the expression and thus determine whether or not a branch is to be taken.

Figure 1 defines a logical expression.

Logical expressions contain unquoted spaces that do not terminate the operand field. This is called logical-expression format, and such expressions are always enclosed in parentheses.

A logical expression can consist of a logical expression and a logical term separated by a logical operator delimited by spaces. The logical operators are:
AND

Format: Logical-expression

Operands: Binary

Output: (bexpr1 AND bexpr2) has value 1, if each logical expression evaluates to 1, otherwise the value is 0.

The following is the example for AND:

After the following statements &VAR contains the arithmetic value 0.
Name      Operation      Operand

&OP1      SETB           1
&OP2      SETB           0
&VAR      SETB           (&OP1 AND &OP2)
AND NOT

Format: Logical-expression

Operands: Binary Output: The value of the second logical term is inverted, and the expression is evaluated as though the AND operator was specified.

The following is the example for AND NOT:

(1 AND NOT 0) is equivalent to (1 AND 1).

NOT

Format:Logical-expression

Operands: Binary

Output: NOT(bexp) inverts the value of the logical expression.

OR

Format: Logical-expression

Operands: Binary

Output: (bexp1 OR bexp2) returns a value of 1, if either of the logical expressions contain or evaluate to 1. If they both contain or evaluate to 0 then the value is 0.

OR NOT

Format: Logical-expression

Operands: Binary

Output: (bexp1 OR NOT bexp2) inverts the value of the second logical term, and the expression is evaluated as though the OR operator was specified. For example, (1 OR NOT 1) is equivalent to (1 OR 0).

XOR

Format: Logical-expression

Operands: Binary

Output: (bexp1 XOR bexp2) evaluates to 1 if the logical expressions contain or evaluate to opposite bit values. If they both contain or evaluate to the same bit value, the result is 0.

XOR NOT

Format: Logical-expression

Operands: Binary

Output: (bexp1 XOR NOT bexp2) inverts the second logical term, and the expression is evaluated as though the XOR operator was specified.

Example (1 XOR NOT 1) is equivalent to (1 XOR 0).