Assembly Language 

The assembly language is a programming language that uses symbolic names to represent operations, registers and memory locations. Hence programs are still written in a natural language style. However, each assembly language instruction (or statement) would correspond to a single machine language instruction. This makes it easier for the programmer to produce efficient machine language programs.

Why Learn Assembly Language?

Writing assembly programms gives the computer designer the needed deep understanding of the instruction set and how to design one
To be able to write compilers for HLLs, we need to be expert with the machine language. Assembly programming provide this experience
Sometimes very efficient machine codes are required to do some specific functions and these can not be produced by HLL and compilers. In this case assembly language has to be used
Sometimes we want to access specific memory addresses or I/O ports. This is very difficult to do using HLLs. In these cases Assembly language would be the better choice
Embeded-controllers that find numerous applications nowadays usually contain special-purpose processors. Assembly programming is usually the only practical way to program these processors.

Mapping Between Assembly Language and HLL

The mapping between HLL constructs and Assembly language instructions is many-to-many, as it was between HLL and machine language. The table below shows some examples of mapping between some HLL instructions (written in C language) and assembly language instructions (of the 8086 microprocessor):


Mapping between some C instructions and 8086 assembly language

Instruction ClassCAssembly Language
Data Movementa = 5MOV a, 5
Arithmetic/Logic
b = a + 5
MOV ax, a
ADD ax, 5
MOV b, ax
Control Flowgoto LBLJMP LBL

The Assembler

The program that translates from assembly language to machine language is called an Assembler . It allows the programmer to specify the memory locations for his data and programs and symbolically refer to them in his assembly code. It will translate these symbolic addresses to actual (physical) addresses in the produced machine code.

The Linker

This is the program that is used to link together separately assembled/compiled programs into a single executable code. This allows the programmers to develop different parts of a large program separately (some in HLL and others in Assembly depending on the best choice for that part), test them separately and ‘freeze’ them for future use. This produces modular programs and greatly enables the management of large programming projects.

Debugger and Monitor

These are tools that allow the assembly programmers to:

Display and alter the contents of memory and registers while running their code,
Perform disassembly of their machine code (show the assembly language equivalent),
Permit them to run their programs, stop (or halt) them, run them step-by-step or insert break points.

Break points: Positions in the program that if are encountered during run time, the program will be halted so the programmer can examine the memory and registers contents and determine what went wrong.