Search notes:

The Microsoft macro assembler

The microsoft (macro) assembler (aka MASM) comes with a Visual Studio when installing a C++ workload.
The 32-bit version is named ml.exe, the 64-bit version ml64.exe. These executables are installed under %VCToolsInstallDir%\bin\Hostx…\x…. (See Visual Studio environment variables)

Some interesting directives

Data declaration:
PUBLIC exports(?) a symbol(?) so that other modules can use it.

Command line options

/AT Enables tiny-memory-model support. (not available in ml64.exe)
/Bl<linker> Use alternate linker
/c Assemble without linking
/coff Generates common object file format (COFF) type of object module. Required for Win32 assembly language development. (Not available in ml64.exe).
/Cp Preserve case of user identifiers
/Cu Maps all all identifiers to uppercase. Not available in ml64.exe
/Cx Preserve case in publics, externs
/D<name>[=text] Define text macro
/EP Output preprocessed listing to stdout. See also /Sf
/F <hex> Set stack size (bytes)
/Fe<file> Name executable
/Fl[file] Generate listing
/Fm[file] Generate map
/Fo<file> Name object file
/Fr[file] Generate limited browser info
/FR[file] Generate full browser info
/Gc Not available in ml64.exe
/Gd Not available in ml64.exe
/Gz Not available in ml64.exe
/H Not available in ml64.exe
/I<name> Add include path
/link <linker options and libraries>
/nologo Suppress copyright message
/Sa Maximize source listing
/ZH:SHA_256 Use SHA256 for checksum in debug info (experimental)
/Gy[-] separate functions for linker
/safeseh Marks the object as either containing no exception handlers or containing exception handlers that are all declared with .SAFESEH.
/Sf Generate first pass listing
/Sl<width> Set line width
/Sn Suppress symbol-table listing
/Sp<length> Set page length
/Ss<string> Set subtitle
/St<string> Set title
/Sx List false conditionals
/Ta<file> Assemble non-.ASM file
/w Same as /W0 /WX
/WX Treat warnings as errors
/W<number> Set warning level
/X Ignore INCLUDE environment path
/Zd Add line number debug info
/Zf Make all symbols public
/Zi Add symbolic debug info
/Zp[n] Set structure alignment
/Zs Perform syntax check only

Defining macros

Macros (for which MASM probably was named) can be defined with the macro directive.

See also

Hello world with MASM
Visual Studio
Assembler (x86/x64)

Index