Saturday 17 September 2011

RELOCATING LOADER


RELOCATING LOADER
AIM:
To implement a Relocating loader in C language.
ALGORITHM:
1. Enter the new starting location to which the object code has to be relocated
2. Read the content of the input file as strings one at a time
3. Transfer the strings from input file to output file, until ‘T’ is encountered
4. Move the consecutive next three strings from input to output
5. Convert the current string, which is the relocation bit associated with each text record to
binary form
6. Make the necessary changes in the corresponding words of object code by adding the new
starting address with the address part of the object code for which the corresponding
relocation bit is set and store the updated object code in the output
7. Move the object code for which the corresponding relocation bit is not set from output to
input without change
8. Repeat steps from 2 to 7 until end record is encountered
9. If object code is in character form, convert it to internal hexadecimal representation
10. Move object codes to specified locations in memory
11. Write the starting location counter value of a block of object code and the corresponding
internal hexadecimal representations to the output file
INPUT.DAT:
H 1000 200
T 1000 11001 14 1033 48 1039 90 1776 92 1765 57 1765
T 2011 11110 23 1838 43 1979 89 1060 66 1849 99 1477
E 1000
Enter the actual starting address: 7000


RESULT:
Thus a Relocating loader is implemented in C language.

0 comments:

Post a Comment