Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル

製品コード
SW006021-1
ページ / 518
Macro Assembler
 2012 Microchip Technology Inc.
DS52053B-page 263
6.4.9.14
LOCAL
The LOCAL directive allows unique labels to be defined for each expansion of a given 
macro. Any symbols listed after the LOCAL directive will have a unique assembler 
generated symbol substituted for them when the macro is expanded. For example:
down MACRO count
    LOCAL more
    more: DECFSZ count
    GOTO more
ENDM
when expanded will include a unique assembler generated label in place of more. For 
example:
down foobar
expands to:
??0001 DECFSZ foobar
    GOTO ??0001
If invoked a second time, the label more would expand to ??0002 and multiply defined 
symbol errors will be averted.
6.4.9.15
ALIGN
The ALIGN directive aligns whatever is following, data storage or code etc., to the spec-
ified offset boundary within the current psect. The boundary is specified as a number 
of bytes following the directive.
For example, to align output to a 2 byte (even) address within a psect, the following 
could be used.
ALIGN 2
Note that what follows will only begin on an even absolute address if the psect begins 
on an even address; i.e., alignment is done within the current psect. See 
Section 6.4.9.3.11 “Reloc” for psect alignment.
The ALIGN directive can also be used to ensure that a psect’s length is a multiple of a 
certain number. For example, if the above ALIGN directive was placed at the end of a 
psect, the psect would have a length that was always an even number of bytes long.
6.4.9.16
REPT
The REPT directive temporarily defines an unnamed macro, then expands it a number 
of times as determined by its argument.
For example:
REPT 3
    ADDWF fred,w
ENDM
will expand to:
    ADDWF fred,w
    ADDWF fred,w
    ADDWF fred,w