The MASM Forum

Projects => ObjAsm => Topic started by: HSE on January 01, 2022, 06:43:31 AM

Title: A trick for "m2m" macro
Post by: HSE on January 01, 2022, 06:43:31 AM
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.
Title: Re: A trick for "m2m" macro
Post by: Biterider on January 02, 2022, 04:19:19 AM
Hi HSE
Nice trick. Thanks for sharing it  :thumbsup:

Biterider