IMPLEMENT PASS-2 OF TWO PASS ASSEMBLER
Aim: To write a C-program to implement pass-2 assembler ie object code creation.
- Read first line from the intermediate file.
- Check to see if the opcode from the first line read is “START”.If so then write label,opcode and operand field values of corresponding statement directly to final output files.
- start the following processing for other lines in intermediate file if it is not a comment line until an “END” statement is reached.
- Start writing labels LOCCTR opcode and operand fields of corresponding statement to the output file along with object code.The object code is found by assembling each statement opcode machine equivalent with label address.
- If there is no symbol or label in the operand field, then the operand address is assigned as zero and it is assembled with object code of instruction
- If OPCODE is BYTE,WORD,RESB etc are convert constants to oblect code close operand file and exit.