Google Search

Sunday, June 5, 2011

Implement a Pass I of Two Pass Assembler : write a C program to perform pass1 of a two assembler.

Implement a Pass I of Two Pass Assembler

Aim:  To write a C program to perform pass1 of a two assembler.

Algorithm:

  1. Start the assembly process by processing the assembly program statements.
  2. Location counter is initialized to the starting address if OPCODE = “START” else  if it is initialized to 0.It is incremented depending upon the size of next consecutive instruction.
  3. If there is any symbol present in lable field, location counter is entered into symbol table.The opcode table must be present in the memory during pass1.
  4. Search the OPTAB.If it is found add 3 to locctr.
  5. If not found in OPTAB, update the location value by checking whether the opcode is WORD,RESW,RESB or BYTE.
  6. Write the program line with locctr value to intermediate file.
  7. Read the next input  line.
  8. Steps3 to 7 is carried out  till  the end statement is reached.
  9. Finally save the value of 1 locctr-starting address) and program length.
  10. Stop.

0 comments:

Post a Comment