[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Assembler Language Reference

.align Pseudo-op

Purpose

Advances the current location counter until a boundary specified by the Number parameter is reached.

Syntax

.align Number

Description

The .align pseudo-op is normally used in a control section (csect) that contains data.

If the Number parameter evaluates to 0, alignment occurs on a byte boundary. If the Number parameter evaluates to 1, alignment occurs on a halfword boundary. If the Number parameter evaluates to 2, alignment occurs on a word boundary. If the Number parameter evaluates to 3, alignment occurs on a doubleword boundary.

If the location counter is not aligned as specified by the Number parameter, the assembler advances the current location counter until the number of low-order bits specified by the Number parameter are filled with the value 0 (zero).

If the .align pseudo-op is used within a .csect pseudo-op of type PR or GL which indicates a section containing instructions, alignment occurs by padding with nop (no-operation) instructions. In this case, the no-operation instruction is equivalent to a branch to the following instruction. If the align amount is less than a fullword, the padding consists of zeros.

Parameters

Number Specifies an absolute expression that evaluates to an integer value from 0 to 12, inclusive. The value indicates the log base 2 of the desired alignment. For example, an alignment of 8 (a doubleword) would be represented by an integer value of 3; an alignment of 4096 (one page) would be represented by an integer value of 12.

Examples

The following example demonstrates the use of the .align pseudo-op:

                .csect   progdata[RW]
                .byte    1
                         # Location counter now at odd number
                .align   1
                         # Location counter is now at the next
                         # halfword boundary.
                .byte    3,4
                .
                .
                .
                .align   2       # Insure that the label cont
                                 # and the .long pseudo-op are
                                 # aligned on a full word
                                 # boundary.
        cont:   .long    5004381

Related Information

Pseudo-ops Overview.

.byte Pseudo-op, .comm Pseudo-op, .csect Pseudo-op, .double Pseudo-op, .float Pseudo-op, .long Pseudo-op, .short Pseudo-op.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]