SLAU131Y October 2004 – June 2021
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 between 20 and 215, inclusive. An operand of 2 aligns the SPC on the next word boundary, and this is the default if no size is given. For example:
2 | aligns SPC to word boundary |
4 | aligns SPC to 2 word boundary |
128 | aligns SPC to 128-byte boundary |
Using the .align directive has two effects:
This example shows several types of alignment, including .align 4, .align 8, and a default .align.
1 0000 0004 .byte 4
2 .align 2
3 0002 0045 .string "Errorcnt"
0003 0072
0004 0072
0005 006F
0006 0072
0007 0063
0008 006E
0009 0074
4 .align
5 000a 0003 .field 3,3
6 000a 002B .field 5,4
7 .align 2
8 000c 0003 .field 3,3
9 .align 8
10 0010 0005 .field 5,4
11 .align
12 0012 0004 .byte 4