#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    172
    Rep Power
    11

    convert C to assembly


    Hi..

    I just want to know if there is a program that i can download to convert C language to assembly in WINDOWS XP

    ..

    I got linux(redhat v9) but i dont know why there is a problem with GCC compiler which gives me (when i enter any thing with gcc at the begning) no such command, also when i try to use the debuger (gdb).

    ..

    also if there is a good debuger(for windows xp) that i can use to debug .o files .It will be helpfull, also if there is something that can convert .o file to assembly or C language.

    ..

    please help me , i got an assignment to do (its realy easy but i cant do it becuase its in .o , what we take in class is to use gdb with it but i cant with my PC :( )

    ..

    Thanks for reading
    bye..
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2004
    Location
    Colorful Colorado
    Posts
    743
    Rep Power
    0
    GCC can do it. just type: gcc -S myfile.c any compiler can do this, just read the documentation
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    172
    Rep Power
    11
    I downloaded GCC in windows but there is something that i have to change in AUTOEXEC.bat accualy i didnt find this file in my PC i found AUTOEXEC.NT

    thats why gcc compiler isnt working with my windows :(

    thanks for responding :)
  6. #4
  7. not a fan of fascism (n00b)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Feb 2003
    Location
    ct
    Posts
    2,756
    Rep Power
    95
    Originally Posted by BaAa3
    also if there is a good debuger(for windows xp) that i can use to debug .o files .It will be helpfull, also if there is something that can convert .o file to assembly or C language.

    what you want is a dissasembler. try win32dasm . iirc it's not free, but i found some warez googlin around awhile back
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    172
    Rep Power
    11
    thaks

    i will give it a shot
  10. #6
  11. Lord of Dorkness
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2004
    Location
    Central New York. Texan via Arizona, out of his element!
    Posts
    8,524
    Rep Power
    3314
    Many, maybe most, compilers have an option for emitting listing files, which are assembly language. I downloaded a disassembler called disasm, but I don't remember where from. It appears to work, although I haven't used it except to disassemble its own .exe file.
    Functionality rules and clarity matters; if you can work a little elegance in there, you're stylin'.
    If you can't spell "u", "ur", and "ne1", why would I hire you? 300 baud modem? Forget I mentioned it.
    DaWei on Pointers Politically Incorrect.
  12. #7
  13. Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jan 2004
    Location
    near St. Louis Illinois
    Posts
    3,288
    Rep Power
    24
    you can use the free debug.exe that is distributed with windows operating system. it will show the assembly code of any executable, and the binary/hex/ascii representation of any file.

    kind of cryptic -- but it works.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    172
    Rep Power
    11
    Originally Posted by DaWei_M
    Many, maybe most, compilers have an option for emitting listing files, which are assembly language. I downloaded a disassembler called disasm, but I don't remember where from. It appears to work, although I haven't used it except to disassemble its own .exe file.

    mmm iam trying to find 1
    i found Win32Dasm All Versions in werz site which is 100 mb size
    should i download it or find better 1
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    172
    Rep Power
    11
    I downloaded win32dasm v893_1
    i just conver a little C code and it gives me a realy strang codes which i didnt understand :) is there is a program that can give some thing like linux gcc compiler !


    that is the C code :


    #include <stdio.h>
    int main ()
    {
    int a , int b ;
    a = 6 ;
    a = b ;
    return 0
    }

    that what it gives me

    Disassembly of File: C:\NEWTEX~1.c
    Code Offset = 00000000, Code Size = 00000057
    Data Offset = 00000000, Data Size = 00000000

    Number of Objects = 0001 (dec), Imagebase = 00000000h

    Object01: RVA: 00000000 Offset: 00000000 Size: 00000057 Flags: 00000000


    Number of Imported Modules = 0 (decimal)


    +++++++++++++++++++ IMPORT MODULE DETAILS +++++++++++++++

    +++++++++++++++++++ EXPORTED FUNCTIONS ++++++++++++++++++
    Number of Exported Functions = 0000 (decimal)




    +++++++++++++++++++ ASSEMBLY CODE LISTING ++++++++++++++++++
    //********************** Start of Code in Object BinaryCode **************
    Program Entry Point Not Available


    :00000000 23696E and ebp, dword ptr [ecx+6E]
    :00000003 636C7564 arpl dword ptr [ebp+2*esi+64], ebp
    :00000007 65203C73 and byte ptr gs:[ebx+2*esi], bh
    :0000000B 7464 je 00000071
    :0000000D 696F2E683E0D0A imul ebp, dword ptr [edi+2E], 0A0D3E68
    :00000014 696E74206D6169 imul ebp, dword ptr [esi+74], 69616D20
    :0000001B 6E outsb
    :0000001C 2028 and byte ptr [eax], ch
    :0000001E 290D0A7B0D0A sub dword ptr [0A0D7B0A], ecx
    :00000024 696E742061202C imul ebp, dword ptr [esi+74], 2C206120
    :0000002B 20696E and byte ptr [ecx+6E], ch
    :0000002E 7420 je 00000050
    :00000030 6220 bound esp, dword ptr [eax]
    :00000032 3B0D0A61203D cmp ecx, dword ptr [3D20610A]
    :00000038 2036 and byte ptr [esi], dh
    :0000003A 203B and byte ptr [ebx], bh
    :0000003C 0D0A61203D or eax, 3D20610A
    :00000041 206220 and byte ptr [edx+20], ah
    :00000044 3B0D0A726574 cmp ecx, dword ptr [7465720A]
    :0000004A 7572 jne 000000BE
    :0000004C 6E outsb
    :0000004D 2030 and byte ptr [eax], dh
    :0000004F 200D0A7D0D0A and byte ptr [0A0D7D0A], cl
    :00000055 0D0A000000 or eax, 0D7D0A0A
    Last edited by BaAa3; April 30th, 2004 at 04:00 PM.
  18. #10
  19. Lord of Dorkness
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2004
    Location
    Central New York. Texan via Arizona, out of his element!
    Posts
    8,524
    Rep Power
    3314
    LOL, man, what did you expect? Idiomatic English? That's assembler code, horribly formatted. Here's a sample of the output from the one I'm attaching. You can look at it and do what you will.
    Code:
    
    +++++++++++++++++++ ASSEMBLY CODE LISTING +++++++++++++++++++
    //********************** Start of Code in Object CODE **************
    Program Entry Point = 0042001D (disasm.exe File Offset:00001000)
    
    =========
    :00401000 8B1500854B00      mov edx, dword[004B8500]
    :00401006 56                      push esi
    :00401007 33C0                   xor eax, eax
    :00401009 85D2                   test edx, edx
    :0040100B 57                       push edi
    :0040100C 761E                   jbe 0040102C
    :0040100E 8B3D0C854B00      mov edi, dword[004B850C]
    :00401014 8B74240C             mov esi, dword[esp+0C]
    :00401018 8BCF                    mov ecx, edi
    :0040101A 8D9B00000000       lea ebx, dword[ebx+00000000]
    ---------
    EDIT: It's output is nicely tabbed before it hits these pages.
    Functionality rules and clarity matters; if you can work a little elegance in there, you're stylin'.
    If you can't spell "u", "ur", and "ne1", why would I hire you? 300 baud modem? Forget I mentioned it.
    DaWei on Pointers Politically Incorrect.
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    172
    Rep Power
    11
    Oh..
    WOW why its like this in windows, in linux its too much easyer
    I dont know why my comiler wont work in linux :(

    Thanks anyway u were great guys ;)
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    172
    Rep Power
    11
    mmm

    Is there a program that can convert assembly to c language

    if there is please tell what is it , and if u can wjere to get it !

    :)
  24. #13
  25. Lord of Dorkness
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2004
    Location
    Central New York. Texan via Arizona, out of his element!
    Posts
    8,524
    Rep Power
    3314
    I understand the the million monkeys that are producing Shakespeare have a copy...
    Functionality rules and clarity matters; if you can work a little elegance in there, you're stylin'.
    If you can't spell "u", "ur", and "ne1", why would I hire you? 300 baud modem? Forget I mentioned it.
    DaWei on Pointers Politically Incorrect.
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1373
    It sounds like the problem you are having with your linux setup is that the path does not include the location of gcc. Try explicitly giving the full path to gcc or gdb, and see what happens.

    You can also install gcc on Windows. It is included with the cygwin unix tools port (http:/www.cygwin.com/). If you download and install the full version then it should include everything you need to do your project.

    Dave - The Developers' Coach

IMN logo majestic logo threadwatch logo seochat tools logo