Keil Logo

( ) Assembler Operator

Arguments
The argument list between parentheses depends on the use case.
Description

Parentheses operators are used to:

  • group expressions
  • change precedence
  • isolate conditional expressions
  • define and call functions or macros

Parentheses can also be part of a directive.

Example
EXTRN  CODE  (CLAB)                                 ; entry in CODE space
EXTRN  DATA  (DVAR)                                 ; variable in DATA space
...
MSK    EQU   0F0H                                   ; define symbols
LVAL   EQU   12345678H
...
       MOV    R3,#(0x20 AND MSK)                    ; calculations; grouping expressions
       MOV    R7,#LOW (MSK + 20H)
       MOV    R6,#1 OR (MSK SHL 4)
...
       MOV    R1,#((0x20 OR MSK) AND (LVAL + 20H))  ; change precedence
...
$IF (LVAL = 1)                                      ; isolating conditional expression
...
$ENDIF
...
       MOV    WR4,#WORD2 (LVAL)                     ; part of directive; load high word of LVAL
...
%*DEFINE (BMOVE (src, dst, cnt)) LOCAL lab (        ; macro definition
        MOV     R2,#%cnt
        MOV     R1,#%src
        MOV     R0,#%dst
%lab:   MOV     A,@R1
        MOV     @R0,A
        INC     R0
        INC     R1
        DJNZ    R2,lab
)
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.