Search code examples
assembly

What is the meaning of DATA SEGMENT USE16 PARA PUBLIC 'DATA' when defining a data segment?


I use 80x86 Assembly language.

DATA SEGMENT USE16 PARA PUBLIC 'DATA'
DAT DW 0AH
TMP DB 'WWWWW$' 
TGT DB 'WWWWW$' 
DATA ENDS

       

Solution

  • The SEGMENT directive can take the two forms:

    name SEGMENT [attributes]
    
    SEGMENT name [attributes]
    

    The first one is used in this case.


    DATA
    This is the name of the segment

    SEGMENT
    This is the first form of segment directive.

    USE16
    When used in a code segment declaration, this defines the default operand size. When used in a data segment it limits the maximum size of the segment.

    PARA
    Align on paragraphs (16-byte).

    PUBLIC
    This segment will be concatenated with other segments of the same name outside of the module to form a single contiguous segment.

    'DATA'
    This is the segment class. It is used by the linker to order and group (concat) the segments at linking time. Each segment with the same class is grouped together but other grouping is also possible (e.g. data and uninitialised data).