Part 2 



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 addressassociated 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.

LOADERS AND LINKERS

1. What are the basic functions of loaders?

 Loading – brings the object program into memory for execution

 Relocation – modifies the object program so that it can be loaded at an

address different from the location originally specified

 Linking – combines two or more separate object programs and also

supplies the information needed to reference them.

2. Define absolute loader.

The loader, which is used only for loading, is known as absolute loader.

e.g. Bootstrap loader

3. What is meant by bootstrap loader?

This is a special type of absolute loader which loads the first program to be run by

the computer. (usually an operating system)

4. What are relative (relocative) loaders?

Loaders that allow for program relocation are called relocating (relocative) loaders.

5. What is the use of modification record?

Modification record is used for program relocation. Each modification record

specifies the starting address and the length of the field whose value is to be altered

and alsodescribes the modification to be performed.

6. What are the 2 different techniques used for relocation?

Modification record method and relocation bit method.

7. Define Relocation bit method.

If the relocation bit corresponding to a word of object code is set to 1, the

program’s starting address is to be added to this word when the program is

relocated. Bit value 0 indicates no modification is required.

8. Define bit mask.

The relocation bits are gathered together following the length indicator in each text

record and which is called as bit mask. For e.g. the bit mask FFC(111111111100)

specifies that the first 10 words of object code are to be modified during relocation.

9. What is the need of ESTAB?

It is used to store the name and address of the each external symbol. It also

indicatesin which control section the symbol is defined.

10. What is the use of the variable PROGADDR?

It gives the beginning address in memory where the linked program is to

be loaded. The starting address is obtained from the operating system.

11. Write the two passes of a linking loader.

Pass1: assigns address to all external symbols

Pass2: it performs actual loading, relocation and linking.

12. Define automatic library search.

In many linking loaders the subroutines called by the program being loaded are

automatically fetched from the library, linked with the main program and loaded.

This feature is referred to as automatic library search.

13. List the loader options INCLUDE &DELETE.

The general format of INCLUDE is INCLUDE program_name (library name) This

command direct the loader to read the designated object program from a library

and treat it as the primary loader input. The general format of DELETE command

is DELETE Csect-name It instructs the loader to delete the named control sections

from the sets of programs loaded.

14. Give the functions of the linking loader.

The linking loader performs the process of linking and relocation. It includes the

operation of automatic library search and the linked programs are directly loaded

into the memory.

15. Give the difference between linking loader and linkage editors.

Linking loader Linkage editor

1. The relocation and linking is performed each time the program is loaded

1. It produces a linked version of a program and which is written in a file for

later execution Here the loading can be accomplished in a single pass Two

passes are required


16. Define dynamic linking.

If the subroutine is loaded and linked to the program during its first call

(run time), then it is called as dynamic loading or dynamic linking.

17. Write the advantage of dynamic linking.

 It has the ability to load the routine only when they are needed

 The dynamic linking avoids the loading of entire library for each

execution.

18. What is meant by static executable and dynamic executable?

In static executable, all external symbols are bound and ready to run. In dynamic

executables some symbols are bound at run time.

19. What is shared and private data?

The data divided among processing element is called shared data.

 If the data is not shared among processing elements then it is called private data.

20. Write the absolute loader algorithm.

Begin

Read Header record

Verify program name and length

Read first text record

While record type != ‘E’ do

Begin

Moved object code to specified location in memory

Read next object program record

End

Jump to address specified in End record.

Viva important questions bcsl22 part 1

 Viva important questions bcsl22 part 3