Ax51 User's Guide

- Assembler Operator

Arguments
- operand
operand1 - operand2


Description

The minus sign ('-') is used as the unary minus operator and as the subtraction operator.

The unary minus operator is used to change the sign of the specified operand. If the value of the operand is positive, the sign is changed to negative. If the value is negative, it is changed to positive.

The subtraction operator is used to subtract the value of operand2 from the value of operand1. The specified operands may be absolute or relocatable. The type of the resulting expression is determined by the operand types as shown in the following table:

Operand TypesResulting Expression Type
absolute - absoluteabsolute
absolute - relocatableError: Not allowed.
relocatable - absoluterelocatable
relocatable - relocatableabsolute1

1. Relocatable operands are allowed if both are defined in the same parent section. External operands are not allowed.

Note

  • As a general rule, relocatable expressions must evaluate to a relocatable symbol plus or minus an optional constant value (displacement).
See Also

+

Example
labx:   MOV     R1, #5678-1234
laby:   MOV     R2, laby-labx