You are on page 1of 6

Programming concepts

MP Module 1- Part 2
The assembly process
 Mnemonics-specifies the operation to be done

 Assembler-translate symbolic language (assembly) to machine code


 Assembler is a translator that translates source instruction into
target instructions on a one to one basis
 Assembler should give appropriate error messages
Features of assembler
 Labels-names for memory location
 Macro assembler- an assembler that supports macros
 Macro is a name given to a sequence of instruction lines
 Once a macro is defined , it can be used in place of the set of lines
Instructions and directives
 Directives (pseudo-instruction)- direct the assembler to perform in
certain ways
 Instructions get translated to machine codes, but directives do not
 Assembler converts source code to object code
 Object file will loaded into memory (done by loader)and executed
after linking with necessary files
The forward reference problem
 BEGIN: MOV AX, COST
 BEGIN,COST is a label
 MOV is a mnemonics

BEGIN: MOV AX, COST


JMP AGAIN
---------------
--------------- assembler wait till it see the definition of label “AGAIN”
AGAIN:-----
Two pass assembler
 Pass – reading of code from beginning to end
 Second pass will be over a file generated in the first pass
 In first pass, it looks for label definitions and insert them in the
symbol table after assigning them addresses
 At the end of the first pass, the symbol table should contain
definitions of all the labels used in the program
 Duty of the assembler during first pass is assigning memory
address to labels
 In second pass, the actual translation of assembly code to machine
code is done.
 Also errors are reported
 Creates a re-locatable object file
 MAMS(Microsoft Macro Assembler)

You might also like