PDA

View Full Version : Any good ASM to C translators?



BFeely
June 2nd, 2003, 02:25
Does anybody know where I can download a good, free ASM to C translator?

Slougi
June 2nd, 2003, 09:28
Nowhere would be my guess.

Hacktarux
June 2nd, 2003, 12:24
Originally posted by BFeely
Does anybody know where I can download a good, free ASM to C translator?

Your brain ?
I don't know where it's hidden but you probably know :D

blight
June 2nd, 2003, 13:34
well... there are such programs... what do you believe will the output from such a program be? the original sourcecode? *lol*
everything it output's is "ASM translated to C"... i.e. if the asm would say add eax, ebx you would as output get eax += ebx; and that's it - it's like a different way of viewing asm and when compiled again i guess it will be much slower...

new_profile
June 3rd, 2003, 09:44
May be this link will help you : http://desquirr.sourceforge.net/
It's a plugin for IDA Pro from Datarescue.

Cyberman
June 4th, 2003, 23:03
I've done that with Z80 source and converted the useful parts to C++.

Here are things that are challenging with this:
First is the original source in C C++ purely assembly, or another language such as PASCAL etc.

It's importent to understand the nature of compilors in order to do this properly.

The original compilor VERSION and NAME is mandatory.. why? Optimizations in the compilor itself are the primary reason.

If you look at the GNU C compilor you'll see that each processor supported as 2 sections. The first section is the virtual model, the second is the optimization. Redundant translated code is removed in the optimization section. Here is an example.

long int *Str;

*Str++ = 0; // zero even locations in array
Str++; // skip odd locations

This might translate to say
mov [r0], 0
add r0,4
add r0,4

the optimizer would then make a second pass and do this.

mov [r0],0
add r0,8

This is very HARD to reverse back to the original code.

might end up being something like.
*PTR = 0;
PTR +=2;

With C++ things are a LOT more complicated.

Cyb