Keil™, An ARM® Company

Technical Support

A51: LOCAL LABELS DON'T WORK IN MACROS

Information in this article applies to:

  • A51 Macro Assembler All Versions
  • AX51 Macro Assembler All Versions
  • A251 Macro Assembler All Versions

SYMPTOMS

I have defined the following MACRO in my assembly file:

INC_BUF_POINTER      MACRO   X,Y,Z,W
;
LOCAL   IBP1
;
INC     DPTR
;
MOV     A,DPL
CJNE    A,#LOW(X),IBP1
.
.
.
ENDM

When I assemble this in my program, I get the following error message:

                =1  1488             INC_BUF_POINTER COM_BUF_END,COM_BUF_START,COM_BUF_HEAD_H,COM_BUF_HEAD_L
                =1  1489+1   ;
                =1  1490+1           LOCAL   IBP1
*** _________________________________^
*** ERROR #9 IN 1490 (\SB1\SB\SMARTPAD\KEIL.V08\RS232.A51, LINE 393): SYNTAX ERROR

What can I do for this?

CAUSE

The LOCAL directive must be specified immediately after the MACRO definition. If it is not, the text LOCAL will be included in the macro expansion. Since LOCAL is not a recognized keyword (by the assembler), the error results.

RESOLUTION

Change your macro definition to read as follows:

INC_BUF_POINTER      MACRO   X,Y,Z,W
LOCAL   IBP1
.
.
.
ENDM

When you re-assemble your program, the error will go away.

MORE INFORMATION

Refer to the A51/AX51 User's Guide, Chapter 5, Assembler Macros, Labels for more information about the LOCAL directive.

SEE ALSO

Last Reviewed: Monday, May 10, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure