2.2 Assembling and Linking Files

A program may be assembled and linked using the following command-line statements:


nasm [-g] {-f obj} [-o outfile] {filename} [-l listfile]

Assemble the named file.

  • The -g option enables debugging output (so the original source code is visible in the debugger).

  • The -f option specifies the output object format (obj is standard for DOS programs).

  • The -o option specifies the output filename. This is optional, as NASM can infer the output filename from the object format and source filename.

  • The -l option specifies the list output filename. If this option is not specified, a list file will not be written.


tlink [/c] [/v] {objfile ...} , [exefile] , [mapfile] , [libfile ...]

Link together several object files and libraries into a single executable.

  • The /c option makes the link case-sensitive. As NASM is case-sensitive, this should normally be enabled.

  • The /v option includes debugging information in the executable.

  • objfile is an input obj file.

  • exefile optionally specifies the filename of the output executable. If not specified, it defaults to the first object file listed with an exe extension.

  • mapfile optionally specifies the filename of a map file. If not specified, a map file is not written.

  • libfile is an (optional) library file.