Skip to main content
GameDev.net gamedev.net
🔒 Locked

Assembly Question C++ Source

Started by Mad_Koder May 23, 2006 at 4:43 PM 8 replies 1.9k views
Original Post
Mad_Koder
Mad_Koder
I have seen dissasemblers that can turn .exe and rom riles into assembly, I was wondering why it is not possible then to turn the assembly into C++ code with an application. Thanks a ton!!!!! ~Mad_Koder~
Dont need one.... i'm so cool, dont ask me just do what you do..... meet me in the trap its going down....
jpetrie
jpetrie
The transformation from C++ loses information. The mapping from machine code to assembly is quite simple. The mapping from assembly to C++ is very complex, and in general cannot be determined with any kind of accuracy (you could guess, I suppose).

If somebody bothered to write such a program (by using the "guess the mapping" method), it would produce output that would (when compiled) yeild the original input only for the most trivial cases.

Such a program would be completely useless, because the resulting C++ would look nothing like the original C++ that compiled the original .exe, which is why nobody has really bothered to put for the effort.
ZedFx
ZedFx
It is possible to turn the assembly into C++ code, however, it depends if you know the compiler and the compilation rules which built the executable file.

for example, the following line could be compiled in many different ways (two are shown here)

a *= 2;

where a is an unsigned int, could be either

mov eax, a
mul eax, 2
mov a, eax

or

mov eax, a
lea eax, dword ptr [eax * 2]
mov a, eax

This is of course using x86 assembler. So if you know how the compiler has done it you can get it in C++, otherwise learn assembler.
Mad_Koder
Mad_Koder
So is thier any roms that have been done this way that you know of and how is C++ mapping to machine code more complex, an example?
Dont need one.... i'm so cool, dont ask me just do what you do..... meet me in the trap its going down....
Aardvajk
Aardvajk
Even if it were possible, shall we have a competition to try to list the legal applications? Bet you can't name 10 :)
_mycoplasma_
_mycoplasma_
you could try the open source boomerang decompiler at http://boomerang.sourceforge.net/ but even the people who make it admit that it's not too accurate.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.