hello
November 25th, 2008, 11:01
i have been struggling for days not knowing how to convert C to asm (so simple now); visiting all familiar sites; downloading all compilers available, then struggling to install it and finally losing track of what i wanted to do in the first place. Then, finally decided to visit this great place and lo and behold! blabberer with one rap showed me the right way.
Thank you...
So what is given below is a bit of show off. (excuse for the impudence)
#include<stdio.h>
void main()
{
printf("GOOD LUCK "

;
getchar();
}
-------------------------
The output in assembly …… trimmed
?live1@0:
;
; void main()
;
push ebp
mov ebp,esp
;
; {
; printf("GOOD LUCK "

;
;
@1:
push offset s@
call _printf
pop ecx
;
; getchar();
;
mov eax,offset __streams
dec dword ptr [eax+8]
js short @2
-------------------------------
Reversed from the executable
00401150 /. 55 PUSH EBP
00401151 |. 8BEC MOV EBP, ESP
00401153 |. 68 28A14000 PUSH abc.0040A128 ; /Arg1 = 0040A128 ASCII "GOOD LUCK”
00401158 |. E8 6F2B0000 CALL abc.00403CCC ; \abc.00403CCC
0040115D |. 59 POP ECX
0040115E |. B8 90A64000 MOV EAX, abc.0040A690
00401163 |. FF48 08 DEC DWORD PTR DS:[EAX+8]
00401166 |. 78 09 JS SHORT abc.00401171
00401168 |. BA 90A64000 MOV EDX, abc.0040A690
So, the compiler has done HIS work to translate the source to asm. But, compiler doesn’t allot an address to the instruction (example: push ebp) , because in reversed code i find the same instruction (00401150 Push Ebp) comes from an address 401150.
Who makes this allotment?
Next, how do I convert this .asm to .exe?
Regards...