Slide 8.1: Data-related operators Slide 8.3: PTR operator Home |
ALIGN
Directive
ALIGN
directive causes the assembler to align the next data item or instruction on an address according to a given value. The number
could be 1, 2, or 4. If it equals 1, the next variable or byte is aligned on a 1-byte boundary. If number
is 2, the next variable is aligned on an even-numbered address, and if number
is 4, the next address is a multiple of 4.
ALIGN 1 |
ALIGN 2 |
ALIGN 4 |
.data X BYTE 0FFh ALIGN 1 Y DWORD 12345678h .code mov eax, 0 mov ebx, OFFSET X mov ax, [ebx + 2] call WriteHex |
.data X BYTE 0FFh ALIGN 2 Y DWORD 12345678h .code mov eax, 0 mov ebx, OFFSET X mov ax, [ebx + 2] call WriteHex |
.data X BYTE 0FFh ALIGN 4 Y DWORD 12345678h .code mov eax, 0 mov ebx, OFFSET X mov ax, [ebx + 2] call WriteHex |
Output | Output | Output |
NOP
s for instruction.
The NOP
instruction is used to delete/insert machine code, to delay execution for purposes of timing, or to align a subsequent instruction on a word boundary.
NOP
simply performs a null operation by executing “XCHG AX, AX
” .
NOP — No Operation |
|||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|