Assembler directives are special instructions that provide information to the assembler. Assembler directives do not generate code.
Segment directives, equ, assume, and end mnemonics are all directives. These are not valid 80x86 instructions.

Directives may be divided into the following classes:

  • Pseudo-Opcode directive or Processor Code Generation Directives
  • Memory Model Directives
  • Segment Definition Directives
  • Segment Ordering Directives
  • Linkage Directives
  • Data Allocation Directives
  • Logical and Bit Oriented Directives
  • Macro Definition Directives
  • Program Listing and Documentation Directives
  • Conditional Assembly Directives
  • User Message Directives
  • Predefined Equates
  • Radix Specifiers
  • Other Operators and Directives
  • Pseudo-Opcode Directives:

    A pseudo-opcode is a message to the assembler just like an assembler directive. However, a pseudo-opcode will emit object code bytes. Examples of pseudo-opcodes include byte, word, dword, qword, and tbyte. These instructions emit the bytes of data specified by their operands but they are not true 80X86 machine instructions.

    At this level only the most commonly used directives are briefly presented.

    Memory Model Directives:

    These are already seen in the section related to models. The following table summarizes the main points about segment directives.

    Directive Effect
    .MODEL model defines memory model to be one of the following:
    must be used prior to any other segment directive
    .CODE [name] starts code segment; must follow .MODEL directive
    .DATA starts a near data segment for initialized data
    must follow .MODEL directive;
    .STACK [size] indicates start of stack segment named 'STACK'
    with size indicating number of bytes to reserve.

    Table 6: Model and Segment directives

    Segment Definition Directives:

    Directive Effect
    name PROC [NEAR|FAR] defines procedure; NEAR/FAR has .MODEL default
    name ENDP ends procedure 'name'
    PUBLIC name[,name...] makes symbol 'name', which could be a variable or
    END [name] marks end of source module and sets program
    start address (CS:IP) if 'name' is present a procedure available to other modules.

    Table 7: Segment Definition directives

    Data Allocation Directives:

    Directive Effect
    [name] DB init[,init...] define byte
    [name] DW init[,init...] define word (WORD, 2 bytes)
    [name] DD init[,init...] define double word (DWORD, 4 bytes)
    [name] DF init[,init...] define far word (FWORD, 386, 6 bytes)
    [name] DQ init[,init...] define quad word (QWORD, 8 bytes)
    [name] DT init[,init...] define temp word (TBYTE, 10 bytes)
    count DUP(init[,init...]) duplicate 'init' 'count' times; DUP can be

    Table 8: Data Allocation directives

    Predefined Equates:

    These are available only if simplified segments are used.

    Directive Effect
    @code contains the current code segment
    @codesize 0 for small and compact; 1 for large medium and huge
    @datasize 0 for small and medium; 1 for compact ;2 for large
    @data contains segment of define by .DATA
    @stack contains segment of define by .STACK

    Table 9: Equates directives

    Radix Specifiers:

    Directive Effect
    .RADIX expr sets radix [2..16] for numbers (dec. default)
    .RADIX B binary data specifier
    .RADIX Q octal data specifier
    .RADIX O octal data specifier
    .RADIX D decimal data specifier (default)
    .RADIX H hex

    Table 10: Radix Specifiers directives

    Macro Definition Directives:

    Directive Effect
    name MACRO [parm[,parm...]] defines a macro and it's parameters
    ENDM terminates a macro block
    LOCAL name[,name...] defines scope symbol as local to a macro
    EXITM exit macro expansion immediately
    REPT expr repeats all statements through ENDM statement
    for 'expr' times

    Table 11: Macro Definition directives