7 logical operators (unary), 8 relational operators (binary), Logical operators (unary) – Motorola HC12 User Manual

Page 152: Relational operators (binary), Assembler syntax

Advertising
background image

User’s Manual

MCUez HC12 Assembler

152

Assembler Syntax

MOTOROLA

Assembler Syntax

7.7.7 Logical Operators (Unary)

Syntax:

Logical NOT: !<operand>

Description:

The ! (exclamation point) operator returns 1 (true) if the
operand is 0; otherwise, it returns 0 (false).

The operand can be any expression evaluating to an absolute
expression.

Example:

!(8<5) ; = $1 (TRUE)

7.7.8 Relational Operators (Binary)

Syntax:

Equal:

<operand>

= <operand>

<operand>

== <operand>

Not equal:

<operand>

!= <operand>

<operand>

<> <operand>

Less than:

<operand>

< <operand>

Less than or equal: <operand> <= <operand>
Greater than: <operand> > <operand>
Greater than or equal:<operand> >= <operand>

Description:

These operators compare the two operands and return 1 if the
condition is true or 0 if the condition is false.

The operands can be any expression evaluating to an absolute
expression.

Example:

3 >= 4

; = 0 (FALSE)

label = 4

; = 1 (TRUE) if label is 4,

; 0 (FALSE) otherwise

9 < $B

; = 1 (TRUE)

Advertising