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 LanguageExample: Argument Concatenation Operator - \Consider the following macro definition:MAC_A .MACRO reg,valsub r\reg,r\reg,#val.ENDMThe macro is called as follows:MAC_A 2,1The macro expands as follows:sub r2,r2,#1The macro preprocessor substitutes the character '2' <strong>for</strong> the argument reg, and the character '1' <strong>for</strong> theargument val. The concatenation operator (\) indicates to the macro preprocessor that the substitutioncharacters <strong>for</strong> the arguments are to be concatenated with the characters 'r'.Without the '\' operator the macro would expand as:sub rreg,rreg,#1which results in an assembler error (invalid operand).Example: Decimal Value Operator - ?Instead of substituting the <strong>for</strong>mal arguments with the actual macro call arguments, you can also use thevalue of the macro call arguments.Consider the following source code that calls the macro MAC_A after the argument AVAL has been set to1.AVAL .SET 1MAC_A 2,AVALIf you want to replace the argument val with the value of AVAL rather than with the literal string 'AVAL',you can use the ? operator and modify the macro as follows:MAC_A .MACRO reg,valsub r\reg,r\reg,#?val.ENDMExample: Hex Value Operator - %The percent sign (%) is similar to the standard decimal value operator (?) except that it returns thehexadecimal value of a symbol.139

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

Saved successfully!

Ooh no, something went wrong!