Keil Logo

Local Symbols

MPL macros may include local labels that are the targets of branches. Fixed label names cause errors if the macro is called more than once. This happens because the same label name may be used only once in a source file. This problem may be solved by using local symbols. Local macro symbols are appended with a unique, sequential number that increments each time the macro is invoked.

Local symbols must be declared in the macro definition line:

%*DEFINE (macro-name <[>parameter-list<]>) <[>LOCAL local-list<]> (macro-body)

where the local-list is a list (separated by commas or spaces) of the macro's local symbols.

Local symbols must be prefixed with the meta character when they are used in the macro macro-body. For example:

%*DEFINE (BMOVE (src, dst, cnt)) LOCAL lab (
       MOV      R2,#%cnt
       MOV      R1,#%src
       MOV      R0,#%dst
%lab:  MOVB     [R0+],[R1]
       ADD      R1,#1
       CMPD1    R2,#0
       JMP      CC_NZ, %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.