PDA

Click to See Complete Forum and Search --> : x86 Assembly Language


Louix
Aug 31st, 2008, 05:40 PM
Does anybody know of a good place to learn x86 assembly and understand it fully? I know a bit of it but I don't really understand it :(

techgnome
Aug 31st, 2008, 07:20 PM
that's hard to say, everyone is different. What works for one, doesn't work for others. I picked up ASM close to 20 years ago by reading the friggin manual that came with my copy of Turbo ASM -- and I mean the REFERENCE Manual.... not the user manual.... picked up Pascal the same way.

-tg

Shaggy Hiker
Aug 31st, 2008, 08:19 PM
If I was to start into assembler today, I would consider a book as a place to start, coupled with an appreciation that you will have to WORK to really understand it.

TG speaks of days gone by when life was simple and memory was segmented. I, too, learned ASM in those halcyon days where a bit of ASM, artfully dropped into your program, could give you recognizeable performance boosts. The manuals in those days (I still have one) gave you actual instruction timing in cycles. For instance, you could look up the exact number of cycles taken by MOV ax,bx for all the x86 processors. A good book from those days, which would still be quite relevant now, would be Jeff Duntemann's Assembly Language Step by Step, put out by Wiley Press. However, you would have to keep in mind that times have changed.

If you look up the Intel x86 instruction set manuals nowadays, which I did a couple years back online, you won't find the cycle count for any instructions. Instead, you will find a discussion of the factors that go into the timing of each instruction. The introduction of multiple pipes (not cores, just pipes, introduced with the Pentium chip), pre-fetch, caches, etc., means that a simple instruction such as MOV ax,bx can take a variety of real execution times beginning with a fraction of a cycle.

The result of this is that hand-tuning code for optimal performance is FAR more difficult than it used to be. You can't add the cycles for each instruction, because the actual cycles taken depends on the code around the instruction itself. Therefore, optimization is something of a major specialization. Several years ago, not long after the advent of the Pentium, I read a book on using ASM for optimization that opined that the compilers for the 486 were so good that an individual was unlikely to improve on the ASM put out by a C compiler. The author went on to say that the dual pipes in the Pentium opened the door to new and better optimizations that were greater than what the compilers of the time could accomplish. These days, it is quite likely that the door to casual optimization has slammed shut for good. I would expect that modern compilers are so much more effective at generating code than all but a handful of ASM wizards that there is nothing to be gained by hand optimizing ASM. The rules that go into the timing of each instruction are so interrelated that you can't keep them all in mind well enough to optimize much of anything.

MaximilianMayrhofer
Aug 31st, 2008, 10:27 PM
That's so depressing.. thank goodness for Intel's new multi-threading classes.

mendhak
Sep 1st, 2008, 01:38 AM
Moved to the Assembly forum

Louix
Sep 1st, 2008, 06:39 PM
Well what works for one, must work for at least one other when you think about it.

Has anybody here seen a good web tutorial or book on x86 assembly with NASM?

I want to know how things work on the lowest levels, you see.

pcuser
Feb 24th, 2009, 01:00 PM
Has anybody here seen a good web tutorial or book on x86 assembly with NASM?

http://www.drpaulcarter.com/pcasm/