| Electronic Components Datasheet Search |
|
AN3350 Datasheet(PDF) 68 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3350 Datasheet(HTML) 68 Page - STMicroelectronics |
|
68 / 185 page ![]() Working with the assembler AN3350 68/185 Doc ID 018512 Rev 2 Circular definitions are allowed, but invocation of the macro will stop after one level of expansion. For example, the following example code expands the next(10) only once to next(10) + 1 . #define next(a) next(a) + 1 next(10) Note: All macro definitions have a signature (name and parity). Therefore, the assembler does not generate error messages for calls to macros with the same name that have a different number of arguments; instead, the assembler silently ignores them (no expansion occurs). Macro names are not assembly symbols. During assembly, the assembler does not assign macros numeric values. When preprocessing is complete, all macros have been expanded, and their corresponding names cease to exist. 10.5.3 Multi-line macros A multi-line macro includes all code lines between a #macro and the closest following #endm directive. To invoke a multi-line macro, the macro name must be the first, or left-most, token in the line of code (the name can be prefixed by a label and white space). Multi-line macro arguments are similar to those for single line macros, except that the former are defined and used without parentheses. Multi-line macros cannot be defined within macros of the same type. For example, the code in Example 6 defines a macro that, given a register (R), creates the value 3 * R + 2 and stores that value in register a. A possible invocation of this macro is do_it p . Example 6 Multi-line macro example #macro do_it R move a,R add a,a,R add a,a,R addi a,2 #endm Note: The assembler does not perform type or semantic checking on the arguments. Consequently the macro can be invoked, for example, with the argument a + 4, which would result in the expansion of invalid code. Passing R1 as an argument results in the calculation, with unexpected results, of 4 * a + 2. Local labels inside a macro When labels are defined or used inside a macro it follows that all macro invocations will use that name. This may be problematic (and, in fact, invalid) as labels are not singly defined. To declare and use labels local to macros, the label name should be prepended with \@. For example, the following code causes the assembler to interpret the label next in the epilog macro differently each time it is invoked: #macro epilog jmp.n zero,next\@ |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |