News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Please help me with this code

Started by vohai2003, July 12, 2020, 06:25:23 PM

Previous topic - Next topic

vohai2003

I'm totally noob in assembly. I don't know anything about it.
Now I'm trying to recompile a x64 code into x86, which have a assembly inside that project.
I don't know how to convert it.
It may be sound silly, but can anyone help me to convert it?
P/s: This code is from citra source code. I'm trying to make a x86 version to compatible with older PC (like mine :thumbsup:)

felipe

since citra is software that gives you the source code for you to compile under license gpl i think this post is legitimate, but i'm not telling you that i will help you. Maybe i can help you (depends on my time), but the source you provided says:


include ksamd64.inc


Since that file is, most probably, in 64 bits assembly, then it would be needed too, to do the conversion. You should post that one too.  :icon_idea:

felipe

Also you should know that because 32 bits and 64 bits are different, even if you can compile all the c or c++ code for 32 bits easily (maybe),  it will be requiered (most likely) to know more about the project, for these 64 bits assembly files can work as intended after converting them to 32 bits files. So even after converting the files, there are no warranties that the files work as intended originally within the 64 bits original project in the converted 32 bits project.  :icon_idea:

vohai2003

Yes, you're right. I didn't even notice that.
C code are quite easy to recompile, but nothing warranty that it works, since some change have been made on my project automatically.
Even lastest build for x86 I found working quite laggy and can't run some game with unusual memory stack.
I can't find ksamd64.inc in that project. Weird. Maybe it's a build-in VS file. :dazzled:

jj2007

There is a file with this name here. However, it's also mentioned at Microsoft docs.

vohai2003

Nice, thanks! :thumbsup:
But the biggest problem is I can't find it anywhere.

TouEnMasm

The ksamd64.inc is part of the sdk,recommended download.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared\ksamd64.inc
That will be a little less dificult work If you have the source instead of a dissasembly X64 source code.
There is also
Quote
CallConv.Inc
ks386.inc
ksamd64.inc
ksamd64_stub.inc
kxamd64.inc
kxamd64_stub.inc
macamd64.inc
Little suprise,they are in masm langage



Fa is a musical note to play with CL

vohai2003

That's mean we can try to replace ksamd64.inc with ks386.inc right?
Is there any difficulty? :undecided:

TouEnMasm

That's mean that your disassembly code was originally write in masm64 ,to be more precise ML64.exe.
I have recoqnize his macro.
The ks386.inc had only constants values in it.
The Ksamd64.inc had Include files and many macros in it.

see https://docs.microsoft.com/en-us/cpp/build/exception-handling-x64?view=vs-2019
for more informations

Fa is a musical note to play with CL

vohai2003

So if we want it to run on 32 bit, we have to find replacement for that included libraries and re-make the macros. Understood :thup:.
I don't think there'll be so much difficulty but I think everything is possible.

vohai2003

Good news!!!
I've just successfully converted all C code in that project!!! Now the only problem is the asm file.

TouEnMasm


If you can post the C code,this can be down easily by Visual Studio itself,cool no ?!
Fa is a musical note to play with CL

vohai2003