GNU Info

Info Node: (nasm.info)Section 2.1

(nasm.info)Section 2.1


Next: Section 2.1.1 Prev: Chapter 2 Up: Chapter 2
Enter node , (file) or (file)node

2.1. NASM Command-Line Syntax
=============================

   To assemble a file, you issue a command of the form

     nasm -f <format> <filename> [-o <output>]

   For example,

     nasm -f elf myfile.asm

   will assemble `myfile.asm' into an `ELF' object file `myfile.o'. And

     nasm -f bin myfile.asm -o myfile.com

   will assemble `myfile.asm' into a raw binary file `myfile.com'.

   To produce a listing file, with the hex codes output from NASM
displayed on the left of the original sources, use the `-l' option to
give a listing file name, for example:

     nasm -f coff myfile.asm -l myfile.lst

   To get further usage instructions from NASM, try typing

     nasm -h

   As `-hf', this will also list the available output file formats, and
what they are.

   If you use Linux but aren't sure whether your system is `a.out' or
`ELF', type

     file nasm

   (in the directory in which you put the NASM binary when you
installed it).  If it says something like

     nasm: ELF 32-bit LSB executable i386 (386 and up) Version 1

   then your system is `ELF', and you should use the option `-f elf'
when you want NASM to produce Linux object files. If it says

     nasm: Linux/i386 demand-paged executable (QMAGIC)

   or something similar, your system is `a.out', and you should use `-f
aout' instead (Linux `a.out' systems have long been obsolete, and are
rare these days.)

   Like Unix compilers and assemblers, NASM is silent unless it goes
wrong: you won't see any output at all, unless it gives error messages.

Section 2.1.1
The `-o' Option: Specifying the Output File Name
Section 2.1.2
The `-f' Option: Specifying the Output File Format
Section 2.1.3
The `-l' Option: Generating a Listing File
Section 2.1.4
The `-M' Option: Generate Makefile Dependencies.
Section 2.1.5
The `-F' Option: Selecting a Debug Information Format
Section 2.1.6
The `-g' Option: Enabling Debug Information.
Section 2.1.7
The `-X' Option: Selecting an Error Reporting Format
Section 2.1.8
The `-E' Option: Send Errors to a File
Section 2.1.9
The `-s' Option: Send Errors to `stdout'
Section 2.1.10
The `-i' Option: Include File Search Directories
Section 2.1.11
The `-p' Option: Pre-Include a File
Section 2.1.12
The `-d' Option: Pre-Define a Macro
Section 2.1.13
The `-u' Option: Undefine a Macro
Section 2.1.14
The `-e' Option: Preprocess Only
Section 2.1.15
The `-a' Option: Don't Preprocess At All
Section 2.1.16
The `-On' Option: Specifying Multipass Optimization.
Section 2.1.17
The `-t' option: Enable TASM Compatibility Mode
Section 2.1.18
The `-w' Option: Enable or Disable Assembly Warnings
Section 2.1.19
The `-v' Option: Display Version Info
Section 2.1.20
The `-y' Option: Display Available Debug Info Formats
Section 2.1.21
The `--prefix' and `--postfix' Options.
Section 2.1.22
The `NASMENV' Environment Variable

automatically generated by info2www version 1.2.2.9