I'm in the process of porting NASM code to MASM, and I'm stuck on a NASM empty macro with 2 parameters and register usage with the _m suffix.
example code:
;register defines
%define arg0 rcx
%define arg4 r12
%define tmp4 r14
%define len arg0
%define dest1 arg4
%define dest2 tmp4
%define PS 8
;empty macro
%macro SLDR 2
%endmacro
%define SSTR SLDR
; example usage in code:
SLDR len, len_m
sub len, 16
SSTR len_m, len
jl .return0
;...
SLDR dest1, dest1_m
mov dest2, [dest1+PS]
SSTR dest2_m, dest2
mov dest1, [dest1]
SSTR dest1_m, dest1
I assume the _m parameters are macro generated names, but what register(s) do they represent (assuming they are not on the stack)?
In this case:
parameter_m
is just a literal argument passed into the macro.
The macro doesn’t know or care what register parameter_m
is unless you define it elsewhere.
If parameter_m
is not defined, then NASM throws an error like:
error: symbol `parameter_m' undefined
.
(Or it would if your macro used this token as an operand to an instruction, rather than in a %define
or stringifying it or something. As is, it assembles cleanly since the empty macro does nothing with it.)