.MODEL
Initializes the program memory model.
.MODEL memorymodel [[, langtype]] [[, stackoption]]
.MODEL is not used in MASM for x64 (ml64.exe).
The following table lists the possible values for each parameter when targeting 16-bit and 32-bit platforms:
|
Parameter |
32-bit values |
16-bit values (support for legacy 16-bit development) |
|---|---|---|
|
memorymodel |
FLAT |
TINY , SMALL, COMPACT, MEDIUM, LARGE, HUGE, FLAT |
|
langtype |
C , STDCALL |
C , BASIC, FORTRAN, PASCAL, SYSCALL, STDCALL |
|
stackoption |
Not used |
NEARSTACK , FARSTACK |
For MASM-related samples, download the Compiler samples from Visual C++ Samples and Related Documentation for Visual Studio 2010.
The following example demonstrates the use of the .MODEL directive.
; file simple.asm ; For x86 (32-bit), assemble with debug information: ; ml -c -Zi simple.asm ; For x64 (64-bit), assemble with debug information: ; ml64 -c -DX64 -Zi simple.asm ; ; In this sample, the 'X64' define excludes source not used ; when targeting the x64 architecture ifndef X64 .686p .XMM .model flat, C endif .data ; user data .code ; user code fxn PROC public xor eax, eax ; zero function return value ret fxn ENDP end