Keil™, An ARM® Company

Technical Support

AX51: USING THE ! MACRO OPERATOR


Information in this article applies to:

  • A51 Version 7
  • AX51 Version 2
  • A251 Version 3

QUESTION

I do not understand how to use the ! macro operator. There is no example in the manual.

ANSWER

The ! macro operator is used to literalize a macro parameter. It is usually used to pass delimiters. The following example shows how you can comment parts of macros by using the ! operator to pass a semicolon as a comment start.

?ID?SEG SEGMENT IDATA
        RSEG    ?ID?SEG
VAL0:   DS      1
VAL1:   DS      1
VAL2:   DS      1

LD_ID   MACRO   Adr, Modi
        MOV     R0,#Adr
        MOV     A,@R0
        Modi    R0
ENDM

?PR?SEG SEGMENT CODE
        RSEG    ?PR?SEG

        LD_ID   VAL0, INC   ; LOAD VAL0 and INC R0
        ADD     A,@R0       ; VAL1

        LD_ID   VAL2, DEC   ; LOAD VAL0 and DEC R0
        XRL     A,@R0       ; VAL2

        LD_ID   VAL1, !;    ; LOAD VAL1 and leave R0 unmodified
        ADD     A,@R0       ; VAL1

END

MORE INFORMATION

SEE ALSO

Last Reviewed: Wednesday, August 03, 2005


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