| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Assembly Questions and Answers for Assembly here! |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
converting c code to assembly code
does anyone know how to convert c code to assembly code?
i really need this thanks sean |
|
#2
|
||||
|
||||
|
Re: converting c code to assembly code
Quote:
Code:
// 32bit code
int foo ( int x, int x )
{
return (x + y);
}
Code:
foo: push ebp mov ebp, esp ; Return value expected in EAX mov eax, [ebp+8] ; First parameter add eax, [ebp+12] ; Second one pop ebp ret ; Somtimes it is also retf (return far)
__________________
I am not offering technical guidiance via email or IM Come on share your photo with us! CG members photo album! Use the Code Tags! |
|
#3
|
||||
|
||||
|
Re: converting c code to assembly code
Most of compilers has option 'generate assembler source'. When you enable it and compile your files, assembly source files will be generated. However, they contain a lot of extra data, like debug info etc, and are hard to read (huh, sounds like assembler is easy to read sometimes
)
__________________
B+! 'There is no cat' - A. Einstein Use [code] [/code] tags! Did YOU share your photo with us at CG Members photo gallery ? |
|
#4
|
||||
|
||||
|
Re: converting c code to assembly code
some ASM is easy to read
it's rather nice being able to put ASM inside the code for C++ or C for GFX programs in certain parts (if you look at the source code for the build engine ken silverman put some of the more intensive GFX parts in pure ASM)
__________________
In C, you merely shoot yourself in the foot. In C++, you accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical care is impossible, because you can't tell which are bitwise copies and which are just pointing at others and saying, "That's me, over there." |
|
#5
|
||||
|
||||
|
Re: converting c code to assembly code
Quote:
__________________
I am not offering technical guidiance via email or IM Come on share your photo with us! CG members photo album! Use the Code Tags! |
|
#6
|
||||
|
||||
|
Re: converting c code to assembly code
I mean that it is not hard to read three letters long mnemonics and not so much longer arguments, which is like ~10 characters per line. But understand a story which is hidden behind those sentences is lotta harder
__________________
B+! 'There is no cat' - A. Einstein Use [code] [/code] tags! Did YOU share your photo with us at CG Members photo gallery ? |
|
#7
|
||||
|
||||
|
Re: converting c code to assembly code
Quote:
![]() Also very difficult: Writing something heavy in Assembler (like DistributionSort) and then try to read it months ago, and try to make changes in it .
__________________
I am not offering technical guidiance via email or IM Come on share your photo with us! CG members photo album! Use the Code Tags! |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|