I would like to define a macro.
Procedure generation.
first param: procedure name
second param: procedura arg number
defProc proc1 , 3
want:
proc1 proc p1:DWORD, p2:DWORD, p3:DWORD
hi korte - welcome to the forum
i seem to recall macros like that in previous threads
try using the forum search tool - i bet you'll find just what you want
sorry dear dedndave, not found.
we tired:
proc_entry MACRO nam:REQ,nums
LOCAL cnt
lastproc equ _&nam
arg equ <>
arg CATSTR arg,<nam >
arg CATSTR arg,< proc >
cnt=0
FOR var,<nums>
if cnt gt 0
arg CATSTR arg,<p>,cnt,<,:DWORD>
else
arg CATSTR arg,<p>,cnt,<:DWORD>
endif
cnt = cnt + 1
ENDM
arg
endm
proc_entry myproc,10
Quote from: korte on November 20, 2009, 03:48:34 PM
want:
proc1 proc p1:DWORD, p2:DWORD, p3:DWORD
with a few changes to your macro it works:
proc_entry MACRO nam:REQ,nums
LOCAL cnt
lastproc equ _&nam
arg TEXTEQU <>
arg CATSTR arg,<nam >
arg CATSTR arg,< proc >
cnt=0
WHILE cnt LT nums
if cnt gt 0
arg CATSTR arg,<p>,%cnt+1,<,:DWORD>
else
arg CATSTR arg,<p>,%cnt+1,<:DWORD>
endif
cnt = cnt + 1
ENDM
arg
endm
proc_entry MACRO nam:REQ,nums
LOCAL cnt
lastproc equ &nam
arg TEXTEQU <>
arg CATSTR arg,<nam >
arg CATSTR arg,< proc >
cnt=0
WHILE cnt LT nums
if cnt gt 0
arg CATSTR arg,<,p>,%cnt+1,<:DWORD>
else
arg CATSTR arg,<p>,%cnt+1,<:DWORD>
endif
cnt = cnt + 1
ENDM
arg
endm
thank you. Great
Hi korte,
Another procedure definition by assuming that all the parameters are DWORD by default :
DefProc procname,p1,p2,p3
Greetings, dear forum
Next "FOR" problem
work, but ugly
FOR i, <16,17,18,19,20,21,22,23,24>
mov [xxx+i],eax
endm
Quote from: korte on November 24, 2009, 01:39:54 PM
... ugly
That's a question of taste.
However, similarly to your previous problem:
cnt=16
WHILE cnt LT 25
mov [xxx+cnt],eax
cnt = cnt + 1
ENDM
I understand.
Thank you.
But not the specific case.
I would like to solve with "FOR"....
What is the purpose?
include \masm32\include\masm32rt.inc
fm MACRO mem:REQ, args:VARARG
mov edx, mem
FOR arg, <args>
mov [edx+arg], eax
ENDM
ENDM
.data?
MyBuffer dd 20 dup(?)
.code
start:
fm offset MyBuffer, 16,17,18,19,20,21,22,23,24
exit ; short form of invoke ExitProcess, 0
end start