News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

void MACRO

Started by jj2007, December 07, 2009, 10:49:55 AM

Previous topic - Next topic

jj2007

52 of the macros in \masm32\macros\macros.asm return eax ("EXITM <eax>").
When using such a macro e.g. as mov eax, fsize(hFile), OllyDbg reveals that you create a pretty superfluous mov eax, eax.
Here is a very simple workaround:
void MACRO args
  % @CatStr(<;>, <args>)
ENDM


Usage (for example):
void fsize(hFile)
mov esi, alloc(eax)

dedndave

that is a much-needed macro, Jochen
i think it allows certain use of some of these macros that has otherwise been ellusive

jj2007

Dave,
mov esi, alloc(fsize(0)) works, too, but I remember some situations where I simply could not get rid of the mov eax, eax
:bg

hutch--

Ummmm,

How about,


mov pMem, alloc(bytesize)


No mov eax, eax there.  :bg

It is a cute macro though.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Slugsnack

Quote from: hutch-- on December 07, 2009, 12:01:47 PM
Ummmm,

How about,


mov pMem, alloc(bytesize)


No mov eax, eax there.  :bg

It is a cute macro though.
In some cases we don't want to move it anywhere. And just to have it stored in a register. And in the cases when we are content with having it left in EAX the assembler would generate an extra 'mov eax, eax' :/

hutch--

thats easy to deal with, if you don't want the function format, don't use it. Just call the procedure directly or if you want a macro that works differently, write one. With the format of the macro returning EAX from the mACRo, it is in fact the author that is writing mov eax, eax, not the assembler or the macro.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php