Assembly language#Assembler

An assembler (according to DIN 44300: Assemblers ) is translated a tool of programming ( programming tool ), which (also called machine code or native code) a program written in assembly language machine-oriented computer program in machine language. Assembler is often used as a synonym for assembly language. The first assembler was written 1948-1950 by Nathaniel Rochester for an IBM 701.

Description

More and more machine-oriented programming - the domain of assembly language - can be almost completely covered by higher programming languages ​​today. Also, the possibility of producing efficient programs is facing the difficult maintainability of assembly language programs. For optimal code more and more contextual knowledge is required (for example, cache usage, locality, temporal use, etc.). An example of this would be movntq the SSE instruction, which can not or can only be used by compilers highly speculative due to lack of context knowledge.

On the other hand, most compilers for high-level languages ​​use only a small part of the instruction set of the CPU ( a fact which has led to the development of RISC processors ), while the assembler programmer of the full instruction set is available, so that it more efficient in some situations can use commands to the pure high-level language programmer does not accessible. Some programming systems for high-level languages ​​make it possible to integrate assembly language commands using inline assembler in the source code. The application can then be restricted to situations where it is necessary or useful for functional or efficiency reasons, machine level programming.

It should be noted that different processor architectures have fundamentally different assembler and machine language so that each one is needed for the current architecture suitable assembler and the programs are portable, or only with great limitations.

Macro assembler allow the formation of parameterized statements. A macro instruction is generally implemented in more than one machine instruction.

Differentiation from high-level language compilers

Assembler are always aligned specifically to one or a few types of processors. Assembler and assembly language for the IA32 architecture for example, differ completely from that for the MIPS architecture.

Some high-level language compilers translate a program in assembly language first and then call an assembler to generate machine language. While high-level languages ​​rather oriented to the human language and thus are relatively easy to understand, to assembly language closely follows the machine. In assembly language opcodes (commands) of the CPU with names, called mnemonics provided and thus form a direct image of the instruction set of the CPU. While little or no need to worry about the underlying CPU in a high level language, so understanding this in assembler is a prerequisite.

Special forms

Cross assembler

A cross - assembler is a special form of the assembler that runs on a computer platform H (host) and generates machine code for another computer platform T ( target). It is thus a special cross-compiler.

Cross - Assembler come today, especially in the development of embedded systems are used to create fast and compact code for microcontrollers and DSPs.

One example is the Cross - Assembler ASEM -51, which runs on the host platforms, MS- DOS, Windows, and Linux. It generates code for the microcontroller family MCS -51 Intel ( target platform ).

Disassembler

Main article: disassembler.

A program for Reversing machine language into assembly language is called a disassembler. This retranslation is possible because it - unlike high-level languages ​​- is a one-to- one correspondence between simple assembly language and machine language. However, identifiers and comments can not be restored because they will be lost by the assembly. Most assembly languages ​​are supplemented with macro capabilities, so this direct mapping is only partially possible.

Machine language monitor

On some platforms, a very simple version of an assembler, combined with the ability to test programs interactively and analyze the machine language monitor is called there.

Manufacturers and Products

For x86 processors family and compatible processors (eg Intel Pentium or AMD Athlon ) the Microsoft Macro Assembler ( MASM ), the Borland Turbo Assembler ( TASM ) and the Netwide Assembler ( NASM ) are widely used. Also the Flat Assembler ( FASM ) provides many features required by a modern assembler. Yasm finally is a rewrite of the NASM under the BSD license. In addition to assemblers who are familiar with the Intel syntax, there are still those that can assemble the assembly code in AT & T syntax, such as the mainly used on Linux GNU assembler (GAS). Since version 2.10 of the. Intel_syntax GAS directive also supports the Intel syntax.

On IBM mainframes (System z) of the High Level Assembler is used Hercules users must either use the outdated assembler assembler -F or use the Tachyon Legacy Assembler, which runs on Linux for z / Series.

For the microcontroller family MCS -51 Intel, whose first representative was 8051, there is the free Macro Assembler ASEM 51st Today, there are already hundreds of 8051 derivatives by over 50 semiconductor manufacturers.

4591
de