answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

#include<string.h>

#include<stdlib.h>

struct object_code

{

int locctr;

char add[10];

}obcode[300];

void main()

{

char input[100][16],output[100][16],binary[20],address[20],stloc[10];

int len,bitmask,loc,tlen=0,tloc,textloc,i=0,location,j,k,count=0,start,n,num=0,inc=0;

FILE *fp1,*fp2;

clrscr();

fp1=fopen("linput.dat","r");

fp2=fopen("reloadout.dat","w");

printf("Enter the location where the program has to be loaded:");

scanf("%s",stloc);

start=atoi(stloc);

location=start;

tloc=start;

fscanf(fp1,"%s",input[i]);

while(strcmp(input[i],"T")!=0)

{

strcpy(output[i],input[i]);

i++;

fscanf(fp1,"%s",input[i]);

strcpy(output[i],input[i]);

}

itoa(start,output[2],10);

while(strcmp(input[i],"E")!=0)

{

strcpy(output[i],input[i]);

if(strcmp(input[i],"T")==0)

{

for(j=0;j<3;j++)

{

i++;

fscanf(fp1,"%s",input[i]);

strcpy(output[i],input[i]);

}

bitmask=atoi(output[i]);

itoa(bitmask,binary,2);

strcpy(output[i],NULL);

textloc=atoi(output[i-2]);

textloc=textloc+start;

itoa(textloc,output[i-2],10);

for(n=0;n<(textloc-(tloc+tlen));n++)

{

strcpy(obcode[inc].add,"xx");

obcode[inc++].locctr=location++;

}

tlen=atoi(output[i-1]);

tloc=textloc;

k=0;

}

else

{

if(binary[k]==1)

{

num=0;

len=strlen(output[i]);

strcpy(address,NULL);

for(j=2;j<len;j++)

{

address[num]=output[i][j];

output[i][j]='\0';

num++;

}

loc=atoi(address);

loc=loc+start;

itoa(loc,address,10);

strcat(output[i],address);

}

k++;

len=strlen(output[i]);

num=0;

for(n=0;n<len;n++)

{

obcode[inc].add[num++]=output[i][n];

if(num>1)

{

obcode[inc++].locctr=location++;

num=0;

}

}

}

i++;

fscanf(fp1,"%s",input[i]);

}

strcpy(output[i],input[i]);

i++;

fscanf(fp1,"%s",input[i]);

loc=atoi(input[i]);

loc=loc+start;

strcpy(output[i],itoa(loc,address,10));

count=0;

i=0;

n=0;

fprintf(fp2,"%d\t",obcode[n].locctr);

for(n=0;n<inc;n++)

{

fprintf(fp2,"%s",obcode[n].add);

i++;

if(i>3)

{

fprintf(fp2,"\t");

i=0;

count++;

}

if(count>3)

{

fprintf(fp2,"\n%d\t",obcode[n+1].locctr);

count=0;

}

}

getch();

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Write a program to implement prim's algorithm?

dfgbrgffee


How to write a boot loader program for ADSP- 21060?

To write a boot loader program for the ADSP-21060, you'll first need to familiarize yourself with its architecture and booting process. Start by setting up the necessary environment, including an assembly or C compiler compatible with the ADSP-21060. Your boot loader should initialize the processor, configure the memory, and establish communication protocols (e.g., serial or parallel) to load the main application code from an external source into the DSP's memory. Finally, implement error handling and ensure that the boot loader can correctly jump to the application code once loading is complete.


Write A program to implement insertion using AVL trees?

yes


Write a program to implement domain and referential integrity?

give me the program which can related on domain and referential integrity.


Write a program in c plus plus to implement macro processor?

Don't write, it is already written, google for 'cpp'.


Write a program in c language to implement framing methods like character stuffing?

A program in c language to implement framing methods like character stuffing can be grave sizeCRC-32 and the variable c50.


Write a program of binary heap in c or c language?

to implement operations on binary heap in c


Write a program to implement a line using slope intercept formula?

lund lelo mooh mein


Write a C program to implement excelp system call?

You are not able to do that, but you can write a program, that uses the system-call./* exectest.c */#include int main (void){execlp ("/bin/ls", "ls", "-ld", ".", NULL);return 0;}


Write a program to implement the various operations on string such as length of string concatenation reverse of a string copy of a string to another in VB?

what is string


Write a algorithm for absolute loader?

Answe check for login


Write a program in C language to implement the apriori algorithm?

JavaScript is one program that has been written in C to implement the Apriori algorithm. There are also several other known programs available on the Internet that implement it as well.