Assembly Programming...

This is a discussion on Assembly Programming... within the Tech Board forums, part of the Community Boards category; Write small C programs, and study the output of say gcc -S prog.c Then compare with gcc -S -O2 prog.c...

  1. #16
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    Write small C programs, and study the output of say
    gcc -S prog.c

    Then compare with
    gcc -S -O2 prog.c
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  2. #17
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by brewbuck View Post
    It can be fun when you're learning. Once you're experienced, it's just boring busy work. I'd rather write new code from scratch :-)
    Also, it is a MAJOR pain in the rear if, say, the program is BIOS (pulling a random example from the air) that just happens to be screwing with a piece of hardware. . . BIOS is not arranged in any type of logical manner that can be easily disassembled. . . so, no, disassembling is no fun at all.

  3. #18
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Cool stories =)

    Haha, i'm using VC++ Express though, and running windows xp, can that compiler show me the assembly?
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  4. #19
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    Well it can, if you RTM.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #20
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    RTM?
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  6. #21
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,662
    Read The Manual (i.e., the documentation).
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #22
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    lol alrighty
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  8. #23
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Okay... so i downloaded the MASM which is supposed to integrate with VC++ Express Edition (MASM 8.0), but does anyone know how to make Asm files with VC++ Express?

    thanks!
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  9. #24
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    And i tried googling it and looking for it on MSDN =(
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  10. #25
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    anyone?
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  11. #26
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,662
    For Visual C++ 2005:

    Project -> Properties -> Configuration Properties -> C/C++ -> Output Files -> Assembler Output

    You could choose "Assembly-Only Listing (/FA)". After compilation, you should find the appropriate .asm files in your output directory.

    Incidentally, I found the hint on MSDN: /FA, /Fa (Listing File).
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #27
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Alrighty well i downloaded WinASM (www.winasm.net) and installed MASM32 and added all those files and all.

    And i went to make a 16-bit COM DOS file, but it wouldn't work. Kept saying i needed another link.exe file, so i got it and put it int hte directory it said to, but still it keeps saying it cant find the link.war file.

    Anyone got any ideas?

    thanks!
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  13. #28
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Might want to try Borland's command line tools. If you're not obsessed with fancy IDEs or flashy features, it's easy enough to get around. You might have to find some files for the assembler separately.

    You can call C-library functions quite easily. Something simplified like this:

    Code:
    .386
    .model flat
    
    public _main
    extern _printf:near
    
    .data
    	msg	db	"Hello World!",0ah,00h
    .code
    _main proc
    	push offset msg
    	call _printf
    	add esp, 4
    	ret
    _main endp
    end

  14. #29
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Yeah i just hate TASM in dos, it's soooooo slow when you type, and i like programs with highlighting and such cause i think it helps me to learn better.

    I'm getting an IDE with the book that should come (today hopefully) so maybe i'll just wait for that, but i do like this WinASM thing, i just cant get it to work for 16-bit DOS COM and EXE files =(

    Thanks!
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  15. #30
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    I tend to stay away from IDE's when I can. I stick with a fancy text editor that does all the highlighting and a terminal window for compiling and executing. Simplifies everything greatly for me.

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning Assembly
    By mrafcho001 in forum Tech Board
    Replies: 5
    Last Post: 03-12-2006, 04:00 PM
  2. C to assembly interface
    By Roaring_Tiger in forum C Programming
    Replies: 4
    Last Post: 02-04-2005, 02:51 PM
  3. assembly language...the best tool for game programming?
    By silk.odyssey in forum Game Programming
    Replies: 50
    Last Post: 06-22-2004, 01:11 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 03:28 AM
  5. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 02:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21