3 sign operators (unary), 4 shift operators (binary), Sign operators (unary) – Motorola HC12 User Manual

Page 150: Shift operators (binary), Assembler syntax

Advertising
background image

User’s Manual

MCUez HC12 Assembler

150

Assembler Syntax

MOTOROLA

Assembler Syntax

7.7.3 Sign Operators (Unary)

Syntax:

Plus: +<operand>

Minus: –<operand>

Description:

The + (plus) operator does not change the operand, whereas the
– (minus) operator changes the operand to its two’s
complement. These operators are only valid for absolute
expression operands.

Example:

+$32 ; ( = $32)

–$32 ; ( = $CE = –$32)

7.7.4 Shift Operators (Binary)

Syntax:

Shift left: <operand> << <count>

Shift right: <operand> >> <count>

Description:

The << (double less than) operator shifts the left operand left
by the number of bytes specified in right operand.

The >> (double greater than) operator shifts the left operand
right by the number of bytes specified in right operand.
Operands can be any expression evaluating to an absolute
expression.

Example:

$25 << 2 ; shift left ( = $94)

$A5 >> 3 ; shift right( = $14)

Advertising