The Assembly Language Level - Kent State University

The Assembly Language

Level

Translators can be divided into two groups.

? When the source language is essentially a symbolic representation for a numerical machine language, the translator is called an assembler, and the source language is called an assembly language.

? When the source language is a high-level language such as Java or C, the translator is called a compiler.

A pure assembly language is a language in which each statement produces exactly one machine instruction.

The Assembly Language Level

The use of symbolic names and symbolic addresses (rather than binary or hexadecimal ones) makes it easier to program in assembly language than in machine language.

The assembly programmer has access to all the features and instructions on the target machine.

? The high-level language programmer does not. ? Languages for system programming, such as C,

provide much of the access to the machine of an assembly language.

Assembly programs are not portable.

Why Use Assembly Language?

There are several reasons to program in assembly, rather than a high-level language:

1. An expert assembly language programmer can often produce code that is much smaller and much faster than a high-level language programmer can.

2. Some procedures need complete access to the hardware, something usually impossible in high-level languages.

3. A compiler must either produce output used by an assembler or perform the assembly process itself - and someone has to program the compiler.

4. Studying assembly language exposes the real machine to view.

Why Use Assembly Language?

Comparison of assembly language and high-level language programming, with and without tuning.

Assembly Language Statements

Assembly language statements have four parts:

? a label field ? an operation (opcode) field ? an operands field ? a comments field

Labels are used for branches and to give a symbolic name to some memory address.

? Some assemblers restrict labels to six or eight characters.

Assembly Language Statements

Computation of N = I + J. (a) Pentium 4.

Assembler Pseudoinstructions

In addition to specifying which machine instructions to execute, an assembly language program can also contain commands to the assembler itself.

? For example, allocate some storage, or eject to a new page in the listing.

? Commands to the assembler itself are called pseudoinstructions or assembler directives.

? Some typical pseudoinstructions are shown on the following slide. These are from the Microsoft MASM assembler for the Intel family.

Assembler Pseudoinstructions

Some of the pseudoinstructions available in the Pentium 4 assembler (MASM).

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download