SLAU131V October 2004 – February 2020
Table 5-1 through Table 5-16 summarize the assembler directives.
Besides the assembler directives documented here, the MSP430 software tools support the following directives:
NOTE
Labels and Comments Are Not Shown in SyntaxesMost source statements that contain a directive can also contain a label and a comment. Labels begin in the first column (only labels and comments can appear in the first column), and comments must be preceded by a semicolon, or an asterisk if the comment is the only element in the line. To improve readability, labels and comments are not shown as part of the directive syntax here. See the detailed description of each directive for using labels with directives.
Mnemonic and Syntax | Description | See |
---|---|---|
.bss symbol, size in bytes[, alignment] | Reserves sizebytes in the .bss (uninitialized data) section | .bss topic |
.data | Assembles into the .data (initialized data) section | .data topic |
.intvec | Creates an interrupt vector entry in a named section that points to an interrupt routine name. | .intvec topic |
.sect "section name" | Assembles into a named (initialized) section | .sect topic |
.text | Assembles into the .text (executable code) section | .text topic |
symbol .usect "section name", size in bytes
[, alignment] |
Reserves sizebytes in a named (uninitialized) section | .usect topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.endgroup | Ends the group declaration. | .endgroup topic |
.gmembersection name | Designates section name as a member of the group. | .gmember topic |
.group group section name group type: | Begins a group declaration. | .group topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.retain "section name" | Instructs the linker to include the current or specified section in the linked output file, regardless of whether the section is referenced or not | .retain topic |
.retainrefs "section name" | Instructs the linker to include any data object that references the current or specified section. | .retain topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.bits value1[, ..., valuen] | Initializes one or more successive bits in the current section | .bits topic |
.byte value1[, ..., valuen] | Initializes one or more successive bytes in the current section | .byte topic |
.char value1[, ..., valuen] | Initializes one or more successive bytes in the current section | .char topic |
.cstring {expr1|"string1"}[,... , {exprn|"stringn"}] | Initializes one or more text strings | .string topic |
.double value1[, ..., valuen] | Initializes one or more 64-bit, IEEE double-precision, floating-point constants | .double topic |
.field value[, size] | Initializes a field of size bits (1-32) with value | .field topic |
.float value1[, ..., valuen] | Initializes one or more 32-bit, IEEE single-precision, floating-point constants | .float topic |
.half value1[, ... , valuen] | Initializes one or more 16-bit integers (halfword) | .half topic |
.int value1[, ... , valuen] | Initializes one or more 16-bit integers | .int topic |
.long value1[, ... , valuen] | Initializes one or more 32-bit integers | .long topic |
.short value1[, ... , valuen] | Initializes one or more 16-bit integers (halfword) | .short topic |
.string {expr1|"string1"}[,... , {exprn|"stringn"}] | Initializes one or more text strings | .string topic |
.ubyte value1[, ... , valuen] | Initializes one or more successive unsigned bytes in the current section | .ubyte topic |
.uchar value1[, ..., valuen] | Initializes one or more successive unsigned bytes in the current section | .uchar topic |
.uhalf value1[, ... , valuen] | Initializes one or more unsigned 16-bit integers (halfword) | .uhalf topic |
.uint value1[, ... , valuen] | Initializes one or more unsigned 32-bit integers | .uint topic |
.ulong value1[, ... , valuen] | Initializes one or more unsigned 32-bit integers | .long topic |
.ushort value1[, ... , valuen] | Initializes one or more unsigned 16-bit integers (halfword) | .short topic |
.uword value1[, ... , valuen] | Initializes one or more unsigned 16-bit integers | .uword topic |
.word value1[, ... , valuen] | Initializes one or more 16-bit integers | .word topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.align [size in bytes] | Aligns the SPC on a boundary specified by size in bytes, which must be a power of 2; defaults to word (2-byte) boundary | .align topic |
.bessize | Reserves size bytes in the current section; a label points to the end of the reserved space | .bes topic |
.spacesize | Reserves size bytes in the current section; a label points to the beginning of the reserved space | .space topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.drlist | Enables listing of all directive lines (default) | .drlist topic |
.drnolist | Suppresses listing of certain directive lines | .drnolist topic |
.fclist | Allows false conditional code block listing (default) | .fclist topic |
.fcnolist | Suppresses false conditional code block listing | .fcnolist topic |
.length [page length] | Sets the page length of the source listing | .length topic |
.list | Restarts the source listing | .list topic |
.mlist | Allows macro listings and loop blocks (default) | .mlist topic |
.mnolist | Suppresses macro listings and loop blocks | .mnolist topic |
.nolist | Stops the source listing | .nolist topic |
.option option1[, option2, . . .] | Selects output listing options; available options are A, B, H, M, N, O, R, T, W, and X | .option topic |
.page | Ejects a page in the source listing | .page topic |
.sslist | Allows expanded substitution symbol listing | .sslist topic |
.ssnolist | Suppresses expanded substitution symbol listing (default) | .ssnolist topic |
.tab size | Sets tab to size characters | .tab topic |
.title "string" | Prints a title in the listing page heading | .title topic |
.width [page width] | Sets the page width of the source listing | .width topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.copy ["]filename["] | Includes source statements from another file | .copy topic |
.include ["]filename["] | Includes source statements from another file | .include topic |
.mlib ["]filename["] | Specifies a macro library from which to retrieve macro definitions | .mlib topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.common symbol, size in bytes [, alignment]
.common symbol, structure tag [, alignment] |
Defines a common symbol for a variable. | .common topic |
.def symbol1[, ... , symboln] | Identifies one or more symbols that are defined in the current module and that can be used in other modules. | .def topic |
.global symbol1[, ... , symboln] | Identifies one or more global (external) symbols. | .global topic |
.ref symbol1[, ... , symboln] | Identifies one or more symbols used in the current module that are defined in another module. | .ref topic |
.symdependdst symbol name[,src symbol name] | Creates an artificial reference from a section to a symbol. | .symdepend topic |
.weaksymbol name | Identifies a symbol used in the current module that is defined in another module. | .weak topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.if condition | Assembles code block if the condition is true | .if topic |
.else | Assembles code block if the .if condition is false. When using the .if construct, the .else construct is optional. | .else topic |
.elseifcondition | Assembles code block if the .if condition is false and the .elseif condition is true. When using the .if construct, the .elseif construct is optional. | .elseif topic |
.endif | Ends .if code block | .endif topic |
.loop [count] | Begins repeatable assembly of a code block; the loop count is determined by the count. | .loop topic |
.break [end condition] | Ends .loop assembly if end condition is true. When using the .loop construct, the .break construct is optional. | .break topic |
.endloop | Ends .loop code block | .endloop topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.emember | Sets up C-like enumerated types in assembly code | Section 5.9 |
.endenum | Sets up C-like enumerated types in assembly code | Section 5.9 |
.endstruct | Ends a structure definition | .struct topic |
.enum | Sets up C-like enumerated types in assembly code | Section 5.9 |
.struct | Begins structure definition | .struct topic |
.tag | Assigns structure attributes to a label | .struct topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.asg ["]character string["], substitution symbol | Assigns a character string to substitution symbol. Substitution symbols created with .asg can be redefined. | .asg topic |
.define ["]character string["], substitution symbol | Assigns a character string to substitution symbol. Substitution symbols created with .define cannot be redefined. | .asg topic |
symbol .equ value | Equates value with symbol | .equ topic |
.elfsymname, SYM_SIZE(size) | Provides ELF symbol information | .elfsym topic |
.evalexpression,
substitution symbol |
Performs arithmetic on a numeric substitution symbol | .eval topic |
.labelsymbol | Defines a load-time relocatable label in a section | .label topic |
.newblock | Undefines local labels | .newblock topic |
symbol .set value | Equates value with symbol | .set topic |
.unasgsymbol | Turns off assignment of symbol as a substitution symbol | .unasg topic |
.undefinesymbol | Turns off assignment of symbol as a substitution symbol | .unasg topic |
Mnemonic and Syntax | Description | See |
---|---|---|
macname .macro [parameter1][,... , parametern] | Begin definition of macro named macname | .macro topic |
.endm | End macro definition | .endm topic |
.mexit | Go to .endm | Section 6.2 |
.mlib filename | Identify library containing macro definitions | .mlib topic |
.var | Adds a local substitution symbol to a macro's parameter list | .var topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.emsg string | Sends user-defined error messages to the output device; produces no .obj file | .emsg topic |
.mmsgstring | Sends user-defined messages to the output device | .mmsg topic |
.wmsg string | Sends user-defined warning messages to the output device | .wmsg topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.asmfunc | Identifies the beginning of a block of code that contains a function | .asmfunc topic |
.endasmfunc | Identifies the end of a block of code that contains a function | .endasmfunc topic |
Mnemonic and Syntax | Description | See |
---|---|---|
.setsect | Produced by absolute lister; sets a section | Section 9 |
.setsym | Produced by the absolute lister; sets a symbol | Section 9 |
Mnemonic and Syntax | Description | See |
---|---|---|
.cdecls [options,]"filename"[, "filename2"[, ...] | Share C headers between C and assembly code | .cdecls topic |
.end | Ends program | .end topic |
In addition to the assembly directives that you can use in your code, the C/C++ compiler produces several directives when it creates assembly code. These directives are to be used only by the compiler; do not attempt to use these directives.