Description
For this assignment, you are to write a linker/loader for the object programs produced by your assembler using the format described in the text book. Write the linker/loader as a separate program. Do not include it as a separate part of the assembler. This is to be a stand-alone program.
Input to the linker/loader will be a variable list of object program names. If my executable program were named linkghh I would type the following on the command line:
linkghh prog1.obj prog2.obj prog3.obj
This would link prog1, prog2 and prog3 together. You must read the names of the object programs from the command line to receive full credit.
Output will be the absolute machine code that would be in memory following the loading and linking process. Assume a load address of 03300 (a 5 digit hexadecimal value). Output is to be written to a file named MEMORY.DAT and displayed on the monitor in a format similar to the following:
0 1 2 3 4 5 6 7 8 9 A B C D E F
03300 XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
03310 XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
03320 XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
.
.
Execution begins at address XXXXXX
Each XX pair is replaced by 1 byte of object code produced by the linker/loader. Signify unknown memory locations by question marks. This is needed when storage is reserved but not initialized (i.e. RESW 1 would produce 3 question mark pairs.)
You may assume that the output file will have at most 50 lines. Display the output file to the monitor in a neat and readable format.