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

For following code what will be output generated by Pass-I and Pass-II for two pass assembler. Explain with database.

ABC     Start   O.
USING *, 15 
L   1, FIVE
A   1, FOUR 
ST  1, TEMP 
FOUR    DC  F'4' 

FIVE     Dc     F’5’
TEMP    DS  1F
END
1 Answer
1
877views

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

enter image description here

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.
Literal 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, $\hspace{2 cm}$ ‘N’ -
1, $\hspace{2 cm}$ ‘N’ -
‘N’ -
15, $\hspace{2 cm}$ ‘Y’ 00
Please log in to add an answer.