1.3.2 Using the OPTION Directive

The OPTION directive lets you modify global aspects of the assembly process. With OPTION, you can change command-line options and default arguments. These changes affect only statements that follow the use of OPTION.

For example, you may have MASM code in which the first character of a variable, macro, structure, or field name is a dot (.). Since a leading dot causes MASM 6.0 to generate an error, you can use this statement in your program:

OPTION DOTNAME

This enables the use of the dot for the first character.

Changes made with OPTION override any corresponding command-line option. For example, suppose you compile a module with this command line (which enables M510 compatibility):

ML /Zm TEST.ASM

but this statement is in the module:

OPTION NOM510

From this point on in the module, the M510 compatibility options are disabled.

The lists below explain each of the arguments for the OPTION directive. You can put more than one OPTION statement on one line if you separate them by commas.

Options for M510 Compatibility

Argument Description
CASEMAP: maptype CASEMAP:NONE (or /Cx) causes internal symbol recognition to be case sensitive and causes the case of identifiers in the .OBJ file to be the same as specified in the EXTERNDEF, PUBLIC, or COMM statement. The default is CASEMAP:NOTPUBLIC (or /Cp). It specifies case insensitivity for internal symbol recognition and the same behavior as CASEMAP:NONE for case of identifiers in .OBJ files. CASEMAP:ALL (/Cu) specifies case insensitivity for identifiers and converts all identifier names to uppercase.
DOTNAME | NODOTNAME Enables the use of the dot (.) as the leading character in variable, macro, structure, union, and member names. NODOTNAME is the default.
M510 | NOM510 Sets all features to be compatible with MASM version 5.1, disabling the SCOPED argument and enabling OLDMACROS, DOTNAME, and, OLDSTRUCTS. OPTION M510 conditionally sets other arguments for the OPTION directive. The default is NOM510. See Appendix A for more information on using OPTION M510.
OLDMACROS | NOOLDMACROS Enables the version 5.1 treatment of macros. MASM 6.0 treats macros differently. The default is NOOLDMACROS.
OLDSTRUCTS | NOOLDSTRUCTS Enables compatibility with MASM 5.1 for treatment of structure members. See Section 5.2 for information on structures.
SCOPED | NOSCOPED Guarantees that all labels inside procedures are local to the procedure when SCOPED (the default) is enabled.

Options for Procedure Use

Argument Description
LANGUAGE: langtype Specifies the default language type (C, PASCAL, FORTRAN, BASIC, SYSCALL, or STDCALL) to be used with PROC, EXTERN, and PUBLIC. This use of the OPTION directive overrides the .MODEL directive but is normally used when .MODEL is not given.
EPILOGUE: macroname Instructs the assembler to call the macroname to generate a user-defined epilogue instead of the standard epilogue code when a RET instruction is encountered. See Section 7.3.8.
PROLOGUE: macroname Instructs the assembler to call macroname to generate a user-defined prologue instead of generating the standard prologue code. See Section 7.3.8.
PROC: visibility Allows the default visibility to be set explicitly. The default visibility is PUBLIC. The visibility can also be either EXPORT or PRIVATE.

Other Options

Argument Description
EXPR16 | EXPR32 Sets the expression word size to 16 or 32 bits. The default is 32 bits. The M510 argument to the OPTION directive sets the word size to 16 bits. Once set with the OPTION directive, the expression word size cannot be changed.
EMULATOR | NOEMULATOR Controls the generation of floating-point instructions. The NOEMULATOR option generates the coprocessor instructions directly. The EMULATOR option generates instructions with special fixup records for the linker so that the Microsoft floating-point emulator, supplied with other Microsoft languages, can be used. It produces the same result as setting the /Fpi command-line option. You can set this option only once per module.
LJMP | NOLJMP Enables automatic conditional-jump lengthening. The default is LJMP. See Section 7.1.2 for information about conditional-jump lengthening.
NOKEYWORD:<keywordlist> Disables the specified reserved words. See Section 1.2.1, “Reserved Words,” for an example of the syntax for this argument.
NOSIGNEXTEND Overrides the default sign-extended opcodes for the AND, OR, and XOR instructions and generates the larger non-sign-extended forms of these instructions. Provided for compatibility with NEC V25Ň and NEC V35Ô controllers.
OFFSET: offsettype Determines the result of OFFSET operator fixups. SEGMENT sets the defaults for fixups to be segment-relative (compatible with MASM 5.1). GROUP, the default, generates fixups relative to the group (if the label is in a group). FLAT causes fixups to be relative to a flat frame. (The .386 mode must be enabled to use FLAT.) See Appendix A for more information.
READONLY | NOREADONLY Enables checking for instructions that modify code segments, thereby guaranteeing that read-only code segments are not modified. Replaces the /p command-line option of MASM 5.1. It is useful for OS/2, where code segments are normally read-only.
SEGMENT: segSize Allows global default segment size to be set. Also determines the default address size for external symbols defined outside any segment. The segSize can be USE16, USE32, or FLAT.