|
Chapter 11 Writing Macro Control StatementsMacro Operators 21111.4 Macro OperatorsMacro operators are used in macro bodies to operate on parameters of macro calls. Macro operatorsare listed below.Usage exampleThe following example uses the operators \, <>, and &. The & characters in the body of macro mac1are used with two different meanings. The & before the dummy parameters is a macro operator. The &before the hexadecimal 0x0f indicates a logical AND.Operator Description& Concatenates strings.Macro definition dummy parameters Macro call Macro expansionp1&p2&p3 → abc, def,ghi → abcdefghip1&p2&p3 → data, 1, 3 → data13\ Escape characters for including normally unusable characters (<, >, &, \) in parameters ofmacro calls.Macro definition dummy parameters Macro call Macro expansionp1&p2&\>\>&p3\&0x0f → var. 3. 2 → var3>>2&0x0f< > Passes the enclosed string as a single parameter of a macro call.Macro parameters Macro call Macro expansionp1 → <“abc”, 1> → “abc”, 1mac1 macro p1, p2, p3mov p1&p2\>\>&p3\&0x0f, D0endmmac2 macro p1, p2p1 p2endm_TEXT section CODE, PUBLIC, 1mac1 1,2,3mac2 , <1, D0>end
PreviousNext |