Вы находитесь на странице: 1из 3

Suraj Dev Singh Roll No: 17STAMCA027

Q 1. What is the difference between a macro and a subroutine? Explain with example.
A. Difference between macro and subroutine

Macro Subroutine

Macro permit a group of instructions to be defined Subroutine permit a group of instructions to be


as a single entity with a unique given label or name defined as a single entity with a unique given label
called up when needed. or name called up when needed.

Macro is called by simply using its name. A subroutine is called by the BSR or JSR instructions.

Simpler to write and use. Subroutines are more complex, stacks are used.

Macros are faster Subroutine are slower

Example:
Example:
sqr macro
&hello;
move X,d0
sub hello {
muls d0,d0
print “Hello World .! \n”;
move d0,X
}
mend

Q 2. How is pure interpreter different from impure interpreter? Explain with examples for each.
A. In a pure interpreter, the source program is retained in the source form all through its
interpretation. This arrangement incurs substantial analysis overheads while interpreting a statement.
An impure interpreter performs some preliminary processing of the source program to reduce the analysis
overheads during interpretation. The preprocessor converts the program to an intermediate
representation (IR), which is used during interpretation. This speeds up interpretation as the code
component of the IR i.e. the IC, can be analyzed more efficiently than the source form of the program .

Q 3. What do understand by the terms – translation time address, linked address, load time address,
translated origin, and load origin?
A. Translation time address: Translation time address is used at the translation time. This address is
assigned by translator
Suraj Dev Singh Roll No: 17STAMCA027

Linked address: Linked address are the addresses which are assigned to the linker .
Load time address: These are the address assigned by the loader.
Translated origin: These are the addresses which are assumed by the translator.
Load origin: These are the address of the origin assigned by the loader while loading the program for
execution.

Q 4. What is a linker and a loader?


A. A linker links and combines objects generated by a compiler into a single executable. A linker is also
responsible to link and combine all modules of a program if written separately.
A loader loads the programs into the main memory from the storage device. The OS transparently
calls the loader when needed.

Q 5. What are EXTRN and ENTRY statements?


A. The EXTRN statement (which may appear anywhere in the assembler source file) specifies symbols
that the current source file uses but which are defined in other object modules. The module where
the symbols are defined must export those using GLOBAL or PUBLIC statements. The EXTRN statement
specifies the symbol and its type.
The ENTRY statement permits a program unit to define multiple procedures, each with a different entry
point.

Q 6. Explain the steps of program execution using a suitable diagram.


A. The following diagram shows the steps in program execution
Suraj Dev Singh Roll No: 17STAMCA027

Editor: It can be any text editor which can be used for writing codes by the programmer.
Compiler: Compiler is a software which converts a program written in high level language (Source
Language) to low level language (Object/Target/Machine Language).
Assembler: For every platform (Hardware + OS) there is an assembler. They are not universal since for
each platform one assembler is needed. The output of assembler is called object file. Its translates
assembly language to machine code.
Linker: It converts the relocatable code into absolute code and tries to run the program resulting in a
running program or an error message.
Loader: Linker loads a variety of object files into a single file to make it executable. Then loader loads it in
memory and executes it.
Debugger: There are programs called debuggers that help software developers find and eliminate bugs
while they are writing programs. A debugger tells the programmer what types of errors it finds and often
marks the exact lines of code where the bugs are found. Debuggers also allow programmers to run a
program step by step so that they can determine exactly when and why a program crashes.

References
Q1:
1. http://users.encs.concordia.ca/~aagarwal/coen311/notes/macro.pdf
Q2:
1. https://study-for-exam.blogspot.com/2013/05/explain-following-i-elimination-of.html
Q3:
1. http://www.wbuthelp.com/chapter_file/2681.pdf
Q4:
1. https://www.careerride.com/os-loader-and-linker.aspx
Q5:
1. http://www.keil.com/support/man/docs/a166/a166_st_extrn.htm
2. http://www.lahey.com/docs/lfpro78help/F95ARENTRYStmt.htm
Q6:
1. https://www.geeksforgeeks.org/introduction-compiler-design/
2. https://techterms.com/definition/debugger

Вам также может понравиться