| |||||||||||||||||
| |||||||||||||||||
The substitute operator (&) forces the assembler to substitute a parameter with the actual argument. The syntax is &namewhere name is the value of the argument in the macro call. The & operator is typically used to concatenate one or more parameters with other text.
In this macro, the cond parameter specifies the relationship of num2 relative to num1. For example, to sort two unsigned numbers value1 and value2 such that value1 >= value2, we can invoke the macro as sort2 AE, value1, value2which causes the following macro expansion: sort2 AE, value1, value2 PUSH AX MOV AX, value1 CMP AX, value2 JAE ??0000 XCHG AX, value2 MOV value1, AX ??0000: POP AX If value1 and value2 are signed numbers, this macro should be invoked as sort2 GE, value1, value2which generates the JGE conditional jump instruction in the macro expansion. The substitute operator is also useful to force the assembler to substitute a parameter inside a quoted string. This is illustrated in the following example.
When the macro is invoked as range_error 1, Assignment_markit will be expanded as err_msg1 DB "Assignment_mark: out of range",0 |