# x86-64 Directives

[x86-64 Documentation](https://asm-editor.specy.app/documentation/x86.md)

Web page: https://asm-editor.specy.app/documentation/x86/directive

Sections, data, constants, macros and prefixes: what NASM reads besides instructions.

32 entries, each with its own page of markdown:

- [What directives are](https://asm-editor.specy.app/documentation/x86/directive/what-directives-are.md): Directives are not executed by the processor: they tell the assembler where to put code and data, what bytes to emit, which names stand for which values, and…
- [Directives](https://asm-editor.specy.app/documentation/x86/directive/directives.md): Directives tell the assembler what to do.
- [`section`](https://asm-editor.specy.app/documentation/x86/directive/section.md): Opens a section: .text for code, .data for initialised data, .bss for space that starts as zeroes, .rodata for constants.
- [`global`](https://asm-editor.specy.app/documentation/x86/directive/global.md): Makes a label visible outside the file.
- [`extern`](https://asm-editor.specy.app/documentation/x86/directive/extern.md): Declares that a name is defined in another file, so this one may refer to it.
- [`bits`](https://asm-editor.specy.app/documentation/x86/directive/bits.md): Assembles for 16, 32 or 64 bit mode.
- [`default`](https://asm-editor.specy.app/documentation/x86/directive/default.md): Chooses whether a bare memory reference is rel (an offset from rip) or abs (an absolute address).
- [`cpu`](https://asm-editor.specy.app/documentation/x86/directive/cpu.md): Refuses to assemble instructions newer than the processor named, which is a way to keep a program inside the instruction set a course is teaching.
- [`absolute`](https://asm-editor.specy.app/documentation/x86/directive/absolute.md): Starts a block of labels that describe a layout without emitting anything, the way a structure declaration does.
- [Data and space](https://asm-editor.specy.app/documentation/x86/directive/data.md): These live in the instruction table and behave like directives: they put bytes in the output, or reserve room for them.
- [`db, dw, dd, dq`](https://asm-editor.specy.app/documentation/x86/directive/db-dw-dd-dq.md): Emit bytes, words (2 bytes), doublewords (4) and quadwords (8), in order, where the line is.
- [`dt, do, dy, dz`](https://asm-editor.specy.app/documentation/x86/directive/dt-do-dy-dz.md): Emit 10, 16, 32 and 64 byte values, for the x87 and vector types.
- [`resb, resw, resd, resq`](https://asm-editor.specy.app/documentation/x86/directive/resb-resw-resd-resq.md): Reserve room without writing anything: buffer: resb 64.
- [`equ`](https://asm-editor.specy.app/documentation/x86/directive/equ.md): Gives a name to a value, evaluated once where it is written: LEN equ 64.
- [`incbin`](https://asm-editor.specy.app/documentation/x86/directive/incbin.md): Copies a file into the output at this point, byte for byte.
- [`times`](https://asm-editor.specy.app/documentation/x86/directive/times.md): Repeats the rest of the line: times 64 db 0 emits 64 zero bytes, and times 8 - ($ - start) db 0 pads to a fixed size.
- [The preprocessor](https://asm-editor.specy.app/documentation/x86/directive/preprocessor.md): The preprocessor runs over the text before the assembler reads it, so it can define names, repeat blocks and include files, and knows nothing about registers…
- [`%define`](https://asm-editor.specy.app/documentation/x86/directive/preprocessor-define.md): A macro expanded wherever its name appears, with arguments if it was given any.
- [`%assign`](https://asm-editor.specy.app/documentation/x86/directive/preprocessor-assign.md): A single line macro whose value is evaluated at once, and may be reassigned.
- [`%macro`](https://asm-editor.specy.app/documentation/x86/directive/preprocessor-macro.md): A multi line macro, ended by %endmacro.
- [`%include`](https://asm-editor.specy.app/documentation/x86/directive/preprocessor-include.md): Assembles another file here, the way a header is included.
- [`%ifdef, %ifndef, %if`](https://asm-editor.specy.app/documentation/x86/directive/preprocessor-ifdef-ifndef-if.md): Assemble a block only under a condition, ending at %endif, with %else and %elif in between.
- [`%rep`](https://asm-editor.specy.app/documentation/x86/directive/preprocessor-rep.md): Repeats a block a fixed number of times, ending at %endrep.
- [Prefixes and operand sizes](https://asm-editor.specy.app/documentation/x86/directive/prefixes.md): Words that go in front of an instruction or an operand rather than standing on their own.
- [`lock`](https://asm-editor.specy.app/documentation/x86/directive/lock.md): Makes a read-modify-write instruction atomic against other processors.
- [`rep`](https://asm-editor.specy.app/documentation/x86/directive/rep.md): Repeats a string instruction rcx times, counting down.
- [`repe, repz, repne, repnz`](https://asm-editor.specy.app/documentation/x86/directive/repe-repz-repne-repnz.md): Repeat while the comparison keeps saying equal, or keeps saying not equal, and stop early when it changes.
- [`o16, o32, o64, a16, a32, a64`](https://asm-editor.specy.app/documentation/x86/directive/o16-o32-o64-a16-a32-a64.md): Force the operand or address size of one instruction, overriding what the mode implies.
- [`byte, word, dword, qword`](https://asm-editor.specy.app/documentation/x86/directive/byte-word-dword-qword.md): Say how wide a memory operand is, which the instruction cannot always work out on its own: mov qword [rsp], 0 writes eight bytes, mov byte [rsp], 0 writes one.
- [`near, short, far`](https://asm-editor.specy.app/documentation/x86/directive/near-short-far.md): Choose the reach of a jump or call.
- [`rel, abs`](https://asm-editor.specy.app/documentation/x86/directive/rel-abs.md): Say whether a memory reference is an offset from rip or an absolute address, for one operand rather than for the file the way default does.
- [Everything else](https://asm-editor.specy.app/documentation/x86/directive/everything-else.md): The rest of what NASM accepts, from its own tables.
