News:

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

64-bit Code

Started by Astro, August 04, 2009, 02:47:58 AM

Previous topic - Next topic

Astro

Hi,

I couldn't see this in the docs.

I'm aware of the machine-level differences between 32-bit and 64-bit (particularly registers) but I can't see a clear way of building 64-bit code.

Is there a simple command-line option, is the binary directly 64-bit compatible without special modification, or is there more to it?

Will I need to re-write my 32-bit code (e.g. replace all 32-bit registers with 64-bit?).

Best regards,
Astro.

dedndave

if you look down at the bottom of the list of sub-forums, there is one dedicated to 64-bit assembler
i think a lot of the guys in here use GoAsm for 64-bit

donkey

Quote from: Astro on August 04, 2009, 02:47:58 AM
Hi,

I couldn't see this in the docs.

I'm aware of the machine-level differences between 32-bit and 64-bit (particularly registers) but I can't see a clear way of building 64-bit code.

Is there a simple command-line option, is the binary directly 64-bit compatible without special modification, or is there more to it?

Will I need to re-write my 32-bit code (e.g. replace all 32-bit registers with 64-bit?).

Best regards,
Astro.

Hi Astro,

Last I checked MASM is pretty much crippled for 64 bit, you can check some of the MASM64 related posts for what it can and can't do but it is obvious that MS did not intend it to be a fully stand alone assembler using 64 bit code. Yes, for the most part you will have to replace the registers, calling conventions are different x64 uses FASTCALL (afaik there is no invoke in MASM64 so you will have to hand code it) and many data types are extended to 64 bits so you will have to deal with those (ie handles), also many structures are changed in x64.

Yes, as dedndave said many here use GoAsm for 64 bit as conversion is fairly easy and automated. Using my headers all type conversions and structures are dynamically changed in a 64 bit build and GoAsm can handle the register translations for you, also GoAsm has all of the same functionality in 32 or 64 bit mode including invoke.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Astro

Quoteas conversion is fairly easy and automated
So I can feed it MASM32 code and it will convert it?

I'll go take a look further down the forums!

Thanks!

Best regards,
Astro.

donkey

Quote from: Astro on August 04, 2009, 01:43:34 PM
Quoteas conversion is fairly easy and automated
So I can feed it MASM32 code and it will convert it?

I'll go take a look further down the forums!

Thanks!

Best regards,
Astro.

No, MASM32 code though close in syntax is not directly compatible with GoAsm, what I meant is that 32 bit GoAsm code is easily ported to 64 bit GoAsm code. There is a translation utility bundled with GoAsm (AdaptAsm) but it does not handle some of the high level stuff that you do with MASM such as macros or HLC's.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

GregL

Astro,

Well, I for one don't think 64-bit MASM (ml64.exe) is that bad. Yes, it lacks most of high-level stuff so it's a "bare-bones" assembler, but you can still get the job done.

If you really want know all the details of how x64 works, using ml64 is the way to go, because it forces you to handle all of the details.  Though, after you learn it, it does get tiresome having to code all the details.  I wish Microsoft would add more features to ml64.


ecube

If you insist on MASM64 I put together a very rough SDK awhile ago at http://www.masm32.com/board/index.php?topic=11115.0

But I highly recommend GoASM as it's a pure work of art, and as a commerical developer it's very exciting being able to write hybrid code for 32bit and 64bi t and just compile for both platforms at the same time. The old unofficial GoASM SDK I put together, that can help you get start, has quite a few examples is at http://www.masm32.com/board/index.php?topic=11180.0