7 operators, 1 addition and subtraction operators (binary), Operators – Motorola HC12 User Manual

Page 149: Addition and subtraction operators (binary)

Advertising
background image

Assembler Syntax

Operators

MCUez HC12 Assembler

User’s Manual

MOTOROLA

Assembler Syntax

149

7.7 Operators

The following subsections describe the operators used in expressions that are
recognized by the assembler.

7.7.1 Addition and Subtraction Operators (Binary)

Syntax:

Addition: <operand> + <operand>

Subtraction: <operand> – <operand>

Description:

The + (plus) operator adds two operands, whereas the –
(minus) operator subtracts them. The operands can be any
expression evaluating to an absolute or relocatable expression.
Note that addition between two relocatable operands is not
allowed.

Example:

$A3216 + $42; Addition of 2 absolute operands ( = $A3258)

label – $10 ; Subtraction with value of ‘label’

7.7.2 Multiplication, Division, and Modulo Operators (Binary)

Syntax:

Multiplication: <operand> * <operand>

Division: <operand> / <operand>

Modulo: <operand> % <operand>

Description:

The * (asterisk) operator multiplies two operands, the / (slash)
operator performs an integer division of the two operands and
returns the quotient of the operation. The % (percent) operator
performs an integer division of the two operands and returns
the remainder of the operation.

The operands can be any expression evaluating to an absolute
expression. The second operand in a division or modulo
operation cannot be 0.

Example:

23 * 4 ; multiplication ( = 92)

23 / 4 ; division ( = 5)

23 % 4 ; remainder( = 3)

Advertising