<<< Modules, Logical Segments, and Segment Directives | Index | Small, Medium, Compact, Large, and Huge Models >>> |
The .MODEL directive defines the attributes that affect the entire module:
memory model
default calling and naming conventions
operating system
stack type.
.MODEL directive
enables use of simplified segments
controls the name of the code segment
controls the default distance for procedures.
.MODEL must appear in source file before any other simplified segment directive. The syntax is:
.MODEL memorymodel, options-optional
The memorymodel can be TINY, SMALL, COMPACT, MEDIUM, LARGE, HUGE, or FLAT, it determines size of code and data pointers. This field is required.
For example,
.MODEL small ; Small memory model .MODEL large, c, farstack ; Large memory model, ; C conventions, ; separate stack .MODEL medium, pascal ; Medium memory model, ; Pascal conventions, ; near stack (default)
When writing assembler modules for a high-level language, you should use the same memory model as the calling language.
Choose the smallest memory model available that can contain your data and code, since near references operate more efficiently than far references.
<<< Modules, Logical Segments, and Segment Directives | Index | Small, Medium, Compact, Large, and Huge Models >>> |