0.1.2 Segment Management

This section lists the changes and additions to memory-model and operating-system support as well as to directives that relate to these topics.

New Predefined Symbols

The following new predefined symbols (also called predefined equates) provide information about simplified segments:

Predefined Symbol Value  
@stack DGROUP for near stacks, STACK for far stacks  
@Interface Information about language parameters  
@Model Information about the current memory model  
@Line The source line in the current file  
@Date The current date  
@FileCur The current file  
@Time The current time  
@Environ The current environment variables  

For more information, see Section 1.2.3, “Predefined Symbols,” or online help.

Enhancements to the ASSUME Directive

MASM automatically generates ASSUME values for the code segment register (CS) when a segment is opened. It is no longer necessary to include lines such as

ASSUME CS:MyCodeSegment

in your programs. In addition, the ASSUME directive can now include ERROR, FLAT, or register:type. Generating ASSUME values for the code segment register CS to be other than the current segment or group is no longer valid.

For more information, see Sections 2.3.3, “Setting the ASSUME Directive for Segment Registers,” and 3.3.2, “Defining Register Types with ASSUME.”

Relocatable Offsets

For compatibility with Windows programs, the new LROFFSET operator can calculate a relocatable offset, which is resolved by the loader at run time. See online help for details.

Flat Model

In the flat memory model (available only in version 2.0 of OS/2), segments may be as large as four gigabytes because offsets contain 32 bits instead of 16. Segments are limited to 64K in all other memory models supported by DOS and earlier versions of OS/2. Version 2.0 of OS/2 runs only on 80386/486 processors. For more information about memory models, see Section 2.2.1, “Defining Basic Attributes with .MODEL.”

Operating Systems Support

Specifying the new OS_OS2 or OS_DOS keywords in the .MODEL statement allows the new .STARTUP directive to generate start-up code appropriate for the language and operating system. The new .EXIT directive generates the appropriate exit code.

Section 2.2.1, “Defining Basic Attributes with .MODEL,” provides more information on specifying an operating system. Also see Section 2.2.6, “Starting and Ending Code with .STARTUP and .EXIT.”