summaryrefslogtreecommitdiff
path: root/doc/nasmdoc.src
diff options
context:
space:
mode:
Diffstat (limited to 'doc/nasmdoc.src')
-rw-r--r--doc/nasmdoc.src81
1 files changed, 56 insertions, 25 deletions
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index 8d815396..86b2c826 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -475,29 +475,38 @@ Use this option to specify listing output details.
Supported options are:
-\c{-Lb} show builtin macro packages (standard and \c{%use})
+\b \c{-Lb} show builtin macro packages (standard and \c{%use})
-\c{-Ld} show byte and repeat counts in decimal, not hex
+\b \c{-Ld} show byte and repeat counts in decimal, not hex
-\c{-Le} show the preprocessed input
+\b \c{-Le} show the preprocessed input
-\c{-Lf} ignore \c{.nolist} and force listing output
+\b \c{-Lf} ignore \c{.nolist} and force listing output
-\c{-Lm} show multi-line macro calls with expanded parameters
+\b \c{-Lm} show multi-line macro calls with expanded parameters
-\c{-Lp} output a list file in every pass, in case of errors
+\b \c{-Lp} output a list file in every pass, in case of errors
-\c{-Ls} show all single-line macro definitions
+\b \c{-Ls} show all single-line macro definitions
-\c{-Lw} flush the output after every line (very slow!)
+\b \c{-Lw} flush the output after every line (very slow!)
-\c{-L+} enable \e{all} listing options
+\b \c{-L+} enable \e{all} listing options
These options can be enabled or disabled at runtime using the
\c{%pragma list options} directive:
\c %pragma list options [+|-]flags...
+For example, to turn on the \c{d} and \c{m} flags but disable the
+\c{s} flag:
+
+\c %pragma list options +dm -s
+
+For forward compatility reasons, an undefined flag will be
+ignored. Thus, a new flag introduced in a newer version of NASM can be
+specified without breaking older versions. Listing flags will always
+be a single alphanumeric character and are case sensitive.
\S{opt-M} The \i\c{-M} Option: Generate \i{Makefile Dependencies}
@@ -910,7 +919,7 @@ Running this:
\c nasm -f macho --pragma "macho gprefix _"
-is equivalent to the example in \k{opt-pfix}.
+is equivalent to the example in \k{opt-pfix}. See \k{pragma}.
\S{opt-before} The \i\c{--before} Option
@@ -923,10 +932,13 @@ shown in \k{opt-pragma} is the same as running this:
\S{opt-limit} The \i\c{--limit-X} Option
-This option allows user to setup various maximum values for these:
+This option allows user to setup various maximum values after which
+NASM will terminate with a fatal error rather than consume arbitrary
+amount of compute time. Each limit can be set to a positive number or
+\c{unlimited}.
\b\c{--limit-passes}: Number of maximum allowed passes. Default is
-effectively unlimited.
+\c{unlimited}.
\b\c{--limit-stalled-passes}: Maximum number of allowed unfinished
passes. Default is 1000.
@@ -946,13 +958,18 @@ under \c{%rep}. Default is 1000000.
\b\c{--limit-eval}: This number sets the boundary condition of allowed
expression length. Default is 8192 on most systems.
-\b\c{--limit-lines}: Total number of source lines as allowed to be
+\b\c{--limit-lines}: Total number of source lines allowed to be
processed. Default is 2000000000.
-In example, running this limits the maximum line count to be 1000.
+For example, set the maximum line count to 1000:
\c nasm --limit-lines 1000
+Limits can also be set via the directive \c{%pragma limit}, for
+example:
+
+\c %pragma limit lines 1000
+
\S{opt-keep-all} The \i\c{--keep-all} Option
@@ -2492,23 +2509,37 @@ includes backwards compatibility aliases defined by NASM itself.
To disable aliases without undefining them, use the \c{%aliases off}
directive.
-To check whether an alias is defined, use \c{%ifdefalias}.
+To check whether an alias is defined, regardless of the existence of
+the aliased macro, use \c{%ifdefalias}.
-This
+For example:
+\c %defalias OLD NEW
+\c ; OLD and NEW both undefined
+\c %define NEW 123
+\c ; OLD and NEW both 123
+\c %undef OLD
+\c ; OLD and NEW both undefined
+\c %define OLD 456
+\c ; OLD and NEW both 456
+\c %undefalias OLD
+\c ; OLD undefined, NEW defined to 456
\S{cond-comma} \i{Conditional Comma Operator}: \i\c{%,}
-As of version 2.15, NASM has conditional comma operator \c{%,} that expands to a
-comma unless followed by a null expansion, which allows suppressing the comma before an
-empty argument. For example, all the expressions below are valid:
+As of version 2.15, NASM has a conditional comma operator \c{%,} that
+expands to a comma \e{unless} followed by a null expansion, which
+allows suppressing the comma before an empty argument. This is
+especially useful with greedy single-line macros.
+
+For example, all the expressions below are valid:
\c %define greedy(a,b,c+) a + 66 %, b * 3 %, c
\c
-\c db greedy(1,2)
-\c db greedy(1,2,3)
-\c db greedy(1,2,3,4)
-\c db greedy(1,2,3,4,5)
+\c db greedy(1,2) ; db 1 + 66, 2 * 3
+\c db greedy(1,2,3) ; db 1 + 66, 2 * 3, 3
+\c db greedy(1,2,3,4) ; db 1 + 66, 2 * 3, 3, 4
+\c db greedy(1,2,3,4,5) ; db 1 + 66, 2 * 3, 3, 4, 5
\H{strlen} \i{String Manipulation in Macros}
@@ -3402,8 +3433,8 @@ infinite loop in the preprocessor, which (on multitasking or
multi-user systems) would typically cause all the system memory to
be gradually used up and other applications to start crashing.
-Note a maximum repeat count is limited by 62 bit number, though it
-is hardly possible that you ever need anything bigger.
+Note the maximum repeat count is limited to the value specified by the
+\c{--limit-rep} option or \c{%pragma limit rep}, see \k{opt-limit}.
\H{files} Source Files and Dependencies