Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a two-pass linker in Java and submit the source code. The target machine is word addressable and has a memory of 200 words, each

Implement a two-pass linker in Java and submit the source code. The target machine is word addressable and has a memory of 200 words, each consisting of 4 decimal digits. The first (leftmost) digit is the opcode, which is unchanged by the linker. The remaining three digits (called the address field) are either An immediate operand, which is unchanged. An absolute address, which is unchanged. A relative address, which is relocated. An external address, which is resolved.

Input consists of a series of object modules, each of which contains three lists: definitions of symbol that are used in other modules, uses of symbols defined in other modules, and the program text. The format of the lists is given below and a complete sample input is on the next page. The linker processes the input twice (that is why it is called two-pass). Pass one determines the base address for each module and produces a symbol table containing the absolute address for each defined symbol. The first module has base address zero; the base address for module M+1 is equal to the base address of module M plus the length of module M. The absolute address for symbol S defined in module M is the base address of M plus the relative address of S within M. Pass two uses the base addresses and the symbol table computed in pass one to generate the actual output by relocating relative addresses and resolving external references. The definition list is a count ND followed by ND pairs (S, R) where S is the symbol being defined and R is the relative address to which the symbol refers. Pass one relocates R forming the absolute address A and stores the pair (S, A) in the symbol table. The use list is a count NU followed by NU pairs (S, R), where S is the symbol being used and R is a relative address where S is used. The address initially in R is the relative address the next use of S in this module.. This linked list of uses ends with a sentinel of 777. The program text consists of a count NT followed by NT 5-digit numbers, where the first 4 digits form an instruction as described above and the last digit gives the type of the address component: 1=immediate, 2=absolute, 3=relative, and 4=external. NT, the number of instructions, is thus the length of the module.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions

Question

How can a firm use a swap to manage its interest rate risk?

Answered: 1 week ago

Question

What is the significance of employee selection?

Answered: 1 week ago

Question

=+ Are you interested in creating or

Answered: 1 week ago

Question

=+working on a micro-multinational?

Answered: 1 week ago