Vous êtes sur la page 1sur 3

UNIT II

1. What is an assembler?
An assembler is a program that accepts as input assembly language
program and produces its machine language equivalent along with the information
for the loader.

2. What are the functions of an assembler?


The functions of an assembler are
 translating mnemonic operation code to their machine language
equivalent.
 Assigning machine address to symbolic address used by the
programmer.
3. What are assembler directives? List all assembler directives?
The statement that directs the assembler to take certain actions during the
process of assembling programs are called assembly directive.
START, BYTE,WORD,RESB,RESW,END are some of the assembly
directives.

1. Explain the following assembler directive: START, END, and WORD?


 START: specify name and starting address for the program.
 END: Indicate the end of the source program and specify the first
executable instruction in the program.
 WORD: Generate one word integer constant.

2. Explain the following assembler directive: BYTE, RESW,RESB?


 BYTE: Generate character or hexadecimal constant, occupying as many
bytes as needed to represent the constant.
 RESB: Reserve the indicated number of bytes for a data area.
 RESW: Reserve the indicated number of words for a data area.

3. What are the functions required in translation of source program to object code?
 Convert mnemonic operation codes to their machine language equivalent.
 Convert symbolic operands to their equivalent machine address.
 Built the machine instructions in the proper format.
 Convert the data constant specified in the source program to their internal
machine representation.

4. What is meant by forward reference?


 Forward is a reference to a label that is defined later in the program.

5. What are assembler directives or pseudo-instructions?


Assembler directives or pseudo-instructions provide instructions to the
assembler itself. These assembler directive statements are not translated in
to machine instruction.
Eg: BYTE, WORD

6. What is the purpose of PASS1 and PASS2 of a two pass assembler?


The purpose of
 PASS1 is to define symbols and literals.
 PASS2 is to generate object code.

7. List the steps involved in defining symbols and literals (PASS1 of an assembler)?
The steps involved in defining symbols and literals are
 Determining length of machine instructions.
 Keeping track of location counter.
 Remembering values until PASS2.
 Processing some pseudo ops.
 Remembering literals.

8. What are steps involved in generating the object program?


The steps involved in generating the object program are
 Looking up values of symbols.
 Generating instructions.
 Generating data.
 Processing pseudo ops.

9. What are the data bases used by pass1 of an assembler?


 Input source program.
 A location counter.
 Symbol table.
 Operation code table.
 A copy of input to be us later by pass2.

10. What are the data bases used by pass2 of an assembler?


 Copy of source program input to pass2.
 Location counter.
 Symbol table.

11. What are the types of record present in a simple object program?
 Header record Contains the program name, starting address length.
 Text record Contains translated instruction and data of the program,
together with the indication of the address where these are to be loaded.
 End record->Marks the end of the object program.

12. Mention the major data structure used by an assembler?


 Operation code table
 Symbol table

13. What is the use of location counter (LOCCTR)?


Location counter is a variable that is used to help in the assignment of
address. LOCCTR is initialized to the beginning address specified in the
START statement. After each source statement is processed, the length of
the assembled instruction or data area to be generated is added to
LOCCTR.

14. What is a symbol table?


A symbol table is a data structure that is used to store each label, its
corresponding value, length and a flag to indicate error condition.

15. What are literals?


A constant operand whose value is stated literally in the instruction itself
is called a literal.

16. Why do we need a 2 pass assembler?


To solve the problem of forward reference and to develop necessary
background for the processing of declaratives and assembler directives, a
2 pass assembler is needed.

17. What are the problems encountered in a single pass assembler?


o Assembly of instructions containing forward references.
o Processing of declaratives and assembler directives.

Vous aimerez peut-être aussi