News:

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

Main Menu

A trick for "m2m" macro

Started by HSE, January 01, 2022, 06:43:31 AM

Previous topic - Next topic

HSE

Hi all!

ObjAsm m2m macro is a little problematic for dual bitness because in 32 bit can trash one register (and in 32 bits registers are few). But a little trick can prevent that:m2m [xsi].orden, xordenmodelo, @if64bits(r13)
@if64bits macro RegAux
    if @WordSize eq 4
        exitm <>
    else
        exitm <&RegAux>
    endif   
endm


Then:32bits:
00407ADC | FF 75 0C                 | push dword ptr ss:[ebp + C]             |
00407ADF | 8F 46 10                 | pop dword ptr ds:[esi + 10]             |

64bits:
00007FF781378601 | 4C 8B 6D 28              | mov r13,qword ptr ss:[rbp+28]           |
00007FF781378605 | 4C 89 6E 1C              | mov qword ptr ds:[rsi+1C],r13           |


Regards, HSE.
Equations in Assembly: SmplMath

Biterider

Hi HSE
Nice trick. Thanks for sharing it  :thumbsup:

Biterider