Assembler - An assembler enables software and application developers to access, operate and manage a computer's hardware architecture and components. An assembler is sometimes reffered to as the compiler of assembly language. It also provides the services of an interpreter. Assemblers are classified based on the number of times it takes them to read the source code before translating it.
There are two different types of assemblers
-
one-pass assembler
-
two-pass assembler
-
one-pass assembler : scans the program only once and creates the equivalent binary program, the assembler substitute all of the symbolic instruction with machine code in one pass. In first pass it collect the symbols and labels and assembles the instruction ( e.g. MASM)
-
two-pass assembler : in first pass it collects the labels and symbols and in second pass it assembles the instructions, it stores mnemonics and pseudo codes separately, literals and symbols are stored in literal and symbol table respectively, the second pass assembler locates and completes (using the symbol table) the partial instruction (e.g. JWASM)
Why 2 pass assembler?
One pass assembler cannot resolve forward references of data symbols. It requires all data symbols to be defined prior to being used. A two-pass assembler solves this dilemma by devoting one-pass to exclusively resolve all (data/label) forward references and then generate machine code with no hashels in the next pass