13.07.2015 Views

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Assembly Language.MACRO, .ENDMSyntaxmacro_name .MACRO [argument[,argument]...]...macro_definition_statements....ENDMDescriptionWith the .MACRO directive you define a macro. Macros provide a shorthand method <strong>for</strong> handling a repeatedpattern of code or group of instructions. You can define the pattern as a macro, and then call the macroat the points in the program where the pattern would repeat.The definition of a macro consists of three parts:• Header, which assigns a name to the macro and defines the arguments (.MACRO directive).• Body, which contains the code or instructions to be inserted when the macro is called.• Terminator, which indicates the end of the macro definition (.ENDM directive).The arguments are symbolic names that the macro processor replaces with the literal arguments whenthe macro is expanded (called). Each <strong>for</strong>mal argument must follow the same rules as symbol names: thename can consist of letters, digits and underscore characters (_). The first character cannot be a digit.Argument names cannot start with a percent sign (%).Macro definitions can be nested but the nested macro will not be defined until the primary macro isexpanded.You can use the following operators in macro definition statements:Operator\?%“^NameDescriptionMacro argument concatenation Concatenates a macro argument with adjacentalphanumeric characters.Return decimal value of symbol Substitutes the ?symbol sequence with a character stringthat represents the decimal value of the symbol.Return hex value of symbolMacro string delimiterMacro local label overrideSubstitutes the %symbol sequence with a character stringthat represents the hexadecimal value of the symbol.Allows the use of macro arguments as literal strings.Prevents name mangling on labels in macros.ExampleThe macro definition:macro_a .MACRO arg1,arg2.db arg1;header;body121

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!