大家好,Ax51中有一个宏操作符!,在手册中是这样介绍的:
- The exclamation mark operator ('!') is used to indicate that a special character is to be passed to a macro literally. This operator enables you to pass comma (',') and angle bracket characters ('<' and '>'), that would normally be interpreted as delimiters, to a macro.
有哪位大神能帮忙举个栗子吗?
在Keil官网上有这么一个栗子:
- ?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
但是AX51直接报错,A51生成代码错误。