SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
Align SPC on the Next Boundary
.align [size in bytes]
The .align directive aligns the section program counter (SPC) on the next boundary, depending on the size in bytes parameter. The size can be any power of 2 , although only certain values are useful for alignment. An operand of 1 aligns the SPC on the next byte boundary, and this is the default if no size in bytes is given. The size in bytes must equal a power of 2; the value must be between 1 and 32,768, inclusive. The assembler assembles words containing null values (0) up to the next size in bytes boundary:
1 | aligns SPC to byte boundary |
2 | aligns SPC to halfword boundary |
4 | aligns SPC to word boundary |
8 | aligns SPC to doubleword boundary |
128 | aligns SPC to page boundary |
Using the .align directive has two effects:
This example shows several types of alignment, including .align 2, .align 8, and a default .align.
1 00000000 04 .byte 4
2 .align 2
3 00000002 45 .string "Errorcnt"
00000003 72
00000004 72
00000005 6F
00000006 72
00000007 63
00000008 6E
00000009 74
4 .align
5 0000000c 60000000 .field 3,3
6 0000000c 6A000000 .field 5,4
7 .align 2
8 0000000c 6A006000 .field 3,3
9 .align 8
10 00000010 50000000 .field 5,4
11 .align
12 00000014 04 .byte 4