edited by
1,429 views

1 Answer

1 votes
1 votes

First Pass

On the first pass, the assembler performs the following tasks:

  • Checks to see if the instructions are legal in the current assembly mode.
  • Allocates space for instructions and storage areas you request.
  • Fills in the values of constants, where possible.
  • Builds a symbol table, also called a cross-reference table, and makes an entry in this table for every symbol it encounters in the label field of a statement.

symbol table:-

The assembler reads one line of the source file at a time. If this source statement has a valid symbol in the label field, the assembler ensures that the symbol has not already been used as a label. If this is the first time the symbol has been used as a label, the assembler adds the label to the symbol table and assigns the value of the current location counter to the symbol. If the symbol has already been used as a label, the assembler returns the error message Redefinition of symbol and reassigns the symbol value.

The assembler keeps scanning statements and building its symbol table until there are no more statements to read.

At the end of the first pass, all the necessary space has been allocated and each symbol defined in the program has been associated with a location counter value in the symbol table. When there are no more source statements to read, the second pass starts at the beginning of the program.

Second Pass

On the second pass, the assembler:

  • Examines the operands for symbolic references to storage locations and resolves these symbolic references using information in the symbol table.
  • Ensures that no instructions contain an invalid instruction form.
  • Translates source statements into machine code and constants, thus filling the allocated space with object code.
  • Produces a file containing error messages, if any have occurred.

Related questions

0 votes
0 votes
2 answers
1
go_editor asked Mar 27, 2020
3,838 views
Code optimization is responsibility of :Application programmerSystem programmerOperating systemAll of the above
0 votes
0 votes
3 answers
2
go_editor asked Mar 27, 2020
1,866 views
Which activity is included in the first pass of two pass assemblers?Build the symbol tableConstruct the intermediate codeSeparate mnemonic opcode and operand fieldsNone o...
0 votes
0 votes
1 answer
3
Krithiga2101 asked Mar 27, 2020
393 views
Which activity is not included in the first pass of two pass assemblers ?Build the symbol tableConstruct the intermediate codeSeparate mnemonic opcode and operand fieldsN...
2 votes
2 votes
2 answers
4
go_editor asked Mar 27, 2020
905 views
Which of the following is not collision resolution technique?Hash addressingChainingBoth (A) and (B)Indexing