Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which syntax and architecture of assembly is most useful to know?

Tags:

I've always wanted to learn assembly, but there seems to be a jungle of assembly-related information out there that is difficult to interpret. I haven't just been able to google "learn assembly" and get going.

First, there are two types of syntax: Intel and AT&T. What's the difference? Why are there still two in use? When would I need to use one versus the other?

Second, there's a multitude of chips out there. Intel vs AMD, 32-bit versus 64-bit, x86 vs other architectures... even x86 is really a whole family of chips. So, how can I know whether the assembly I'm learning from a certain web page will work for my machine?

There exist even more variations (operating system even plays a role in determining how code will run.

So, the big question is, with all these variables, how can I know what type I should learn? What's most common? How is it possible for people to "know assembly" when there are all of these variations?

like image 704
stalepretzel Avatar asked Aug 31 '09 02:08

stalepretzel


People also ask

Which assembly language is most used?

The current most popular are ARM, MIPS, and x86. ARM is used on lots of cell phones and many embedded systems. MIPS is popular on IBM CPUs and is found on systems such as Macs, some video game consoles, and a few I'm sure I'm missing. x86 assembler is used on Intel PCs.

What is architecture in assembly language?

The architecture is the most important thing to know when programming in Assembly Language. The architecture in question might be the specific hardware that the application is designed to run on, or a virtual machine.

Which language requires knowledge of assembly?

assembly language, type of low-level computer programming language consisting mostly of symbolic equivalents of a particular computer's machine language. Computers produced by different manufacturers have different machine languages and require different assemblers and assembly languages.


1 Answers

First, there are two types of syntax: Intel and AT&T. What's the difference?

The main differences are superficial: reversed operands, for example.

Why are there still two in use? When would I need to use one versus the other?

Intel uses a syntax that is a major departure from the syntax that virtually all other processor ISA documents use.

GNU as uses AT&T syntax for all platforms, and supports Intel syntax for x86 and x86_64.

Other assemblers (like NASM, MASM, etc.) use Intel syntax exclusively.

So, how can I know whether the assembly I'm learning from a certain web page will work for my machine?

It's documented in the processor manuals from Intel and AMD. Sandpile is also a good resource.

So, the big question is, with all these variables, how can I know what type I should learn? What's most common?

The most widely-supported would be Pentium-pro class, so-called 'i686', and K8-class (referred to as 'x86_64' or 'amd64' or 'EM64T'). The variations from there are whether MMX or SSE or its variations are supported. Look up the CPUID instruction - it will provide you with support information for the processor you're running on.

How is it possible for people to "know assembly" when there are all of these variations?

I don't think anyone "knows" x86. Everyone who needs to has a copy of the processor manuals.

like image 75
greyfade Avatar answered Sep 30 '22 21:09

greyfade