Monday, August 2, 2010

Introduction to Assembly Language

Assembly language, commonly called assembly or asm, is a human-readable notation for the machine language that a specific computer architecture uses. Machine language, a pattern of bits encoding machine operations, is made readable by replacing the raw values with symbols called mnemonics.

For example, a computer with the appropriate processor will understand this x86/IA-32 machine language:

10110000 01100001

For programmers, however, it is easier to remember the equivalent assembly language representation:

mov al, 061h

which means to move the hexadecimal value 61 (97 decimal) into the processor register with the name "al". The mnemonic "mov" is short for "move", and a comma-separated list of arguments or parameters follows it; this is a typical assembly language statement.

Transforming assembly into machine language is accomplished by an assembler, and the reverse by a disassembler. Unlike in high-level languages, there is usually a 1-to-1 correspondence between simple assembly statements and machine language instructions. However, in some cases an assembler may provide pseudoinstructions which expand into several machine language instructions to provide commonly needed functionality. For example, for a machine that lacks a "branch if greater or equal" instruction, an assembler may provide a pseudoinstruction that expands to the machine's "set if less than" and "branch if zero (on the result of the set instruction)".

Computer Articles and Tutorials
...PHP, MySQL, Perl...

Every computer architecture has its own machine language, and therefore its own assembly language. Computers differ by the number and type of operations they support. They may also have different sizes and numbers of registers, and different representations of data types in storage. While all general-purpose computers are able to carry out essentially the same functionality, the way they do it differs, and the corresponding assembly language must reflect these differences.

In addition, multiple sets of mnemonics or assembly-language syntax may exist for a single instruction set. In these cases, the most popular one is usually that used by the manufacturer in their documentation.

No comments:

Post a Comment