0
4.0kviews
For following code what will be output generated by Pass-I and Pass-II for two pass assembler.

enter image description here

This question appears in Mumbai University > System Programming and Compiler Construction subject

Marks: 10 M

Year: May 2015

1 Answer
0
12views

Assembler

• Assembler is the language translator that accepts inputs as assembly language (ALP) and obtains its machine equivalent code (Object code) along with the information required by the loader.

• ALP is low-level language .The execution of statements can be done line by line.

• Diagram

enter image description here

• Multipass assembler means more than one pass is used by assembler.

• Multipass assembler is used to eliminate forward references in symbol definition.

• It creates a number of passes that is necessary to process the definition of symbols.

• In pass one we find out all the Symbols and Literals.

• And in pass two we will perform assembling of code and the data (generating instruction and generating data).

Following is the output generated by Pass-I and Pass-II for two pass assembler.

enter image description here

Following are the Databases used in Pass 1 and Pass 2 Assembler

1) Machine Opcode Table (MOT):

  • MOT is a fixed length table i.e. we make no entry in either of the passes.

  • In pass 1, using mnemonic Opcode, MOT is consulted to update location Counter (LC).

  • In pass 2, using mnemonic opcode, MOT is consulted to obtain

  1. Binary opcode (to generate the instruction).
  2. Instruction length (to update the instruction).
  3. Instruction Format (to assemble the instruction).
M/C Instruction Binary Opcode Length Instruction Format
L
A
ST

2) Pseudo Opcode Table (POT)

• POT is the fixed length table.

• In pass 1, using Pseudo Opcode, POT is consulted for processing some pseudo opcode like DS, DC, START, END, etc.

• In pass 2 using Pseudo Opcode, POT is consulted for processing some pseudo opcode like DS, DC, USING DROP

Pseudo Opcode Binary OpcodeAddress of routine to process pseudo opcode

3) Symbol Table (ST)

• Symbol table is used for keeping the track of symbol that are defined in the program.

• Symbol is said to be defined it appears in a label field.

• In pass 1, whenever a symbol is defined and for entry is made in symbol table.

• In pass2, symbol table is used for generating address of a symbol.

Symbol Vale Length Rel /Abs
ABC 00 01 R
FOUR 12 04 R
FIVE 16 04 R
TEMP 20 04 R

4) Literal Table (LT)

• Literal table is used for keeping track of literals that are encountered in the programs.

• Literals are always encountered in the operand field of an instruction.

• In pass 1, whenever a Literal is defined and for entry is made in Literal table.

• In pass2, Literal table is used for generating address of a Literal.

Symbol Vale Length Rel /Abs

• As there is no literal in the above program so there is no literal defined in the table.

5) Base Table (BT)

• Base table is used for keeping the track of base registers and there values.

• In Pass 1, BT is not required.

• In pass 2, BT is required for processing of USING and DROP statements.

Availability indicator Content of base Register
0, ‘N’
1, ‘N’
‘N’
15, ‘Y’ 00
Please log in to add an answer.

Continue reading...

The best way to discover useful content is by searching it.

Search