Jump to content


Photo
- - - - -

x64 or x86 ASM on x64 machine


  • Please log in to reply
5 replies to this topic

#1 0x9D88BD8

0x9D88BD8

    n00bie

  • Members
  • 4 posts

Posted 06 January 2012 - 07:02 AM

Hey guys,

I used to code many years ago and just recently got back into it all. Main difference now days being everyone including myself is running a x64 machine instead of a x86 (which wern't popular 10+ years ago when I was last coding). I know I can't use inline asm with msvsc++ and that I need to revert back to dreaded MASM on a 64 bit :(

This is probably a really noobie question but I just want to know for sure before I start refreshing my memory and reading up on the latest information. I am assuming most games today are still 32 bit processes and are running as *32 on 64 bit machines. I know I have to compile 32 bit DLL files to inject into a 32 bit process even when running on a x64 machine. Does that mean I need to write my code in 64 bit asm when working with a 32 bit process which is running on a x64 machine.

I am sure someone is rolling their eyes right now but thanks for taking the time to answer my out of practice question.

#2 KEMiCZA

KEMiCZA

    Administrator

  • Administrators
  • 400 posts
  • LocationBelgium

Posted 06 January 2012 - 03:28 PM

I'm certain you can use inline assembly within Visual Studio. Also all 32bit applications will automatically be compatible with 64bit OS under Windows. For gamehacking purposes there is no need to learn x64 assembly yet. Most games still work under 32bit. But it could be pratical to know a few x64 bit instructions such as MOVSD, ADDSD, DIVSD, etc..

#3 0x9D88BD8

0x9D88BD8

    n00bie

  • Members
  • 4 posts

Posted 06 January 2012 - 09:34 PM

I'm certain you can use inline assembly within Visual Studio.


Thanks for clearing that up KEMiCZA. Great to hear I can stick to x86 ASM - makes life so much easier.

I have written a few DLL files just messing around on the MS games (which are 64 bit) and inline asm definitely isn't supported by vsc++. What I done instead was make a .asm file and assembly it with MASM, then call the function in the .cpp file.

I don't have the same problem compiling projects that are 32 bit though, which leads to me believe 64 bit inline asm isn't supported by vsc++ yet.

#4 g3nuin3

g3nuin3

    Elite

  • Members
  • 261 posts

Posted 11 April 2012 - 09:35 PM

You are correct, 64bit applications in Visual Studio do not support inline assembly, and as far as i know, it never will be..embedding an assembly file and calling it is one way and embedding also as a resource seems to work as well.
-=Intelligence is my Bitch=-
Posted Image
<3 Micral for ths one ;)

#5 STN

STN

    Administrator

  • Administrators
  • 777 posts
  • LocationRight next to Mitt Romney

Posted 22 April 2012 - 10:24 PM

I think a lot of time will pass before we see games transition to x64 on large scale. The only games i have seen using 64bit are big titles only, with support for 32bit gamers as well. Learning 64bit assembly shouldn't be too hard though, i've had a peek at it and it wasn't something alien.

I know I have to compile 32 bit DLL files to inject into a 32 bit process even when running on a x64 machine. Does that mean I need to write my code in 64 bit asm when working with a 32 bit process which is running on a x64 machine.


The simple answer is No. You have to honor the architecture the target process is running i.e 64bit asm code for 64bit process and 32bit asm for 32bit process. There is a workaround i believe for injecting 32bit dll to a 64bit or vice versa however the work involved to inject and perform required functions is just a waste of time and resources. Much better to use same architecture.

PS: That is sad to hear about MSVC not supporting inline asm in 64bit. I've been using inline asm in my projects for like forever.
Posted Image


DEViATED Game Trainers- Owning your asses since Sept 2010!
-Still OWNING
not really =(

#6 g3nuin3

g3nuin3

    Elite

  • Members
  • 261 posts

Posted 24 April 2012 - 07:07 AM

There is something called intrinsics functions, they are as close to inline asm you can get with MSVS on 64bit.
-=Intelligence is my Bitch=-
Posted Image
<3 Micral for ths one ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users