Professional Documents
Culture Documents
This structure totally joins the user to the hardware and software.
Source code: Source code is what the programmer or user write for the accurate
results and outputs. It is then compiled by the compiler.
Compiler: compiler uses to compile the source code. Compiler actually converts
the high level language to the machine understandable language i.e. assembly
language.
Assembly language: Assembly language is the machine understandable
language. The code in this language comes from the compiler and goes to the
assembler and converts to the object code.
Assembler: Assembler converts assembly language to object code.
Object code: Object code is a code comes from the assembler. It is totally
machine understandable language.
Loader: Loader loads the object code into the memory for the execution.
Linker: Linker separates the relocation and loading. It performs the linking
operation.
David START 0
USING *, 21
L 1, Four
A 1, Length
ST 1,Buffer
Four RESW 1
Length RESW 1
Buffer RESB 4096
END
Ans:
PASS1
Relative Address Mnemonic Code
0 L 1, __ (0, 21)
4 A 1, __ (0, 21)
8 ST 1, __ (0, 21)
12 4
16 _
20 _
PASS2
Q5: An assembler can tell loader which part of object code needs
modification, how modification can be done in this case.
Ans: An assembler can tell loader which part of object code needs modification. This is
a machine dependent feature. Assembler itself identifies the address of the modification.
As when user changes the starting address of the code then the relative address in the
code automatically changes which is in the assembler so assembler can tell the loader
which part of the object code needs modification.
Q6: Is there any need to design the pass2 of an assembler? Can we
generate both the passes in a single pass, if yes how?
Ans: Yes, there is a need to design the pass 2 of an assembler. Pass1 scan the source
code and then segregate the literals, symbols. It generates tables and pass2 generates the
object code from the addresses of pass1.
Yes, we can generate both the passes in a single pass. This single pass is a combination of
pass1 and pass2. Single pass eliminate the forward reference in symbol reference.