Write small C programs, and study the output of say
gcc -S prog.c
Then compare with
gcc -S -O2 prog.c
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.
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.
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
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.
RTM?
"Anyone can aspire to greatness if they try hard enough."
- Me
Read The Manual (i.e., the documentation).
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
lol alrighty
"Anyone can aspire to greatness if they try hard enough."
- Me
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
And i tried googling it and looking for it on MSDN =(
"Anyone can aspire to greatness if they try hard enough."
- Me
anyone?
"Anyone can aspire to greatness if they try hard enough."
- Me
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).
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
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
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
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
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.