Vector Basic Interpreter Basic 80 Reference Manual - page 23
IF 0<200 AND F<4 TEEN 80
IF I>10 OR K IF NOT P THEN 100 Logical operators work by converting their operands to sixteen bit, siqned, two r S complement integers in the range -32768 to +32767. (If the operands are not in this range, an error results.) If both operands are supplied as 0 or -1, logical operators return 0 or -1. The given operation is performed on these integers in bitwise fashion, i.e., each bit of the result is determined by the corresponding bits in the two operands. Thus, it is possible to use logical operators to test bytes for a particular bit pattern. For instance, the AND operator maybe used to "mask" all but one of the bits of a status byte at a machine I/O port. The OR operator may be used to "merge" two bytes to create a particular binary value. Tbe following examples will help demonstrate how the logical operators work. 63 • binary 111111 and 16 • binary 10000, so 63 AND 16 - 16 15 • binary 1111 and 14 - binary 1110, so 15 AND 14 - 14 (binary 1110) -1 - binary 1111111111111111 and 8 • binary 1000, so -1 AND 8 • 8 4 • binary 100 and 2 -binary 10, so 4 OR 2 - 6 (binary 110) 10 - binary 1010, so 1010 OR 1010 • 1010 (10) -1 • binary 1111111111111111 and -2 • binary 1111111111111110, so -1 OR -2 • -1. The bit complement of sixteen zeros is sixteen ones, which is the two's complement representation of -1. The two's complement of any integer is t,hebit complement plus one.