3.6 Directive OPTION PROCALIGN

Asmc Macro Assembler

3.6 Directive OPTION PROCALIGN

With OPTION PROCALIGN parameter it's possible to automatically align procedures. Syntax is:
OPTION PROCALIGN: [1|2|4|8|16|32]
The default value is 1. The current value can be saved/restored with directives PUSHCONTEXT / POPCONTEXT ALIGNMENT,

Example:

    .386
    .model flat, stdcall
    option PROCALIGN:16
    .code

proc1 PROC
    ret
proc1 endp

proc2 PROC
    ret
proc2 endp

    end

The listing shows that start address of proc2 is aligned to 16 (=10h):

00000000                        proc1 PROC
00000000                            ret
00000000  C3                *   retn
00000001                        proc1 endp

00000010                        proc2 PROC
00000010                            ret
00000010  C3                *   retn
00000011                        proc2 endp

Note: to ensure that the procedures are aligned in the final binary as it is supposed by the OPTION PROCALIGN value, the alignment of the current code segment must be at least the value of OPTION PROCALIGN.