News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

invope macro

Started by HSE, January 02, 2017, 02:29:14 AM

Previous topic - Next topic

HSE

HI all!

This is a simple macro for nicer code. Perhaps there is a similar one, but I don't saw.

;######################################################
; A wrapper to invoke
; pushing registers before, and poping after

invope macro regis:REQ, params:VARARG
local count

argstr equ <invoke >
PushAll regis                                        ;ObjAsm32 macro
count = 0
FOR param1, <params>
if count eq 0
   argstr CATSTR argstr, <param1>
count = count+1
else
  argstr CATSTR argstr, <,param1>
endif
ENDM
argstr
PopAllRev regis      ;ObjAsm32 macro
endm


That allow to change:
push ecx
        invoke IsWindowVisible, [ecx].puntero
        pop ecx
        push eax
        push ecx
        invoke StrCat, addr [esi].salida, addr [esi].str_op
        pop ecx
        pop eax

by:

invope ecx, IsWindowVisible, [ecx].puntero
invope <eax, ecx>, StrCat, addr [esi].salida, addr [esi].str_op


Regards. HSE
Equations in Assembly: SmplMath