Machine instructions are represented by patterns of 0’s and
Use of symbolic words – Move, Add, Increment, Branch etc
When writing programs such words are replaced by
acronyms called mnemonics like MOV, ADD, INC, BR.
R3 to represent register 3 and LOC to refer to a memory
Assembly language – A complete set of such symbolic names
and rules for their use constitute a programming language
Syntax – set of rules
Assembler – A program that automatically translates the programs
written in an assembly language into a sequence of machine
It is one of a collection of utility programs.
User program in original alphanumeric text format is source
Assembled language program is called object program
Assembly language program may or may not be case sensitive.
Mnemonic MOVE represents the binary pattern or op code for the
Assembler translates this mnemonic into binary op code that
Op code followed by operands information (source, destination)
Here, Source operand …………??????
Destination operand …………??????
Since there are several possible addressing modes for specifying operand
locations, assemble language should indicate the mode
In some assemble language this can be denoted by indented op code
Indirect addressing modes is specified by putting in ( ),
In addition to providing a mechanism for representing
instructions in a program, the assemble language allows the
programmer to specify other information needed for
Suppose SUM is used to represent the value 200
SUM EQU 200
It simply informs the assembler that the name SUM should
replace the value 200 whenever it appears in the program
Assembler Directives (Or commands)
It shows the memory addresses
where the machine instructions
and the required data items are
to be found after the program
loaded for execution.
Assembler has to know
How to interpret the names
Where to place the instructions in the memory
Where to place the data operands in the memory
Program begins with Assembler Directives
RETURN – idenfies the point at which the execution of the program should be
It causes the assembler to insert an appropriate machine instruction that
returns control to the OS
Most assemble languages requires statements in a source program to
be written as
Label Operation Operand(s) Comment
Separated by an appropriate delimiter, one or more blank characters.
Label – optional name associated with the memory address where the
machine language instruction produced from the statement will be
loaded. Also associated with address of the data items
Operation – op code muemonic or assembler directives
Operand – addressing information of the operands
Comment – ignored by the assembler program (only for documentation
Assembly and Execution of
Key part of the assembly process is determining the values to
replace the names.
In some cases the value is specified by EQU directive
Other case, a name is defined in the Label field of a given
Hence assembler must keep track of address it generates the
machine code for successive instructions
In some cases assembler does not directly replace a name
representing an address with the actual value
Example in branch instructions – Branch target using Relative
addressing mode (branch offset)
Symbol table – it keeps all names and numerical values that
correspond to them while scanning the source program.
Problem arises when a name appears as an operand before it is given
This happens if a forward branch is required.
A simple solution is to have the assembler scan through the source
During the first pass, it creates a complete symbol table and assigns
numerical value for all names at the end of the pass
The assembler then goes through the source program a second time
and substitutes values for all names from the symbol table
Assembler stores the program in the magnetic disk
Loader – another utility program that loads the object
program into the memory of a computer before it is
Loader must know the length of the program and the
address in the memory where it will be stored
Debugger – helps the user to find programming errors
Numerical values are stored as binary values.
Most assembler allows numerical values to be specified in
different ways defined by assembly language syntax
Can be represented as