Algorithm of Second pass of assembler
Step 1: Set Location Counter to beginning
Step 2: Scan next line of code, if pseudo instruction present then go to step 3, else go to step 8.
Step 3:Check whether origin present , if yes then go to step 4, else go to step 5
Step 4: Set Location Counter and go to Step 2.
Step 5: Check whether end occur if yes then go to last step 17 ,else go to step 6.
Step 6:Convert operand to binary and store in location given by LC.
Step 7:Increment LC and go to step 2.
Step 8:Check whether Memory Reference Instruction or not , if yes then go to Step 9, else go to Step 13.
Step 9: Get operand code and set 2 -4 bits of instruction format.
Step 10:Search address symbol table for binary equivalent of symbolic address and set bits 5 – 16 of instruction format.
Step 11: Check the mode , I is present of not, if present then set first bit to 1, else set first bit to 0.
Step 12: Assembly all parts of binary instruction and store in location given by LC, and go to step 7.
Step 13:Check whether valid NON-MRI instruction or not, if valid then go to next , else go to step 16.
Step 14: Store binary equivalent of instruction in location given by LC.
Step 15:Go to step 7.
Step 16: Error in Code , and go to step 7.
Step 17: done , Stop
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment