Freescale Semiconductor, Inc.
SC_Assem.book Page 50 Thursday, September 23, 2004 10:44 AM
Expressions
Operator Precedence
Table 3.2 Assembler Operators ( continued)
Type
Logical
Operator
&&
||
Description
Logical AND — Returns integer 1 if both operands are nonzero; otherwise returns integer 0.
Logical OR — Returns integer 1 if either operand is nonzero; otherwise returns integer 0.
Operator Precedence
The assembler evaluates expressions from left to right, following these rules of operator precedence:
1. Parenthetical expression (innermost first)
2. Unary plus, unary minus, one’s complement, logical negation
3. Multiplication, division, mod
4. Addition, subtraction
5. Shift
6. Relational operators: less, less or equal, greater, greater or equal
7. Relational operators: equal, not equal
8. Bitwise AND, OR, exclusive OR
9. Logical AND, OR
Valid operands include numeric constants, literal ASCII strings, and symbols.
You cannot apply the one’s complement, shift, or bitwise operators to floating-point operands. That is, if an expression evaluation results in a floating-point value on either side of any such operator, the assembler generates an error message.
Functions
The assembler’s built-in functions support data conversion, string comparison, and transcendental math computations. You may use functions as terms in any arbitrary expression; functions may have no arguments, one argument, or multiple arguments.
These rules apply:
• Open and close parentheses must always follow functions.
• Arguments that are expressions must be absolute expressions, except where noted.
• Arguments must not contain external references.
50 SC100 Assembler User Guide
For More Information: www.freescale.com
Freescale Semiconductor, Inc.
SC_Assem.book Page 51 Thursday, September 23, 2004 10:44 AM
Expressions
Functions
• There must not be intervening spaces between the function name and the open parenthesis, or between comma-separated arguments.
Table 3.3 lists the assembler functions of each type:
Table 3.3 Assembler Function List
Type Function
Mathematical ABS — Absolute value
ACS — Arc cosine
ASN — Arc sine
AT2 — Arc tangent
ATN — Arc tangent
CEL — Ceiling
COH — Hyperbolic cosine
COS — Cosine
FLR — Floor
L10 — Log base 10
LOG — Natural logarithm
MAX — Maximum value
MIN — Minimum value
POW — Raise to power
RND — Random value
SGN — Return sign
SIN — Sine
SNH — Hyperbolic sine
SQT — Square root
TAN — Tangent
TNH — Hyperbolic tangent
XPN — Exponential function
SC100 Assembler User Guide 51
For More Information: www.freescale.com
Freescale Semiconductor, Inc.
SC_Assem.book Page 52 Thursday, September 23, 2004 10:44 AM
Expressions
Functions
Table 3.3 Assembler Function List ( continued)
Type
Conversion
String
Macro
Assembler
Mode
Function
CVF — Convert Integer to floating point
CVI — Convert floating point to integer
CVS — Convert Memory space
FLD — Shift and mask
FRC — Convert floating point to fractional
LFR — Convert floating point to long fractional
LNG — Concatenate to double word
LUN — Convert long fractional to floating point
RVB — Reverse bits in field
UNF — Convert fractional to floating point
LEN — String length
POS — Position of substring
SCP — Compare strings
ARG — Macro argument
CNT — Macro argument count
MAC — Macro definition
MXP — Macro expansion
BIGENDIAN — Endian mode check
CCC — Cumulative cycle count
CHK — Instruction/data checksum
CTR — Location counter number
DEF — Defined symbol
EXP — Expression check
INT — Integer check
LCV — Location counter value
52 SC100 Assembler User Guide
For More Information: www.freescale.com