Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / Inline assembly, getting started Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
adel

May 17, 2005, 07:04 AM

Hello everyone. I ran into a couple of articles explaining how to optimize various critical routines using assembly, particularly inline assembly. At that point I realized that it should be useful to learn assembly so that later I can learn how to use SSE, SSE2... etc. I spent a few hours googling for a good place to start learning assembly but I found nothing useful. That is, I want to learn assembly programming with MASM or the inline assembler built into the VC++ compiler. Where do I start, please?

 
Chris

May 17, 2005, 07:36 AM

I'd recommend starting with inline assembly.

The definitive reference for all the commands is the IA-32 Architecture Software Developer's Handbook, download free at intel.com.

http://developer.intel.com/design/pentium4/manuals/index_new.htm

It contains all the instructions along with a short explanation.
Technically, everything's in there, but it may be hard to read for beginners.

Once you've got a good grasp of the basic instructions, registers, and addressing modes (which you might learn by way of some short tutorials in some hours), the rest is pure art, experience, and hours of experiments. You probably can gain that only by dedication to the subject ... I want to say here that it takes you some months or even longer to understand how you can do things in a smarter way than the compiler does. There are loads of insanely clever tricks, and this cannot be taught very well.

Sometimes it's really challenging to create something in assembly yourself that outperforms a good compiler.

That said, you should regard assembly as a last resort. For most projects, it's much more rewarding to think over your data structures and algorithms for some days, than to start recoding inner-loops in assembly.

Anway, googling for "vc++ inline assembly tutorial" gave me these:

http://www.codeproject.com/cpp/sseintro.asp
http://www.funducode.com/freec/misc_c/misc_c11/misc_c11.htm
http://www.daniweb.com/techtalkforums/thread8072.html

Related thread with some additional links:
http://www.codeguru.com/forum/showthread.php?t=308073

 
Scali

May 17, 2005, 09:14 AM

And remember that most compilers can generate assembly output (and failing that, you could disassemble the resulting binary).
If you want to get started, it may help to just create test-cases and study the generated code, to see how it is done in assembly.

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.