Wednesday 26 December 2012

CS2308 System Software laboratory VIVA QUESTION with ANSWERs (PART 2)

ASSEMBLERS

1. Define the basic functions of assembler.
* Translating mnemonic operation codes to their machine language
equivalents.
* Assigning machine addresses to symbolic labels used by the
programmer.

2. What is meant by assembler directives? Give example.
These are the statements that are not translated into machine instructions, but they provide instructions to assembler itself.
example START,END,BYTE,WORD,RESW and RESB.
3. What are forward references?
It is a reference to a label that is defined later in a program.
Consider the statement
10 1000 STL RETADR
. . . .
. . . .
80 1036 RETADR RESW 1
The first instruction contains a forward reference RETADR. If we attempt to translate the program line by line, we will unable to process the statement in line10 because we do not know the address that will be assigned to RETADR .The address is assigned later(in line 80) in the program.

4. What are the three different records used in object program?
The header record, text record and the end record are the three different records used in object program.
The header record contains the program name, starting address and
length of the program.
Text record contains the translated instructions and data of the program.
End record marks the end of the object program and specifies the address in the program where execution is to begin.

5. What is the need of SYMTAB (symbol table) in assembler?
The symbol table includes the name and value for each symbol in the
source program, together with flags to indicate error conditions. Some times it may contain details about the data area. SYMTAB is usually organized as a hash table for efficiency of insertion and retrieval.

6. What is the need of OPTAB (operation code table) in assembler?
The operation code table contains the mnemonic operation code and its
machine language equivalent. Some assemblers it may also contain information about instruction format and length. OPTAB is usually organized as a hash table, with mnemonic operation code as the key.

7. What are the symbol defining statements generally used in assemblers?
* 'EQU'-it allows the programmer to define symbols and specify their
values directly. The general format is Symbol EQU value
* 'ORG'-it is used to indirectly assign values to symbols. When this
statement is encountered the assembler resets its location counter to the specified value. The general format is ORG value

In the above two statements value is a constant or an expression
involving constants and previously defined symbols.

8. Define relocatable program.
An object program that contains the information necessary to perform
required modification in the object code depends on the starting location of the program during load time is known as relocatable program.

9. Differentiate absolute expression and relative expression.
If the result of the expression is an absolute value (constant) then it is known as absolute expression.
Eg: BUFEND - BUFFER

If the result of the expression is relative to the beginning of the program then it is known as relative expression. label on instructions and data areas and references to the location counter values are relative terms.
Eg: BUFEND + BUFFER

10. Write the steps required to translate the source program to object program.
* Convert mnemonic operation codes to their machine language
equivalents.
* Convert symbolic operands to their equivalent machine addresses
* Build the machine instruction in the proper format.
* Convert the data constants specified in the source program into their internal machine representation
* Write the object program and assembly listing.

11. What is the use of the variable LOCCTR (location counter) in assembler?
This variable is used to assign addresses to the symbols. 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 and hence whenever we reach a label in the source program the current value of
LOCCTR gives the address associated with the label.
12. Define load and go assembler.
One pass assembler that generates their object code in memory for
immediate execution is known as load and go assembler. Here no object programmer is written out and hence no need for loader.

13. What are the two different types of jump statements used in MASM assembler?
* Near jump
A near jump is a jump to a target in the same segment and it is
assembled by using a current
code segment CS.
* Far jump
A far jump is a jump to a target in a different code segment and it is
assembled by using different segment registers .

14. What is the use of base register table in AIX assembler?
A base register table is used to remember which of the general purpose
registers are currently available as base registers and also the base addresses they contain.
.USING statement causes entry to the table and .DROP statement
removes the corresponding table entry.
15. Differentiate the assembler directives RESW and RESB.
RESW -It reserves the indicated number of words for data area.
Eg: 10 1003 THREE RESW 1
In this instruction one word area (3 bytes) is reserved for the symbol
THREE. If the memory is byte addressable then the address assigned for the next symbol is 1006.
RESB -It reserves the indicated number of bytes for data area.
Eg: 10 1008 INPUT RESB 1
In this instruction one byte area is reserved for the symbol INPUT .Hence the address assigned for the next symbol is 1009.

16. Define modification record and give its format.
This record contains the information about the modification in the object code during program relocation. the general format is Col 1 M
Col 2-7 Starting location of the address field to be modified relative to the beginning of the program
Col 8-9 length of the address field to be modified in half bytes.

17. Write down the pass numbers (PASS 1/ PASS 2) of the following activities that occur in a two pass assembler:
a. Object code generation
b. Literals added to literal table
c. Listing printed
d. Address location of local symbols
Answer:
a. Object code generation - PASS 2
b. Literals added to literal table - PASS 1
c. Listing printed - PASS2
d. Address location of local symbols - PASS1
18. What is meant by machine independent assembler features?
The assembler features that do not depend upon the machine
architecture are known as machine independent assembler features.
Eg: program blocks, Literals.

19. How the register to register instructions are translated in assembler?
In the case of register to register instructions the operand field contains the register name. During the translation first the object code is converted into its corresponding machine language equivalent with the help of OPTAB. Then the SYMTAB is searched for the
numeric equivalent of register and that value is inserted into the operand field.
Eg: 125 1036 RDREC CLEAR X B410
B4-macine equivalent of the opcode CLEAR
10-numeric equivalent of the register X.

20. What is meant by external references?
Assembler program can be divided into many sections known as control
sections and each control section can be loaded and relocated independently of the others. If the instruction in one control section need to refer instruction or data in another control section.the assembler is unable to process these references in normal way. Such
references between control are called external references.
21. Define control section.
A control section is a part of the program that maintains its identity after assembly; each control section can be loaded and relocated independently of the others. Control sections are most often used for subroutines. The major benefit of using control sections is to increase flexibility.

22. What is the difference between the assembler directive EXTREF and EXTDEF.
EXTDEF names external symbols that are defined in a particular control
section and may be used in other sections. EXTREF names external symbols that are referred in a particular control section and defined in another control section.

23. Give the general format of define record.
This record gives information about external symbols that are defined in a particular control section. The format is
Col 1 D
Col 2-7 name of external symbol defined in this control section
Col 8-13 relative address of the symbol with in this control section
Col 14-73 name and relative address for other external symbols.

24. Give the use of assembler directive CSECT and USE
CSECT - used to divide the program into many control sections
USE - used to divide the program in to many blocks called program blocks

25. What is the use of the assembler directive START?
The assembler directive START gives the name and starting address of
the program.
The format is
PN START 1000
Here
PN - Name of the program
1000 - Starting address of the program.


 MORE>>>

Don't You Think this Awesome Post should be shared ??
| CS2308 System Software laboratory VIVA QUESTION with ANSWERs (PART 2) |
Back To Top Related Posts Plugin for WordPress, Blogger...