⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nasmdoc.txt

📁 EDIT Assembler can for VC6 VC8 VC2005
💻 TXT
📖 第 1 页 / 共 5 页
字号:
       This differs from the `-M' option in that if a nonexisting file is
       encountered, it is assumed to be a generated file and is added to
       the dependency list without a prefix.

 2.1.6 The `-MF' Option: Set Makefile Dependency File

       This option can be used with the `-M' or `-MG' options to send the
       output to a file, rather than to stdout. For example:

       nasm -M -MF myfile.dep myfile.asm

 2.1.7 The `-MD' Option: Assemble and Generate Dependencies

       The `-MD' option acts as the combination of the `-M' and `-MF'
       options (i.e. a filename has to be specified.) However, unlike the
       `-M' or `-MG' options, `-MD' does _not_ inhibit the normal operation
       of the assembler. Use this to automatically generate updated
       dependencies with every assembly session. For example:

       nasm -f elf -o myfile.o -MD myfile.dep myfile.asm

 2.1.8 The `-MT' Option: Dependency Target Name

       The `-MT' option can be used to override the default name of the
       dependency target. This is normally the same as the output filename,
       specified by the `-o' option.

 2.1.9 The `-MQ' Option: Dependency Target Name (Quoted)

       The `-MQ' option acts as the `-MT' option, except it tries to quote
       characters that have special meaning in Makefile syntax. This is not
       foolproof, as not all characters with special meaning are quotable
       in Make.

2.1.10 The `-MP' Option: Emit phony targets

       When used with any of the dependency generation options, the `-MP'
       option causes NASM to emit a phony target without dependencies for
       each header file. This prevents Make from complaining if a header
       file has been removed.

2.1.11 The `-F' Option: Selecting a Debug Information Format

       This option is used to select the format of the debug information
       emitted into the output file, to be used by a debugger (or _will_
       be). Prior to version 2.03.01, the use of this switch did _not_
       enable output of the selected debug info format. Use `-g', see
       section 2.1.12, to enable output. Versions 2.03.01 and later
       automatically enable `-g' if `-F' is specified.

       A complete list of the available debug file formats for an output
       format can be seen by issuing the command `nasm -f <format> -y'. Not
       all output formats currently support debugging output. See section
       2.1.26.

       This should not be confused with the `-f dbg' output format option
       which is not built into NASM by default. For information on how to
       enable it when building from the sources, see section 6.12.

2.1.12 The `-g' Option: Enabling Debug Information.

       This option can be used to generate debugging information in the
       specified format. See section 2.1.11. Using `-g' without `-F'
       results in emitting debug info in the default format, if any, for
       the selected output format. If no debug information is currently
       implemented in the selected output format, `-g' is _silently
       ignored_.

2.1.13 The `-X' Option: Selecting an Error Reporting Format

       This option can be used to select an error reporting format for any
       error messages that might be produced by NASM.

       Currently, two error reporting formats may be selected. They are the
       `-Xvc' option and the `-Xgnu' option. The GNU format is the default
       and looks like this:

       filename.asm:65: error: specific error message 

       where `filename.asm' is the name of the source file in which the
       error was detected, `65' is the source file line number on which the
       error was detected, `error' is the severity of the error (this could
       be `warning'), and `specific error message' is a more detailed text
       message which should help pinpoint the exact problem.

       The other format, specified by `-Xvc' is the style used by Microsoft
       Visual C++ and some other programs. It looks like this:

       filename.asm(65) : error: specific error message

       where the only difference is that the line number is in parentheses
       instead of being delimited by colons.

       See also the `Visual C++' output format, section 6.3.

2.1.14 The `-Z' Option: Send Errors to a File

       Under `MS-DOS' it can be difficult (though there are ways) to
       redirect the standard-error output of a program to a file. Since
       NASM usually produces its warning and error messages on `stderr',
       this can make it hard to capture the errors if (for example) you
       want to load them into an editor.

       NASM therefore provides the `-Z' option, taking a filename argument
       which causes errors to be sent to the specified files rather than
       standard error. Therefore you can redirect the errors into a file by
       typing

       nasm -Z myfile.err -f obj myfile.asm

       In earlier versions of NASM, this option was called `-E', but it was
       changed since `-E' is an option conventionally used for
       preprocessing only, with disastrous results. See section 2.1.20.

2.1.15 The `-s' Option: Send Errors to `stdout'

       The `-s' option redirects error messages to `stdout' rather than
       `stderr', so it can be redirected under `MS-DOS'. To assemble the
       file `myfile.asm' and pipe its output to the `more' program, you can
       type:

       nasm -s -f obj myfile.asm | more

       See also the `-Z' option, section 2.1.14.

2.1.16 The `-i' Option: Include File Search Directories

       When NASM sees the `%include' or `%pathsearch' directive in a source
       file (see section 4.6.1, section 4.6.2 or section 3.2.3), it will
       search for the given file not only in the current directory, but
       also in any directories specified on the command line by the use of
       the `-i' option. Therefore you can include files from a macro
       library, for example, by typing

       nasm -ic:\macrolib\ -f obj myfile.asm

       (As usual, a space between `-i' and the path name is allowed, and
       optional).

       NASM, in the interests of complete source-code portability, does not
       understand the file naming conventions of the OS it is running on;
       the string you provide as an argument to the `-i' option will be
       prepended exactly as written to the name of the include file.
       Therefore the trailing backslash in the above example is necessary.
       Under Unix, a trailing forward slash is similarly necessary.

       (You can use this to your advantage, if you're really perverse, by
       noting that the option `-ifoo' will cause `%include "bar.i"' to
       search for the file `foobar.i'...)

       If you want to define a _standard_ include search path, similar to
       `/usr/include' on Unix systems, you should place one or more `-i'
       directives in the `NASMENV' environment variable (see section
       2.1.28).

       For Makefile compatibility with many C compilers, this option can
       also be specified as `-I'.

2.1.17 The `-p' Option: Pre-Include a File

       NASM allows you to specify files to be _pre-included_ into your
       source file, by the use of the `-p' option. So running

       nasm myfile.asm -p myinc.inc

       is equivalent to running `nasm myfile.asm' and placing the directive
       `%include "myinc.inc"' at the start of the file.

       For consistency with the `-I', `-D' and `-U' options, this option
       can also be specified as `-P'.

2.1.18 The `-d' Option: Pre-Define a Macro

       Just as the `-p' option gives an alternative to placing `%include'
       directives at the start of a source file, the `-d' option gives an
       alternative to placing a `%define' directive. You could code

       nasm myfile.asm -dFOO=100

       as an alternative to placing the directive

       %define FOO 100

       at the start of the file. You can miss off the macro value, as well:
       the option `-dFOO' is equivalent to coding `%define FOO'. This form
       of the directive may be useful for selecting assembly-time options
       which are then tested using `%ifdef', for example `-dDEBUG'.

       For Makefile compatibility with many C compilers, this option can
       also be specified as `-D'.

2.1.19 The `-u' Option: Undefine a Macro

       The `-u' option undefines a macro that would otherwise have been
       pre-defined, either automatically or by a `-p' or `-d' option
       specified earlier on the command lines.

       For example, the following command line:

       nasm myfile.asm -dFOO=100 -uFOO

       would result in `FOO' _not_ being a predefined macro in the program.
       This is useful to override options specified at a different point in
       a Makefile.

       For Makefile compatibility with many C compilers, this option can
       also be specified as `-U'.

2.1.20 The `-E' Option: Preprocess Only

       NASM allows the preprocessor to be run on its own, up to a point.
       Using the `-E' option (which requires no arguments) will cause NASM
       to preprocess its input file, expand all the macro references,
       remove all the comments and preprocessor directives, and print the
       resulting file on standard output (or save it to a file, if the `-o'
       option is also used).

       This option cannot be applied to programs which require the
       preprocessor to evaluate expressions which depend on the values of
       symbols: so code such as

       %assign tablesize ($-tablestart)

       will cause an error in preprocess-only mode.

       For compatiblity with older version of NASM, this option can also be
       written `-e'. `-E' in older versions of NASM was the equivalent of
       the current `-Z' option, section 2.1.14.

2.1.21 The `-a' Option: Don't Preprocess At All

       If NASM is being used as the back end to a compiler, it might be
       desirable to suppress preprocessing completely and assume the
       compiler has already done it, to save time and increase compilation
       speeds. The `-a' option, requiring no argument, instructs NASM to
       replace its powerful preprocessor with a stub preprocessor which
       does nothing.

2.1.22 The `-On' Option: Specifying Multipass Optimization.

       NASM defaults to being a two pass assembler. This means that if you
       have a complex source file which needs more than 2 passes to
       assemble optimally, you have to enable extra passes.

       Using the `-O' option, you can tell NASM to carry out multiple
       passes. The syntax is:

       (*) `-O0' strict two-pass assembly, JMP and Jcc are handled more
           like v0.98, except that backward JMPs are short, if possible.
           Immediate operands take their long forms if a short form is not
           specified.

       (*) `-O1' strict two-pass assembly, but forward branches are
           assembled with code guaranteed to reach; may produce larger code
           than -O0, but will produce successful assembly more often if
           branch offset sizes are not specified. Additionally, immediate
           operands which will fit in a signed byte are optimized, unless
           the long form is specified.

       (*) `-On' multi-pass optimization, minimize branch offsets; also
           will minimize signed immediate bytes, overriding size
           specification unless the `strict' keyword has been used (see
           section 3.7). The number specifies the maximum number of passes.
           The more passes, the better the code, but the slower is the
           assembly.

       (*) `-Ox' where `x' is the actual letter `x', indicates to NASM to
           do unlimited passes.

       Note that this is a capital `O', and is different from a small `o',
       which is used to specify the output file name. See section 2.1.1.

2.1.23 The `-t' option: Enable TASM Compatibility Mode

       NASM includes a limited form of compatibility with Borland's `TASM'.
       When NASM's `-t' option is used, the following changes are made:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -