Author Topic: Migrating from 32-bit to 64-bit assembly. Things You should know  (Read 1333 times)

coder

  • Member
  • **
  • Posts: 103
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:

 

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4886
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Migrating from 32-bit to 64-bit assembly. Things You should know
« Reply #1 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
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

coder

  • Member
  • **
  • Posts: 103
Re: Migrating from 32-bit to 64-bit assembly. Things You should know
« Reply #2 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.

coder

  • Member
  • **
  • Posts: 103
Re: Migrating from 32-bit to 64-bit assembly. Things You should know
« Reply #3 on: January 20, 2017, 02:41:42 AM »
xor reg64, imm64 works?

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4886
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Migrating from 32-bit to 64-bit assembly. Things You should know
« Reply #4 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

coder

  • Member
  • **
  • Posts: 103
Re: Migrating from 32-bit to 64-bit assembly. Things You should know
« Reply #5 on: January 20, 2017, 02:46:48 AM »
oh ok. Thanks for the correction.


coder

  • Member
  • **
  • Posts: 103
Re: Migrating from 32-bit to 64-bit assembly. Things You should know
« Reply #6 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:

jj2007

  • Member
  • *****
  • Posts: 7666
  • Assembler is fun ;-)
    • MasmBasic
Re: Migrating from 32-bit to 64-bit assembly. Things You should know
« Reply #7 on: January 20, 2017, 03:21:50 AM »
ML64 does not support invoke but MASM64 does. Test piece below works fine.

Even this one assembles without errors:
Code: [Select]
invoke MessageBox, 0, "MASM64 does support 'invoke' notation", "Correct", MB_OK, 123, "that's great"
Here you can find a beautiful .if macro that improves on ugly obsolete MASM syntax like .if eax<=ecx 8)

 ;)

Vortex

  • Member
  • *****
  • Posts: 1714
Re: Migrating from 32-bit to 64-bit assembly. Things You should know
« Reply #8 on: January 20, 2017, 04:23:33 AM »
Don't understand why ML64 skips "invoke"

Probably, MS is "trying" to discourage the coders from using ml.exe

ragdog

  • Member
  • ****
  • Posts: 515
Re: Migrating from 32-bit to 64-bit assembly. Things You should know
« Reply #9 on: January 20, 2017, 05:02:36 AM »
Quote
Here you can find a beautiful .if macro that improves on ugly obsolete MASM syntax like .if eax<=ecx

 :lol: :icon_rolleyes:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4886
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Migrating from 32-bit to 64-bit assembly. Things You should know
« Reply #10 on: January 20, 2017, 11:18:06 AM »
 :biggrin:

Code: [Select]
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:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin: