Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Assembly Language to C programming language?

Status
Not open for further replies.
Of cause there is. It's called a decompiler and it probably came with your compiler and assembler.

Larry
 
Decompilers exist for many different architectures and languages. However, the output is likely to be worse code than the input. You'd learn more just doing the conversion the old-fashioned way: reading the asm and writing the corresponding C yourself.

Among other things, symbol names and some other information is lost. The output will be very literal and probably not particularly easy to read.

https://www.embeddedrelated.com/usenet/embedded/show/27425-1.php

**broken link removed**

Again, the tools are not perfect and it's usually easier just to learn to read the assembly.


Torben
 
Interesting suggestion, perhaps you could give an example? - I've never seen any such thing in all the compilers I've used over the years.

It's not IN a compiler. It's a separate program that you feed the asm to and you get out a very confusing compiler version. The output generally does not use headers and includes so you get out ALL the code needed to assemble the asm.

It's most confusing and like Torben said it would be much easier to learn ASM.

Larry
 
I've read many 'asm to C' attempts to decompile in a sensible symbolism, all of them are at best half-assed. They usually use simple proper noun replacement to try
to help native understanding of the converted code, and it's always bad.

Bob is my uncle, my uncle is 3.1415926 positive times in relation to itself and his father is 3 less than his mother is 1 more than her daughters last mood change.

If you just want to use the ASM code in a C environment use an inline ASM argument, most C copilers support this if the ASM memory/code structure is known.
 
Thats tough to do. There are so many assembly combinations out there for a set of C instructions, that it makes this very difficult. If you want it done right, you're best off doing it yourself.
 
It's not IN a compiler. It's a separate program that you feed the asm to and you get out a very confusing compiler version. The output generally does not use headers and includes so you get out ALL the code needed to assemble the asm.

I never suggested it was internal to the compiler, just included (or rather not) in the compiler package.

I'll ask again - can you give an example of any such compiler package?.
 
Just Google it. There are loads of them.


Larry

That's just lazy. Earlier you stated that:

Larry4911 said:
Of cause there is. It's called a decompiler and it probably came with your compiler and assembler.

Larry

I'm with Nigel. While decompilers exist and while there are examples of compiler/decompiler packages, they are not the norm and the statement that "it probably came with your compiler and assembler" is not true.

Unless of course you feel like providing some links to back up your statement. It's not our job to defend your position. If you can't be bothered to, why should anyone else?


Torben
 
Basic code to ASM or De-ASM is integral to any compiler that understands it's own hardware architecture, things like Java based programming or higher end languages are exempt of course.
 
Last edited:
Basic code to ASM or De-ASM is integral to any compiler that understands it's own hardware architecture, things like Java based programming or higher end languages are exempt of course.

While I'm aware of quite a number of third-party decompilers, I'm not familiar with any common compilers which come with an asm-to-<insert original language here> decompiler, although most of the compilers I've used do produce (or can be configured to produce) assembler output as an interim step in the compilation process.

Disassemblers are a different topic and of course are required for use in interactive debuggers. They generally do not produce code in the original high-level language, though.


Torben
 
That's just lazy. Earlier you stated that:

I'm with Nigel. While decompilers exist and while there are examples of compiler/decompiler packages, they are not the norm and the statement that "it probably came with your compiler and assembler" is not true.

Unless of course you feel like providing some links to back up your statement. It's not our job to defend your position. If you can't be bothered to, why should anyone else?
Torben

Well said and quite lawyerly at that. I agree, it would be the claimant that has the burden of proof... :)
 
I don't require anyone to defend my statement. There are decompilers around that is in evidence from other posters and Google and In some of the original C++ releases a decompiler came with it. I have no knowledge of more recent versions so cannot comment further.

Larry
 
.... most C copilers ...
Next some wiseacre will inform us that those "C copilers" will actually copula....
ooops family values and such.

I never saw a de-compiler.
I never hope to see one,
but, I can tell you anyhow,
I'd rather see than be one!

Ahhh..cha..cha..cha
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top