3.6.10. Unary operators

Unary operators have the highest precedence and are evaluated first. A unary operator precedes its operand. Adjacent operators are evaluated from right to left.

Table 3.4 lists the unary operators.

Table 3.4. Unary operators

Operator

Usage

Description

?

?A

Number of bytes of executable code generated by line defining symbol A.

BASE

:BASE:A

If A is a pc-relative or register-relative expression, BASE returns the number of its register component

BASE is most useful in macros.

INDEX

:INDEX:A

If A is a register-relative expression, INDEX returns the offset from that base register.

INDEX is most useful in macros.

+ and -

+A

-A

Unary plus. Unary minus. + and – can act on numeric and program-relative expressions.

LEN

:LEN:A

Length of string A.

CHR

:CHR:A

One-character string, ASCII code A.

STR

:STR:A

Hexadecimal string of A.

STR returns an eight-digit hexadecimal string corresponding to a numeric expression, or the string "T" or "F" if used on a logical expression.

NOT

:NOT:A

Bitwise complement of A.

LNOT

:LNOT:A

Logical complement of A.

DEF

:DEF:A

{TRUE} if A is defined, otherwise {FALSE}.

SB_OFFSET_19_12:SB_OFFSET_19_12: labelBits[19:12] of (label – sb). See Example of use of :SB_OFFSET_19_12: and :SB_OFFSET_11_ 0
SB_OFFSET_11_0:SB_OFFSET_11_0: labelLeast-significant 12 bytes of (label – sb).

Example of use of :SB_OFFSET_19_12: and :SB_OFFSET_11_ 0

MyIndex EQU 0
    AREA area1, CODE
    LDR IP, [SB, #0]
    LDR IP, [IP, #MyIndex]
    ADD IP, IP, # :SB_OFFSET_19_12: label
    LDR PC, [IP, # :SB_OFFSET_11_0: label]
    AREA area2, DATA
label
    IMPORT FunctionAddress
    DCD FunctionAddress
    END

These operators can only be used in ADD and LDR instructions. They can only be used in the way shown.

Copyright © 2000, 2001 ARM Limited. All rights reserved.ARM DUI 0068B
Non-Confidential