View previous topic :: View next topic |
Author |
Message |
someone Guest
|
assembly to C conversion |
Posted: Tue Nov 28, 2006 5:42 am |
|
|
Hi everyone
I was wondering if there is any way to convert an assembly language code into a C code for PIC
Best Regards |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Tue Nov 28, 2006 6:14 am |
|
|
This is what we are doing here since many years !!!
Humberto |
|
|
someone Guest
|
|
Posted: Tue Nov 28, 2006 6:27 am |
|
|
hmm
Are you being sarcastic and implying that it cant be done? |
|
|
Guest
|
|
Posted: Tue Nov 28, 2006 7:05 am |
|
|
Forget about low level language to high level language translation.
Not only a dream. It won't be so useful. |
|
|
Ttelmah Guest
|
|
Posted: Tue Nov 28, 2006 7:50 am |
|
|
Let's be slightly more informative about this.
There are several different possible combinations:
First 'pure' assembler.
Then assembler that was itself generated by an 'unknown' compiler.
Then assembler that has come from a 'known' compiler.
The last is the one with the best chance of any utility at all. Here is is potentially possible to look at the individual routines, and work out that this particular code is perhaps the printf function, and decode it as such. However there are huge problems. First all variable names will be 'meaningless'. Second, so will the function names. Third even if in some places the original routine can be worked out, there will be places, where there are literally dozens of different possible code arrangements, that could result in that particular assembler.
For the earlier source possibilities it gets even worse.
It is possible to have a program that will generate a set of C code, that will result in a particular assembler output, for some assembler programs (though not all, except as something like a simple 'ROM' declaration - the V4 compiler can do this), but the resulting C, is likely to be harder to modify for any particular purpose, than the original assembler would be...
Best Wishes |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Tue Nov 28, 2006 11:56 am |
|
|
Quote: |
Are you being sarcastic and implying that it cant be done?
|
I wasnīt sarcastic as you say, just a joke that you didnīt catch.
Considerable efforts are made by compiler builders to make a good translator
from High Level to Low Level and suddenly a question requesting just the opposite,
thatīs all...
I doesnīt know translators from assembly to C code for PIC, there are some as
Ttelmah said, that generate an assembler that has come from a 'known' compiler.
http://citeseer.ist.psu.edu/cifuentes98assembly.html
Humberto |
|
|
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
|
Posted: Wed Nov 29, 2006 10:08 am |
|
|
Hey, Someone....
Do you have an assembly language program you are currently working with? If so, what compiler does it require? I have used both the microchip compiler and the Tech-Tools (8051-like) assembly compiler. Do you have the source assembly code or just the machine language code that was read out of a chip?
It is not too difficult if you understand both assembly and C to convert an assembly language program to C. I had to do it a few months ago. It has to be done manually, line by line.
I hope this helps. |
|
|
|