| Electronic Components Datasheet Search |
|
UM0144 Datasheet(PDF) 27 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
UM0144 Datasheet(HTML) 27 Page - STMicroelectronics |
|
27 / 92 page ![]() ST7 Assembler Linker 3 ST7 Assembler UM0144 27/92 The true use of macros is in small snippets of code that you use repeatedly— perhaps with different arguments—which can be formalized into a 'template' for the macros' definition. 3.5.1 Defining macros Macros are defined using three directives: MACRO, MEND and LOCAL. The format is: <macro-name>MACRO [parameter-1][, parameter-2 ...] [LOCAL] <label-name>[, label-name ...]] <body-of-macro> MEND For example: The piece of code of the example might be called by: add16 index,offset,index which would add the following statements to the source code at that point: ld A,index adc A,offset ld index.X,A Note that the formal parameters given in the definition have been replaced by the actual parameters given on the calling line. These new parameters may be expressions or strings as well as label names or constants. Because they may be complex expressions, they are bracketed when there is any extra numeric activity; this is to make sure they come out with the precedence correctly parsed. Macros do not need to have any parameters. You may leave the MACRO argument field blank (and, in this case, give no parameters on the calling line). There is one further problem: because a macro may be called several times in the same module, any labels defined in the macro will be duplicated. The LOCAL directive gets around this problem: add16 MACRO first,second,result ld A,first adc A,second ld result,A MEND |
|
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 |