I’m wanting to get an assembly book to learn assembly, and was wandering if i get a book for intel x86 processor will there be any problems assembling the code on an amd processor?
2
For the most part you shouldn’t notice any problems at all. Any introductory text will be using very common mnemonics (commands) and macros. Intel tried to introduce a 64-bit processor, IA-64 Itanium, that broke compatibility with the 8086 family of processors. AMD stepped up and designed a 64 bit processor that continued to work with older programming. Obvoiusly, this is what ended up being popular and Intel had to drop IA-64 and make something to work like AMD’s.(Duntemann 106-107)
So now both AMD and Intel work from a set of instructions that work almost exactly the same. Little things here and there, but because the market demands it there are little differences to us the programmers. Anything you’ll be learning will address when a particular mnemonic came along and which models it begins working on, for all but the latest and most obscure stuff you probably won’t need for awhile anyway.
I would highly recommend Jeff Duntemann’s Step by Step Assembly language. I learned from this originally 15 years ago. I was going to relearn it, and bought some other book… It just didn’t work. So I found that Duntemann had released a new edition in 2009. It does a quick cover of the differences with some aspects of x86_64 but focuses on 32 bit. It really a back to front programming guide with more than just assembly. Editing, good commenting, linking, how the cpu moves data, base number counting, etc.
His website.
http://duntemann.com/assembly.html
Amazon link for the book:
http://www.amazon.com/Assembly-Language-Step—Step-Programming/dp/0470497025/ref=sr_1_1?ie=UTF8&qid=1367027229&sr=8-1&keywords=jeff+duntemann
1
I think it will be compatible(but still depends on what AMD you are using), as cited in Wiki:
x86 assembly language is a family of backward-compatible assembly
languages, which provide some level of compatibility all the way back
to the Intel 8008. x86 assembly languages are used to produce object
code for the x86 class of processors, which includes Intel’s Core
series and AMD’s Phenom and Phenom II series.
3
You will mostly have the same instructions.
There is an instruction named “CPUID” which lets you among other things identify the processor. Obviously it will give different results on AMD and Intel CPUs. And once you know which processor you have, you need to follow the instructions in AMD and Intel manuals separately to get more information about the processor.
Each processor has a different set of features (for example MMX, SSE, SSE2, SSE3 and so on), and you use the CPUID instruction to find what features are available. Once a feature is available, it is the same on all processors. Some instructions were only ever available on one processor; those instructions are usually not used by anybody.