SLAU131Y October 2004 – June 2021
Initialize 32-Bit Integer
.long value1[, ... , valuen]
.ulong value1[, ... , valuen]
The .long directive places one or more values into consecutive words in the current section. A value can be either:
A value can be either an absolute or a relocatable expression. If an expression is relocatable, the assembler generates a relocation entry that refers to the appropriate symbol; the linker can then correctly patch (relocate) the reference. This allows you to initialize memory with pointers to variables or labels.
The .long directive performs a word (16-bit) alignment before any data is written to the section.
When you use .long directive in a .struct/.endstruct sequence, it defines a member's size; it does not initialize memory. See the .struct/.endstruct/.tag topic.
This example shows how the .long directive initializes words. The symbol DAT1 points to the first word that is reserved.
1 0000 ABCD DAT1: .long 0ABCDh, 'A' + 100h, 'g', 'o'
0002 0000
0004 0141
0006 0000
0008 0067
000a 0000
000c 006F
000e 0000
2 0010 0000! .long DAT1, 0AABBCCDDh
0012 0000
0014 CCDD
0016 AABB
3 0018 DAT2: