Hello

I'm learning asm, so I thought that maybe it could help a bit to try to disassemble programs made in c++(because that's a language that I know well) to see the output code. I wrote a Hello World program and disassembled it just to find that I couldn't find the "Hello world" text in any part of the code. What's wrong? Where should I look for it?

I was using the demo version of W32dasm.

Thanks
Posted on 2008-02-05 17:48:52 by devoured_elysium
Forget about w32dasm, and look for the freeware version of DataRescue's IDA - I don't have any links ready, google is your friend.

Also, you don't need a disassembler, just about all compilers have a command-line switch to generate an assembly listing. Those can be pretty cluttered though, so disassembling the .obj can often be easier. But do check assembly listing, and for learning purposes, either disable optimizations or optimize for size, not speed.
Posted on 2008-02-05 18:24:04 by f0dder
I think first reading the free online book "Art of Assembly" would be a better start. Plus a debugger, where you'll step-through individual instructions and see how they change registers/memory/flags. The compiler will put a lot of dirt around the code, so you'll have a harder time understanding asm. The most common type of "dirt" is:
mov somevar,EAX // somevar = register_EAX;
mov EAX,somevar // register_EAX = somevar; // wtf
inc EAX // register_EAX++;
mov somevar,EAX ; somevar=register_EAX
mov EAX,somevar // register_EAX = somevar; // omg
....
it's horror
Posted on 2008-02-07 22:33:25 by Ultrano

I think first reading the free online book "Art of Assembly" would be a better start. Plus a debugger, where you'll step-through individual instructions and see how they change registers/memory/flags. The compiler will put a lot of dirt around the code, so you'll have a harder time understanding asm. The most common type of "dirt" is:
mov somevar,EAX // somevar = register_EAX;
mov EAX,somevar // register_EAX = somevar; // wtf
inc EAX // register_EAX++;
mov somevar,EAX ; somevar=register_EAX
mov EAX,somevar // register_EAX = somevar; // omg
....
it's horror


The trade-off in using compilers for decreasing development time, is an increase the size/bloat of the code. Compilers, no matter how much they have improved and will improve in the future, can only apply so many tricks and algorithms to assist in optimizing the code.

With that being said, compilers can only make so assumptions when dealing with inefficient source code, as well.

So, most compilers can beat most "programmers"... but there is still room for some good hand optimization and that is yet another reason why Assembly Language never can die :P
Posted on 2008-02-07 23:04:38 by SpooK
... and that is yet another reason why Assembly Language never can die :P


May I hear everybody say Amen?
Posted on 2008-02-08 10:53:00 by XCHG
Ultrano: that "load/inc/store" is pretty stupid indeed, but if you use "/O1s" as your for-size optimization flag, you should get a direct INC instead...
Posted on 2008-02-08 18:38:05 by f0dder