We recommend using Visual Studio 2017

SEGMENT

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at SEGMENT.

Defines a program segment called name having segment attributes

  
   name SEGMENT [[READONLY]] [[align]] [[combine]] [[use]] [[characteristics]] ALIAS(string) [['class']]  
statements  
name ENDS  

Parameters

align
The range of memory addresses from which a starting address for the segment can be selected. The alignment type can be any one of the following:

Align TypeStarting Address
BYTENext available byte address.
WORDNext available word address (2 bytes per word).
DWORDNext available double word address (4 bytes per double word).
PARANext available paragraph address (16 bytes per paragraph).
PAGENext available page address (256 bytes per page).
ALIGN(n)Next available nth byte address. See Remarks section for more information.

If this parameter is not specified, PARA is used by default.

combine
PUBLIC, STACK, COMMON, MEMORY, ATaddress, PRIVATE

use
USE16, USE32, FLAT

characteristics
INFO, READ, WRITE, EXECUTE, SHARED, NOPAGE, NOCACHE, and DISCARD

These are supported for COFF only and correspond to the COFF section characteristics of similar name (for example, SHARED corresponds to IMAGE_SCN_MEM_SHARED). READ sets the IMAGE_SCN_MEM_READ flag. The obsolete READONLY flag caused the section to clear the IMG_SCN_MEM_WRITE flag. If any characteristics are set, the default characteristics are not used and only the programmer-specified flags are in effect.

ALIAS( string )
This string is used as the section name in the emitted COFF object. Creates multiple sections with the same external name, with distinct MASM segment names.

Not supported with /omf.

class
Designates how segments should be combined and ordered in the assembled file. Typical values are, 'DATA', 'CODE', 'CONST' and 'STACK'

For ALIGN(``n``), n may be any power of 2 from 1 to 8192; not supported with /omf.

Directives Reference

Show: