Commit graph

313 commits

Author SHA1 Message Date
H. Peter Anvin (Intel)
9969b34454 listing: add __?LIST_OPTIONS?__ and __?LIST_OPTIONS_DEFAULT?__ macros
Add macros to query the current state of the listing options, add
appropriate documentation.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-28 20:13:30 -07:00
H. Peter Anvin (Intel)
4d18bdd318 listing: allow the user to suppress abbreviation of TIMES and INCBIN
Allow the user to suppress the abbreviation of the output from TIMES
(and therefore ALIGN) and INCBIN.

Sync the documentation with the help text, too.

Fixes: https://github.com/netwide-assembler/nasm/issues/211
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-28 18:11:40 -07:00
H. Peter Anvin (Intel)
7bc82e7daf asm/nasm.c: fix use-after-free for -M* options in -@ files
-M* options in response files would hold on to a pointer to the new
value, but in response files that is not a persistent buffer. Make
sure to make a copy instead.

This uses the new nasm_str[dup]to() helpers.

(Note that calling nasm_free() on a NULL pointer is guaranteed safe.)

Reported-by: <BreakingBad6@github.com>
Fixes: https://github.com/netwide-assembler/nasm/issues/222
Fixes: CVE-2026-6068
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-26 17:35:33 -07:00
H. Peter Anvin (Intel)
24263bc4c1 doc/changes.src: document defanging of "%[i]rmacro"
Formally document in the change notes that %[i]rmacro falls back to
%[i]macro with a warning.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-26 14:39:12 -07:00
H. Peter Anvin (Intel)
a55b5930b3 changes.src: document fixing $-escaped symbols in directives
Document the fix of $-escaped symbols in directives. Tidy up the
source formatting (no output change) of one of the bullet points.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-26 14:20:31 -07:00
H. Peter Anvin (Intel)
022586090d changes.src: document %clear directive fix
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-11 14:42:55 -07:00
H. Peter Anvin (Intel)
471073c0d0 changes.src: update release notes
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-07 18:25:57 -07:00
H. Peter Anvin (Intel)
00fe1077dc Add \^ escape sequences for Ctrl characters
It is fairly common to want to represent characters like
Ctrl-Z. Instead of having to use character codes, allow these to be
coded as `\^z` or `\^Z` instead.

`\^?` is DEL.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-04-09 18:08:21 -07:00
H. Peter Anvin (Intel)
fe5235ffc9 limits: allow querying limits, and reset limits for each pass
Allow limits to be queried via a %limit() preprocessor function and a
__?NASM_LIMITS?__ macro.

Reset limits at the top of each pass. Note that the pass number limits
are checked at the *end* of the pass, so a %pragma limit will be
properly honored anyway.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-04-09 17:00:49 -07:00
H. Peter Anvin (Intel)
a9e46d4572 doc: update changes to the limit option and pragmas
Add --limit-params and the default and maximum keywords.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-04-09 15:19:36 -07:00
H. Peter Anvin (Intel)
55e064dccb preproc: %env() function
Add an %env() function for expanding environment variables as a more
flexible and robust alternative to %! (the variable name can be
computed without doing weird things like %tok(%strcat("%!",...)) and a
fallback value can be specified by the user.)

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-04-08 01:14:17 -07:00
H. Peter Anvin (Intel)
cf770c08e8 changes.src: document fix to generating binary constants in smacros
Document the fix to smacro argument evaluation that caused truncation
to 63 bits.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-04-07 23:55:34 -07:00
H. Peter Anvin (Intel)
447bb02e1d Changes: document arith AL,imm8 fix
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-04-06 18:09:48 -07:00
H. Peter Anvin (Intel)
c8fa17205b Add support for C2y-style \o and braced escapes, and \d for decimal
C2y adds \o for octal byte escapes, and allows \x, \o, or \u escape
sequences to be enclosed in braces to indicate their termination.

Add a \d sequence as a NASM extension to allow decimal bytes to be
specified.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-03-06 17:59:28 -08:00
H. Peter Anvin (Intel)
a4c5b2829c changes.src: document JMP/CALL immediate size fix
- Document the fix to the JMP/CALL immediate size.
- Keep the convention to use capitals for keywords and instructions.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-03-03 13:23:26 -08:00
H. Peter Anvin (Intel)
5de64ecd20 changes.src: minor formatting fixes
- Minor format cleanups
- Correct the statement on PUSH.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-03-03 13:17:05 -08:00
Maciej Wieczor-Retman
e7aa83c68e doc: Update changelogs with bugfixes
Write up regression solving results for the upcoming 3.02.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2026-03-03 13:09:16 -08:00
Maciej Wieczor-Retman
1ef93d643d doc: Fix issue #191 - badly formatted link
Fix bad link formatting that prevents building the documentation.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2026-02-06 19:15:52 +01:00
H. Peter Anvin (Intel)
0bc4333150 Change JMPE encoding from being relative to being absolute
Apparently NASM has been doing this in violation of the spec since
JMPE was first added. Hopefully fixing it won't cause new problems...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-12 12:58:04 -07:00
H. Peter Anvin (Intel)
e20b3087cc changes.src: update release notes
A few more changes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-10 16:37:04 -07:00
H. Peter Anvin (Intel)
a7457e66cf Fix matching of branch instructions with prefixes and sizes
Matching of branch instructions with prefixes and sizes is, to say the
least, tricky. Work through it, and add a new macro to help.

Fixes: https://github.com/netwide-assembler/nasm/issues/144
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-10 13:07:46 -07:00
H. Peter Anvin (Intel)
7e82d9d1e3 Add a default-error warning for impossible o64, a64, or a16 prefixes
The o64, a64 and a16 prefixes are only possible in specific
modes. It is a lot easier to debug with a more sensible error message.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-09 19:24:07 -07:00
H. Peter Anvin (Intel)
b8e256a475 changes.src: add missing \>
Add missing \> marker (bulleted list continuation.)

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-09 17:25:54 -07:00
H. Peter Anvin (Intel)
ddf85b55ed changes.src: update release notes
Add recent changes to the release notes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-09 16:14:58 -07:00
H. Peter Anvin (Intel)
ae9335a0b9 labels: make the prefix/suffix options and pragmas consistent
Make the spellings for the label-mangling options and pragmas
consistent, and implement the directive forms which were documented
but never implemented.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-07 18:46:39 -07:00
H. Peter Anvin (Intel)
99df4c97be changes.src: handwavy note about various instruction changes
A lot of minor changes, but not worth enumerating them.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-07 16:31:43 -07:00
H. Peter Anvin (Intel)
0a1a9789ec Fix confusion between "postfix" and "suffix"
"suffix" is the more common English term, but NASM used "postfix" for
a long time.  Allow them as aliases, and tidy up the documentation
accordingly.  While making these changes, tidy up the handling of
options in the index.

Fixes: https://github.com/netwide-assembler/nasm/pull/61
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-07 10:49:55 -07:00
H. Peter Anvin
fa43d8e01d asm: new --bits option to set the processor mode on the command line
This is really just a shorthand for the --before option, but it is
really convenient for quickly writing multimode tests.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-07 09:56:20 -07:00
H. Peter Anvin
f1b6d3188c preproc: add a %selbits() function
Although one can implement this "manually" in terms of %sel(), this
function is *really* useful for making multi-mode tests and allows for
better error checking.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-07 09:17:59 -07:00
KO Myung-Hun
57bf1b7b06 doc: document that the obj output format GROUP directive is cumulative
The GROUP directive can now be specified more than once for a group,
and the result is cumulative (the union of all specified groups.)

Signed-off-by: KO Myung-Hun <komh78@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-06 13:26:35 -07:00
H. Peter Anvin
0bc42dd1e0 changes.src: document TEST reg,mem fix
Add TEST reg,mem to release notes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-06 13:11:09 -07:00
H. Peter Anvin
d5705c96bb changes.src: use \c{...} formatting for instructions
Instructions are literals, mark them with \c{...}.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-06 11:57:37 -07:00
Maciej Wieczor-Retman
cb03c02553 doc: Summarize PR changes
Merge PRs 127, 126, 125, 124 and 91. Document some of the most relevant
changes.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-10-06 19:29:38 +02:00
H. Peter Anvin
13379eb48a changes.src: document %exitrep/%exitmacro %if fix
Add the fix for %exitrep/%exitmacro to the release notes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-06 09:43:26 -07:00
H. Peter Anvin
6b1636ab0e changes.src: drop 3.00.01; plan 3.01 as a bug fix release
Looks like there are enough critical changes to justify a release
without a bunch of new development. Let's just call the new
release 3.01 and avoid a bunch of excess dottage.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-06 08:33:16 -07:00
H. Peter Anvin
3bb875f3e5 Merge remote-tracking branch 'origin/nasm-3.00.xx' 2025-10-04 18:31:52 -07:00
H. Peter Anvin
1ec9d7dc22 changes.src: add obj2 output format to the release notes
Need to be added to the release notes...

Cc: KO Myung-Hun <komh78@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-04 15:59:13 -07:00
H. Peter Anvin
3472f368cd This is the development branch intended to become NASM 3.01
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-03 12:59:05 -07:00
H. Peter Anvin
fe7c3c7171 This is the maintenance branch destined to become NASM 3.00.01 2025-10-03 12:58:02 -07:00
H. Peter Anvin
568fbff1cd changes.src: add a few more release notes
A few more notes about changes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-03 12:01:05 -07:00
H. Peter Anvin
95f866d47c changes.src: document FLAT obj changes.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-03 10:29:08 -07:00
H. Peter Anvin
1185c1f118 Document the [LIST] directive and add -LF option to suppress it
- Document the [LIST] directive
- Add an option -LF to ignore the [LIST] directive
- Fix [LIST -] suppressing output on a following pass
- Minor other documentation fixes

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-29 21:48:43 -07:00
H. Peter Anvin
df4bb50e23 changes.src: add %use vtern to the release notes
One more thing for the release notes...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-29 20:51:45 -07:00
H. Peter Anvin
22cef23b34 macros: add st() macro to the masm macro package
A very easy way to improve portability.  Guarded with %ifndef just in
case...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-29 17:31:42 -07:00
H. Peter Anvin
0e253844da doc: prettify the HTML documentation
- Improve the look of the TOC
- Add some highlight to code blocks

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-29 11:28:12 -07:00
H. Peter Anvin
f6166e571a preproc: implement %hs2b() and %b2hs() functions for compact binary data
Convenience preprocessor functions that allows for efficient packing
of binary data in source code.

Move some functions that has previously been local but are more
generally useful into more accessible places.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-15 23:01:59 -07:00
H. Peter Anvin
856ac7b7fb preproc: add %chr() and %ord() string <-> byte list functions
It is sometimes just too convenient to be able to convert between
strings and bytes at will. At one point I was considering making
something with the full power of the db (et al) directives, but that
is a much bigger change...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-15 21:48:07 -07:00
H. Peter Anvin
31c4d8bcfd doc: describe caveat with old NASM and new %if directives
Older versions of NASM would not try to match unknown %if directives
with a corresponding %endif, resulting in some very odd consequences
when it comes to trying to handle support for multiple NASM versions.

Document the problem.

Reported-by: E. C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2025-09-14 04:07:19 -07:00
H. Peter Anvin
1f1f3266d6 preproc: look for what looks to be an unknown conditional
If an unknown preprocessor directive starting with %if or %elif is
encountered, assume it should be treated as a conditional directive
for the purpose of balancing %if...%endif.

This avoids some really ugly problems when dealing with code that is
intended to work across NASM versions that uses %if directives that
don't yet exist.

Reported-by: E. C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-14 03:25:26 -07:00
H. Peter Anvin
7276cfde99 preproc: remove the message-generating functions
The message-generating functions appear to get expanded when they
shouldn't, resulting in errors. Disable them for now and remove them
from the documentation.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-14 02:48:58 -07:00