mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-10-10 00:25:06 -04:00
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>
This commit is contained in:
@@ -31,6 +31,8 @@ It is the production version of NASM since 2025.
|
||||
now be specified for the same group; the resulting group includes
|
||||
all sections specified in all \c{GROUP} directives for the group.
|
||||
|
||||
\b A new \c{%selbits()} preprocessor function. See \k{f_selbits}.
|
||||
|
||||
|
||||
\S{cl-3.00} Version 3.00
|
||||
|
||||
|
@@ -1011,6 +1011,24 @@ expands to nothing.
|
||||
The arguments not selected are never expanded.
|
||||
|
||||
|
||||
\S{f_selbits} \i\c{%selbits()} Function
|
||||
|
||||
The \c{%selbits()} function returns its first, second, or third
|
||||
argument depending on if the current mode is 16, 32 or 64 bits. If
|
||||
less than three arguments are given, the last argument is considered
|
||||
repeated. Like \c{%cond()}, this is a specialized version of the
|
||||
\c{%sel()} function.
|
||||
|
||||
For example:
|
||||
|
||||
\c BITS 64
|
||||
\c
|
||||
\c %define breg %selbits(bx,ebx,rbx)
|
||||
\c %define vreg %selbits(ax,eax)
|
||||
\c
|
||||
\c mov vreg,[breg] ; mov eax,[rbx]
|
||||
|
||||
|
||||
\S{f_str} \i\c\{%str()} Function
|
||||
|
||||
The \c{%str()} function converts its argument, including any commas,
|
||||
|
Reference in New Issue
Block a user