The MASM Forum

64 bit assembler => 64 bit assembler. Conceptual Issues => Topic started by: coder on January 20, 2017, 02:25:51 AM

Title: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: coder on January 20, 2017, 02:25:51 AM
Please correct me if I am wrong. I have prepared a short list of these things as far as my noobish experience is concerned. Could be useful to new migrators.

1. [DELETED]

2. [DELETED].


[End of the 'short' list. Please continue to number 2 and beyond]  :greenclp:

Title: Re: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: hutch-- on January 20, 2017, 02:36:13 AM
ML64 does not support invoke but MASM64 does. Test piece below works fine.

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm32\include64\masm64rt.inc

    .code

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

entry_point proc


    mov rcx,0FFFFFFFFFFFFFFFEh   ;ok
    xor rcx,0FFFFFFFFFFFFFFFEh      ; not in your dream buddy
    ;; push 0fffffffffffffffeh      ; leave the stack alone

    invoke MessageBox,0,"MASM64 does support 'invoke' notation","Correct",MB_OK

    ;; pop 0fffffffffffffffeh       ; leave the stack alone

    waitkey

    invoke ExitProcess,0

    ret

entry_point endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    end
Title: Re: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: coder on January 20, 2017, 02:39:27 AM
Good! I know that :D

But I was referring to the instruction set. Don't understand why ML64 skips "invoke". It's a valid x86 instruction anyway. Seems like ML64 is not in complete agreement with the ISA.
Title: Re: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: coder on January 20, 2017, 02:41:42 AM
xor reg64, imm64 works?
Title: Re: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: hutch-- on January 20, 2017, 02:45:00 AM
"invoke" is not an Intel mnemonic, its originally in the 16 and 32 bit versions of MASM a method to automate procedure calls. The invoke in the example is a macro as 64 bit MASM is an unconfigured low level assembler but it is a MACRO assembler which makes these macros possible.
Title: Re: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: coder on January 20, 2017, 02:46:48 AM
oh ok. Thanks for the correction.

Title: Re: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: coder on January 20, 2017, 03:02:42 AM
So I deleted number 1 or 2. Must have read it wrong somewhere  :eusa_boohoo:

So the list is opened from point #1 then  :lol:
Title: Re: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: jj2007 on January 20, 2017, 03:21:50 AM
Quote from: hutch-- on January 20, 2017, 02:36:13 AM
ML64 does not support invoke but MASM64 does. Test piece below works fine.

Even this one assembles without errors:
invoke MessageBox, 0, "MASM64 does support 'invoke' notation", "Correct", MB_OK, 123, "that's great"

Here (http://masm32.com/board/index.php?topic=5956.msg63195#msg63195) you can find a beautiful .if macro that improves on ugly obsolete MASM syntax like .if eax<=ecx 8)

;)
Title: Re: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: Vortex on January 20, 2017, 04:23:33 AM
Quote from: coder on January 20, 2017, 02:39:27 AM
Don't understand why ML64 skips "invoke"

Probably, MS is "trying" to discourage the coders from using ml.exe
Title: Re: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: ragdog on January 20, 2017, 05:02:36 AM
QuoteHere you can find a beautiful .if macro that improves on ugly obsolete MASM syntax like .if eax<=ecx

:lol: :icon_rolleyes:
Title: Re: Migrating from 32-bit to 64-bit assembly. Things You should know
Post by: hutch-- on January 20, 2017, 11:18:06 AM
 :biggrin:


invoke MessageBox, 0, "MASM64 does support 'invoke' notation", "Correct", MB_OK, 123, "that's great"


If your grasp of 64 bit assembler is so poor, perhaps you should stick to Visual Garbage generators.

> Here you can find a beautiful .if macro that improves on ugly obsolete MASM syntax like .if eax<=ecx

Well, real men[TM] code the serious stuff in mnemonics where it matters, not everyone is rusted onto 1990 Microsoft code, especially Microsoft.  :badgrin: