Saturday, 17 December 2011
PASS2 OF DIRECTLINKING LOADER
PROGRAM:
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
struct exttable
{
char
csect[20],sname[20];
int padd,plen;
}estab[20];
struct objectcode
{
unsigned char
code[15];
int add;
}obcode[500];
void main()
PASS1 OF DIRECT LINKING LOADER
PROGRAM:
#include<stdio.h>
#include<conio.h>
#include<string.h>
struct estab
{
char csname[10];
char extsym[10];
int address;
int length;
}es[20];
void main()
{
char
input[10],name[10],symbol[10],ch;
int
count=0,progaddr,csaddr,add,len;
FILE *fp1,*fp2;
clrscr();
fp1=fopen("LINP.DAT","r");
fp2=fopen("LOADMAP.DAT","w");
printf("\n\nEnter the address where the program has loaded:
");
scanf("%x",&progaddr);
csaddr=progaddr;
fprintf(fp2,"CS_NAME\tEXT_SYM_NAME\tADDRESS\tLENGTH\n");
fprintf(fp2,"------------------------------\n");
fscanf(fp1,"%s",input);
while(strcmp(input,"END")!=0)
Relocation loader using C
IMPLEMENTATION OF
RELOCATION LOADER
AIM
To implement relocation loader using C.
ALGORITHM
1.Enter new starting location to which object has ti be
relocated.
2.Read the content of the input file as strings one at a
time in an array input.
3.Transfer the string read in array input into another array
output until it is incremented.
4.Move consecutive next 3 strings into array “output”.
5.Cover current location bit associated with each text
record to binary form.
6.Make necessary changes in corresponding words of object
code and store the updated object code into array “output”.
7.Move object code for which corresponding relocation bit is not set directly to the
array “output” from array “input” without any change.
8.Repeat step 2 to 8 until end record is encountered.
9.If the object code is in character form ,convert into
internal hexadecimal representation.
10.Move object code to specified location in memory
11.Write starting LOCCTR value of block of object code and
the corresponding internal hexadecimal representative to the output files.
Absolute loader
IMPLEMENTATION OF
ABSOLUTE LOADER
AIM
To implement absolute loader using C.
ALGORITHM
1.Read loader record and filter the starting location and
other details.
2.Read the first text record.
3.If the object code is in character form convert it into
internal hexadecimal representation.
4.Move object code to specified location in memory.
5.Write starting location couter value of block of object
code and corresponding internal hexadecimal representation to the output file.
6.Read next record from the input file.
7.Close all opened files and exit.
PROGRAM:
#include<stdio.h>
Subscribe to:
Posts (Atom)