System information
Table 3-2. Arithmetic and Logical Operators (continued)
a * b unsigned magnitude multiplication of a and b
a / bunsigned magnitude division of a by b
a MOD b remainder after a / b.
NOT b logical inverse of b (all 0s become 1s, 1s become 0s), where b is considered a
16-bit value
a AND b bit-by-bit logical and of a and b
a OR b bit-by-bit logical or of a and b
a XOR b bit-by-bit logical exclusive or of a and b
a SHL b the value that results from shifting a to the lef by an amount b, with zero fill
a SHR b the value that results from shifting a to the right by an amount b, with zero fill
In each case, a and b represent simple operands (labels, numeric constants, reserved words, and
one- or two-character strings) or fully enclosed parenthesized subexpressions, like those shown
in the following examples:
10+20 10h+37Q L1/3 (L2+4) SHR3
('a' and 5fh)+'O'('B'+B)OR(PSW+M)
(1+(2+c))shr(A-(B+1))
Note that all computations are performed at assembly time as 16-bit unsigned operations. Thus,
-1 is computed as 0 - 1, which results in the value 0ffffh (that is, all 1s). The resulting expression
must fit the operation code in which it is used. For example, if the expression is used in an ADI
(add immediate) instruction, the high-order 8 bits of the expression must be zero. As a result, the
operation ADI -1 produces an error message (-1 becomes 0ffffh, which cannot be represented as
an 8-bit value), while ADI (-1) AND 0FFH is accepted by the assembler because the AND
operation zeros the high-order bits of the expression.
3.3 Forming the Operand CP/M Operating System Manual
3-8