From 22cef23b34dc4e5c22d4cfbca833cd248518bed7 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 29 Sep 2025 17:31:42 -0700 Subject: [PATCH] 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) --- doc/changes.src | 2 ++ doc/macropkg.src | 3 +++ macros/masm.mac | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/changes.src b/doc/changes.src index 4a5ce2f11..18038922b 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -67,6 +67,8 @@ It is the production version of NASM since 2025. implemented conditional directive, and tries to match it with a corresponding \c{%endif}. See \k{if_caveat}. +\b The \c{masm} macro package now defines a macro for x87 register syntax. + \H{cl-2.xx} NASM 2 Series diff --git a/doc/macropkg.src b/doc/macropkg.src index 769c1856c..59fb87853 100644 --- a/doc/macropkg.src +++ b/doc/macropkg.src @@ -178,6 +178,9 @@ after \c{PROC} other than \c{FAR} is ignored. \b In 64-bit mode relative addressing is the default (\c{DEFAULT REL}, see \k{default-rel}). +\b A macro is defined to allow the syntax \c{st(0)} instead of +\c{st0}, and so on. + In addition, NASM now natively supports, regardless of whether this package is used or not: diff --git a/macros/masm.mac b/macros/masm.mac index f476364f6..f575ac530 100644 --- a/macros/masm.mac +++ b/macros/masm.mac @@ -1,6 +1,6 @@ ;; -------------------------------------------------------------------------- ;; -;; Copyright 2019 The NASM Authors - All Rights Reserved +;; Copyright 2019-2025 The NASM Authors - All Rights Reserved ;; See the file AUTHORS included with the NASM distribution for ;; the specific copyright holders. ;; @@ -69,6 +69,10 @@ USE: masm %undef ret %endmacro +%ifndef st + %idefine st(x) st %+ x +%endif + %idefine ptr __?masm_ptr?__ %idefine flat __?masm_flat?__ ; is %idefine really correct here? %idefine offset